Skip to content

Commit

Permalink
Calibration tool: added support for rational model (8 coeff)
Browse files Browse the repository at this point in the history
  • Loading branch information
matlabbe committed May 31, 2024
1 parent 32e03aa commit 2f21d42
Show file tree
Hide file tree
Showing 6 changed files with 455 additions and 227 deletions.
6 changes: 3 additions & 3 deletions corelib/src/CameraModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ CameraModel::CameraModel(
localTransform_(localTransform)
{
UASSERT(K_.empty() || (K_.rows == 3 && K_.cols == 3 && K_.type() == CV_64FC1));
UASSERT(D_.empty() || (D_.rows == 1 && (D_.cols == 4 || D_.cols == 5 || D_.cols == 6 || D_.cols == 8) && D_.type() == CV_64FC1));
UASSERT(D_.empty() || (D_.rows == 1 && (D_.cols == 4 || D_.cols == 5 || D_.cols == 6 || D_.cols == 8 || D_.cols == 12 || D_.cols == 14) && D_.type() == CV_64FC1));
UASSERT(R_.empty() || (R_.rows == 3 && R_.cols == 3 && R_.type() == CV_64FC1));
UASSERT(P_.empty() || (P_.rows == 3 && P_.cols == 4 && P_.type() == CV_64FC1));
}
Expand Down Expand Up @@ -156,7 +156,7 @@ CameraModel::CameraModel(
bool CameraModel::initRectificationMap()
{
UASSERT(imageSize_.height > 0 && imageSize_.width > 0);
UASSERT(D_.rows == 1 && (D_.cols == 4 || D_.cols == 5 || D_.cols == 6 || D_.cols == 8));
UASSERT(D_.rows == 1 && (D_.cols == 4 || D_.cols == 5 || D_.cols == 6 || D_.cols == 8 || D_.cols == 12 || D_.cols == 14));
UASSERT(R_.rows == 3 && R_.cols == 3);
UASSERT(P_.rows == 3 && P_.cols == 4);
// init rectification map
Expand Down Expand Up @@ -279,7 +279,7 @@ bool CameraModel::load(const std::string & filePath)
std::vector<double> data;
n["data"] >> data;
UASSERT(rows*cols == (int)data.size());
UASSERT(rows == 1 && (cols == 4 || cols == 5 || cols == 8));
UASSERT(rows == 1 && (cols == 4 || cols == 5 || cols == 8 || cols == 12 || cols == 14));
D_ = cv::Mat(rows, cols, CV_64FC1, data.data()).clone();
}
else
Expand Down
9 changes: 8 additions & 1 deletion guilib/include/rtabmap/gui/CalibrationDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ class RTABMAP_GUI_EXPORT CalibrationDialog : public QDialog, public UEventsHand
void setCameraName(const QString & name);
void setProgressVisibility(bool visible);
void setSwitchedImages(bool switched);
void setFisheyeImages(bool enabled);
void setFisheyeModel();
void setPlumbobModel();
void setRationalModel();
void setStereoMode(bool stereo, const QString & leftSuffix = "left", const QString & rightSuffix = "right");
void setSavingDirectory(const QString & savingDirectory) {savingDirectory_ = savingDirectory;}

Expand All @@ -78,6 +80,7 @@ public Q_SLOTS:
void setBoardWidth(int width);
void setBoardHeight(int height);
void setSquareSize(double size);
void setCalibrationDataSaved(bool enabled);
void setExpectedStereoBaseline(double length);
void setMaxScale(int scale);

Expand Down Expand Up @@ -114,10 +117,14 @@ private Q_SLOTS:
QString cameraName_;
bool processingData_;
bool savedCalibration_;
int currentId_;
QString timestamp_;

std::vector<std::vector<std::vector<cv::Point2f> > > imagePoints_;
std::vector<std::vector<std::vector<float> > > imageParams_;
std::vector<std::vector<int > > imageIds_;
std::vector<std::vector<std::vector<cv::Point2f> > > stereoImagePoints_;
std::vector<int> stereoImageIds_;
std::vector<cv::Size > imageSize_;
std::vector<rtabmap::CameraModel> models_;
rtabmap::StereoCameraModel stereoModel_;
Expand Down
Loading

0 comments on commit 2f21d42

Please sign in to comment.