ORL人脸库共40个人,每人有10张照片。存储路径为 "ORL\\s1\\1.pgm",此文整理专用遍历ORL人脸文件代码
(1)代码备注:
bool traverseORL(vector<string> &filenames,vector<int> &labels,bool bTrain)
/*
function:read ORL files (eg. s1\1.pgm)
parameter:
--vector<string> &filenames : filepath
--vector<int> &labels: the labels of faces
--bool bTrain :true represents Train (No.1-No.5);
false represents Test(No.6-No.10)
commentray: sprintf_s write the filepath to strFilename
*/
(2)代码实现: