windows 加载文件夹下所有文件 / 加载文件夹下所有图片
GetImageFileNamesFromFolder
void GetImageFileNamesFromFolder(const char *folder, vector<string> &vImageFileNames)
{
vImageFileNames.clear();
string folder_str(folder);
_finddata_t file;
long lf;
if (folder_str.empty())
{
cout << "unable get the source file name." << endl;
return;
}
if (folder_str[folder_str.length() - 1] != '\\') //for windows
{
folder_str += "\\";
}
string fileFind = folder_str + "*.*";
if ((lf = _findfirst(fileFind.c_str(), &file)) == -1)
{
printf("Found no files in image folder ...\n");
return;
}
else
{
while (_findnext(lf, &file) == 0)
{
string tempFileName(file.name);
string suffix = tempFileName.substr(tempFileName.rfind(".") + 1, tempFileName.length());
if (suffix == "jpg" || suffix == "JPG" || suffix
|