opencv::imgproc

Function remap_def

Source
pub fn remap_def(
    src: &impl ToInputArray,
    dst: &mut impl ToOutputArray,
    map1: &impl ToInputArray,
    map2: &impl ToInputArray,
    interpolation: i32,
) -> Result<()>
Expand description

Applies a generic geometrical transformation to an image.

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

block formula

with the WARP_RELATIVE_MAP flag :

block formula

where values of pixels with non-integer coordinates are computed using one of available interpolation methods. inline formula and inline formula can be encoded as separate floating-point maps in inline formula and inline formula respectively, or interleaved floating-point maps of inline formula in inline formula, 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, inline formula contains pairs (cvFloor(x), cvFloor(y)) and inline formula contains indices in a table of interpolation coefficients.

This function cannot operate in-place.

§Parameters

  • src: Source image.
  • dst: Destination image. It has the same size as map1 and the same type as src .
  • map1: The first map of either (x,y) points or just x values having the type CV_16SC2 , CV_32FC1, or CV_32FC2. See convert_maps for details on converting a floating point representation to fixed-point for speed.
  • 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 #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)
  • borderMode: Pixel 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.
  • borderValue: Value used in case of a constant border. By default, it is 0.

Note: Due to current implementation limitations the size of an input and output images should be less than 32767x32767.

§Note

This alternative version of remap function uses the following default values for its arguments:

  • border_mode: BORDER_CONSTANT
  • border_value: Scalar()