Fuchs
7
//x,y coordinates of my first frame
Point2f p1_1 = { 294.332,204.907 };
Point2f p1_2 = { 568.93, 153.152 };
Point2f p1_3 = { 568.93, 153.152 };
Point2f p1_4 = { 322.765, 202.582 };
vector <Point2f > Vec1= { p1_1,p1_2,p1_3,p1_4 };
vector<Point2f> Vec2;
for (int i=0;i<Vec1.size();i++){
Point3f p3d;
p3d.x=Vec1[i].x;
p3d.y=Vec1[i].y;
p3d.z= depth_img1.at<double>(Vec[1]) // z coordinate at point x,y
double arr[4]={p3d.x, p3d.y,1. , p3d.z}
Mat p4d(Size(1,4),CV_64F,arr);
Mat p_img2=ProjectionMat * p4d; // compute points of the second frame
Point2f pt2d= { (float)p_img2.at<double>(0,0), (float)p_img2.at<double>(1,0)}; //pick the x and y coordinates
Vec2.push_back(pt2d);
}
Mat H=getPerspectiveTransform(Vec2,Vec1);