Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenCV - How does it handle color profiles?

I have a jpeg. Its color profile is sRGB, of course. I load it into "image" and call

cvCvtColor(image, gray, CV_BGR2GRAY); 

to convert it to grayscale. When I step into that routine in the debugger, I find it multiplying pixels by these values:

#define cscGr_32f  0.299f
#define cscGg_32f  0.587f
#define cscGb_32f  0.114f

Waaaait a minute. Those are the luminance values for NTSC RGB, not sRGB. Furthermore, I cannot see that it's doing anything about gamma correction. I am confused. When OpenCV decodes the image, does it remove gamma correction and convert to NTSC RGB?

Bonus question: Is there an OpenCV forum where the gurus hang? I've googled in vain.

like image 439
Jive Dadson Avatar asked Jan 20 '26 05:01

Jive Dadson


1 Answers

It ignores. OpenCV usually does not perform gamma correction. Well, it does, only when cvtColoring RGB-to-L*a*b*/L*u*v* (But, how? Does OpenCV assume the gamma of the input image?).

like image 81
Константин Ван Avatar answered Jan 22 '26 02:01

Константин Ван



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!