I was trying the ColorCorretionMatris of the lib argus iAutoControlSetting and it seems like the matrix is applied in the YUV domain and not in the RGB domain as stated in the documentation (see Pictures below).
Is this the intended behavior?
I also have a second question, namely:
Is it possible to add a Bias to the CCM?
(Such that the resulting transform looks like: v’ = CCM * v +Bias)
Original image (CCM: 100 010 001)
Only first channel (CCM: 100 000 000)
Only second channel (CCM: 000 010 000)
Only third channel (CCM: 000 000 001)
The ISP pipeline is as below:
Input Bayer Raw image → Demosaic to RGB → Color Correction Matrix to optimize the color → Convert to YUV by referring to Color Conversion Matrix → using the YUV frame to encode to JPEG or MP4
So the adjustment on Color Correction Matrix, should only apply to the RGB domain data.
This is also the behavior I expected from the documentation of the setColorCorrectionMatrix() function.
But, I still don’t understand why I get the pictures as shown in the first post.
For Example I set the CCM to [0,0,0,0,1,0,0,0,0], which should result in the matrix
| 0 0 0 |
| 0 1 0 |
| 0 0 0 |
and therefore only the Green channel should be visible in the output image. However, the output image looks like it only contains the Y channel, see:
This [000, 010, 000] result looks okay for me.
Cause we have RGGB or GRBG Bayer input, 2 pixels are for Green.
And normally the Y value of the image are from the G.
This test scene are mostly white, so the [000, 010, 000] result does not a problem.
You can test again with the color 24 chart.
Ok I think I found my error:
In the Documentation is stated that “A colour correction matrix that maps sensor RGB to linear sRGB.”. Therefore, I expected an only green picture with a CCM of [000, 010, 000]. Because the RGB → sRGB discarded the other colour channels and afterwards it will be YUV encoded.
The examined behaviour is that the CCM maps from RGB directly in YUV, is this correct?
There are also two additional oddities I come across:
The output of the CCM has to be in the order VYU and not YUV.
In the Documentation there is also stated that “This matrix is given in row-major order…”. This would imply this transformation:
[V Y U] = [R G B] * CCM
Where the matrix is multiplied from the right onto a row vector.
If the matrix would be given in column major order the transformation would have a more standard form with:
|Y| = CCM * |G|
Where the matrix is left multiplied onto a column vector.
Is this behaviour intended and if so, would it be possible to add it to the documentation?
The 24 color chart with ccm of [000, 010, 000]
Suppose you are confuse the Color Correction Matrix(CCM) with Color Conversion Matrix,
The CCM(Color Correction Matrix) is using only for the sensor color tuning. Due to different sensor will have different sensitivity for the color
Yes I have misinterpreted the CCM, I tried the RGB → sRGB version and it seems to work fine.
However, I still don’t understand why I get a Grayscale image when only the green channel is present ( and not a “Greenscale” image, whith also let me to the RGB → YUV idea)