Added StereoVideo source input (side-by-side video)

This commit is contained in:
matlabbe
2015-07-16 14:44:25 -04:00
parent 6872b16550
commit 8754da7420
8 changed files with 485 additions and 58 deletions

View File

@@ -93,6 +93,7 @@ public:
kSrcDC1394 = 100,
kSrcFlyCapture2 = 101,
kSrcStereoImages = 102,
kSrcStereoVideo = 103,
kSrcRGB = 200,
kSrcUsbDevice = 200,
@@ -184,7 +185,9 @@ public:
int getSourceImagesSuffixIndex() const; //Images group
int getSourceImagesStartPos() const; //Images group
bool getSourceImagesRefreshDir() const; //Images group
bool getSourceImagesRectify() const; //Images group
QString getSourceVideoPath() const; //Video group
bool getSourceVideoRectify() const; //Video group
QString getSourceDatabasePath() const; //Database group
bool getSourceDatabaseOdometryIgnored() const; //Database group
bool getSourceDatabaseGoalDelayIgnored() const; //Database group
@@ -196,6 +199,8 @@ public:
int getSourceOpenni2Gain() const; //Openni group
bool getSourceOpenni2Mirroring() const; //Openni group
int getSourceFreenect2Format() const; //Openni group
bool getSourceStereoImagesRectify() const;
bool getSourceStereoVideoRectify() const;
bool isSourceRGBDColorOnly() const;
Transform getSourceLocalTransform() const; //Openni group
Camera * createCamera(bool useRawImages = false); // return camera should be deleted if not null
@@ -261,6 +266,7 @@ private slots:
void selectSourceStereoImagesPath();
void selectSourceImagesPath();
void selectSourceVideoPath();
void selectSourceStereoVideoPath();
void selectSourceOniPath();
void selectSourceOni2Path();
void updateSourceGrpVisibility();

View File

