/* Calculates the transfer error between a point and its correspondence for a given homography, i.e. for a point x, it's correspondence x', and homography H, computes d(x', Hx)^2. @param pt a point @param mpt pt's correspondence @param H a homography matrix @return Returns the transfer error between pt and mpt given H */ double homog_xfer_err( CvPoint2D64f pt, CvPoint2D64f mpt, CvMat* H ) { CvPoint2D64f xpt = persp_xform_pt( pt, H );//pt经变换矩阵H变换后的点xpt,即H乘以x对应的向量 return sqrt( dist_sq_2D( xpt, mpt ) );//两点间距离的平方 }
/* Calculates the transfer error between a point and its correspondence for a given homography, i.e. for a point x, it's correspondence x', and homography H, computes d(x', Hx)^2. @param pt a point @param mpt pt's correspondence @param H a homography matrix @return Returns the transfer error between pt and mpt given H */ double homog_xfer_err( CvPoint2D64f pt, CvPoint2D64f mpt, CvMat* H ) { CvPoint2D64f xpt = persp_xform_pt( pt, H ); return sqrt( dist_sq_2D( xpt, mpt ) ); }