Added Source/Mirroring parameter for convenience

This commit is contained in:
matlabbe
2015-02-28 18:09:22 -05:00
parent 395dac5777
commit cf69f17925
9 changed files with 100 additions and 43 deletions

View File

@@ -1905,6 +1905,14 @@ void MainWindow::applyPrefSettings(PreferencesDialog::PANEL_FLAGS flags)
((CameraOpenNI2*)_camera->cameraRGBD())->setGain(_preferencesDialog->getSourceOpenni2Gain());
}
}
if(_camera->camera())
{
_camera->camera()->setMirroringEnabled(_preferencesDialog->isSourceMirroring());
}
if(_camera->cameraRGBD())
{
_camera->cameraRGBD()->setMirroringEnabled(_preferencesDialog->isSourceMirroring());
}
}
if(_dbReader)
{
@@ -2633,6 +2641,7 @@ void MainWindow::startDetection()
((CameraOpenNI2*)camera)->setGain(_preferencesDialog->getSourceOpenni2Gain());
}
}
camera->setMirroringEnabled(_preferencesDialog->isSourceMirroring());
_camera = new CameraThread(camera);
if(_odomThread)
@@ -2738,6 +2747,7 @@ void MainWindow::startDetection()
camera = 0;
return;
}
camera->setMirroringEnabled(_preferencesDialog->isSourceMirroring());
_camera = new CameraThread(camera);
}

View File

@@ -122,6 +122,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
#ifdef _WIN32
_ui->radioButton_openni2->setChecked(true);
_ui->radioButton_opennipcl->setChecked(false);
showOpenNI2GroupBox(true);
#endif
if(RTABMAP_NONFREE == 0)
@@ -241,6 +242,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
//Source panel
connect(_ui->general_doubleSpinBox_imgRate, SIGNAL(valueChanged(double)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->source_mirroring, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
//Image source
connect(_ui->groupBox_sourceImage, SIGNAL(toggled(bool)), this, SLOT(makeObsoleteSourcePanel()));
_ui->stackedWidget_image->setCurrentIndex(_ui->source_comboBox_image_type->currentIndex());
@@ -888,6 +890,7 @@ void PreferencesDialog::resetSettings(QGroupBox * groupBox)
else if(groupBox->objectName() == _ui->groupBox_source0->objectName())
{
_ui->general_doubleSpinBox_imgRate->setValue(30.0);
_ui->source_mirroring->setChecked(false);
_ui->groupBox_sourceImage->setChecked(false);
_ui->source_spinBox_imgWidth->setValue(0);
@@ -1143,6 +1146,7 @@ void PreferencesDialog::readCameraSettings(const QString & filePath)
settings.beginGroup("Camera");
_ui->groupBox_sourceImage->setChecked(settings.value("imageUsed", _ui->groupBox_sourceImage->isChecked()).toBool());
_ui->general_doubleSpinBox_imgRate->setValue(settings.value("imgRate", _ui->general_doubleSpinBox_imgRate->value()).toDouble());
_ui->source_mirroring->setChecked(settings.value("mirroring", _ui->source_mirroring->isChecked()).toBool());
_ui->source_comboBox_image_type->setCurrentIndex(settings.value("type", _ui->source_comboBox_image_type->currentIndex()).toInt());
_ui->source_spinBox_imgWidth->setValue(settings.value("imgWidth",_ui->source_spinBox_imgWidth->value()).toInt());
_ui->source_spinBox_imgheight->setValue(settings.value("imgHeight",_ui->source_spinBox_imgheight->value()).toInt());
@@ -1391,6 +1395,7 @@ void PreferencesDialog::writeCameraSettings(const QString & filePath) const
settings.beginGroup("Camera");
settings.setValue("imageUsed", _ui->groupBox_sourceImage->isChecked());
settings.setValue("imgRate", _ui->general_doubleSpinBox_imgRate->value());
settings.setValue("mirroring", _ui->source_mirroring->isChecked());
settings.setValue("type", _ui->source_comboBox_image_type->currentIndex());
settings.setValue("imgWidth", _ui->source_spinBox_imgWidth->value());
settings.setValue("imgHeight", _ui->source_spinBox_imgheight->value());
@@ -3046,6 +3051,10 @@ double PreferencesDialog::getGeneralInputRate() const
{
return _ui->general_doubleSpinBox_imgRate->value();
}
bool PreferencesDialog::isSourceMirroring() const
{
return _ui->source_mirroring->isChecked();
}
bool PreferencesDialog::isSourceImageUsed() const
{
return _ui->groupBox_sourceImage->isChecked();
@@ -3406,6 +3415,7 @@ void PreferencesDialog::testOdometry(int type)
((CameraOpenNI2*)camera)->setGain(getSourceOpenni2Gain());
}
}
camera->setMirroringEnabled(isSourceMirroring());
if(camera)
@@ -3573,6 +3583,7 @@ void PreferencesDialog::testRGBDCamera()
((CameraOpenNI2*)camera)->setGain(getSourceOpenni2Gain());
}
}
camera->setMirroringEnabled(isSourceMirroring());
if(camera)
@@ -3671,6 +3682,7 @@ void PreferencesDialog::calibrate()
((CameraOpenNI2*)camera)->setGain(getSourceOpenni2Gain());
}
}
camera->setMirroringEnabled(isSourceMirroring());
if(camera)

