How should I read MPO Multi-jpeg files?
I have a 3D digital camera that produces image pairs in the .mpo file format. Each file contains essentially a pair of standard jpeg images, one after another. I know I can manually convert these into separate jpeg files, but that would be cumbersome for large numbers of images.
Since OpenCV contains jpeg-reading code, can anyone suggest a reasonable c++ approach for reading an MPO file and producing two cv::Mat objects?
I've stepped into the imread code and I see that an fopen happens in the private _imread function in loadsave.cpp. That function uses an ImageDecoder object that happens to be a JpegDecoder in my instance.
It looks like I should design to the IJG API or else rely on the ImageDecoder interface which I assume may change in future versions of OpenCV. Is this correct?
That's an interesting problem, and I think it need an extension of VideoCapture to take MPO, not imread. There is some code on Internet to cut MPO into two JPG. By the way, and I know it's not a real solution, but OpenCV opens MPO, only the first image, as the codec detector find it's JPG. I'm interesting to add it to OpenCV, let me know your opinion on the best way to do this.