Skip to content
Discussion options

You must be logged in to vote

Hi @epigraphe 👋🏻 The problem is that you simultaneously pass the coordinates of all PolygonZone's. You need to separate polygons and initiate each PolygonZone separately.

import numpy as np
import supervision as sv

ZONE_POLYGONS = np.array([
    [[0.04, 0.03], [0.42, 0.03], [0.41, 0.51], [0.05, 0.51]],
    [[0.49, 0.03], [0.96, 0.03], [0.96, 0.51], [0.5, 0.51]],
    [[0.05, 0.61], [0.41, 0.6], [0.4, 0.94], [0.04, 0.94]],
    [[0.5, 0.61], [0.95, 0.61], [0.94, 0.91], [0.49, 0.92]]
])

ZONE_POLYGONS = (ZONE_POLYGONS * np.array([width, frame_height])).astype(int)

zones = [
    sv.PolygonZone(
        polygon=polygon,
        frame_resolution_wh=(frame_width, frame_height)
    )
    for pol…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by epigraphe
Comment options

You must be logged in to vote
1 reply
@SkalskiP
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants