Skip to content

UMat

Core and matricesclassOpenCV 5.0.0
import { UMat } from '@banou/opencv-wasm'

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

ARGUMENTSConstructor or factory
CLASSUMat
RETURN TYPEOwned native handle
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Native object: release it with using or delete(). Factories can return null; check before calling methods.

UMat: todo: document

Constructors and members

static new

creates a matrix header for a part of the bigger matrix

new(size: number, _1: number, usageFlags: number): UMat;
2 available overloads
new(): UMat;
new(size: number, _1: number, usageFlags: number): UMat;
size

size argument (number).

_1

1 argument (number).

usageFlags

usage flags argument (number).

Returns

The UMat result.

rows

Number of rows in this CPU-backed unified matrix.

rows: number;

cols

Number of columns in this CPU-backed unified matrix.

cols: number;

offset

Byte offset of this matrix view within its backing allocation.

offset: number;

getMat

Map the CPU-backed unified matrix to an owned Mat header using the requested ACCESS_READ, ACCESS_WRITE or ACCESS_RW mode. Pixel storage is shared.

getMat(access: number): Mat;
access

access argument (number).

Returns

The Mat result. Release returned native handles with using or delete(), including handles nested in results.

get

Return an owned Mat header for CPU read access to this unified matrix. Pixel storage is shared; dispose the returned header.

get(): Mat;
Returns

The Mat result. Release returned native handles with using or delete(), including handles nested in results.

isContinuous

returns true iff the matrix data is continuous (i.e. when there are no gaps between successive rows). similar to CV_IS_MAT_CONT(cvmat->type)

isContinuous(): boolean;
Returns

The boolean result.

isSubmatrix

returns true if the matrix is a submatrix of another matrix

isSubmatrix(): boolean;
Returns

The boolean result.

channels

returns element type, similar to CV_MAT_CN(cvmat->type)

channels(): number;
Returns

The number result.

depth

returns element type, similar to CV_MAT_DEPTH(cvmat->type)

depth(): number;
Returns

The number result.

total

returns the total number of matrix elements

total(): number;
Returns

The number result.

clone

returns deep copy of the matrix, i.e. the data is copied

clone(): UMat;
Returns

The UMat result.

empty

returns true if matrix data is NULL

empty(): boolean;
Returns

The boolean result.

type

returns element type, similar to CV_MAT_TYPE(cvmat->type)

type(): number;
Returns

The number result.

copyTo

copies the matrix content to "m". It calls m.create(this->size(), this->type()).

copyTo(m: Mat): void;
m

m argument (Mat).

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.