33 #include <Math/Math3d.h>
34 #include <Math/Math2d.h>
36 #include <opencv2/core.hpp>
37 #include <opencv2/core/utility.hpp>
38 #include <opencv2/imgproc.hpp>
39 #include <opencv2/calib3d.hpp>
40 #include <opencv2/imgcodecs.hpp>
41 #include <opencv2/videoio.hpp>
42 #include <opencv2/highgui.hpp>
79 flag |= cv::CALIB_RATIONAL_MODEL;
83 flag |= cv::CALIB_FIX_K3;
84 flag |= cv::CALIB_FIX_K4;
85 flag |= cv::CALIB_FIX_K5;
86 flag |= cv::CALIB_FIX_K6;
93 flag |= cv::CALIB_FIX_ASPECT_RATIO;
100 ARMARX_ERROR <<
" Camera calibration mode does not exist. ";
152 def->defineOptionalProperty<std::string>(
"ImageProviderAdapterName",
"ImageProvider",
"Ice Adapter name of the image provider");
153 def->defineOptionalProperty<
int>(
"NumberOfImages", 20,
"Number of images used for the calibration");
154 def->defineOptionalProperty<
int>(
"WaitingIntervalBetweenImages", 500,
"Waiting time between captured images, in ms");
155 def->defineOptionalProperty<
int>(
"NumberOfRows", 5,
"Number of corner rows on the calibration pattern (height; chessboard squares - 1)");
156 def->defineOptionalProperty<
int>(
"NumberOfColumns", 5,
"Number of corner columns on the calibration pattern (width; chessboard squares - 1)");
157 def->defineOptionalProperty<
double>(
"PatternSquareSize", 30.0,
"Size of the squares on the calibration pattern");
158 def->defineOptionalProperty<std::string>(
"OutputFileName",
"cameras.txt",
"Path to the file for saving the calibration");
159 def->defineOptionalProperty<
bool>(
"UseAdditionalParams",
false,
"Also use K3-K6 parameters");
160 def->defineOptionalProperty<
bool>(
"EnableFixAspectRatio",
false,
"Fix/Calibrate focal length aspect ratio");
161 def->defineOptionalProperty<std::string>(
"ImageToUse",
"left",
"Use left or rigth image for calibration").map(
"left",
"left").map(
"right",
"right");
167 enum {CAPTURING, CALIBRATED};
169 int m_mode = CAPTURING;
173 std::vector<std::vector<cv::Point2f>> imagePoints;
174 cv::Mat cameraMatrix, distCoeffs;
177 std::string providerName;
178 ImageProviderInterfacePrx imageProviderPrx;
185 CByteImage** cameraImages;
187 std::string m_outputFileName;
191 unsigned int imageID;