Skip to content

Polygon

Overview

The Polygon node produces a user-defined polygon shape based on a list of coordinates. It's used to define areas of interest for detection and processing.

Use Polygon when:

  • You need to specify a static spatial region for an analysis node.
  • You want to define complex shapes for geometric operations or masking.

💡 Tip

Use the interactive polygon widget to draw your shape directly on a reference image for precise placement.

Outputs

NameTypeDescription
polygonpolygonThe defined set of polygon vertices.

Parameters

ParameterDefaultValid valuesTunable
Polygon coordinatesunit squarelist of at least 3 points

Polygon coordinates

A list of {"x", "y"} points that define the polygon vertices. Coordinates are normalized — expressed as fractions of the image dimensions where {"x": 0, "y": 0} is the top-left corner and {"x": 1, "y": 1} is the bottom-right corner. For example, {"x": 0.5, "y": 0.5} represents the center of the image.

The default value is a unit square covering the full image: [{"x": 0, "y": 0}, {"x": 0, "y": 1}, {"x": 1, "y": 1}, {"x": 1, "y": 0}].

⚠️ Warning

The polygon must contain at least 3 points. Fewer points will cause a validation error.

Editing the polygon

The polygon parameter uses a visual widget with two editing modes:

JSON editor — Set coordinates numerically via a JSON structure.

JSON Editor
The JSON editor lets you define polygon vertices numerically.

Visual editor — Draw and adjust the polygon interactively on a preview image. Click the preview tab to open it.

Polygon preview
Click the preview tab to switch to the visual polygon editor.

You can upload a reference image with the file uploader to position the polygon precisely over the area of interest. Click on the preview to open the interactive editor where you can drag individual points.

Polygon editor
The interactive editor — drag points to reshape the polygon over a reference image.

💡 Tip

Don't forget to save the polygon after editing — unsaved changes will be lost.

Example

Defining a surveillance zone

A user draws a triangular area over a specific entryway in a camera view. The Polygon node provides this shape to a detection node that only alerts on movement within that specific zone.

Configuration:

  • Polygon coordinates: [{"x": 0, "y": 0}, {"x": 1, "y": 0}, {"x": 0.5, "y": 0.8}]

Result: A triangular polygon object is output to the downstream flow.

Triangle polygon in normalized coordinate space
The configured triangle spans the full image width at the top and tapers to a point at 80 % height.

Reference: