Skip to content

Friendlier error messages when image path does not exist: Add warning message to imread() #21067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 18, 2021
Merged

Friendlier error messages when image path does not exist: Add warning message to imread() #21067

merged 2 commits into from
Nov 18, 2021

Conversation

NickJackolson
Copy link
Contributor

@NickJackolson NickJackolson commented Nov 16, 2021

resolves #20167
Add a warning message using CV_LOG_WARNING() to imread().
Add a src check using CV_Assert() to seamlessClone().
These changes would help using imread() and seamlessClone(). Change in imread would especially help to new users when they can make mistakes with path.

Signed-off-by: nickjackolson metedurlu@gmail.com

System Info:

  • Linux pop-os 5.13.0-7614-generic 14 x86_64 x86_64 x86_64 GNU/Linux
  • cmake version 3.16.3
  • g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0

Pull Request Readiness Checklist

  • [ + ] I agree to contribute to the project under Apache 2 License.
  • [ + ] To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • [ + ] The PR is proposed to proper branch
  • [ + ] There is reference to original bug report and related work
  • [ + ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • [ + ] The feature is well documented and sample code can be built with the project CMake
allow_multiple_commits=1

@NickJackolson NickJackolson marked this pull request as ready for review November 16, 2021 21:50
Copy link
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contribution!

@NickJackolson NickJackolson requested a review from alalek November 18, 2021 19:49
@alalek
Copy link
Member

alalek commented Nov 18, 2021

Looks good!

This patch should go into 3.4 branch first.
We will merge changes from 3.4 into 4.x regularly (weekly/bi-weekly).

Please:

  • change "base" branch of this PR: 4.x => 3.4 (use "Edit" button near PR title)
  • rebase your commits from 4.x onto 3.4 branch. For example:
    git rebase -i --onto upstream/3.4 upstream/4.x
    (check list of your commits, save and quit (Esc + "wq" + Enter)
    where upstream is configured by following this GitHub guide and fetched (git fetch upstream).
  • push rebased commits into source branch of your fork (with --force option)

Note: no needs to re-open PR, apply changes "inplace".

@NickJackolson NickJackolson changed the base branch from 4.x to 3.4 November 18, 2021 20:17
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>
issue #20617 addresses lack of warnings on
seamlessClone() function when src is None.
This commit adds source check using CV_Assert
therefore debugging would be easier.

Signed-off-by: nickjackolson <metedurlu@gmail.com>
@NickJackolson
Copy link
Contributor Author

Looks good!

This patch should go into 3.4 branch first. We will merge changes from 3.4 into 4.x regularly (weekly/bi-weekly).

Please:

  • change "base" branch of this PR: 4.x => 3.4 (use "Edit" button near PR title)
  • rebase your commits from 4.x onto 3.4 branch. For example:
    git rebase -i --onto upstream/3.4 upstream/4.x
    (check list of your commits, save and quit (Esc + "wq" + Enter)
    where upstream is configured by following this GitHub guide and fetched (git fetch upstream).
  • push rebased commits into source branch of your fork (with --force option)

Note: no needs to re-open PR, apply changes "inplace".

Did as you instructed. git log now shows new commits coming after latest 3.4 commits. Waiting for checks(builds) to be completed.

Copy link
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done 👍

@opencv-pushbot opencv-pushbot merged commit 585484c into opencv:3.4 Nov 18, 2021
@alalek alalek mentioned this pull request Nov 20, 2021
@alalek alalek mentioned this pull request Dec 30, 2021
@alalek alalek mentioned this pull request Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Friendlier error messages when image path does not exist in cv2.seamlessClone()
3 participants