How to convert sRGB to CIELAb and CIELab to sRGB e

2020-07-10 06:58发布

I don't understand how to convert sRGB to CIELab and backward. Help me please. it's desirable in с++ code

标签: c++ srgb
2条回答
Summer. ? 凉城
2楼-- · 2020-07-10 07:30

In case, I have prepared a list of links (in different programming languages) which can be helpful for the conversion process (sRGB to LAB and back) and also, conversion of sRGB to linear RGB. Linear RGB can be further used for white balance and color calibration of an image (provided color patch, like Macbeth color chart).

Interesting links:

(i) Understanding sRGB and linear RGB space: http://filmicgames.com/archives/299; http://www.cambridgeincolour.com/tutorials/gamma-correction.htm

(ii) MATLAB tutorial: https://de.mathworks.com/help/vision/ref/colorspaceconversion.html

(iii) Python package: http://pydoc.net/Python/pwkit/0.2.1/pwkit.colormaps/

(iv) C code: http://svn.int64.org/viewvc/int64/colors/color.c?view=markup

(v) OpenCV does not provide sRGB to linear RGB conversion but it does the conversion inside color.cpp code (OpenCV_DIR\modules\imgproc\src\color.cpp). Check out method called initLabTabs(), there is a gamma encoding and decoding. OpenCV color conversion API: http://docs.opencv.org/3.1.0/de/d25/imgproc_color_conversions.html

查看更多
forever°为你锁心
3楼-- · 2020-07-10 07:37

Convert from sRGB to RGB by applying inverse gamma, convert RGB to XYZ using 3x3 matrix, convert XYZ to Lab using standard formula and D6500 white point

References:

The rest... you can do on your own :-)

查看更多
登录 后发表回答