10 #ifndef CVCALIBRATIONESTIMATOR_H
11 #define CVCALIBRATIONESTIMATOR_H
30 : std::runtime_error(
toMessage(msg, line, file).c_str())
35 string toMessage(
const string& msg,
const int line,
const string& file)
38 ss << msg <<
": Exception thrown at line " << line <<
" in " << file << std::endl;
63 string imageOutputPath,
69 const CVMat& imageGray,
71 bool drawCorners =
true);
95 vector<float>& reprojErrs,
100 bool useReleaseObjectMethod);
114 const CVMat& cameraMatrix,
115 const CVMat& distCoeffs,
116 vector<float>& perViewErrors);
vector< cv::Point3f > CVVPoint3f
vector< vector< cv::Point3f > > CVVVPoint3f
vector< vector< cv::Point2f > > CVVVPoint2f
special exception that informs about errors during calibration process
CVCalibrationEstimatorException(const string &msg, const int line, const string &file)
string toMessage(const string &msg, const int line, const string &file)
bool isDoneCaptureAndSave()
CVCalibrationEstimatorException _exception
cv::Mat _currentImgToExtract
void saveImage(cv::Mat imageGray)
void updateOnlyCapture(bool found, bool grabFrame, cv::Mat imageGray)
bool calculate()
Initiates the final calculation.
CVVVPoint2f _imagePoints
2D vector of corner points in chessboard
string _calibParamsFileName
name of calibration paramters file
CVCalibration getCalibration()
Get resulting calibration.
bool _calibrationSuccessful
static bool calcCalibration(CVSize &imageSize, CVMat &cameraMatrix, CVMat &distCoeffs, const CVVVPoint2f &imagePoints, CVVMat &rvecs, CVVMat &tvecs, vector< float > &reprojErrs, float &totalAvgErr, CVSize &boardSize, float squareSize, int flag, bool useReleaseObjectMethod)
Calculates the calibration with the given set of image points.
int _numCaptured
NO. of images captured.
void updateExtractAndCalc(bool found, bool grabFrame, cv::Mat imageGray)
float _reprojectionError
Reprojection error after calibration.
~CVCalibrationEstimator()
string _calibImgOutputDir
static void calcBoardCorners3D(const CVSize &boardSize, float squareSize, CVVPoint3f &objectPoints3D)
Calculates the 3D positions of the chessboard corners.
bool loadCalibParams()
Loads the chessboard calibration pattern parameters.
CVCalibrationEstimatorParams _params
bool updateAndDecorate(CVMat imageColor, const CVMat &imageGray, bool grabFrame, bool drawCorners=true)
< Finds the inner chessboard corners in the given image
@ BusyExtracting
Estimator is busy extracting the corners of a frame.
@ DoneCaptureAndSave
All images are captured in.
@ Streaming
Estimator waits for new frames.
@ Done
Estimator finished.
@ Calculating
Estimator is currently calculating the calibration.
CVCalibrationEstimator(CVCalibrationEstimatorParams params, int camSizeIndex, bool mirroredH, bool mirroredV, CVCameraType camType, string computerInfos, string calibDataPath, string imageOutputPath, string exePath)
CVSize _boardSize
NO. of inner chessboard corners.
std::future< bool > _calibrationTask
future object for calculation of calibration in async task
int _numOfImgsToCapture
NO. of images to capture.
bool calibrationSuccessful()
CVSize _imageSize
Input image size in pixels (after cropping)
float _boardSquareMM
Size of chessboard square in mm.
CVCalibration _calibration
estimated calibration
static double calcReprojectionErrors(const CVVVPoint3f &objectPoints, const CVVVPoint2f &imagePoints, const CVVMat &rvecs, const CVVMat &tvecs, const CVMat &cameraMatrix, const CVMat &distCoeffs, vector< float > &perViewErrors)
Calculates the reprojection error of the calibration.
Live video camera calibration class with OpenCV an OpenCV calibration.