I am working with images taken by a high speed IP camera which transmits them through Ethernet port. During transmission, a few bytes are lost or corrupted occasionally without any visual impact. When I load the images in a sequence using cvLoadImage, frequently a message like "Corrupt JPEG data: Premature end of data segment" or "Corrupt JPEG data: extraneous bytes before marker 0*d9" appears.
I don't want cvLoadImage to display such errors since they are common due to high speed transmission of images. Also printing to console is time-consuming since I might be processing upto 2000 images at a time.
How do I disable these messages. I have the Opencv 2.0 source and can dig into it if I get the right pointer.
P.S. I tried looking into grfmt_jpeg.cpp and similar source files but didn't find this error message anywhere.
I don't think there is a nice and neat way of avoiding these error printouts - they originate from the core of libjpeg.
If you do want to dig in and see who is actually emitting the errors, take a look in 3rdparty/libjpeg/. Look at jerror.h/c.
PS. I think your particular error comes from the no_more_bytes-goto-flag in the
jpeg_fill_bit_buffer()
in jdhuff.c.