【发布时间】:2018-06-03 14:23:10
【问题描述】:
我使用opencv3.3开发一些算法。一个功能是读取视频或图片序列。
读取视频文件时,VidoeCapture 类运行良好。每帧读取只需几毫秒(小于 3 毫秒 @frame 1280*720)。
但是,从目录中读取图片序列时,读取过程太慢,大约每帧 40 ~ 42 ms。我确信代码正确且成功(它可以正确显示图片)。似乎 OpenCV 已将 fps 锁定在 25(40 毫秒/帧),但我不知道如何更改。
string filePath = "<my picture sequences dir>\\001_01_%06d.png"; // the file path, the name of pictures is consecutive
VideoCapture sq(filePath);
Mat _sq_tmpImage;
while(1){
sq >> _sq_tmpImage; // I had insert the breakpoint to check the cost time, it is about 40-42 ms pre frame. I also use the function "sq.read(_sq_tmpImage)" instead, but seems the same.
}
【问题讨论】:
标签: image opencv video-capture sequences