我使用opencv3.3开发了一些algorithms.One函数,即读取vidoe或图片序列。
当读取视频文件时,类VidoeCapture运行良好。每帧读取仅需几毫秒(小于3 ms @frame 1280*720)。
然而,当从目录读取图像序列时,读取过程太慢,每帧约40 ~ 42 ms。我确信代码是正确和成功的(它可以正确地显示图片)。OpenCV似乎将fps锁定在25(40 to /帧),但我不知道如何改变它。
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.
}发布于 2018-06-07 06:57:34
不,代码在读取/加载图像之间没有任何延迟,可以找到代码在这里。
如果您还没有将图像存储在SSD上,请尝试这样做。或者使用一种具有更快解码器的格式,也许jpeg比png更快。
https://stackoverflow.com/questions/50667389
复制相似问题