當前位置: 首頁>>代碼示例>>Python>>正文


Python io.ImageCollection方法代碼示例

本文整理匯總了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 
開發者ID:LiangjunFeng,項目名稱:Broad-Learning-System,代碼行數:31,代碼來源:bls.py

示例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 
開發者ID:LiangjunFeng,項目名稱:Machine-Learning,代碼行數:17,代碼來源:A10.SFA.py


注:本文中的skimage.io.ImageCollection方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。