28 #ifndef RTABMAP_CALIBRATIONDIALOG_H_
29 #define RTABMAP_CALIBRATIONDIALOG_H_
31 #include "rtabmap/gui/rtabmap_gui_export.h"
35 #include <opencv2/opencv.hpp>
42 #if defined(HAVE_OPENCV_ARUCO) || CV_MAJOR_VERSION > 4 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION >= 7)
43 #include <opencv2/aruco/charuco.hpp>
47 class Ui_calibrationDialog;
57 CalibrationDialog(
bool stereo =
false,
const QString & savingDirectory =
".",
bool switchImages =
false, QWidget * parent = 0);
60 bool isCalibrated()
const {
return models_[0].isValidForProjection() && (stereo_?models_[1].isValidForProjection():
true);}
66 int boardWidth()
const;
67 int boardHeight()
const;
68 double squareSize()
const;
69 double markerLength()
const;
71 void saveSettings(QSettings & settings,
const QString & group =
"")
const;
72 void loadSettings(QSettings & settings,
const QString & group =
"");
75 void setCameraName(
const QString &
name);
76 void setProgressVisibility(
bool visible);
77 void setSwitchedImages(
bool switched);
78 void setFisheyeModel();
79 void setPlumbobModel();
80 void setRationalModel();
81 void setStereoMode(
bool stereo,
const QString & leftSuffix =
"left",
const QString & rightSuffix =
"right");
88 void setBoardType(
int type);
89 void setBoardWidth(
int width);
90 void setBoardHeight(
int height);
91 void setSquareSize(
double size);
92 void setMarkerDictionary(
int dictionary);
93 void setMarkerLength(
double length);
94 void setSubpixelRefinement(
bool enabled);
95 void setSubpixelMaxError(
double value);
96 void setCalibrationDataSaved(
bool enabled);
97 void setExpectedStereoBaseline(
double length);
98 void setMaxScale(
int scale);
100 void processImages(
const cv::Mat & imageLeft,
const cv::Mat & imageRight,
const QString & cameraName);
101 void generateBoard();
110 virtual void closeEvent(QCloseEvent* event);
111 virtual bool handleEvent(
UEvent * event);
114 float getArea(
const std::vector<cv::Point2f> & corners,
const cv::Size & boardSize);
115 float getSkew(
const std::vector<cv::Point2f> & fourCorners);
116 float getSkew(
const std::vector<cv::Point2f> & corners,
const cv::Size & boardSize);
122 void getParams(
const std::vector<cv::Point2f> & corners,
const cv::Size & boardSize,
const cv::Size & imageSize,
123 float & x,
float & y,
float & size,
float & skew);
141 cv::Ptr<cv::aruco::Dictionary> markerDictionary_;
142 cv::Ptr<cv::aruco::DetectorParameters> arucoDetectorParams_;
143 cv::Ptr<cv::aruco::CharucoBoard> charucoBoard_;
160 Ui_calibrationDialog *
ui_;