Skip to content

Process libjpeg errors the OpenCV way - #3314

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

mollierobbert wants to merge 1 commit into
opencv: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

vpisarev commented Oct 8, 2014

Copy link
Copy Markdown
Contributor

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

PatWie commented Oct 20, 2016 •

Copy link
Copy Markdown

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