Python: handle errors in Rect conversions#19380
Merged
opencv-pushbot merged 1 commit intoopencv:masterfrom Jan 24, 2021
Merged
Conversation
alalek
commented
Jan 23, 2021
| cv.rectangle(frame, np.array(box), (0, 255, 0)) | ||
| cv.rectangle(frame, tuple(box), (0, 255, 0)) | ||
| cv.rectangle(frame, list(box), (0, 255, 0)) | ||
| # FIXIT never properly work: cv.rectangle(frame, list(box), (0, 255, 0)) |
Member
Author
There was a problem hiding this comment.
Disabled, because conversion to Rect is never worked properly here (result of Rect(0,0,0,0) or garbage due to index out of range access).
(conversion should be rewritten, starting form "3.4" branch with related tests - out of scope for this hotfix)
VadimLevin
reviewed
Jan 23, 2021
| with self.assertRaises((cv.error, Exception), msg=no_exception_msg) as cm: | ||
| cv.utils.testOverloadResolution(*args, **kwargs) | ||
| res = cv.utils.testOverloadResolution(*args, **kwargs) | ||
| self.fail("Unexpected result for {}: '{}'".format(msg, res)) |
Contributor
There was a problem hiding this comment.
assertRaises should mark the test as failed with a proper no_exception_msg if exception doesn't occur.
What is the purpose of this line?
VadimLevin
reviewed
Jan 23, 2021
| { | ||
| std::vector<int> value(4); | ||
| pyopencvVecConverter<int>::to(obj, value, info); | ||
| if (!pyopencvVecConverter<int>::to(obj, value, info)) |
Contributor
There was a problem hiding this comment.
I think this part wont be needed after #19344 merge, because it handles all Python sequence in a common way.
Member
Author
There was a problem hiding this comment.
Yes, I'm aware of this patch and agree that implementation will be replaced.
Member
Author
|
👍 |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Minimal hotfix for test_overload_resolution() tests.
relates #14780
Tests with Rect conversions should be added in a separate PR (to 3.4 branch). Probably after #19344 to avoid conflicts