View File

@@ -63,9 +63,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-203</y>
<width>744</width>
<height>1101</height>
<y>0</y>
<width>737</width>
<height>1320</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_16">
@@ -86,7 +86,7 @@
<enum>QFrame::Raised</enum>
</property>
<property name="currentIndex">
<number>20</number>
<number>3</number>
</property>
<widget class="QWidget" name="page_22">
<layout class="QVBoxLayout" name="verticalLayout_29">
@@ -1288,6 +1288,20 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_17">
<property name="text">
<string>Mirroring mode (flip image horizontally). It has no effect on database source.</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="source_mirroring">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
@@ -1719,34 +1733,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
<property name="title">
<string>OpenNI 2</string>
</property>
<layout class="QFormLayout" name="formLayout_6">
<item row="6" column="0">
<widget class="QSpinBox" name="openni2_gain">
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QSpinBox" name="openni2_exposure">
<property name="maximum">
<number>65535</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="openni2_autoExposure">
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<layout class="QGridLayout" name="gridLayout_54" columnstretch="0,1">
<item row="0" column="0">
<widget class="QCheckBox" name="openni2_autoWhiteBalance">
<property name="text">
@@ -1767,6 +1754,16 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="openni2_autoExposure">
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_218">
<property name="text">
@@ -1777,7 +1774,14 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property>
</widget>
</item>
<item row="3" column="1">
<item row="2" column="0">
<widget class="QSpinBox" name="openni2_exposure">
<property name="maximum">
<number>65535</number>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_219">
<property name="text">
<string>Exposure.</string>
@@ -1787,7 +1791,17 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property>
</widget>
</item>
<item row="6" column="1">
<item row="3" column="0">
<widget class="QSpinBox" name="openni2_gain">
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_220">
<property name="text">
<string>Gain.</string>
@@ -1797,7 +1811,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property>
</widget>
</item>
<item row="7" column="0">
<item row="4" column="0">
<widget class="QCheckBox" name="openni2_mirroring">
<property name="text">
<string/>
@@ -1807,7 +1821,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property>
</widget>
</item>
<item row="7" column="1">
<item row="4" column="1">
<widget class="QLabel" name="label_223">
<property name="text">
<string>Mirroring.</string>
@@ -1878,10 +1892,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout_21">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<layout class="QGridLayout" name="gridLayout_55" columnstretch="0,1">
<item row="0" column="0">
<widget class="QDoubleSpinBox" name="doubleSpinBox_openniFx">
<property name="maximum">
@@ -4720,7 +4731,7 @@ When set to false, no new words are added to dictionary, so no more updates are
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QFormLayout" name="formLayout_9">
<layout class="QGridLayout" name="gridLayout_10" columnstretch="0,1">
<item row="0" column="0">
<widget class="QComboBox" name="comboBox_vh_strategy">
<property name="sizeAdjustPolicy">