I am trying to rectify images. I have point correspondences and I computed both of the matrices F1 and F2. After that, I want to rectify. following is my code
cv::Mat F1(4,4, CV_64FC1);
cv::Mat F2(4,4, CV_64FC1);
CvMat* points1 = cvCreateMat(8,1,CV_64FC2);
CvMat* points2 = cvCreateMat(8,1,CV_64FC2);
for (int i=0; i<8; i++) {
cvSet2D(points1,i,0,cvScalar(gt[i].xL,gt[i].yL));
cvSet2D(points2,i,0,cvScalar(gt[i].xR,gt[i].yR));
}
cv::Size size (imgL->width, imgL->height);
cv::stereoRectifyUncalibrated(points1, points2, F, size, F1, F2);
IplImage* rectL = cvCreateImage(cvSize(imgL->width,imgL->height), imgL->depth, imgL->nChannels);
cv::warpPerspective(imgL, rectL , F1, size);
cvSaveImage("rectL.jpg", rectL);
The error is the following
error: in passing argument 2 of ‘void cv::warpPerspective(const cv::Mat&, cv::Mat&, const cv::Mat&, cv::Size, int, int, const cv::Scalar&)’
And if I do create a CvMat as follows
CvMat* rectified1 = cvCreateMat(imgL->width,imgL->height,imgL->depth);
cv::warpPerspective(imgL, *rectified1, F1,size);
cvSaveImage("rectified1.png", imgL);
Then the error is in saving the image. It say that this array is not recognized.
I am wondering if someone could please help me in this.
Thanks a lot.
cvMatandcv::Matare two different things.cvMatis obsolete. If you convert everything to cv::Mat it should take care of your problem.