Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Range depends to datatype.

Again, looking at cvtColor doc

Y = 0.299*R + 0.587*G + 0.114*B
Cr = (R-Y)*0.713 + delta
Cb = (B-Y)*0.564 + delta

Y componets represent luma, its coefficients sums 1 than Y has same range of RGB.

Cr, Cb represent color difference that can be max +/- 50% of the range. Given that delta is defined to be half of data type range, we can conclude that, in OpenCV, Cr and Cb cover whole data type value.

definitely, if data type is 8-bit

Y: 0 -> 255 , Cr:0.58 -> 255.45,  Cb: 0.58 -> 255.42
Cr(min): R=0 G=255 B=255    Cr(max): R=255 G=0 B=0   
Cb(min): R=255 G=255 B=0    Cb(max): R=0 G=0 B=255

I don't know if OpenCV uses integer aritmetic or simply round it. In case of round it becomes

Y: 0 -> 255 , Cr:1 -> 255,  Cb: 1 -> 255

Concluding...may be the doc could be more explict as is for other color conversion