使用python进行图像预处理:Lab< - > RGB

时间:2018-03-09 13:53:06

标签: python-3.x python-imaging-library scikit-image

我想写一个处理图像的网络。为此我需要将rgb转换为Lab,使用它并转换回来:Lab to rgb。起初我想测试它是如何工作的:

from skimage import io, color
rgb = io.imread(filename)
lab = color.rgb2lab(rgb)
rgb2 = color.lab2rgb(lab)

我发现rgb2的所有组件都不对应于rgb:

In [5]: arr_rgb
Out[5]: 
array([[[  2.34194446e-17,   3.92156863e-03,   0.00000000e+00],
    [  7.84313725e-03,   1.56862745e-02,   1.17647059e-02],
    [  1.96078431e-02,   2.74509804e-02,   2.35294118e-02],
    ..., 
    [  1.09803922e-01,   1.68627451e-01,   1.56862745e-01],
    [  1.45098039e-01,   2.03921569e-01,   1.92156863e-01],
    [  1.37254902e-01,   1.96078431e-01,   1.84313725e-01]]


In [6]: image
Out[6]: 
array([[[  0,   1,   0],
    [  2,   4,   3],
    [  5,   7,   6],
    ..., 
    [ 28,  43,  40],
    [ 37,  52,  49],
    [ 35,  50,  47]],

0 个答案:

没有答案