remap
import { remap } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
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))
with the WARP_RELATIVE_MAP flag :
\texttt{dst} (x,y) = \texttt{src} (x+map_x(x,y),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.
This function cannot operate in-place.
Note: Due to current implementation limitations the size of an input and output images should be less than 32767x32767.
remap(src: Mat, dst: Mat, map1: Mat, map2: Mat, interpolation: number, borderMode: number, borderValue: Scalar, hint: number): void;4 available overloads
remap(src: Mat, dst: Mat, map1: Mat, map2: Mat, interpolation: number): void;remap(src: Mat, dst: Mat, map1: Mat, map2: Mat, interpolation: number, borderMode: number): void;remap(src: Mat, dst: Mat, map1: Mat, map2: Mat, interpolation: number, borderMode: number, borderValue: Scalar): void;remap(src: Mat, dst: Mat, map1: Mat, map2: Mat, interpolation: number, borderMode: number, borderValue: Scalar, hint: number): void;srcSource image.
dstOutput destination, filled by the native operation. Destination image. It has the same size as map1 and the same type as src .
map1The first map of either (x,y) points or just x values having the type CV_16SC2 , CV_32FC1, or CV_32FC2. See #convertMaps for details on converting a floating point representation to fixed-point for speed.
map2The second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map if map1 is (x,y) points), respectively.
interpolationInterpolation method (see #InterpolationFlags). The methods #INTER_AREA #INTER_LINEAR_EXACT and #INTER_NEAREST_EXACT are not supported by this function. The extra flag WARP_RELATIVE_MAP can be ORed to the interpolation method (e.g. INTER_LINEAR | WARP_RELATIVE_MAP)
borderModePixel extrapolation method (see #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.
borderValueValue used in case of a constant border. By default, it is 0.
hintImplementation modification flags. Set #ALGO_HINT_APPROX to use FP16 precision (if available) for linear calculation for faster speed. See #AlgorithmHint.
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.