Go to the documentation of this file.00001
00005 #include "camera.hpp"
00006
00007 bool cameraParameters::getCameraParameters(std::string intrinsics) {
00008
00009
00010
00011 double alpha = 0.00;
00012 bool centerPrincipalPoint = true;
00013 cv::Rect* validPixROI = 0;
00014
00015 cv::FileStorage fs(intrinsics, cv::FileStorage::READ);
00016 fs["imageSize"] >> imageSize;
00017 fs["cameraMatrix"] >> cameraMatrix;
00018 fs["distCoeffs"] >> distCoeffs;
00019 blankCoeffs = cv::Mat::zeros(distCoeffs.rows, distCoeffs.cols, CV_64FC1);
00020 fs.release();
00021
00022 cameraSize = cv::Size(imageSize.at<unsigned short>(0, 0), imageSize.at<unsigned short>(0, 1));
00023
00024 newCamMat = getOptimalNewCameraMatrix(cameraMatrix, distCoeffs, cameraSize, alpha, cameraSize, validPixROI, centerPrincipalPoint);
00025
00026 newCamMat.copyTo(K);
00027
00028 K_inv = K.inv();
00029
00030
00031
00032
00033
00034
00035 if (K.rows == 0) {
00036 return false;
00037 }
00038
00039 return true;
00040
00041 }