1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
CvSize size_ut = cvSize(640,480);
CvMat* fundamental_ext =cvCreateMat(3,3,CV_64F);
CvMat* point_image_g = (CvMat*)cvLoad( "point_image_g.xml" );
CvMat* point_image_d = (CvMat*)cvLoad( "point_image_d.xml" );
CvMat* homography_matrix_g = cvCreateMat(3,3,CV_64F);
CvMat* homography_matrix_d = cvCreateMat(3,3,CV_64F);
//pour transformer mes deux matrices de points de float à double
double tabgauche[240][2];
double tabdroite[240][2];
int i,j;
double t,y;
for(i=0 ; i<240;i++){
for(j=0;j<2;j++){
t=cvmGet(point_image_g,i,j);
tabgauche[i][j]=t;
y=cvmGet(point_image_d,i,j);
tabdroite[i][j]=y;
}
}
cvInitMatHeader(point_image_new_g, 240, 2, CV_64F, tabgauche);
cvInitMatHeader(point_image_new_d, 240, 2, CV_64F, tabdroite);
cvSave("new_point_g.xml",point_image_new_g);
cvSave("new_point_d.xml",point_image_new_d);
cvFindFundamentalMat(point_image_g,point_image_d,fundamental_ext);
cvSave( "fundamental_ext.xml",fundamental_ext);
cvStereoRectifyUncalibrated(point_image_new_g,point_image_new_d,fundamental_ext,size_ut,homography_matrix_g,homography_matrix_d); |
Partager