< Previous | Contents | Next >

Introduction

In Using the Matrix we saw how a Matrix object could be used to collect multiple spatial transformations on an image. In this article we explore how a variant on that technique can also be used to perform color operations.

The key to this approach is that you consider the values in the red green and blue channels as coordinates in x, y and z instead. Once you do that, it becomes apparent that operations like Gain are really no different than spatial transformations like Scale.

In fact, Gain is identical to scaling the image, while brightness is nothing more than a translation of the image. A contrast operation is nothing more than a scale centered around 0.5 instead of 0.0. Even the conversion to YUV can be represented in this way. This allows us to build up several ‘linear’ color operations into one operation, and then apply them as a single pass. We can even use a matrix to swap channels, or mix them together.

Non linear color operations (like gamma) cannot be represented this way in a Matrix.

Fusion provides a ColorMatrix object for RGB image operations, and the ColorMatrixFull object for RGBA images.