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>
This commit is contained in:
nickjackolson 2021-11-14 20:43:50 +01:00
parent 49432009fe
commit 79d4e865fe

View File

@ -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, ' ');