Skip to content

Process libjpeg errors the OpenCV way#3314

Closed
mollierobbert wants to merge 1 commit intoopencv:2.4from
mollierobbert:patch-1
Closed

Process libjpeg errors the OpenCV way#3314
mollierobbert wants to merge 1 commit intoopencv:2.4from
mollierobbert:patch-1

Conversation

@mollierobbert
Copy link
Copy Markdown

Errors from libjpeg, specifically "Corrupted JPEG data" messages, are printed to stderr by the default error handler, making those errors uncatchable. By overwriting the output_message method as suggested by the libjpeg docs we can handle those errors like regular OpenCV errors.

@vpisarev vpisarev self-assigned this Oct 8, 2014
@vpisarev
Copy link
Copy Markdown
Contributor

vpisarev commented Oct 8, 2014

currently when some jpeg is corrupted, OpenCV returns empty image. With the proposed patch the program will crash if there is no "catch() {}" statement. I'm sure, many people will not like such a change, especially in the stable version. This patch can not be accepted, sorry.

@PatWie
Copy link
Copy Markdown

PatWie commented Oct 20, 2016

And how to handle these cases? Any verify function? I think this is an important issue! I still observe this issue in OpenCV 3.1. Please reopen. Currently there is no way to detect these corrupted images using imread in python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants