Skip to content

minAreaRect

geometryfunctionOpenCV 5.0.0
import { minAreaRect } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSpoints
FUNCTIONminAreaRect
RETURN TYPERotatedRect
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Finds a rotated rectangle of the minimum area enclosing the input 2D point set.

The function calculates and returns the minimum-area bounding rectangle (possibly rotated) for a specified point set. The angle of rotation represents the angle between the line connecting the starting and ending points (based on the clockwise order with greatest index for the corner with greatest y) and the horizontal axis. This angle always falls between [-90, 0) because, if the object rotates more than a rect angle, the next edge is used to measure the angle. The starting and ending points change as the object rotates.Developer should keep in mind that the returned RotatedRect can contain negative indices when data is close to the containing Mat element boundary.

minAreaRect(points: Mat): RotatedRect;
points

Input vector of 2D points, stored in std::vector<> or Mat

Returns

The RotatedRect result.

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.