#include <algorithm>
#include <string>
#include <string.h>
#include <sys/types.h>
#include <dirent.h>
void load_image_path(std::string image_dir_path, std::vector<std::string> &image_paths) {
DIR *pDir;
struct dirent *ptr;
if (!(pDir = opendir(image_dir_path.c_str()))) {
std::cout << "Folder doesn't Exist!" << std::endl;
return;
}
while ((ptr = readdir(pDir)) != 0) {
if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0) {
image_paths.push_back(image_dir_path + "/" + ptr->d_name);
}
}
std::sort(image_paths.begin(), image_paths.end());
closedir(pDir);
return;
}
03-25
3536
09-08
5632
03-23
1万+
05-30
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交