Skip to content

rotatedRectangleIntersection

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

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

ARGUMENTSrect1, rect2, intersectingRegion
FUNCTIONrotatedRectangleIntersection
RETURN TYPEnumber
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Finds out if there is any intersection between two rotated rectangles.

If there is then the vertices of the intersecting region are returned as well.

Below are some examples of intersection configurations. The hatched pattern indicates the intersecting region and the red vertices are returned by the function.

intersection examples

rotatedRectangleIntersection(rect1: RotatedRect, rect2: RotatedRect, intersectingRegion: Mat): number;
rect1

First rectangle

rect2

Second rectangle

intersectingRegion

Output destination, filled by the native operation. The output array of the vertices of the intersecting region. It returns at most 8 vertices. Stored as std::vector<cv::Point2f> or cv::Mat as Mx1 of type CV_32FC2.

Returns

One of #RectanglesIntersectTypes

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.