-
Notifications
You must be signed in to change notification settings - Fork 20
Add support of holes to contours generation #335
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
sovrasov
merged 20 commits into
open-edge-platform:master
from
sovrasov:vs/support_nested_contours
Jul 29, 2025
Merged
Changes from 18 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
3018059
Add support of holes to contours generation
sovrasov 2304c38
Fix logic in case of absence of nested contours
sovrasov 2b9b0a4
Cleanup python impl
sovrasov 93b514d
Add cpp implementation
sovrasov 3726152
Unify contour str reprs
sovrasov e444834
Fix np warning
sovrasov 91e5fff
Resolve some of corner-cases
sovrasov 1a2ecf2
Update refs
sovrasov dde7416
Update pre-commit config
sovrasov 67bfce5
Fix numpy issue
sovrasov 3510428
Update ref tests results
sovrasov cc6e3cf
Retain old data type for Contour init args
sovrasov 7d03560
Exclude nested contours from contour confidence calculation
sovrasov 17f364d
Exclude nested contours from prob computation
sovrasov c7124a4
Rename child_shapes for clarity
sovrasov 77320a8
Unify calls of drawContours
sovrasov 8094ff5
Tests debug
sovrasov ca6568e
Update ref results
sovrasov 410f388
Add numpy conversion to shape
sovrasov f0e812a
Fix list of contours conversion
sovrasov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For
self.shape
andself.excluded_shapes
, I would suggest to force the type to benp.ndarray
orlist[tuple[int, int]]
, but not both. Otherwise clients who consumecontour.shape
have to support both types, which isn't great.Note: this is different from the class constructor parameter, which is instead an input interface. There, supporting more types is helpful for the clients. This principle is somehow formulated in the Postel law.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally prefer garbage in garbage out principle: the system should not help clients if they don't understand that they're doing. Looks like to much hustle for a wrong type annotation, which we can not just drop. Added dummy conversion to numpy.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing it!
I don't fully understand this part; the type hints come from the library and help the client build robust code through static type checking (eg mypy). If the types are imprecise or loose, the client is forced to implement extra logic or suppress the warnings.