Skip to content

transform

Core and matricesfunctionOpenCV 5.0.0
import { transform } from '@banou/opencv-wasm'

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

ARGUMENTSsrc, dst, m
FUNCTIONtransform
RETURN TYPEvoid
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Performs the matrix transformation of every array element.

The function cv::transform performs the matrix transformation of every element of the array src and stores the results in dst :

\texttt{dst} (I) =  \texttt{m} \cdot \texttt{src} (I)

(when m.cols=src.channels() ), or

\texttt{dst} (I) =  \texttt{m} \cdot [ \texttt{src} (I); 1]

(when m.cols=src.channels()+1 )

Every element of the N -channel array src is interpreted as N -element vector that is transformed using the M x N or M x (N+1) matrix m to M-element vector - the corresponding element of the output array dst .

The function may be used for geometrical transformation of N -dimensional points, arbitrary linear color space transformation (such as various kinds of RGB to YUV transforms), shuffling the image channels, and so forth.

See: perspectiveTransform, getAffineTransform, estimateAffine2D, warpAffine, warpPerspective

transform(src: Mat, dst: Mat, m: Mat): void;
src

input array that must have as many channels (1 to 4) as m.cols or m.cols-1.

dst

Output destination, filled by the native operation. output array of the same size and depth as src; it has as many channels as m.rows.

m

transformation 2x2 or 2x3 floating-point matrix.

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.