convertMaps
import { convertMaps } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Converts image transformation maps from one representation to another.
The function converts a pair of maps for remap from one representation to another. The following
options ( (map1.type(), map2.type()) \rightarrow (dstmap1.type(), dstmap2.type()) ) are
supported:
\texttt{(CV_32FC1, CV_32FC1)} \rightarrow \texttt{(CV_16SC2, CV_16UC1)}. This is the most frequently used conversion operation, in which the original floating-point maps (see #remap) are converted to a more compact and much faster fixed-point representation. The first output array contains the rounded coordinates and the second array (created only when nninterpolation=false ) contains indices in the interpolation tables.\texttt{(CV_32FC2)} \rightarrow \texttt{(CV_16SC2, CV_16UC1)}. The same as above but the original maps are stored in one 2-channel matrix.Reverse conversion. Obviously, the reconstructed floating-point maps will not be exactly the same as the originals.
See: remap, undistort, initUndistortRectifyMap
convertMaps(map1: Mat, map2: Mat, dstmap1: Mat, dstmap2: Mat, dstmap1type: number, nninterpolation: boolean): void;2 available overloads
convertMaps(map1: Mat, map2: Mat, dstmap1: Mat, dstmap2: Mat, dstmap1type: number): void;convertMaps(map1: Mat, map2: Mat, dstmap1: Mat, dstmap2: Mat, dstmap1type: number, nninterpolation: boolean): void;map1The first input map of type CV_16SC2, CV_32FC1, or CV_32FC2 .
map2The second input map of type CV_16UC1, CV_32FC1, or none (empty matrix), respectively.
dstmap1Output destination, filled by the native operation. The first output map that has the type dstmap1type and the same size as src .
dstmap2Output destination, filled by the native operation. The second output map.
dstmap1typeType of the first output map that should be CV_16SC2, CV_32FC1, or CV_32FC2 .
nninterpolationFlag indicating whether the fixed-point maps are used for the nearest-neighbor or for a more complex interpolation.
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.