10 #ifndef SENSCALIBRATIONESTIMATOR_H
11 #define SENSCALIBRATIONESTIMATOR_H
24 : std::runtime_error(toMessage(msg, line, file).c_str())
29 std::string
toMessage(
const std::string& msg,
const int line,
const std::string& file)
32 ss << msg <<
": Exception thrown at line " << line <<
" in " << file << std::endl;
55 std::string computerInfos,
56 std::string calibDataPath,
57 std::string imageOutputPath,
62 bool updateAndDecorate(cv::Mat imageColor,
63 const cv::Mat& imageGray,
65 bool drawCorners =
true);
80 bool isDone() {
return _state == State::Done; }
83 static bool calcCalibration(cv::Size& imageSize,
84 cv::Mat& cameraMatrix,
86 const vector<vector<cv::Point2f>>& imagePoints,
87 std::vector<cv::Mat>& rvecs,
88 std::vector<cv::Mat>& tvecs,
89 vector<float>& reprojErrs,
94 bool useReleaseObjectMethod);
97 bool calibrateAsync();
99 bool loadCalibParams();
100 void updateExtractAndCalc(
bool found,
bool grabFrame, cv::Mat imageGray);
101 void updateOnlyCapture(
bool found,
bool grabFrame, cv::Mat imageGray);
102 void saveImage(cv::Mat imageGray);
104 static double calcReprojectionErrors(
const vector<vector<cv::Point3f>>& objectPoints,
105 const vector<vector<cv::Point2f>>& imagePoints,
106 const std::vector<cv::Mat>& rvecs,
107 const std::vector<cv::Mat>& tvecs,
108 const cv::Mat& cameraMatrix,
109 const cv::Mat& distCoeffs,
110 vector<float>& perViewErrors);
111 static void calcBoardCorners3D(
const cv::Size& boardSize,
113 std::vector<cv::Point3f>& objectPoints3D);
116 bool _calibrationSuccessful =
false;
123 float _boardSquareMM = 10.f;
124 int _numOfImgsToCapture = 20;
125 int _numCaptured = 0;
127 float _reprojectionError = -1.f;
131 int _camSizeIndex = -1;
132 bool _mirroredH =
false;
133 bool _mirroredV =
false;
143 bool _hasAsyncError =
false;
special exception that informs about errors during calibration process
std::string toMessage(const std::string &msg, const int line, const std::string &file)
SENSCalibrationEstimatorException(const std::string &msg, const int line, const std::string &file)
std::future< bool > _calibrationTask
future object for calculation of calibration in async task
cv::Mat _currentImgToExtract
std::string _calibImgOutputDir
std::string _calibDataPath
std::unique_ptr< SENSCalibration > _calibration
estimated calibration
bool isDoneCaptureAndSave()
SENSCalibrationEstimatorException _exception
std::string _calibParamsFileName
name of calibration paramters file
SENSCalibration getCalibration()
Get resulting calibration.
cv::Size _imageSize
Input image size in pixels (after cropping)
std::string _computerInfos
SENSCalibrationEstimatorParams _params
cv::Size _boardSize
NO. of inner chessboard corners.
bool calibrationSuccessful()
vector< vector< cv::Point2f > > _imagePoints
2D vector of corner points in chessboard
Parameterset for the SENSCalibrationEstimator.