错误:
File "Dialation.py", line 19, in <module>
img = binary_dilation(img, disk(5))
File "/root/anaconda3/lib/python3.7/site-packages/skimage/morphology/misc.py", line 39, in func_out
return func(image, selem=selem, *args, **kwargs)
File "/root/anaconda3/lib/python3.7/site-packages/skimage/morphology/binary.py", line 77, in binary_dilation
ndi.binary_dilation(image, structure=selem, output=out)
File "/root/anaconda3/lib/python3.7/site-packages/scipy/ndimage/morphology.py", line 510, in binary_dilation
if not structure.shape[ii] & 1:
IndexError: tuple index out of range
错误原因:
skimage 处理的是单通道图像(不论是dilation 还是 binary_dilation), 在读入图像后要确保存放的图像矩阵的通道维数为1, 不能为3