本文整理汇总了Python中skimage.io.ImageCollection方法的典型用法代码示例。如果您正苦于以下问题:Python io.ImageCollection方法的具体用法?Python io.ImageCollection怎么用?Python io.ImageCollection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类skimage.io
的用法示例。
在下文中一共展示了io.ImageCollection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LoadData
# 需要导入模块: from skimage import io [as 别名]
# 或者: from skimage.io import ImageCollection [as 别名]
def LoadData(number):
if number == 1:
path = '/Users/zhuxiaoxiansheng/Desktop/日常/数据集/yale_faces/*.bmp'
elif number == 2:
path = '/Users/zhuxiaoxiansheng/Desktop/日常/数据集/orl_faces_full/*.pgm'
elif number == 3:
path = '/Users/zhuxiaoxiansheng/Desktop/日常/数据集/jaffe/*.tiff'
elif number == 4:
path = '/Volumes/TOSHIBA EXT/数据集/YaleB/*.pgm'
pictures = io.ImageCollection(path)
data = []
for i in range(len(pictures)):
picture = pictures[i]
picture = skimage.color.rgb2gray(picture)
data.append(np.ravel(picture.reshape((1,picture.shape[0]*picture.shape[1]))))
label = []
if number == 1:
for i in range(len(data)):
label.append(int(i/11))
elif number == 2:
for i in range(len(data)):
label.append(int(i/10))
elif number == 3:
for i in range(len(data)):
label.append(int(i/20))
elif number == 4:
label = [0]*64+[1]*64+[2]*64+[3]*64+[4]*64+[5]*64+[6]*64+[7]*64+[8]*64+[9]*64+[10]*60+[11]*59+[12]*60+[13]*63+[14]*62+[15]*63+[16]*63+[17]*64+[18]*64+[19]*64+[20]*64+[21]*64+[22]*64+[23]*64+[24]*64+[25]*64+[26]*64+[27]*64+[28]*64+[29]*64+[30]*64+[31]*64+[32]*64+[33]*64+[34]*64+[35]*64+[36]*64+[37]*64
return np.matrix(data),np.matrix(label).T
示例2: LoadData
# 需要导入模块: from skimage import io [as 别名]
# 或者: from skimage.io import ImageCollection [as 别名]
def LoadData(number): #Load the picture data
if number == 1:
path = '/Users/zhuxiaoxiansheng/Desktop/yale_faces/*.bmp' #the data's path
num =11
elif number == 2:
path = '/Users/zhuxiaoxiansheng/Desktop/orl_faces_full/*.pgm' #the data's path
num =10
pictures = io.ImageCollection(path)
data = []
for i in range(len(pictures)):
data.append(np.ravel(pictures[i].reshape((1,pictures[i].shape[0]*pictures[i].shape[1]))))
label = []
for i in range(len(data)):
label.append(int(i/num))
return np.matrix(data),np.matrix(label).T