我在一个名为:1.jpg
, 3.jpg
, 4.jpg
, 6.jpg
, 8.jpg
, 10.jpg
, 15. jpg
, .... 100.jpg
, 102.jpg
, 103.jpg
, 113.jpg
etc...
我dirent.h
用来遍历文件,但不知何故dirent.h
开始,10.jpg
它提供的下一个文件是突然100.jpg
然后102.jpg
,......为什么它会跳过一些图像?
int main (int argc, const char* argv[] )
{
cv::Mat image;
DIR *dir;
struct dirent *ent;
if ((dir = opendir ("C:\\Users\\Faraz\\Desktop\\Project\\detecting_false_positives_stuff\\face_images\\faces\\")) != NULL) {
ent = readdir (dir);
printf ("%s\n", ent->d_name);
ent = readdir (dir);
printf ("%s\n", ent->d_name);
while ((ent = readdir (dir)) != NULL) {
printf ("%s\n", ent->d_name);
std::string fullPath = std::string("C:\\Users\\Faraz\\Desktop\\Project\\detecting_false_positives_stuff\\face_images\\faces\\") + ent->d_name;
cout<<fullPath;
image = cv::imread(fullPath);
...
}
closedir (dir);
}
return 1;
}