Skip to content

rectangle

Image processingfunctionOpenCV 5.0.0
import { rectangle } from '@banou/opencv-wasm'

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

ARGUMENTSimg, pt1, pt2, color
FUNCTIONrectangle
RETURN TYPEvoid
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Draws a simple, thick, or filled up-right rectangle.

The function cv::rectangle draws a rectangle outline or a filled rectangle whose two opposite corners are pt1 and pt2.

rectangle(img: Mat, pt1: Point, pt2: Point, color: Scalar, thickness: number, lineType: number, shift: number): void;
4 available overloads
rectangle(img: Mat, pt1: Point, pt2: Point, color: Scalar): void;
rectangle(img: Mat, pt1: Point, pt2: Point, color: Scalar, thickness: number): void;
rectangle(img: Mat, pt1: Point, pt2: Point, color: Scalar, thickness: number, lineType: number): void;
rectangle(img: Mat, pt1: Point, pt2: Point, color: Scalar, thickness: number, lineType: number, shift: number): void;
img

Input/output value, modified by the native operation. Image.

pt1

Vertex of the rectangle.

pt2

Vertex of the rectangle opposite to pt1 .

color

Rectangle color or brightness (grayscale image).

thickness

Thickness of lines that make up the rectangle. Negative values, like #FILLED, mean that the function has to draw a filled rectangle.

lineType

Type of the line. See #LineTypes

shift

Number of fractional bits in the point coordinates.

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.