I am new to OpenCV. I want to read XML files in a directory. I am using FindFirstFile, but I am not getting how can I get file names to give as input to cvLoad further. Here is the code I am using:
HANDLE hFind;
WIN32_FIND_DATA FindFileData;
wchar_t* file = L"D:\\zainb_s\\M.phil\\thesis\\dataset\\dataset_3\\RGB_3\\RGB\\s01_e01- Copy\\1_walking\\depth\\*.xml";
hFind = FindFirstFile(file, &FindFileData);
cout << FindFileData.cFileName[0];
FindClose(hFind);
I want to have filenames in an array to read files further to process.
解决方案
If you're using a recent version of OpenCV, you're better off avoiding OS-specific methods:
vector fn; // std::string in opencv2.4, but cv::String in 3.0
string path = "e:/code/vlc/faces2/*.png";
cv::glob(path,fn,false);
// Now you got a list of filenames in fn.
(Ohh, and again, avoid deprecated C-API functions like cvLoad like hell, please!!)