OpenCV中Lab空间简介及RGB转Lab

Lab颜色模式简介:

OpenCV中Lab空间简介及RGB转Lab_第1张图片

OpenCV中Lab空间简介及RGB转Lab_第2张图片

OpenCV中Lab空间简介及RGB转Lab_第3张图片

From:http://wenku.baidu.com/view/67b1b11f650e52ea551898f7.html


OpenCV中使用cvCvtColor加CV_BGR2Lab转成CIELAB后取值范围:

 有时根据需要,我们使用 cvCvtColor( img, img, CV_BGR2Lab );把色彩空间从RGB转换成CIE l* a* b*。但是我们发现转成CIELAB后的L*, a*, b*的值非常诡异,我们在OpenCV的文档中看到,

        0 <= L <= 100

        -127 <= a <= 127

       -127 <= b <= 127

但是我们发现转出来值没有负的,而且L有时还大于100,这是为什么呢? 我思考许久还是不知为什么,去Google终于找到原因:

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

    in the case of 8-bit and 16-bit images R, G and B are converted to 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}

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

    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}

    On output  , -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

      L = L * 255 \ 100, a = a + 128, b = b + 128

    • 16-bit images

      currently not supported

    • 32-bit images

      L, a, b are left as is

      也就是说 L, a, b最后的取值变为了 0 - 255,如果我们的图像是8bit的话。提醒一下,此时IplImage中每个像素为uchar类型。呃...

    From:http://hi.baidu.com/jasonlyy/item/77c4d298487561d37a7f0123




  • 你可能感兴趣的:(c,Google,文档,output)