title: How can I catch corrupt JPEGs when loading an image with imread() in OpenCV?
body: <p>OpenCV says something like</p>
  
  <pre><code>Corrupt JPEG data: premature end of data segment
  </code></pre>
  
  <p>or </p>
  
  <pre><code>Corrupt JPEG data: bad Huffman code
  </code></pre>
  
  <p>or</p>
  
  <pre><code>Corrupt JPEG data: 22 extraneous bytes before marker 0xd9
  </code></pre>
  
  <p>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?</p>