I use opencv3.3 to do develop some algorithms.One function is that read vidoe or picture sequences.
When reading a video file, the class VidoeCapture works well. Reading per frame costs just several milliseconds (less than 3 ms @frame 1280*720).
However, when reading picture sequences from a directory, the reading process is too slow, about 40 ~ 42 ms per frame. I am sure that the code is correct and success (it can show the picture correctly). It seems the OpenCV have locked the fps at 25(40ms/frame), but I don't know how to change this.
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.
}
No, the code doesn't have any delays between reading/loading images, can find the code here.
If you're not already storing the images on an SSD, try that. Or use a format that has a faster decoder, perhaps jpeg is faster than png.