Opencv: Does cvtColor handle non-linearities in the sRGB color space?

Created on 27 Jul 2015  路  3Comments  路  Source: opencv/opencv

Transferred from http://code.opencv.org/issues/4293

|| Ying Xiong on 2015-04-24 15:45
|| Priority: Normal
|| Affected: None
|| Category: imgproc, video
|| Tracker: Feature
|| Difficulty: 
|| PR: 
|| Platform: None / None

Does cvtColor handle non-linearities in the sRGB color space?

I am wondering whether OpenCV has functions to handle the non-linearities in the sRGB color space.

Say I want to convert an JPEG image from sRGB color space into XYZ color space. As specified in this [Wiki page](https://en.wikipedia.org/wiki/SRGB#Specification_of_the_transformation), one needs to first undo the nonlinearities to convert to linear RGB space, and then multiply with the 3x3 color transform matrix. However, I couldn't find any such discussions in the [cvtColor](http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html#cvtcolor) documentation. Did I miss something?

Thanks a lot in advance!

History

Vadim Pisarevsky on 2015-05-25 11:14
-   Category set to imgproc, video
auto-transferred imgproc video feature normal

Most helpful comment

Yes, OpenCV needs a lot of improvement in the gamma area. http://blog.johnnovak.net/2016/09/21/what-every-coder-should-know-about-gamma/

All 3 comments

Yes, OpenCV needs a lot of improvement in the gamma area. http://blog.johnnovak.net/2016/09/21/what-every-coder-should-know-about-gamma/

It would be nice to note that as such in the documentation. For example, note here, where nothing is stated about gamma correction. The fact that the conversion starts with a linear transformation reinforces an assumption that the conversion doesn't perform any sort of gamma correction. When I have more free time, I will try to contribute and fix the issue myself.

On a related note, can you clarify the usage of conversion codes beginning with LRGB or LBGR such as COLOR_LBGR2Lab? Does the L mean the function will expect linear values for RGB/BGR instead of gamma-encoded values?

Thanks in advance! 鉂わ笍

It is also not clear how cv::imshow and cv::imdecode behave. Some documentation would be very appreciated.

Was this page helpful?
0 / 5 - 0 ratings