Skip to content

gapi_remap

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

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

ARGUMENTSsrc, map1, map2, interpolation
FUNCTIONgapi_remap
RETURN TYPEGMat
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Applies a generic geometrical transformation to an image.

The function remap transforms the source image using the specified map:

\texttt{dst} (x,y) =  \texttt{src} (map_x(x,y),map_y(x,y))

where values of pixels with non-integer coordinates are computed using one of available interpolation methods. map_x and map_y can be encoded as separate floating-point maps in map_1 and map_2 respectively, or interleaved floating-point maps of (x,y) in map_1, or fixed-point maps created by using convertMaps. The reason you might want to convert from floating to fixed-point representations of a map is that they can yield much faster (~2x) remapping operations. In the converted case, map_1 contains pairs (cvFloor(x), cvFloor(y)) and map_2 contains indices in a table of interpolation coefficients. Output image must be of the same size and depth as input one.

Note: - Function textual ID is "org.opencv.core.transform.remap"

  • Due to current implementation limitations the size of an input and output images should be less than 32767x32767.
gapi_remap(src: GMat, map1: Mat, map2: Mat, interpolation: number, borderMode: number, borderValue: Scalar): GMat;
3 available overloads
gapi_remap(src: GMat, map1: Mat, map2: Mat, interpolation: number): GMat;
gapi_remap(src: GMat, map1: Mat, map2: Mat, interpolation: number, borderMode: number): GMat;
gapi_remap(src: GMat, map1: Mat, map2: Mat, interpolation: number, borderMode: number, borderValue: Scalar): GMat;
src

Source image.

map1

The first map of either (x,y) points or just x values having the type CV_16SC2, CV_32FC1, or CV_32FC2.

map2

The second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map if map1 is (x,y) points), respectively.

interpolation

Interpolation method (see cv::InterpolationFlags). The methods #INTER_AREA and #INTER_LINEAR_EXACT are not supported by this function.

borderMode

Pixel extrapolation method (see cv::BorderTypes). When borderMode=BORDER_TRANSPARENT, it means that the pixels in the destination image that corresponds to the "outliers" in the source image are not modified by the function.

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.