{% extends "base.html" %} {% block title %} remap {% endblock %} {% block description %}
Applies a generic geometrical transformation to an image.
{% endblock %} {% block signature %}cv2.remap(src, map1, map2, interpolation[, dst[, borderMode[, borderValue]]]) → dst{% endblock %} {% block parameters %}
cv2.CV_16SC2, cv2.CV_32FC1, or cv2.CV_32FC2. See convertMaps for details on converting a floating point representation to fixed-point for speed.cv2.CV_16UC1, cv2.CV_32FC1, or none (empty map if map1 is \((x,y)\) points), respectively.cv2.INTER_*): Interpolation method. The method INTER_AREA is not supported by this function.map1 and the same type as src.cv2.BORDER_*): Pixel extrapolation method. Default is BORDER_DEFAULT. Choose from:
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 map1 and map2 respectively, or interleaved floating-point maps of \((x,y)\) in map1, or fixed-point maps created by using convertMaps.
dst and outputs pixel coordinate in src.map1 contains pairs (cvFloor(x), cvFloor(y)) and map2 contains indices in a table of interpolation coefficients.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.dst to return the result rather than assignment, as users have reported errors otherwise.