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_OBJDETECT) && (CV_MAJOR_VERSION > 4 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION >= 7))
43 #include <opencv2/objdetect/charuco_detector.hpp>
45 #elif defined(HAVE_OPENCV_ARUCO)
46 #include <opencv2/aruco/charuco.hpp>
50 class Ui_calibrationDialog;
60 CalibrationDialog(
bool stereo =
false,
const QString & savingDirectory =
".",
bool switchImages =
false, QWidget * parent = 0);
63 bool isCalibrated()
const {
return models_[0].isValidForProjection() && (stereo_?models_[1].isValidForProjection():
true);}
69 int boardWidth()
const;
70 int boardHeight()
const;
71 double squareSize()
const;
72 double markerLength()
const;
74 void saveSettings(QSettings & settings,
const QString & group =
"")
const;
75 void loadSettings(QSettings & settings,
const QString & group =
"");
78 void setCameraName(
const QString &
name);
79 void setProgressVisibility(
bool visible);
80 void setSwitchedImages(
bool switched);
81 void setFisheyeModel();
82 void setPlumbobModel();
83 void setRationalModel();
84 void setStereoMode(
bool stereo,
const QString & leftSuffix =
"left",
const QString & rightSuffix =
"right");
91 void setBoardType(
int type);
92 void setBoardWidth(
int width);
93 void setBoardHeight(
int height);
94 void setSquareSize(
double size);
95 void setMarkerDictionary(
int dictionary);
96 void setMarkerLength(
double length);
97 void setSubpixelRefinement(
bool enabled);
98 void setSubpixelMaxError(
double value);
99 void setCalibrationDataSaved(
bool enabled);
100 void setExpectedStereoBaseline(
double length);
101 void setMaxScale(
int scale);
103 void processImages(
const cv::Mat & imageLeft,
const cv::Mat & imageRight,
const QString & cameraName);
104 void generateBoard();
113 virtual void closeEvent(QCloseEvent* event);
114 virtual bool handleEvent(
UEvent * event);
117 float getArea(
const std::vector<cv::Point2f> & corners,
const cv::Size & boardSize);
118 float getSkew(
const std::vector<cv::Point2f> & fourCorners);
119 float getSkew(
const std::vector<cv::Point2f> & corners,
const cv::Size & boardSize);
125 void getParams(
const std::vector<cv::Point2f> & corners,
const cv::Size & boardSize,
const cv::Size & imageSize,
126 float & x,
float & y,
float & size,
float & skew);
144 cv::Ptr<cv::aruco::Dictionary> markerDictionary_;
145 cv::Ptr<cv::aruco::DetectorParameters> arucoDetectorParams_;
146 cv::Ptr<cv::aruco::CharucoBoard> charucoBoard_;
147 #if CV_MAJOR_VERSION > 4 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION >= 7)
148 cv::Ptr<cv::aruco::ArucoDetector> arucoDetector_;
149 cv::Ptr<cv::aruco::CharucoDetector> charucoDetector_;
167 Ui_calibrationDialog *
ui_;