This repository has been archived by the owner on Oct 31, 2023. It is now read-only.
Add helper function "cv2_utils.findContours" to maintain version compatibility between versions 3 and 4 #354
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.
Summary
Small PR to fix the version compatibility problem with
cv2.findContours
returning either 2 or 3 values depending on the cv2 version.I replaced all occurrences of
cv2.findContours
with the helper.I put the code in
utils/
dir. Seemed like the best place for it, but please advise.Testing
I tested locally by installing my branch locally using:
Then ran the
demo/Mask_R-CNN_demo.ipynb
and it worked as expected, even though mycv2
version isopencv-python==4.0.0.21
, so this is now compatible with either version.References
fixes #336
#339 also referenced this error but the issue is already closed