Add warning message to imread()

Add a warning message using CV_LOG__WARNING().
This way api behaviour is preserved. Outputs are
the same but user gets an extra warning in case
fopen() fails to access image file for some reason.
This would help new users and also debugging
complex apps which use imread()

Signed-off-by: nickjackolson <metedurlu@gmail.com>
pull/21067/head
nickjackolson 4 years ago
parent 49432009fe
commit 79d4e865fe
  1. 4
      modules/imgcodecs/src/loadsave.cpp

@ -226,8 +226,10 @@ static ImageDecoder findDecoder( const String& filename ) {
FILE* f= fopen( filename.c_str(), "rb" );
/// in the event of a failure, return an empty image decoder
if( !f )
if( !f ) {
CV_LOG_WARNING(NULL, "imread_('" << filename << "'): can't open/read file: check file path/integrity");
return ImageDecoder();
}
// read the file signature
String signature(maxlen, ' ');

Loading…
Cancel
Save