Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I suppose that in OpenCV, Luv* and Lab* color conversion uses the nonlinear R’G’B’ coding that is quite perceptually uniform:

R'G'B' = LabCbrtTab(RGB)

where LabCbrtTab is a lookup table of nonlinear rising slope that consider the luminance of the white reference Yn.

X'Y'Z' = ConvertToXYZ(R'G'B')
L = 116 * Y' - 16

I suppose that the implementation in matlab uses linear RGB coding assuming the luminance of the white reference Yn=1

XYZ = ConvertToXYZ(RGB)
L = 116 * (Y/Yn)^(1/3) - 16

May be you had used this formula to calculate the xyz to luv.

In any case there is a discrepancy between the code and the doc

the doc: L = 116 * Y^(1/3)
the code L = 116 * Y'- 16

I know this don't help so much, if you want you can investigate the code here: <OCV_ROOT>/modules/imgproc/src/color.cpp, RGB2Luv_f, operator()