// 得到文件夹里的所有图片的名称 bool GetPicDirSetInFolder(CString strFindPath, std::vector<CString> &vecPathSet) { WIN32_FIND_DATA wfd; HANDLE hf = FindFirstFileA(strFindPath, &wfd); if (INVALID_HANDLE_VALUE != hf) { vecPathSet.push_back(wfd.cFileName); while (FindNextFileA(hf, &wfd)) { vecPathSet.push_back(wfd.cFileName); } FindClose(hf); } return true; } // 批处理函数 bool BatchProcessing(void) { vector<CString> vecPathSet; CString findPath = "F:\\images\\*.jpg"; CString folder = "F:\\images\\"; CString procFolder = "F:\\save_images\\"; GetPicDirSetInFolder(findPath, vecPathSet); for (int iPic = 0; iPic < vecPathSet.size(); iPic ++) { CString path = folder; path.Append(vecPathSet[iPic]); // load_img_path CString save_path_result = procFolder; save_path_result.Append(vecPathSet[iPic]); //save_img_path // ProcessImage(path, save_img_path); // 进行图像处理 } return true; }
原文:http://blog.csdn.net/u011504498/article/details/44629661