mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 17:40:23 +08:00
fixed fatal error (fx==0) on kinect v2 calibration, added tx,ty,tz to camera local transform in Preferences
This commit is contained in:
@@ -199,7 +199,11 @@ void CalibrationDialog::setSquareSize(double size)
|
||||
|
||||
void CalibrationDialog::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
if(!savedCalibration_ && models_[0].isValid() && (!stereo_ || stereoModel_.isValid()))
|
||||
if(!savedCalibration_ && models_[0].isValid() &&
|
||||
(!stereo_ ||
|
||||
(stereoModel_.left().isValid() &&
|
||||
stereoModel_.right().isValid()&&
|
||||
(!ui_->label_baseline->isVisible() || stereoModel_.baseline() > 0.0))))
|
||||
{
|
||||
QMessageBox::StandardButton b = QMessageBox::question(this, tr("Save calibration?"),
|
||||
tr("The camera is calibrated but you didn't "
|
||||
@@ -287,6 +291,7 @@ void CalibrationDialog::processImages(const cv::Mat & imageLeft, const cv::Mat &
|
||||
|
||||
std::vector<std::vector<cv::Point2f> > pointBuf(2);
|
||||
|
||||
bool depthDetected = false;
|
||||
for(int id=0; id<(stereo_?2:1); ++id)
|
||||
{
|
||||
cv::Mat viewGray;
|
||||
@@ -294,6 +299,7 @@ void CalibrationDialog::processImages(const cv::Mat & imageLeft, const cv::Mat &
|
||||
{
|
||||
if(images[id].type() == CV_16UC1)
|
||||
{
|
||||
depthDetected = true;
|
||||
//assume IR image: convert to gray scaled
|
||||
const float factor = 255.0f / float((maxIrs_[id] - minIrs_[id]));
|
||||
viewGray = cv::Mat(images[id].rows, images[id].cols, CV_8UC1);
|
||||
@@ -488,6 +494,8 @@ void CalibrationDialog::processImages(const cv::Mat & imageLeft, const cv::Mat &
|
||||
}
|
||||
}
|
||||
}
|
||||
ui_->label_baseline->setVisible(!depthDetected);
|
||||
ui_->label_baseline_name->setVisible(!depthDetected);
|
||||
|
||||
if(stereo_ && ((boardAccepted[0] && boardFound[1]) || (boardAccepted[1] && boardFound[0])))
|
||||
{
|
||||
@@ -516,7 +524,10 @@ void CalibrationDialog::processImages(const cv::Mat & imageLeft, const cv::Mat &
|
||||
images[1] = models_[1].rectifyImage(images[1]);
|
||||
}
|
||||
}
|
||||
else if(ui_->radioButton_stereoRectified->isChecked() && stereoModel_.isValid())
|
||||
else if(ui_->radioButton_stereoRectified->isChecked() &&
|
||||
(stereoModel_.left().isValid() &&
|
||||
stereoModel_.right().isValid()&&
|
||||
(!ui_->label_baseline->isVisible() || stereoModel_.baseline() > 0.0)))
|
||||
{
|
||||
images[0] = stereoModel_.left().rectifyImage(images[0]);
|
||||
images[1] = stereoModel_.right().rectifyImage(images[1]);
|
||||
@@ -833,7 +844,10 @@ void CalibrationDialog::calibrate()
|
||||
//ui_->label_error_stereo->setNum(totalAvgErr);
|
||||
}
|
||||
|
||||
if(stereo_ && stereoModel_.isValid())
|
||||
if(stereo_ &&
|
||||
stereoModel_.left().isValid() &&
|
||||
stereoModel_.right().isValid()&&
|
||||
(!ui_->label_baseline->isVisible() || stereoModel_.baseline() > 0.0))
|
||||
{
|
||||
ui_->radioButton_rectified->setEnabled(true);
|
||||
ui_->radioButton_stereoRectified->setEnabled(true);
|
||||
@@ -878,7 +892,9 @@ bool CalibrationDialog::save()
|
||||
}
|
||||
else
|
||||
{
|
||||
UASSERT(stereoModel_.isValid());
|
||||
UASSERT(stereoModel_.left().isValid() &&
|
||||
stereoModel_.right().isValid()&&
|
||||
(!ui_->label_baseline->isVisible() || stereoModel_.baseline() > 0.0));
|
||||
QString cameraName = stereoModel_.name().c_str();
|
||||
QString filePath = QFileDialog::getSaveFileName(this, tr("Export"), savingDirectory_ + "/" + cameraName, "*.yaml");
|
||||
QString name = QFileInfo(filePath).baseName();
|
||||
@@ -889,7 +905,7 @@ bool CalibrationDialog::save()
|
||||
std::string leftPath = base+"_left.yaml";
|
||||
std::string rightPath = base+"_right.yaml";
|
||||
std::string posePath = base+"_pose.yaml";
|
||||
if(stereoModel_.save(dir.toStdString(), name.toStdString()))
|
||||
if(stereoModel_.save(dir.toStdString(), name.toStdString(), false))
|
||||
{
|
||||
QMessageBox::information(this, tr("Export"), tr("Calibration files saved:\n \"%1\"\n \"%2\"\n \"%3\".").
|
||||
arg(leftPath.c_str()).arg(rightPath.c_str()).arg(posePath.c_str()));
|
||||
|
||||
@@ -3221,7 +3221,7 @@ Transform PreferencesDialog::getSourceLocalTransform() const
|
||||
QString str = _ui->lineEdit_sourceLocalTransform->text();
|
||||
str.replace("PI_2", QString::number(3.141592/2.0));
|
||||
QStringList list = str.split(' ');
|
||||
if(list.size() == 6 || list.size() == 9)
|
||||
if(list.size() == 6 || list.size() == 9 || list.size() == 12)
|
||||
{
|
||||
std::vector<float> numbers(list.size());
|
||||
bool ok = false;
|
||||
@@ -3237,16 +3237,22 @@ Transform PreferencesDialog::getSourceLocalTransform() const
|
||||
}
|
||||
if(ok)
|
||||
{
|
||||
if(list.size() == 6)
|
||||
if(numbers.size() == 6)
|
||||
{
|
||||
t = Transform(numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], numbers[5]);
|
||||
}
|
||||
else // 9
|
||||
else if(numbers.size() == 9)
|
||||
{
|
||||
t = Transform(numbers[0], numbers[1], numbers[2], 0,
|
||||
numbers[3], numbers[4], numbers[5], 0,
|
||||
numbers[6], numbers[7], numbers[8], 0);
|
||||
}
|
||||
else if(numbers.size() == 12)
|
||||
{
|
||||
t = Transform(numbers[0], numbers[1], numbers[2], numbers[9],
|
||||
numbers[3], numbers[4], numbers[5], numbers[10],
|
||||
numbers[6], numbers[7], numbers[8], numbers[11]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -64,8 +64,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>759</width>
|
||||
<height>887</height>
|
||||
<width>760</width>
|
||||
<height>1570</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_16">
|
||||
@@ -86,7 +86,7 @@
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_22">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_29">
|
||||
@@ -1436,7 +1436,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="label_42">
|
||||
<property name="text">
|
||||
<string>Local transform from /base_link to /camera_link. Format (6 values): x y z roll pitch yaw. Format (9 values): r11 r12 r13 r21 r22 r23 r31 r32 r33.</string>
|
||||
<string>Local transform from /base_link to /camera_link. Format (6 values): x y z roll pitch yaw. Format (9 [+3] values): r11 r12 r13 r21 r22 r23 r31 r32 r33 [tx ty tz].</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
|
||||
Reference in New Issue
Block a user