SourceRGB: added rectify option for all types (including usb camera)

This commit is contained in:
matlabbe
2017-04-24 14:11:38 -04:00
parent 51c353e504
commit 4e3216a75d
3 changed files with 44 additions and 131 deletions

View File

@@ -446,21 +446,20 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
connect(_ui->lineEdit_sourceDevice, SIGNAL(textChanged(const QString &)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->lineEdit_sourceLocalTransform, SIGNAL(textChanged(const QString &)), this, SLOT(makeObsoleteSourcePanel()));
//Image source
//RGB source
_ui->stackedWidget_image->setCurrentIndex(_ui->source_comboBox_image_type->currentIndex());
connect(_ui->source_comboBox_image_type, SIGNAL(currentIndexChanged(int)), _ui->stackedWidget_image, SLOT(setCurrentIndex(int)));
connect(_ui->source_comboBox_image_type, SIGNAL(currentIndexChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->checkBox_rgb_rectify, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
//images group
connect(_ui->source_images_toolButton_selectSource, SIGNAL(clicked()), this, SLOT(selectSourceImagesPath()));
connect(_ui->source_images_lineEdit_path, SIGNAL(textChanged(const QString &)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->source_images_spinBox_startPos, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->source_images_refreshDir, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->checkBox_rgbImages_rectify, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->comboBox_cameraImages_bayerMode, SIGNAL(currentIndexChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
//video group
connect(_ui->source_video_toolButton_selectSource, SIGNAL(clicked()), this, SLOT(selectSourceVideoPath()));
connect(_ui->source_video_lineEdit_path, SIGNAL(textChanged(const QString &)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->checkBox_rgbVideo_rectify, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
//database group
connect(_ui->source_database_toolButton_selectSource, SIGNAL(clicked()), this, SLOT(selectSourceDatabase()));
connect(_ui->toolButton_dbViewer, SIGNAL(clicked()), this, SLOT(openDatabaseViewer()));
@@ -1350,9 +1349,8 @@ void PreferencesDialog::resetSettings(QGroupBox * groupBox)
_ui->source_comboBox_image_type->setCurrentIndex(kSrcUsbDevice-kSrcUsbDevice);
_ui->source_images_spinBox_startPos->setValue(0);
_ui->source_images_refreshDir->setChecked(false);
_ui->checkBox_rgbImages_rectify->setChecked(false);
_ui->checkBox_rgb_rectify->setChecked(false);
_ui->comboBox_cameraImages_bayerMode->setCurrentIndex(0);
_ui->checkBox_rgbVideo_rectify->setChecked(false);
_ui->source_checkBox_ignoreOdometry->setChecked(false);
_ui->source_checkBox_ignoreGoalDelay->setChecked(true);
@@ -1747,6 +1745,7 @@ void PreferencesDialog::readCameraSettings(const QString & filePath)
settings.beginGroup("rgb");
_ui->source_comboBox_image_type->setCurrentIndex(settings.value("driver", _ui->source_comboBox_image_type->currentIndex()).toInt());
_ui->checkBox_rgb_rectify->setChecked(settings.value("rectify",_ui->checkBox_rgb_rectify->isChecked()).toBool());
settings.endGroup(); // rgb
settings.beginGroup("Openni");
@@ -1811,7 +1810,6 @@ void PreferencesDialog::readCameraSettings(const QString & filePath)
_ui->source_images_lineEdit_path->setText(settings.value("path", _ui->source_images_lineEdit_path->text()).toString());
_ui->source_images_spinBox_startPos->setValue(settings.value("startPos",_ui->source_images_spinBox_startPos->value()).toInt());
_ui->source_images_refreshDir->setChecked(settings.value("refreshDir",_ui->source_images_refreshDir->isChecked()).toBool());
_ui->checkBox_rgbImages_rectify->setChecked(settings.value("rectify",_ui->checkBox_rgbImages_rectify->isChecked()).toBool());
_ui->comboBox_cameraImages_bayerMode->setCurrentIndex(settings.value("bayerMode",_ui->comboBox_cameraImages_bayerMode->currentIndex()).toInt());
_ui->checkBox_cameraImages_timestamps->setChecked(settings.value("filenames_as_stamps",_ui->checkBox_cameraImages_timestamps->isChecked()).toBool());
@@ -1830,7 +1828,6 @@ void PreferencesDialog::readCameraSettings(const QString & filePath)
settings.beginGroup("Video");
_ui->source_video_lineEdit_path->setText(settings.value("path", _ui->source_video_lineEdit_path->text()).toString());
_ui->checkBox_rgbVideo_rectify->setChecked(settings.value("rectify",_ui->checkBox_rgbVideo_rectify->isChecked()).toBool());
settings.endGroup(); // video
settings.beginGroup("ScanFromDepth");
@@ -2133,6 +2130,7 @@ void PreferencesDialog::writeCameraSettings(const QString & filePath) const
settings.beginGroup("rgb");
settings.setValue("driver", _ui->source_comboBox_image_type->currentIndex());
settings.setValue("rectify", _ui->checkBox_rgb_rectify->isChecked());
settings.endGroup(); // rgb
settings.beginGroup("Openni");
@@ -2198,7 +2196,6 @@ void PreferencesDialog::writeCameraSettings(const QString & filePath) const
settings.setValue("path", _ui->source_images_lineEdit_path->text());
settings.setValue("startPos", _ui->source_images_spinBox_startPos->value());
settings.setValue("refreshDir", _ui->source_images_refreshDir->isChecked());
settings.setValue("rectify", _ui->checkBox_rgbImages_rectify->isChecked());
settings.setValue("bayerMode", _ui->comboBox_cameraImages_bayerMode->currentIndex());
settings.setValue("filenames_as_stamps", _ui->checkBox_cameraImages_timestamps->isChecked());
settings.setValue("sync_stamps", _ui->checkBox_cameraImages_syncTimeStamps->isChecked());
@@ -2216,7 +2213,6 @@ void PreferencesDialog::writeCameraSettings(const QString & filePath) const
settings.beginGroup("Video");
settings.setValue("path", _ui->source_video_lineEdit_path->text());
settings.setValue("rectify", _ui->checkBox_rgbVideo_rectify->isChecked());
settings.endGroup(); // video
settings.beginGroup("ScanFromDepth");
@@ -4664,7 +4660,7 @@ Camera * PreferencesDialog::createCamera(bool useRawImages, bool useColor)
{
camera = new CameraVideo(
this->getSourceDevice().isEmpty()?0:atoi(this->getSourceDevice().toStdString().c_str()),
!useRawImages,
_ui->checkBox_rgb_rectify->isChecked() && !useRawImages,
this->getGeneralInputRate(),
this->getSourceLocalTransform());
}
@@ -4672,7 +4668,7 @@ Camera * PreferencesDialog::createCamera(bool useRawImages, bool useColor)
{
camera = new CameraVideo(
_ui->source_video_lineEdit_path->text().toStdString(),
_ui->checkBox_rgbVideo_rectify->isChecked() && !useRawImages,
_ui->checkBox_rgb_rectify->isChecked() && !useRawImages,
this->getGeneralInputRate(),
this->getSourceLocalTransform());
}
@@ -4685,7 +4681,7 @@ Camera * PreferencesDialog::createCamera(bool useRawImages, bool useColor)
((CameraImages*)camera)->setStartIndex(_ui->source_images_spinBox_startPos->value());
((CameraImages*)camera)->setDirRefreshed(_ui->source_images_refreshDir->isChecked());
((CameraImages*)camera)->setImagesRectified(_ui->checkBox_rgbImages_rectify->isChecked() && !useRawImages);
((CameraImages*)camera)->setImagesRectified(_ui->checkBox_rgb_rectify->isChecked() && !useRawImages);
((CameraImages*)camera)->setBayerMode(_ui->comboBox_cameraImages_bayerMode->currentIndex()-1);
((CameraImages*)camera)->setOdometryPath(