import skimage
from skimage import io, color
import numpy as np
import scipy.ndimage as ndi
rgb = io.imread('img.jpg')
lab = color.rgb2lab(skimage.img_as_float(rgb))
l_chan1 = lab[:,:,0]
l_chan1 /= np.max(np.abs(l_chan1))
l_chan_med = ndi.median_filter(l_chan1, size=5)
skimage.io.imshow(l_chan_med)
我正在尝试做一些图像处理。当我改变颜色方案时,我收到了rgb2lab函数的错误。 " color.rgb2lab模块对象没有属性' rgb2lab'。我已导入所有必需的库。任何建议将不胜感激
答案 0 :(得分:0)
试试这个:
import skimage
from skimage import io
from skimage.color import rgb2lab
import numpy as np
import scipy.ndimage as ndi
rgb = io.imread('img.jpg')
lab = rgb2lab(skimage.img_as_float(rgb))
l_chan1 = lab[:,:,0]
l_chan1 /= np.max(np.abs(l_chan1))
l_chan_med = ndi.median_filter(l_chan1, size=5)
skimage.io.imshow(l_chan_med)
答案 1 :(得分:0)
我不知道出了什么问题,但是我的机器上的代码运行正常。 Python 2.7.6,OS X Yosemite。我会尝试重新安装scikit-image。