The IlvColorMatrixFilter Class
The
IlvColorMatrixFilter class lets you apply a matrix transformation on the RGBA components of an input image.
The matrix is given as 5*4 row major order coefficients.
| R' | | a00 a01 a02 a03 a04 | | R |
| G' | | a10 a11 a12 a13 a14 | | G |
| B' | = | a20 a21 a22 a23 a24 | * | B |
| A' | | a30 a31 a32 a33 a34 | | A |
| 1 | | 0 0 0 0 1 | | 1 |
This class has three subclasses with specific coefficients.
The IlvSaturationFilter Class
IlvSaturationFilter computes the transformation matrix from the formula:
| R' | |0.213+0.787s 0.715-0.715s 0.072-0.072s 0 0 | | R |
| G' | |0.213-0.213s 0.715+0.285s 0.072-0.072s 0 0 | | G |
| B' | = |0.213-0.213s 0.715-0.715s 0.072+0.928s 0 0 | * | B |
| A' | | 0 0 0 1 0 | | A |
| 1 | | 0 0 0 0 1 | | 1 |
where s is the saturation factor.
The IlvHueRotateFilter Class
IlvHueRotateFilter computes the transformation matrix from the formula:
| R' | | a00 a01 a02 0 0 | | R |
| G' | | a10 a11 a12 0 0 | | G |
| B' | = | a20 a21 a22 0 0 | * | B |
| A' | | 0 0 0 1 0 | | A |
| 1 | | 0 0 0 0 1 | | 1 |
where the terms a00, a01, and so on, are calculated as follows:
| a01 a01 a02 | [+0.213 +0.715 +0.072]
| a10 a11 a12 | = [+0.213 +0.715 +0.072] +
| a20 a21 a22 | [+0.213 +0.715 +0.072]
[+0.787 -0.715 -0.072]
cos(hueRotate value) * [-0.212 +0.285 -0.072] +
[-0.213 -0.715 +0.928]
[-0.213 -0.715 +0.928]
sin(hueRotate value) * [+0.143 +0.140 -0.283]
[-0.787 +0.715 +0.072]
where value is the angle of rotation for the hue.
Thus, the upper-left term of the hue matrix turns out to be:
.213 + cos(hueRotate value)*.787 - sin(hueRotate value)*.213
The IlvLuminanceToAlphaFilter Class
IlvLuminanceToAlphaFilter computes the transformation matrix from the formula:
| R' | | 0 0 0 0 0 | | R |
| G' | | 0 0 0 0 0 | | G |
| B' | = | 0 0 0 0 0 | * | B |
| A' | | 0.2125 0.7154 0.0721 0 0 | | A |
| 1 | | 0 0 0 0 1 | | 1 |
This filter converts color images to grayscale images.
Version 6.1
Copyright © 2016, Rogue Wave Software, Inc. All Rights Reserved.