Skip to content

gapi_warpAffine

gapifunctionOpenCV 5.0.0
import { gapi_warpAffine } from '@banou/opencv-wasm'

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

ARGUMENTSsrc, M, dsize, flags
FUNCTIONgapi_warpAffine
RETURN TYPEGMat
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Applies an affine transformation to an image.

The function warpAffine transforms the source image using the specified matrix:

\texttt{dst} (x,y) =  \texttt{src} ( \texttt{M} _{11} x +  \texttt{M} _{12} y +  \texttt{M} _{13}, \texttt{M} _{21} x +  \texttt{M} _{22} y +  \texttt{M} _{23})

when the flag #WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted with #invertAffineTransform and then put in the formula above instead of M. The function cannot operate in-place.

See: warpPerspective, resize, remap, getRectSubPix, transform

gapi_warpAffine(src: GMat, M: Mat, dsize: Size, flags: number, borderMode: number, borderValue: Scalar): GMat;
4 available overloads
gapi_warpAffine(src: GMat, M: Mat, dsize: Size): GMat;
gapi_warpAffine(src: GMat, M: Mat, dsize: Size, flags: number): GMat;
gapi_warpAffine(src: GMat, M: Mat, dsize: Size, flags: number, borderMode: number): GMat;
gapi_warpAffine(src: GMat, M: Mat, dsize: Size, flags: number, borderMode: number, borderValue: Scalar): GMat;
src

input image.

M

2\times 3 transformation matrix.

dsize

size of the output image.

flags

combination of interpolation methods (see #InterpolationFlags) and the optional flag #WARP_INVERSE_MAP that means that M is the inverse transformation ( \texttt{dst}\rightarrow\texttt{src} ).

borderMode

pixel extrapolation method (see #BorderTypes); borderMode=#BORDER_TRANSPARENT isn't supported

borderValue

value used in case of a constant border; by default, it is 0.

Returns

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

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.