由对应四点求透视投影矩阵

void get_H_matrix(matchingslist matchings,CvMat* H_Mat1,CvMat* H_Mat2)
{
 
 CvPoint2D32f *points1=new CvPoint2D32f[4];
 CvPoint2D32f *points2=new CvPoint2D32f[4];
 matchingslist::iterator ptr = matchings.begin();
 for(int i=0;i<4;ptr++,i++)
 {
  points1[i].x=cvRound(ptr->first.x);
  points1[i].y=cvRound(ptr->first.y);
  points2[i].x=cvRound(ptr->second.x);
  points2[i].y=cvRound(ptr->second.y);
 }
  cvGetPerspectiveTransform(points1,points2,H_Mat1);//仅仅针对最前边的4对点,而且向后移的四对点,得到的还不一样
 cvGetPerspectiveTransform(points2,points1,H_Mat2);
}

你可能感兴趣的:(由对应四点求透视投影矩阵)