28 #ifndef _COMMON_ARUCO_ 29 #define _COMMON_ARUCO_ 30 #include <opencv/cv.h> 49 ifstream InFile(TheIntrinsicFile.c_str());
50 if (!InFile)
return false;
52 InFile.getline(line,1024);
53 InFile.getline(line,1024);
59 TheDistorsionCameraParams.create(4,1,CV_32FC1);
60 TheIntriscCameraMatrix=Mat::eye(3,3,CV_32FC1);
64 InLine>>TheIntriscCameraMatrix.at<
float>(0,0);
65 InLine>>TheIntriscCameraMatrix.at<
float>(1,1);
66 InLine>>TheIntriscCameraMatrix.at<
float>(0,2);
67 InLine>>TheIntriscCameraMatrix.at<
float>(1,2);
69 for(
int i=0;i<4;i++) InLine>>TheDistorsionCameraParams.at<
float>(i,0);
73 InLine>>width>>height;
75 float AxFactor= float(size.width)/ width;
76 float AyFactor= float(size.height)/ height;
77 TheIntriscCameraMatrix.at<
float>(0,0)*=AxFactor;
78 TheIntriscCameraMatrix.at<
float>(0,2)*=AxFactor;
79 TheIntriscCameraMatrix.at<
float>(1,1)*=AyFactor;
80 TheIntriscCameraMatrix.at<
float>(1,2)*=AyFactor;
83 cout<<
"fx="<<TheIntriscCameraMatrix.at<
float>(0,0)<<endl;
84 cout<<
"fy="<<TheIntriscCameraMatrix.at<
float>(1,1)<<endl;
85 cout<<
"cx="<<TheIntriscCameraMatrix.at<
float>(0,2)<<endl;
86 cout<<
"cy="<<TheIntriscCameraMatrix.at<
float>(1,2)<<endl;
87 cout<<
"k1="<<TheDistorsionCameraParams.at<
float>(0,0)<<endl;
88 cout<<
"k2="<<TheDistorsionCameraParams.at<
float>(1,0)<<endl;
89 cout<<
"p1="<<TheDistorsionCameraParams.at<
float>(2,0)<<endl;
90 cout<<
"p2="<<TheDistorsionCameraParams.at<
float>(3,0)<<endl;
bool readIntrinsicFile(string TheIntrinsicFile, Mat &TheIntriscCameraMatrix, Mat &TheDistorsionCameraParams, Size size)