DBReader: added camera selection

This commit is contained in:
matlabbe
2016-06-20 10:50:01 -04:00
parent 62db5370aa
commit cdddb1209e
6 changed files with 91 additions and 15 deletions
+2 -1
View File
@@ -3886,7 +3886,8 @@ void MainWindow::startDetection()
_preferencesDialog->getSourceDatabaseStampsUsed()?-1:_preferencesDialog->getGeneralInputRate(),
_preferencesDialog->getSourceDatabaseOdometryIgnored(),
_preferencesDialog->getSourceDatabaseGoalDelayIgnored(),
_preferencesDialog->getSourceDatabaseGoalsIgnored());
_preferencesDialog->getSourceDatabaseGoalsIgnored(),
_preferencesDialog->getSourceDatabaseCameraIndex());
//Create odometry thread if rgdb slam
if(uStr2Bool(parameters.at(Parameters::kRGBDEnabled()).c_str()) &&
+16 -3
View File
@@ -427,6 +427,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
connect(_ui->source_checkBox_ignoreGoals, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->source_spinBox_databaseStartPos, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->source_checkBox_useDbStamps, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->source_spinBox_database_cameraIndex, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
//openni group
_ui->stackedWidget_rgbd->setCurrentIndex(_ui->comboBox_cameraRGBD->currentIndex());
@@ -1248,6 +1249,7 @@ void PreferencesDialog::resetSettings(QGroupBox * groupBox)
_ui->source_checkBox_ignoreGoalDelay->setChecked(true);
_ui->source_checkBox_ignoreGoals->setChecked(true);
_ui->source_spinBox_databaseStartPos->setValue(0);
_ui->source_spinBox_database_cameraIndex->setValue(-1);
_ui->source_checkBox_useDbStamps->setChecked(true);
#ifdef _WIN32
@@ -1702,6 +1704,7 @@ void PreferencesDialog::readCameraSettings(const QString & filePath)
_ui->source_checkBox_ignoreGoalDelay->setChecked(settings.value("ignoreGoalDelay", _ui->source_checkBox_ignoreGoalDelay->isChecked()).toBool());
_ui->source_checkBox_ignoreGoals->setChecked(settings.value("ignoreGoals", _ui->source_checkBox_ignoreGoals->isChecked()).toBool());
_ui->source_spinBox_databaseStartPos->setValue(settings.value("startPos", _ui->source_spinBox_databaseStartPos->value()).toInt());
_ui->source_spinBox_database_cameraIndex->setValue(settings.value("cameraIndex", _ui->source_spinBox_database_cameraIndex->value()).toInt());
_ui->source_checkBox_useDbStamps->setChecked(settings.value("useDatabaseStamps", _ui->source_checkBox_useDbStamps->isChecked()).toBool());
settings.endGroup(); // Database
@@ -2109,6 +2112,7 @@ void PreferencesDialog::writeCameraSettings(const QString & filePath) const
settings.setValue("ignoreGoalDelay", _ui->source_checkBox_ignoreGoalDelay->isChecked());
settings.setValue("ignoreGoals", _ui->source_checkBox_ignoreGoals->isChecked());
settings.setValue("startPos", _ui->source_spinBox_databaseStartPos->value());
settings.setValue("cameraIndex", _ui->source_spinBox_database_cameraIndex->value());
settings.setValue("useDatabaseStamps", _ui->source_checkBox_useDbStamps->isChecked());
settings.endGroup(); // Database
@@ -2680,6 +2684,7 @@ void PreferencesDialog::selectSourceDatabase()
_ui->source_checkBox_ignoreOdometry->setChecked(r != QMessageBox::Yes);
_ui->source_database_lineEdit_path->setText(paths.size()==1?paths.front():paths.join(";"));
_ui->source_spinBox_databaseStartPos->setValue(0);
_ui->source_spinBox_database_cameraIndex->setValue(-1);
_ui->source_checkBox_useDbStamps->setChecked(true);
}
}
@@ -3906,6 +3911,10 @@ int PreferencesDialog::getSourceDatabaseStartPos() const
{
return _ui->source_spinBox_databaseStartPos->value();
}
int PreferencesDialog::getSourceDatabaseCameraIndex() const
{
return _ui->source_spinBox_database_cameraIndex->value();
}
bool PreferencesDialog::getSourceDatabaseStampsUsed() const
{
return _ui->source_checkBox_useDbStamps->isChecked();
@@ -4370,7 +4379,9 @@ void PreferencesDialog::testOdometry()
DBReader dbReader(_ui->source_database_lineEdit_path->text().toStdString(),
_ui->source_checkBox_useDbStamps->isChecked()?-1:this->getGeneralInputRate(),
true,
true);
true,
true,
_ui->source_spinBox_database_cameraIndex->value());
Camera * camera = 0;
if(this->getSourceType() == kSrcDatabase)
{
@@ -4464,8 +4475,10 @@ void PreferencesDialog::testCamera()
DBReader dbReader(_ui->source_database_lineEdit_path->text().toStdString(),
_ui->source_checkBox_useDbStamps->isChecked()?-1:this->getGeneralInputRate(),
true,
true);
if(!dbReader.init())
true,
true,
_ui->source_spinBox_database_cameraIndex->value());
if(!dbReader.init(_ui->source_images_spinBox_startPos->value()))
{
QMessageBox::warning(this, tr("Camera viewer"), tr("Failed to initialize the database reader!"));
delete window;
+30 -7
View File
@@ -63,9 +63,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>681</width>
<height>2044</height>
<y>-360</y>
<width>686</width>
<height>2023</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_16">
@@ -86,7 +86,7 @@
<enum>QFrame::Raised</enum>
</property>
<property name="currentIndex">
<number>14</number>
<number>3</number>
</property>
<widget class="QWidget" name="page_22">
<layout class="QVBoxLayout" name="verticalLayout_29" stretch="0,1">
@@ -2307,7 +2307,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
<item>
<widget class="QStackedWidget" name="stackedWidget_src">
<property name="currentIndex">
<number>1</number>
<number>3</number>
</property>
<widget class="QWidget" name="page_41">
<layout class="QVBoxLayout" name="verticalLayout_64">
@@ -3813,7 +3813,7 @@ 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="7" column="1">
<spacer name="verticalSpacer_35">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -3859,7 +3859,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
<number>0</number>
</property>
<property name="maximum">
<number>999999999</number>
<number>99999</number>
</property>
</widget>
</item>
@@ -3916,6 +3916,29 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QSpinBox" name="source_spinBox_database_cameraIndex">
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>9999</number>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="label_315">
<property name="text">
<string>Camera index. If the database contains multi-camera data, you can choose which camera to use. -1 means that all cameras are streamed.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>