SetColorMatrix
Top  Previous  Next

Description

Sets the matrix coefficients for the color correction operation. Used in combination with the ColorCorrect property.


Syntax


[VB]
objActiveUSB.SetColorMatrix rr, rg, rb, gr, gg, gb, br, bg, bb


[C/C++]
HRESULT SetColorMatrix (float rr, float rg, float rb, 
                     
float gr, float gg, float gb, 
                     
float br, float bg, float bb);


Data Types
[VB]

rr, rg, rb, gr, gg, gb, br, bg, bb: Single


Parameters
[C/C++]

rr[in], rg[in], rb[in], gr[in], gg[in], gb[in], br[in], bg[in], bb[in]  
Coefficients of the color correction matrix. Must be in the range from -2.0 to +2.0  
 

Return Values

S_OK  
Success  
E_FAIL  
Failure.  


Example


This VB example defines the color correction matrix and turns on the color correction:

ActiveUSB1.SetColorMatrix 0.85, 0.1, 0.05, 0.05, 0.98, -0.03, 0.13, -0.15, 1.02
ActiveUSB1.ColorCorrect=
True



Remarks

The relations between the original color components of each pixel (R,G,B) and resulting components (R',G',B') are defined by the following formulas:

R' = R*rr + G*rg + B*rb
G' = R*gr + G*gg + B*gb
B' = R*br + G*bg + B*bb

Color correction is used to eliminate the overlap in the color channels caused by the fact that the light intended to be detected only by pixels of a certain color is partially seen by pixels of other colors. For example, the red light is partially seen by green and blue elements of the CCD. A properly adjusted color correction matrix can eliminate this overlap.

In order for the white balance to work properly, the sum of each row in the color correct matrix (i.e. rr+rg+rb) should be equal to 1.