warpPerspective函数
主要作用:对图像进行透视变换
函数的调用形式:
void warpPerspective(InputArray src, OutputArray dst, InputArray M, Size dsize, int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT, const Scalar& borderValue=Scalar())
参数详解:
InputArray src:输入的图像
OutputArray dst:输出的图像
InputArray M:透视变换的矩阵
Size dsize:输出图像的大小
int flags=INTER_LINEAR:输出图像的插值方法,
GetPerspectiveTransform
由四对点计算透射变换
CvMat* cvGetPerspectiveTransform( const CvPoint2D32f * src, const CvPoint2D32f* dst,
CvMat*map_matrix );
#define cvWarpPerspectiveQMatrix cvGetPerspectiveTransform
src 输入图像的四边形顶点坐标。
dst 输出图像的相应的四边形顶点坐标。
map_matrix 指向3×3输出矩阵的指针。
函数cvGetPerspectiveTransform计算满足以下关系的透射变换矩阵:
这里,dst(i)= (x'i,y'i),src(i)= (xi,yi),i = 0..3.