@@ -333,9 +333,11 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
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()));
//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()));
@@ -363,6 +365,10 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
connect(_ui->lineEdit_cameraStereoImages_timestamps, SIGNAL(textChanged(const QString &)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->toolButton_cameraStereoImages_path, SIGNAL(clicked()), this, SLOT(selectSourceStereoImagesPath()));
connect(_ui->lineEdit_cameraStereoImages_path, SIGNAL(textChanged(const QString &)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->checkBox_stereoImages_rectify, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->toolButton_cameraStereoVideo_path, SIGNAL(clicked()), this, SLOT(selectSourceStereoVideoPath()));
connect(_ui->lineEdit_cameraStereoVideo_path, SIGNAL(textChanged(const QString &)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->checkBox_stereoVideo_rectify, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->checkbox_rgbd_colorOnly, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->pushButton_calibrate, SIGNAL(clicked()), this, SLOT(calibrate()));
connect(_ui->toolButton_openniOniPath, SIGNAL(clicked()), this, SLOT(selectSourceOniPath()));
@@ -1036,6 +1042,8 @@ void PreferencesDialog::resetSettings(QGroupBox * groupBox)
_ui->source_comboBox_image_type->setCurrentIndex(kSrcUsbDevice-kSrcUsbDevice);
_ui->source_images_spinBox_startPos->setValue(1);
_ui->source_images_refreshDir->setChecked(false);
_ui->checkBox_rgbImages_rectify->setChecked(false);
_ui->checkBox_rgbVideo_rectify->setChecked(false);
_ui->source_checkBox_ignoreOdometry->setChecked(false);
_ui->source_checkBox_ignoreGoalDelay->setChecked(false);
@@ -1084,6 +1092,9 @@ void PreferencesDialog::resetSettings(QGroupBox * groupBox)
_ui->source_comboBox_image_type->setCurrentIndex(kSrcDC1394-kSrcDC1394);
_ui->lineEdit_cameraStereoImages_timestamps->setText("");
_ui->lineEdit_cameraStereoImages_path->setText("");
_ui->checkBox_stereoImages_rectify->setChecked(false);
_ui->lineEdit_cameraStereoVideo_path->setText("");
_ui->checkBox_stereoVideo_rectify->setChecked(false);
}
else if(groupBox->objectName() == _ui->groupBox_rtabmap_basic0->objectName())
{
@@ -1348,16 +1359,24 @@ void PreferencesDialog::readCameraSettings(const QString & filePath)
settings.beginGroup("StereoImages");
_ui->lineEdit_cameraStereoImages_timestamps->setText(settings.value("stamps", _ui->lineEdit_cameraStereoImages_timestamps->text()).toString());
_ui->lineEdit_cameraStereoImages_path->setText(settings.value("path", _ui->lineEdit_cameraStereoImages_path->text()).toString());
_ui->checkBox_stereoImages_rectify->setChecked(settings.value("rectify",_ui->checkBox_stereoImages_rectify->isChecked()).toBool());
settings.endGroup(); // StereoImages
settings.beginGroup("StereoVideo");
_ui->lineEdit_cameraStereoVideo_path->setText(settings.value("path", _ui->lineEdit_cameraStereoVideo_path->text()).toString());
_ui->checkBox_stereoVideo_rectify->setChecked(settings.value("rectify",_ui->checkBox_stereoVideo_rectify->isChecked()).toBool());
settings.endGroup(); // StereoVideo
settings.beginGroup("Images");
_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());
settings.endGroup(); // images
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("Database");
@@ -1639,16 +1658,24 @@ void PreferencesDialog::writeCameraSettings(const QString & filePath) const
settings.beginGroup("StereoImages");
settings.setValue("stamps", _ui->lineEdit_cameraStereoImages_timestamps->text());
settings.setValue("path", _ui->lineEdit_cameraStereoImages_path->text());
settings.setValue("rectify", _ui->checkBox_stereoImages_rectify->isChecked());
settings.endGroup(); // StereoImages
settings.beginGroup("StereoVideo");
settings.setValue("path", _ui->lineEdit_cameraStereoVideo_path->text());
settings.setValue("rectify", _ui->checkBox_stereoVideo_rectify->isChecked());
settings.endGroup(); // StereoVideo
settings.beginGroup("Images");
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.endGroup(); // images
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("Database");
@@ -2224,6 +2251,20 @@ void PreferencesDialog::selectSourceVideoPath()
}
}
void PreferencesDialog::selectSourceStereoVideoPath()
{
QString dir = _ui->lineEdit_cameraStereoVideo_path->text();
if(dir.isEmpty())
{
dir = getWorkingDirectory();
}
QString path = QFileDialog::getOpenFileName(this, tr("Select file"), _ui->lineEdit_cameraStereoVideo_path->text(), tr("Videos (*.avi *.mpg *.mp4)"));
if(!path.isEmpty())
{
_ui->lineEdit_cameraStereoVideo_path->setText(path);
}
}
void PreferencesDialog::selectSourceOniPath()
{
QString dir = _ui->lineEdit_openniOniPath->text();
@@ -3274,10 +3315,18 @@ bool PreferencesDialog::getSourceImagesRefreshDir() const
{
return _ui->source_images_refreshDir->isChecked();
}
bool PreferencesDialog::getSourceImagesRectify() const
{
return _ui->checkBox_rgbImages_rectify->isChecked();
}
QString PreferencesDialog::getSourceVideoPath() const
{
return _ui->source_video_lineEdit_path->text();
}
bool PreferencesDialog::getSourceVideoRectify() const
{
return _ui->checkBox_rgbVideo_rectify->isChecked();
}
QString PreferencesDialog::getSourceDatabasePath() const
{
return _ui->source_database_lineEdit_path->text();
@@ -3323,6 +3372,14 @@ int PreferencesDialog::getSourceFreenect2Format() const
{
return _ui->comboBox_freenect2Format->currentIndex();
}
bool PreferencesDialog::getSourceStereoImagesRectify() const
{
return _ui->checkBox_stereoImages_rectify->isChecked();
}
bool PreferencesDialog::getSourceStereoVideoRectify() const
{
return _ui->checkBox_stereoVideo_rectify->isChecked();
}
bool PreferencesDialog::isSourceRGBDColorOnly() const
{
@@ -3438,6 +3495,15 @@ Camera * PreferencesDialog::createCamera(bool useRawImages)
camera = new CameraStereoImages(
_ui->lineEdit_cameraStereoImages_path->text().append(QDir::separator()).toStdString(),
_ui->lineEdit_cameraStereoImages_timestamps->text().toStdString(),
_ui->checkBox_stereoImages_rectify->isChecked(),
this->getGeneralInputRate(),
this->getSourceLocalTransform());
}
else if(driver == kSrcStereoVideo)
{
camera = new CameraStereoVideo(
_ui->lineEdit_cameraStereoVideo_path->text().toStdString(),
_ui->checkBox_stereoVideo_rectify->isChecked(),
this->getGeneralInputRate(),
this->getSourceLocalTransform());
}
@@ -3452,6 +3518,7 @@ Camera * PreferencesDialog::createCamera(bool useRawImages)
{
camera = new CameraVideo(
this->getSourceVideoPath().toStdString(),
this->getSourceVideoRectify(),
this->getGeneralInputRate(),
this->getSourceLocalTransform());
}
@@ -3461,6 +3528,7 @@ Camera * PreferencesDialog::createCamera(bool useRawImages)
this->getSourceImagesPath().toStdString(),
this->getSourceImagesStartPos(),
this->getSourceImagesRefreshDir(),
this->getSourceVideoRectify(),
this->getGeneralInputRate(),
this->getSourceLocalTransform());
}

