-
Notifications
You must be signed in to change notification settings - Fork 107
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
Added the Ability to Use Rectilinear Polygons in the Dynamic Zone Block #654
base: main
Are you sure you want to change the base?
Conversation
contours = sv.mask_to_polygons(mask) | ||
largest_contour = max(contours, key=len) | ||
|
||
# https://docs.opencv.org/4.x/d3/dc0/group__imgproc__shape.html#ga014b28e56cb8854c0de4a211cb2be656 | ||
if force_rectangle and required_number_of_vertices == 4: |
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'd move this to the run
function and keep all logic relevant to forced rectangle together
if len(simplified_polygon) != required_number_of_vertices: | ||
continue | ||
simplified_polygons.append(simplified_polygon) | ||
if force_rectangle and required_number_of_vertices == 4: |
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'd vote to raise exception at the beginning of run
method if force_rectangle
is true and requested number of vertices was not set to 4.
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.
Got it. Thanks for flagging this @grzegorz-roboflow. I'll move the logic to the run
function.
@chandlersupple could you please follow up on @grzegorz-roboflow comments - otherwise it may not be pushed into next release |
Description
Added two optional parameters to the Dynamic Zone block allowing users to use rectangles instead of irregular polygons, and get the height, width, and angle of the rectangles.
Type of change
How has this change been tested, please provide a testcase or example of how you tested the change?
Passed all tests. Added the
test_calculate_minimum_bounding_rectangle
test.Any specific deployment considerations
N/A
Docs
N/A