# polygons

The **polygons** parameter is used to describe the geometry of Polygon RoI, as follows:

```
"polygons": [
[
[float,float],
...
],
...
]
```

Each element of a “polygons” array is itself an array of (x,y) coordinates that describes a contiguous region. The polygon boundary is formed by drawing a straight edge between each consecutive pair of (x,y) vertices, and a final edge connecting the last and first vertices. A polygon region is all of the area enclosed by such a boundary. A single “polygons” parameter can include multiple disconnected regions.

## polygon geometry

ApertureDB makes several assumptions about the geometry of a polygon. To be considered a valid polygon, the following conditions must all be met:

A polygon must

**not be empty**. There must be some area inside the polygon. By extension, this means a polygon must have**at least 3 vertices**.A polygon must be

**bounded**. In other words, it must form a closed loop and can’t extend indefinitely in any direction.If the polygon is associated with an image, it also must be fully

**contained within the image**.

A polygon boundary must

**not cross itself**. In other words, if you were to walk along the polygon boundary, the inside of the polygon must always be on the same side of you.Note that a polygon boundary

**may touch itself**, as long as it doesn’t cross. The polygon boundary can arrive at the same location twice, and even trace along itself, so long as it doesn’t cross. This can be used, for example, to describe regions with “holes” in them.

Polygon vertex coordinate values must be

**in pixels**. For example, the center of a 200 x 300 image has the coordinates (100.0, 150.0).