I am using opencv on C++. I am quite new at Opencv, and I think that my problem should be easy to solve ... thank you for your help. I don't understand what should be the data type of the transformation matrix in warpPerspective and how it works. I have a 3 x 3 matrix (of type Eigen::MatrixXf) H, and I manually build a cv::Mat H2 equal to H, so that I could execute that transformation on an image, as follows :
warpPerspective(src , newImg , H2 , Size (5*H1 , 5*W) ) ;
As I have not succeeded to build H2 correctly, I do it and check it step by step, as follows :
Mat H2(3,3, CV_64F);
for (int g=0;g<3;g++) for (int g1=0; g1<3; g1++) H2.at<float>(g,g1)= float(H(g,g1)) ;
cout <<endl<< "Matrix H2 (OpenCV) : "<<endl;
cout<< H2<<endl;
cout <<endl<< "Matrix H2 (OpenCV) Element by element: "<<endl;
for (int t=0; t<3; t++)
{
for (int s=0; s<3; s++)
{
cout<<"Element "<<t<<" , "<<s<<endl;
cout<< H2.at<Vec3f>(t,s)<<endl;
}
cout<<endl;
}
cout <<endl<< "Matrix H (Eigen) : "<<endl;
cout << H<<endl;
But when I print I get in H2 something that seems to be a 3x3x3 tensor, with column 0 for H2 equal to H. As shown in the attached screenshot. C:\fakepath\Capture du 2016-05-20 09:31:51.png
Thank you for your help