OPENCV读取文件夹下多个图片

1.

for (int i = 1; i <= num; i++)
    {
        sprintf(filename, "Path%d.jpg", i);
        image = imread(filename, 1);
        imshow(filename, image);
    }
    waitKey(0);
 

2.

vector filename;//用容器方式来存储文件名
    filename.push_back("1.jpg");
    filename.push_back("2.jpg");
    for (int i = 0; i < filename.size(); i++)
    {
        image = imread(filename[i], 1);
        imshow(filename[i], image);
    }
    waitKey(0);

你可能感兴趣的:(OPENCV)