View File

@@ -63,9 +63,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>760</width>
<height>1570</height>
<y>-290</y>
<width>755</width>
<height>1591</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_16">
@@ -1538,7 +1538,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>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="page_41">
<layout class="QVBoxLayout" name="verticalLayout_64">
@@ -1948,7 +1948,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_58" columnstretch="0,0,0">
<layout class="QGridLayout" name="gridLayout_58" columnstretch="0,0,1">
<item row="0" column="1">
<widget class="QComboBox" name="comboBox_cameraStereo">
<property name="sizeAdjustPolicy">
@@ -1969,6 +1969,11 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
<string>Images</string>
</property>
</item>
<item>
<property name="text">
<string>Video (Side-by-Side)</string>
</property>
</item>
</widget>
</item>
<item row="0" column="2">
@@ -1986,9 +1991,9 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
<item>
<widget class="QStackedWidget" name="stackedWidget_stereo">
<property name="currentIndex">
<number>2</number>
<number>3</number>
</property>
<widget class="QWidget" name="page_47"/>
<widget class="QWidget" name="page_49"/>
<widget class="QWidget" name="page_48"/>
<widget class="QWidget" name="page_53">
<layout class="QVBoxLayout" name="verticalLayout_70">
@@ -2001,7 +2006,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</sizepolicy>
</property>
<property name="title">
<string>CameraStereoImages</string>
<string>Stereo Images</string>
</property>
<layout class="QGridLayout" name="gridLayout_61" columnstretch="0,0,1">
<item row="1" column="1">
@@ -2018,6 +2023,33 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_cameraStereoImages_path">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QToolButton" name="toolButton_cameraStereoImages_path">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer_38">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_248">
<property name="text">
@@ -2028,13 +2060,6 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_cameraStereoImages_path">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_249">
<property name="text">
@@ -2045,15 +2070,44 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QToolButton" name="toolButton_cameraStereoImages_path">
<item row="2" column="2">
<widget class="QLabel" name="label_250">
<property name="text">
<string>...</string>
<string>Rectify images. If checked, the images will be rectified using the calibration file (if its name is set above). If not checked, we assume that images are already rectified.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="checkBox_stereoImages_rectify">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_50">
<layout class="QVBoxLayout" name="verticalLayout_78">
<item>
<widget class="QGroupBox" name="groupBox_cameraStereoImages_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Stereo side-by-side video (*.avi)</string>
</property>
<layout class="QGridLayout" name="gridLayout_66" columnstretch="0,0">
<item row="2" column="0">
<spacer name="verticalSpacer_38">
<spacer name="verticalSpacer_39">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@@ -2065,6 +2119,37 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QToolButton" name="toolButton_cameraStereoVideo_path">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_cameraStereoVideo_path">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox_stereoVideo_rectify">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_234">
<property name="text">
<string>Rectify images. If checked, the images will be rectified using the calibration file (if its name is set above). If not checked, we assume that images are already rectified.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -2157,6 +2242,33 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
<string>Images dataset</string>
</property>
<layout class="QGridLayout" name="gridLayout_7" columnstretch="0,1">
<item row="0" column="1">
<widget class="QLineEdit" name="source_images_lineEdit_path">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_34">
<property name="text">
<string>Refresh the directory files list after each image loaded.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_21">
<property name="text">
<string>Start position (default 1, 0=start from the last).</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="source_images_refreshDir">
<property name="text">
@@ -2174,13 +2286,6 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="source_images_lineEdit_path">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QToolButton" name="source_images_toolButton_selectSource">
<property name="text">
@@ -2188,17 +2293,20 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_34">
<item row="3" column="1">
<widget class="QLabel" name="label_242">
<property name="text">
<string>Refresh the directory files list after each image loaded.</string>
<string>Rectify images. If checked, the images will be rectified using the calibration file (if its name is set above). If not checked, we assume that images are already rectified.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_21">
<item row="3" column="0">
<widget class="QCheckBox" name="checkBox_rgbImages_rectify">
<property name="text">
<string>Start position (default 1, 0=start from the last).</string>
<string/>
</property>
</widget>
</item>
@@ -2242,6 +2350,23 @@ 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_241">
<property name="text">
<string>Rectify images. If checked, the images will be rectified using the calibration file (if its name is set above). If not checked, we assume that images are already rectified.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox_rgbVideo_rectify">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>