OpenCV says something like
Corrupt JPEG data: premature end of data segment
or
Corrupt JPEG data: bad Huffman code
or
Corrupt JPEG data: 22 extraneous bytes before marker 0xd9
when loading a corrupt jpeg image with imread(). Can I somehow catch that? Why would I get this information otherwise? Do I have to check the binary file on my own?
You cannot catch it if you use imread()
. However there is imdecode()
function that is called by imread()
. Maybe it gives you more feedback. For this you would have to load the image into memory on your own and then call the decoder.
It boils down to: You have to dig through the OpenCV sources to solve your problem.