OpenCV中文网站

 找回密码
 立即注册
搜索
热搜: 安装 配置
查看: 9148|回复: 2

关于CvtColor中RGB=>Lab (CV_BGR2Lab, CV_RGB2Lab) 变换矩阵元素值有

[复制链接]
发表于 2009-5-3 13:14:46 | 显示全部楼层 |阅读模式
CvtColor中RGB=>Lab (CV_BGR2Lab, CV_RGB2Lab) 变换矩阵元素值有些疑惑,与indiana 大学(http://cgi.cs.indiana.edu/~oleykin/website/OpenCVHelp/ref/OpenCVRef_Cv.htm#cv_imgproc_filters) 提供的变换矩阵元素值不同,该以哪个作为标准,为什么?还有indiana 大学代码中的Xn, Yn 和 Zn是参考白的三刺激值,代表什么含义。
  1. 文档中内容:
  2. |X|   |0.433910 0.376220 0.189860| |R/255|
  3. |Y| = |0.212649 0.715169 0.072182|*|G/255|
  4. |Z|   |0.017756 0.109478 0.872915| |B/255|
  5. L = 116*Y1/3 for Y>0.008856
  6. L = 903.3*Y for Y<=0.008856
  7. a = 500*(f(X)-f(Y))
  8. b = 200*(f(Y)-f(Z))
  9. where f(t)=t1/3 for t>0.008856
  10. f(t)=7.787*t+16/116 for t<=0.008856
  11. 上面的公式可以参考 http://www.cica.indiana.edu/cica/faq/color_spaces/color.spaces.html
复制代码
  1. 网页http://cgi.cs.indiana.edu/~oleykin/website/OpenCVHelp/ref/OpenCVRef_Cv.htm#cv_imgproc_filters 中内容:
  2. RGB<=>CIE L*a*b* (CV_BGR2Lab, CV_RGB2Lab, CV_Lab2BGR, CV_Lab2RGB)
  3. // In case of 8-bit and 16-bit images
  4. // R, G and B are converted to floating-point format and scaled to fit 0..1 range
  5. // convert R,G,B to CIE XYZ
  6. |X|    |0.412453  0.357580  0.180423| |R|
  7. |Y| <- |0.212671  0.715160  0.072169|*|G|
  8. |Z|    |0.019334  0.119193  0.950227| |B|
  9. X <- X/Xn, where Xn = 0.950456
  10. Z <- Z/Zn, where Zn = 1.088754
  11. L <- 116*Y1/3      for Y>0.008856
  12. L <- 903.3*Y      for Y<=0.008856
  13. a <- 500*(f(X)-f(Y)) + delta
  14. b <- 200*(f(Y)-f(Z)) + delta
  15. where f(t)=t1/3              for t>0.008856
  16.       f(t)=7.787*t+16/116   for t<=0.008856
  17. where delta = 128 for 8-bit images,
  18.               0 for floating-point images
  19. On output 0≤L≤100, -127≤a≤127, -127≤b≤127
  20. The values are then converted to the destination data type:
  21.     8-bit images:
  22.         L <- L*255/100, a <- a + 128, b <- b + 128
  23.     16-bit images are currently not supported
  24.     32-bit images:
  25.         L, a, b are left as is
复制代码
回复

使用道具 举报

发表于 2009-6-1 22:58:10 | 显示全部楼层

关于CvtColor中RGB=&gt;Lab (CV_BGR2Lab, CV_RGB2Lab) 变换矩阵元素

看起来你很细心啊!赞
这个子论坛我好久没有来逛了,下一个有空的时间,我去研究一下,谢谢!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-6-2 15:47:55 | 显示全部楼层

关于CvtColor中RGB=&gt;Lab (CV_BGR2Lab, CV_RGB2Lab) 变换矩阵元素

hehe 要是有新的见解,希望你能帖出来,大家共享一下。   
看起来你很细心啊!赞
这个子论坛我好久没有来逛了,下一个有空的时间,我去研究一下,谢谢!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|OpenCV中文网站

GMT+8, 2024-5-3 12:12 , Processed in 0.008766 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表