Skip to content

Shape

Each ImageAnnotationTarget has Shape selector that defines the image area that is being annotated.

Shape

Each Shape has a type and a geometry.

PropertyTypeDescription
typeShapeTypeEnum indicating the type of shape
geometryGeometryObject containing geometric properties

ShapeType

enum ShapeType {
POLYGON = 'POLYGON',
RECTANGLE = 'RECTANGLE'
}

Geometry

Every Geometry has a bounds property that represents the bounding box of the annotation, useful for quick calculations without parsing the entire geometry. Other geometry properties depend on the type of shape.

Bounds

PropertyTypeDescription
minXnumberLeft X coordinate of the geometry bounding box.
minYnumberTop Y coordinate of the geometry bounding box.
maxXnumberRight X coordinate of the geometry bounding box.
maxYnumberBottom Y coordinate of the geometry bounding box.

Rectangle

const rectangle = {
type: 'RECTANGLE',
geometry: {
x: 10,
y: 10,
w: 100,
h: 50,
bounds: { minX: 10, minY: 10, maxX: 110, maxY: 60 }
}
};

The Rectangle shape is defined by its X/Y position and dimensions.

PropertyTypeDescription
xnumberX-coordinate of the top-left corner.
ynumberY-coordinate of the top-left corner.
wnumberWidth of the rectangle.
hnumberHeight of the rectangle.
boundsBoundsBounding box of the rectangle (redundant).

Polygon

const polygon = {
type: 'POLYGON',
geometry: {
points: [[10, 10], [20, 20], [10, 20]],
bounds: { minX: 10, minY: 10, maxX: 20, maxY: 20 }
}
};

The Polygon shape is defined by a list of X/Y points.

PropertyTypeDescription
pointsArray<Array>Array of [x, y] coordinate pairs.
boundsBoundsPolygon bounding box.