openCV图像处理之重映射

来源:互联网 发布:淘宝达人刷一万粉丝 编辑:程序博客网 时间:2024/06/01 19:09

void cv::remap(InputArray src,  OutputArray dst,  InputArray map1,  InputArray map2,  int interpolation,  int borderMode = BORDER_CONSTANT,  const Scalar & borderValue = Scalar()  )
将一个通用的几何变换应用于图像。

重映射将运用特定的映射对源图像进行转换:

dst(x,y)=src(mapx(x,y),mapy(x,y))

This function cannot operate in-place.

Parameters
src源图像dst目标图像与源图像大小和通道数相同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.map2y方向的映射参数. 注意 map_y 和 map_x 与 src 的大小一致 CV_16UC1, CV_32FC1, or none (empty map if map1 is (x,y) points), respectively.interpolation插值 (see cv::InterpolationFlags). 不支持 INTER_AREA ;非整数像素坐标插值标志. 这里给出的是默认值(双线性插值)borderMode像素外推方法(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值,默认为0

interpolation algorithm

EnumeratorINTER_NEAREST 

nearest neighbor interpolation

INTER_LINEAR 

bilinear interpolation

INTER_CUBIC 

bicubic interpolation

INTER_AREA 

resampling using pixel area relation. It may be a preferred method for image decimation, as it gives moire'-free results. But when the image is zoomed, it is similar to the INTER_NEAREST method.

INTER_LANCZOS4 

Lanczos interpolation over 8x8 neighborhood

INTER_MAX 

mask for interpolation codes

WARP_FILL_OUTLIERS 

flag, fills all of the destination image pixels. If some of them correspond to outliers in the source image, they are set to zero

WARP_INVERSE_MAP 

flag, inverse transformation

For example, polar transforms:

  • flag is not set: dst(ϕ,ρ)=src(x,y)
  • flag is set: dst(x,y)=src(ϕ,ρ)

enum cv::BorderTypes

Various border types, image boundaries are denoted with |

See also
borderInterpolate, copyMakeBorder
EnumeratorBORDER_CONSTANT 

iiiiii|abcdefgh|iiiiiii with some specified i

BORDER_REPLICATE 

aaaaaa|abcdefgh|hhhhhhh

BORDER_REFLECT 

fedcba|abcdefgh|hgfedcb

BORDER_WRAP 

cdefgh|abcdefgh|abcdefg

BORDER_REFLECT_101 

gfedcb|abcdefgh|gfedcba

BORDER_TRANSPARENT 

uvwxyz|absdefgh|ijklmno

BORDER_REFLECT101 

same as BORDER_REFLECT_101

BORDER_DEFAULT 

same as BORDER_REFLECT_101

BORDER_ISOLATED 

do not look outside of ROI


0 0