I am using emgu opencv version 2.4.2 to process a series of PNG images extracted from a 720p video. I use this code to read the image:
image = new Image<Bgr, byte>(filename);
At a random image in my PNG sequence I get:
Convertion from Image<Emgu.CV.Structure.Bgra, System.Byte> to
Image<Emgu.CV.Structure.Bgr, System.Byte> is not supported by OpenCV
Indicating the input image has an alpha channel, and cannot be read directly to a 24 bit image structure.
But, the exception never occurs on the same image. So, the next time I run the program it will probably be read just fine. The exception usually occur quite far into the PNG sequence, like frame 300. Other times it runs fine to a later frame. But it would be normally stop around frame 300-320.
I am not doing any kind of threading here that could potentially cause seemingly random issues, it is a very basic program reading one image, doing some basic modifications to it, then saving it to another file.
I guess a workaround is to simply catch the exception and try again, but that seems messy.
is there anything I am missing here?