Python skimage.io.ImageCollection() Examples
The following are 2
code examples of skimage.io.ImageCollection().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
skimage.io
, or try the search function
.
Example #1
Source File: bls.py From Broad-Learning-System with MIT License | 5 votes |
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
Example #2
Source File: A10.SFA.py From Machine-Learning with MIT License | 5 votes |
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