在应用开发中,如果得到的视频图像是投射变换后的,需要进行校正,可以利用cvWarpPerspective函数实现透视变换,通过透视变换,可实现图像翻转,线性的任意变形。
同样也可以利用投射变换 cvGetQuadrangleSubPix实现图像翻转,但是它的自由度要少三个,所以线性的任意变形不能实现。
//透视变换
int HumanMotion::WarpPerspective(IplImage *grey)
{
IplImage* Img_old = cvCloneImage( grey );
int fix = 4;
int w = Img_old->width + fix;
int h = Img_old->height + fix;
CvPoint2D32f src_point[4];
CvPoint2D32f dst_point[4];
//设定源观察面,即指定四边形的四个顶点
src_point[0].x=17;
src_point[0].y=475;
src_point[1].x=952;
src_point[1].y=449;
src_point[2].x=100;
src_point[2].y=128;
src_point[3].x=840;
src_point[3].y=110;
//设定目标观察面,即指定四边形的四个顶点
dst_point[0].x=-fix;