26,7 → 26,8 |
#include "opencv2/calib3d/calib3d.hpp" |
#include <opencv2/highgui/highgui.hpp> |
|
class CameraCalibrator { |
class CameraCalibrator |
{ |
|
// input points |
std::vector<std::vector<cv::Point3f>> objectPoints; |
41,22 → 42,42 |
bool mustInitUndistort; |
|
public: |
CameraCalibrator() : flag(0), mustInitUndistort(true) {}; |
CameraCalibrator() : |
flag(0), mustInitUndistort(true) |
{ |
} |
; |
|
// Open the chessboard images and extract corner points |
int addChessboardPoints(const std::vector<std::string>& filelist, cv::Size & boardSize); |
int |
addChessboardPoints(const std::vector<std::string>& filelist, |
cv::Size & boardSize); |
// Add scene points and corresponding image points |
void addPoints(const std::vector<cv::Point2f>& imageCorners, const std::vector<cv::Point3f>& objectCorners); |
void |
addPoints(const std::vector<cv::Point2f>& imageCorners, |
const std::vector<cv::Point3f>& objectCorners); |
// Calibrate the camera |
double calibrate(cv::Size &imageSize); |
double |
calibrate(cv::Size imageSize); |
// Set the calibration flag |
void setCalibrationFlag(bool radial8CoeffEnabled=false, bool tangentialParamEnabled=false); |
void |
setCalibrationFlag(bool radial8CoeffEnabled = false, |
bool tangentialParamEnabled = false); |
// Remove distortion in an image (after calibration) |
cv::Mat CameraCalibrator::remap(const cv::Mat &image); |
cv::Mat |
remap(const cv::Mat &image); |
|
// Getters |
cv::Mat getCameraMatrix() { return cameraMatrix; } |
cv::Mat getDistCoeffs() { return distCoeffs; } |
cv::Mat |
getCameraMatrix() |
{ |
return cameraMatrix; |
} |
cv::Mat |
getDistCoeffs() |
{ |
return distCoeffs; |
} |
}; |
|
#endif // CAMERACALIBRATOR_H |