Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Draw Polygon Zones and Lines

Draw a polygon zone or line on an image online and get its polygon coordinates. The Roboflow Workflow editor replaces the PolygonZone tool.

Draw a polygon zone or line on an image in the Roboflow Workflow editor, and get its polygon coordinates as a list of [x, y] points. Blocks use these zones to count objects that cross a line or time how long people stay in an area. The editor replaces the standalone PolygonZone tool (polygonzone.roboflow.com): you draw a polygon online, on a frame from your camera or video, and the editor fills in the polygon points for you.

Blocks That Use Polygon Zones

Block
Field
Shape

Line Segment

Line with 2 points

Zone

Line with 2 points

Reference Path

Line with any number of points

Reference Path

Line with any number of points

Zone

Polygon

Detection Zone

Polygon

Perspective Polygons

Polygon with 4 points

Draw a Polygon Zone

  1. Add one of the blocks above to your Workflow and select it.

  2. Under the line or zone field, click "Set Line" (for lines and paths) or "Set Polygon Zone" (for polygons).

Line Counter block with the Set Line button under the Line Segment field
  1. Upload a frame from your camera or video, or drag one onto the canvas. You can also upload a video file, and the editor uses its first frame. If you don't have a frame, pick a canvas size (ex: HD, Full HD) and draw on a blank canvas.

  2. Click on the image to place points:

    • Line with 2 points: click the start and end. The line finishes on the second click.

    • Path: click each point, then press Enter or click the last point again to finish.

    • Polygon: click each corner, then click the first point or press Enter to close the shape.

  3. Drag any point to adjust it, then click "Save".

Polygon zone editor with a line drawn across two lanes of a road

Copy Polygon Coordinates

After you save, the field holds the shape as a list of [x, y] pixel coordinates (ex: [[84,408],[777,408]] for a line). Click the copy icon next to the field to copy the polygon coordinates for use in code or another Workflow.

Line Counter block with saved line coordinates in the Line Segment field

Coordinates are in pixels of the image you drew on. Use a frame with the same resolution as the video your Workflow will process, or the shape will land in the wrong place. The editor shows the image resolution in the bottom left corner.

Editor Controls

Action
Control

Snap the next segment to 45 degree angles

Hold Shift

Finish the shape

Enter

Cancel an unfinished shape

Esc

Undo

Ctrl/Cmd + Z, or "Undo"

Redo

Ctrl/Cmd + Shift + Z, or "Redo"

Remove the shape

"Clear All"

Draw on a different image

"New Image"

The editor keeps your image while you build the Workflow, so you can draw shapes for several blocks on the same frame.

Last updated

Was this helpful?