$search
00001 #ifndef _Aruco_CameraParameters_H 00002 #define _Aruco_CameraParameters_H 00003 #include <opencv/cv.h> 00004 #include <string> 00005 using namespace std; 00006 namespace aruco 00007 { 00011 class CameraParameters 00012 { 00013 public: 00014 00015 // 3x3 matrix (fx 0 cx, 0 fy cy, 0 0 1) 00016 cv::Mat CameraMatrix; 00017 //4x1 matrix (k1,k2,p1,p2) 00018 cv::Mat Distorsion; 00019 //size of the image 00020 cv::Size CamSize; 00021 00024 CameraParameters() ; 00030 CameraParameters(cv::Mat cameraMatrix,cv::Mat distorsionCoeff,cv::Size size) throw(cv::Exception); 00033 CameraParameters(const CameraParameters &CI) ; 00034 00037 bool isValid()const { 00038 return CameraMatrix.rows!=0 && CameraMatrix.cols!=0 && Distorsion.rows!=0 && Distorsion.cols!=0 && CamSize.width!=-1 && CamSize.height!=-1; 00039 } 00042 CameraParameters & operator=(const CameraParameters &CI); 00045 void readFromFile(string path)throw(cv::Exception); 00048 void saveToFile(string path)throw(cv::Exception); 00049 00052 void readFromXMLFile(string filePath)throw(cv::Exception); 00053 00056 void resize(cv::Size size)throw(cv::Exception); 00057 00061 static cv::Point3f getCameraLocation(cv::Mat Rvec,cv::Mat Tvec); 00062 00063 }; 00064 00065 } 00066 #endif 00067 00068