I have a 24 block color card and I\'m trying to estimate a color correction matrix to the captured images with the said color card. I have manually estimated a CCM
color correction model you are using is well described here:
https://www.informatik.hu-berlin.de/de/forschung/gebiete/viscom/thesis/final/Studienarbeit_Behringer_201308.pdf
This can also be done in c++ opencv. You have to determine equation:
[p1' p2' ... pn' ] = M * [ p1 p2 ... pn]
P' = M * P
Where p1',...pn' are desired values (better if in XYZ color space), p1, ... pn are real values detected and M is 3x3 transformation matrix.
You could solve that system as follows:
M = P * P'.inv(CV_SVD)
The RGB samples used in the optimization should be linear. Undo gamma correction first by calling rgb2lin on the image.
You will also need to apply the CCM on linear RGB values. So undo the gamma correction in your image with rgb2lin
, apply the CCM, and then re-apply gamma correction with lin2rgb.