【发布时间】:2015-09-24 07:53:38
【问题描述】:
我正在尝试从OpenCV 的目录中读取所有图像。我使用videocapture 和以下参考How to read multiple images from a folder in open cv (using C)。如果我这样做:
VideoCapture cap("c:/fullpath/Image_001.png"); // for Image_001.png, etc. This is working.
while( cap.isOpened() )
{
Mat frame;
cap.read(frame);
// process(img);
}
它有效,但如果我这样做:
VideoCapture cap("c:/fullpath/Image_%03d.png"); // for Image_001.png, etc. This doesn't works.
while( cap.isOpened() )
{
Mat frame;
cap.read(frame);
// process(img);
}
然后它显示以下错误:
WARNING: Couldn't read movie file c:/fullpath/Image_%03d.png
请告诉我哪里出错了?
【问题讨论】:
-
使用dirent.h对字符串输出进行排序
-
我已经找到了一个解决方案,我会在有空的时候发布它。谢谢!
-
嗨,介意分享您的解决方案吗?