Skip to content

How to register detection in PolygonZone for any overlap #1022

@marcospgp

Description

@marcospgp

Search before asking

  • I have searched the Supervision issues and found no similar feature requests.

Question

How can I register a detection inside a PolygonZone when there is any overlap? Without requiring the entire bounding box to be contained inside the zone.

image

I tried using triggering_anchors but it didn't work:

    polygon_zone = sv.PolygonZone(
        polygon=zone_ndarray,
        frame_resolution_wh=(img_width, img_height),
        # Make a detection be considered inside the zone if there is any
        # overlap.
        triggering_anchors=[
            Position.TOP_LEFT,
            Position.TOP_RIGHT,
            Position.BOTTOM_RIGHT,
            Position.BOTTOM_LEFT,
        ],
    )

Thanks!

Additional

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions