// // Created by Scheaven on 2020/5/22. // #include "homography_util.h" cv::Point2f getTransPoint(const cv::Point2f rightPoint, cv::Mat homography) { float rightP[3][1], leftP[3][1]; rightP[0][0] = rightPoint.x; rightP[1][0] = rightPoint.y; rightP[2][0] = 1.0; for(int i=0;i<3;++i){//矩阵c=a*b for(int j=0;j<1;++j) { leftP[i][j]=0; for(int k=0;k<3;++k) { leftP[i][j] += homography.at(i,k)*rightP[k][j]; } } } float x = leftP[0][0] / leftP[2][0]; float y = leftP[1][0] / leftP[2][0]; return cv::Point2f(x, y); }