len(img.shape)
from skimage import io,data
img=data.chelsea()
io.imshow(img)
print(type(img)) #显示类型
print(img.shape) #显示尺寸
print(img.shape[0]) #图片高度
print(img.shape[1]) #图片宽度
print(img.shape[2]) #图片通道数
print(img.size) #显示总像素个数
print(img.max()) #最大像素值
print(img.min()) #最小像素值
print(img.mean()) #像素平均值
len()返回对象长度
用于判断图像是否为灰度图或彩色图即判断图像通道数
本文通过实例解析了如何使用Python的skimage库进行图像处理,包括获取图像尺寸、通道数、像素操作和基本统计信息,重点讲解了如何利用`img.shape`判断图像类型,并展示了如何查看图片大小、最大值、最小值和平均像素值。

1831

被折叠的 条评论
为什么被折叠?



