Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

chandlersupple
Copy link
Contributor

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.

dynamic-zone-block-pr

Type of change

  • New feature (non-breaking change which adds functionality)

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

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:
Copy link
Contributor

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:
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@PawelPeczek-Roboflow
Copy link
Collaborator

@chandlersupple could you please follow up on @grzegorz-roboflow comments - otherwise it may not be pushed into next release

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.

3 participants