mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-04 16:57:46 +08:00
Updated Create Calibration dialog
This commit is contained in:
@@ -60,6 +60,7 @@ CreateSimpleCalibrationDialog::CreateSimpleCalibrationDialog(
|
|||||||
connect(ui_->comboBox_advanced, SIGNAL(currentIndexChanged(int)), ui_->stackedWidget, SLOT(setCurrentIndex(int)));
|
connect(ui_->comboBox_advanced, SIGNAL(currentIndexChanged(int)), ui_->stackedWidget, SLOT(setCurrentIndex(int)));
|
||||||
|
|
||||||
connect(ui_->checkBox_stereo, SIGNAL(stateChanged(int)), this, SLOT(updateStereoView()));
|
connect(ui_->checkBox_stereo, SIGNAL(stateChanged(int)), this, SLOT(updateStereoView()));
|
||||||
|
connect(ui_->comboBox_advanced, SIGNAL(currentIndexChanged(int)), this, SLOT(updateStereoView()));
|
||||||
connect(ui_->checkBox_stereo, SIGNAL(stateChanged(int)), this, SLOT(updateSaveStatus()));
|
connect(ui_->checkBox_stereo, SIGNAL(stateChanged(int)), this, SLOT(updateSaveStatus()));
|
||||||
connect(ui_->comboBox_advanced, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSaveStatus()));
|
connect(ui_->comboBox_advanced, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSaveStatus()));
|
||||||
|
|
||||||
@@ -107,7 +108,7 @@ void CreateSimpleCalibrationDialog::updateStereoView()
|
|||||||
ui_->doubleSpinBox_cx_r->setVisible(checked);
|
ui_->doubleSpinBox_cx_r->setVisible(checked);
|
||||||
ui_->doubleSpinBox_cy_r->setVisible(checked);
|
ui_->doubleSpinBox_cy_r->setVisible(checked);
|
||||||
ui_->lineEdit_D_r->setVisible(checked);
|
ui_->lineEdit_D_r->setVisible(checked);
|
||||||
ui_->groupBox_stereo_extrinsics->setVisible(checked);
|
ui_->groupBox_stereo_extrinsics->setVisible(ui_->comboBox_advanced->currentIndex() == 1 && checked);
|
||||||
ui_->label_left->setVisible(checked);
|
ui_->label_left->setVisible(checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,12 +141,13 @@ void CreateSimpleCalibrationDialog::updateSaveStatus()
|
|||||||
(!ui_->checkBox_stereo->isChecked() || !ui_->lineEdit_RT->text().isEmpty()))
|
(!ui_->checkBox_stereo->isChecked() || !ui_->lineEdit_RT->text().isEmpty()))
|
||||||
{
|
{
|
||||||
//advanced
|
//advanced
|
||||||
QStringList distorsionsStrListL = ui_->lineEdit_D_l->text().trimmed().split(' ');
|
QStringList distorsionsStrListL = ui_->lineEdit_D_l->text().remove('[').remove(']').replace(',',' ').replace(';',' ').trimmed().split(' ');
|
||||||
QStringList distorsionsStrListR = ui_->lineEdit_D_r->text().trimmed().split(' ');
|
QStringList distorsionsStrListR = ui_->lineEdit_D_r->text().remove('[').remove(']').replace(',',' ').replace(';',' ').trimmed().split(' ');
|
||||||
|
std::string RT = ui_->lineEdit_RT->text().remove('[').remove(']').replace(',',' ').replace(';',' ').trimmed().toStdString();
|
||||||
|
|
||||||
if((distorsionsStrListL.size() == 4 || distorsionsStrListL.size() == 5 || distorsionsStrListL.size() == 8) &&
|
if((distorsionsStrListL.size() == 4 || distorsionsStrListL.size() == 5 || distorsionsStrListL.size() == 8) &&
|
||||||
(!ui_->checkBox_stereo->isChecked() || distorsionsStrListL.size() == 4 || distorsionsStrListL.size() == 5 || distorsionsStrListL.size() == 8) &&
|
(!ui_->checkBox_stereo->isChecked() || (distorsionsStrListR.size() == 4 || distorsionsStrListR.size() == 5 || distorsionsStrListR.size() == 8)) &&
|
||||||
(!ui_->checkBox_stereo->isChecked() || Transform::canParseString(ui_->lineEdit_RT->text().trimmed().toStdString())))
|
(!ui_->checkBox_stereo->isChecked() || (!RT.empty() && Transform::canParseString(RT))))
|
||||||
{
|
{
|
||||||
valid = true;
|
valid = true;
|
||||||
}
|
}
|
||||||
@@ -190,7 +192,7 @@ void CreateSimpleCalibrationDialog::saveCalibration()
|
|||||||
cv::Mat P = cv::Mat::zeros(3, 4, CV_64FC1);
|
cv::Mat P = cv::Mat::zeros(3, 4, CV_64FC1);
|
||||||
K.copyTo(cv::Mat(P, cv::Range(0,3), cv::Range(0,3)));
|
K.copyTo(cv::Mat(P, cv::Range(0,3), cv::Range(0,3)));
|
||||||
|
|
||||||
QStringList distorsionCoeffs = ui_->lineEdit_D_l->text().trimmed().split(' ');
|
QStringList distorsionCoeffs = ui_->lineEdit_D_l->text().remove('[').remove(']').replace(',',' ').replace(';',' ').trimmed().split(' ');
|
||||||
UASSERT(distorsionCoeffs.size() == 4 || distorsionCoeffs.size() == 5 || distorsionCoeffs.size() == 8);
|
UASSERT(distorsionCoeffs.size() == 4 || distorsionCoeffs.size() == 5 || distorsionCoeffs.size() == 8);
|
||||||
cv::Mat D = cv::Mat::zeros(1, distorsionCoeffs.size(), CV_64FC1);
|
cv::Mat D = cv::Mat::zeros(1, distorsionCoeffs.size(), CV_64FC1);
|
||||||
bool ok;
|
bool ok;
|
||||||
@@ -199,7 +201,7 @@ void CreateSimpleCalibrationDialog::saveCalibration()
|
|||||||
D.at<double>(i) = distorsionCoeffs.at(i).toDouble(&ok);
|
D.at<double>(i) = distorsionCoeffs.at(i).toDouble(&ok);
|
||||||
if(!ok)
|
if(!ok)
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Save"), tr("Error parsing left distorsion coefficients \"%1\".").arg(ui_->lineEdit_D_l->text()));
|
QMessageBox::warning(this, tr("Save"), tr("Error parsing left distortion coefficients \"%1\".").arg(ui_->lineEdit_D_l->text()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -238,7 +240,7 @@ void CreateSimpleCalibrationDialog::saveCalibration()
|
|||||||
cv::Mat P = cv::Mat::zeros(3, 4, CV_64FC1);
|
cv::Mat P = cv::Mat::zeros(3, 4, CV_64FC1);
|
||||||
K.copyTo(cv::Mat(P, cv::Range(0,3), cv::Range(0,3)));
|
K.copyTo(cv::Mat(P, cv::Range(0,3), cv::Range(0,3)));
|
||||||
|
|
||||||
QStringList distorsionCoeffs = ui_->lineEdit_D_r->text().trimmed().split(' ');
|
QStringList distorsionCoeffs = ui_->lineEdit_D_r->text().remove('[').remove(']').replace(',',' ').replace(';',' ').trimmed().split(' ');
|
||||||
UASSERT(distorsionCoeffs.size() == 4 || distorsionCoeffs.size() == 5 || distorsionCoeffs.size() == 8);
|
UASSERT(distorsionCoeffs.size() == 4 || distorsionCoeffs.size() == 5 || distorsionCoeffs.size() == 8);
|
||||||
cv::Mat D = cv::Mat::zeros(1, distorsionCoeffs.size(), CV_64FC1);
|
cv::Mat D = cv::Mat::zeros(1, distorsionCoeffs.size(), CV_64FC1);
|
||||||
bool ok;
|
bool ok;
|
||||||
@@ -247,7 +249,7 @@ void CreateSimpleCalibrationDialog::saveCalibration()
|
|||||||
D.at<double>(i) = distorsionCoeffs.at(i).toDouble(&ok);
|
D.at<double>(i) = distorsionCoeffs.at(i).toDouble(&ok);
|
||||||
if(!ok)
|
if(!ok)
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Save"), tr("Error parsing right distorsion coefficients \"%1\".").arg(ui_->lineEdit_D_l->text()));
|
QMessageBox::warning(this, tr("Save"), tr("Error parsing right distortion coefficients \"%1\".").arg(ui_->lineEdit_D_r->text()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -255,8 +257,8 @@ void CreateSimpleCalibrationDialog::saveCalibration()
|
|||||||
modelRight = CameraModel(name.toStdString(), cv::Size(width,height), K, D, R, P);
|
modelRight = CameraModel(name.toStdString(), cv::Size(width,height), K, D, R, P);
|
||||||
UASSERT(modelRight.isValidForRectification());
|
UASSERT(modelRight.isValidForRectification());
|
||||||
|
|
||||||
UASSERT(Transform::canParseString(ui_->lineEdit_RT->text().trimmed().toStdString()));
|
UASSERT(Transform::canParseString(ui_->lineEdit_RT->text().remove('[').remove(']').replace(',',' ').replace(';',' ').trimmed().toStdString()));
|
||||||
stereoModel = StereoCameraModel(name.toStdString(), modelLeft, modelRight, Transform::fromString(ui_->lineEdit_RT->text().toStdString()));
|
stereoModel = StereoCameraModel(name.toStdString(), modelLeft, modelRight, Transform::fromString(ui_->lineEdit_RT->text().remove('[').remove(']').replace(',',' ').replace(';',' ').trimmed().toStdString()));
|
||||||
UASSERT(stereoModel.isValidForRectification());
|
UASSERT(stereoModel.isValidForRectification());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -350,14 +350,14 @@
|
|||||||
<item row="0" column="0" rowspan="2" colspan="2">
|
<item row="0" column="0" rowspan="2" colspan="2">
|
||||||
<widget class="QLineEdit" name="lineEdit_RT">
|
<widget class="QLineEdit" name="lineEdit_RT">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Format (3 values): x y z<br/>Format (6 values): x y z roll pitch yaw<br/>Format (7 values): x y z qx qy qz qw<br/>Format (9 values, 3x3 rotation): r11 r12 r13 r21 r22 r23 r31 r32 r33<br/>Format (12 values, 3x4 transform): r11 r12 r13 tx r21 r22 r23 ty r31 r32 r33 tz</p><p>KITTI: /base_link to /gray_camera = 0 0 1 -1 0 0 0 -1 0<br/>KITTI: /base_link to /color_camera = 0 0 1 0 -1 0 0 -0.06 0 -1 0 0</p></body></html></string>
|
<string><html><head/><body><p>Format (3 values): x y z<br/>Format (6 values): x y z roll pitch yaw<br/>Format (7 values): x y z qx qy qz qw<br/>Format (9 values, 3x3 rotation): r11 r12 r13 r21 r22 r23 r31 r32 r33<br/>Format (12 values, 3x4 transform): r11 r12 r13 tx r21 r22 r23 ty r31 r32 r33 tz</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Transform between the cameras</string>
|
<string>Transform between the cameras used for stereo rectification.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
|||||||
Reference in New Issue
Block a user