Lab颜色空间

http://www.cnblogs.com/Imageshop/archive/2013/02/02/2889897.html



实现《Color Transfer between Images》这篇论文过程中,被颜色空间之间的转换公式彻底搞懵了,这篇论文里的转换矩阵跟网络上的转换矩阵不一样。

在网上找了半天也找不到合理的解释。也不知道如何找到有关色彩空间的标准。 所以做一个记录,看一下OpenCv和维基百科英语和一些论文里的公式。希望有大神能帮忙解答。


OpenCV的颜色空间转化公式:  http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html?highlight=cvcvtcolor#void%20cvCvtColor%28const%20CvArr*%20src,%20CvArr*%20dst,%20int%20code%29


XYZ:

OPenCV:

RGB\leftrightarrow CIE XYZ.Rec 709 with D65 white point ( CV_BGR2XYZ, CV_RGB2XYZ, CV_XYZ2BGR, CV_XYZ2RGB ):

\begin{bmatrix} X  \\ Y  \\ Z  \end{bmatrix} \leftarrow \begin{bmatrix} 0.412453 & 0.357580 & 0.180423 \\ 0.212671 & 0.715160 & 0.072169 \\ 0.019334 & 0.119193 & 0.950227  \end{bmatrix} \cdot \begin{bmatrix} R  \\ G  \\ B  \end{bmatrix}

\begin{bmatrix} R  \\ G  \\ B  \end{bmatrix} \leftarrow \begin{bmatrix} 3.240479 & -1.53715 & -0.498535 \\ -0.969256 &  1.875991 & 0.041556 \\ 0.055648 & -0.204043 & 1.057311  \end{bmatrix} \cdot \begin{bmatrix} X  \\ Y  \\ Z  \end{bmatrix}





CIE l*a*b*

OpenCV:

  • RGB \leftrightarrow CIE L*a*b* ( CV_BGR2Lab, CV_RGB2Lab, CV_Lab2BGR, CV_Lab2RGB ).

    In case of 8-bit and 16-bit images,R, G, and B are converted to the floating-point format and scaled to fit the 0 to 1 range.

    \vecthree{X}{Y}{Z} \leftarrow \vecthreethree{0.412453}{0.357580}{0.180423}{0.212671}{0.715160}{0.072169}{0.019334}{0.119193}{0.950227} \cdot \vecthree{R}{G}{B}

    X  \leftarrow X/X_n,  \text{where} X_n = 0.950456

    Z  \leftarrow Z/Z_n,  \text{where} Z_n = 1.088754

    L  \leftarrow \fork{116*Y^{1/3}-16}{for $Y>0.008856$}{903.3*Y}{for $Y \le 0.008856$}

    a  \leftarrow 500 (f(X)-f(Y)) + delta

    b  \leftarrow 200 (f(Y)-f(Z)) + delta

    where

    f(t)= \fork{t^{1/3}}{for $t>0.008856$}{7.787 t+16/116}{for $t\leq 0.008856$}

    and

    delta =  \fork{128}{for 8-bit images}{0}{for floating-point images}

    This outputs0 \leq L \leq 100, -127 \leq a \leq 127, -127 \leq b \leq 127 . The values are then converted to the destination data type:

    • 8-bit images

      L  \leftarrow L*255/100, \; a  \leftarrow a + 128, \; b  \leftarrow b + 128

    • 16-bit images

      (currently not supported)

    • 32-bit images

      L, a, and b are left as is


 



维基百科: https://en.wikipedia.org/wiki/LMS_color_space

https://en.wikipedia.org/wiki/CIE_1931_color_space

https://en.wikipedia.org/wiki/Lab_color_space

这篇文章里做了对color space做了介绍
Colour spaces - perceptual, historical and
applicational background



http://www.brucelindbloom.com/index.html?WorkingSpaceInfo.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值