CameraOpenNI2: Added OpenNI2 stamps/Ids option

This commit is contained in:
matlabbe
2015-10-15 16:40:49 -04:00
parent a8b5311d88
commit 835155e6ae
4 changed files with 44 additions and 9 deletions
@@ -160,6 +160,7 @@ public:
bool setExposure(int value); bool setExposure(int value);
bool setGain(int value); bool setGain(int value);
bool setMirroring(bool enabled); bool setMirroring(bool enabled);
void setOpenNI2StampsAndIDsUsed(bool used) {_openNI2StampsAndIDsUsed = used;}
protected: protected:
virtual SensorData captureImage(); virtual SensorData captureImage();
@@ -171,6 +172,7 @@ private:
float _depthFx; float _depthFx;
float _depthFy; float _depthFy;
std::string _deviceId; std::string _deviceId;
bool _openNI2StampsAndIDsUsed;
}; };
+10 -2
View File
@@ -390,7 +390,8 @@ CameraOpenNI2::CameraOpenNI2(
#endif #endif
_depthFx(0.0f), _depthFx(0.0f),
_depthFy(0.0f), _depthFy(0.0f),
_deviceId(deviceId) _deviceId(deviceId),
_openNI2StampsAndIDsUsed(false)
{ {
} }
@@ -715,7 +716,14 @@ SensorData CameraOpenNI2::captureImage()
float(rgb.cols/2) - 0.5f, //cx float(rgb.cols/2) - 0.5f, //cx
float(rgb.rows/2) - 0.5f, //cy float(rgb.rows/2) - 0.5f, //cy
this->getLocalTransform()); this->getLocalTransform());
data = SensorData(rgb, depth, model, this->getNextSeqID(), UTimer::now()); if(_openNI2StampsAndIDsUsed)
{
data = SensorData(rgb, depth, model, depthFrame.getFrameIndex(), double(depthFrame.getTimestamp()) / 1000000.0);
}
else
{
data = SensorData(rgb, depth, model, this->getNextSeqID(), UTimer::now());
}
} }
} }
} }
+5
View File
@@ -377,6 +377,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
connect(_ui->openni2_exposure, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel())); connect(_ui->openni2_exposure, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->openni2_gain, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel())); connect(_ui->openni2_gain, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->openni2_mirroring, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel())); connect(_ui->openni2_mirroring, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->openni2_stampsIdsUsed, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->comboBox_freenect2Format, SIGNAL(currentIndexChanged(int)), this, SLOT(makeObsoleteSourcePanel())); connect(_ui->comboBox_freenect2Format, SIGNAL(currentIndexChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->toolButton_cameraRGBDImages_timestamps, SIGNAL(clicked()), this, SLOT(selectSourceRGBDImagesStamps())); connect(_ui->toolButton_cameraRGBDImages_timestamps, SIGNAL(clicked()), this, SLOT(selectSourceRGBDImagesStamps()));
@@ -1134,6 +1135,7 @@ void PreferencesDialog::resetSettings(QGroupBox * groupBox)
_ui->openni2_exposure->setValue(0); _ui->openni2_exposure->setValue(0);
_ui->openni2_gain->setValue(100); _ui->openni2_gain->setValue(100);
_ui->openni2_mirroring->setChecked(false); _ui->openni2_mirroring->setChecked(false);
_ui->openni2_stampsIdsUsed->setChecked(false);
_ui->comboBox_freenect2Format->setCurrentIndex(0); _ui->comboBox_freenect2Format->setCurrentIndex(0);
_ui->lineEdit_openniOniPath->clear(); _ui->lineEdit_openniOniPath->clear();
_ui->lineEdit_openni2OniPath->clear(); _ui->lineEdit_openni2OniPath->clear();
@@ -1408,6 +1410,7 @@ void PreferencesDialog::readCameraSettings(const QString & filePath)
_ui->openni2_exposure->setValue(settings.value("exposure", _ui->openni2_exposure->value()).toInt()); _ui->openni2_exposure->setValue(settings.value("exposure", _ui->openni2_exposure->value()).toInt());
_ui->openni2_gain->setValue(settings.value("gain", _ui->openni2_gain->value()).toInt()); _ui->openni2_gain->setValue(settings.value("gain", _ui->openni2_gain->value()).toInt());
_ui->openni2_mirroring->setChecked(settings.value("mirroring", _ui->openni2_mirroring->isChecked()).toBool()); _ui->openni2_mirroring->setChecked(settings.value("mirroring", _ui->openni2_mirroring->isChecked()).toBool());
_ui->openni2_stampsIdsUsed->setChecked(settings.value("stampsIdsUsed", _ui->openni2_stampsIdsUsed->isChecked()).toBool());
_ui->lineEdit_openni2OniPath->setText(settings.value("oniPath", _ui->lineEdit_openni2OniPath->text()).toString()); _ui->lineEdit_openni2OniPath->setText(settings.value("oniPath", _ui->lineEdit_openni2OniPath->text()).toString());
settings.endGroup(); // Openni2 settings.endGroup(); // Openni2
@@ -1721,6 +1724,7 @@ void PreferencesDialog::writeCameraSettings(const QString & filePath) const
settings.setValue("exposure", _ui->openni2_exposure->value()); settings.setValue("exposure", _ui->openni2_exposure->value());
settings.setValue("gain", _ui->openni2_gain->value()); settings.setValue("gain", _ui->openni2_gain->value());
settings.setValue("mirroring", _ui->openni2_mirroring->isChecked()); settings.setValue("mirroring", _ui->openni2_mirroring->isChecked());
settings.setValue("stampsIdsUsed", _ui->openni2_stampsIdsUsed->isChecked());
settings.setValue("oniPath", _ui->lineEdit_openni2OniPath->text()); settings.setValue("oniPath", _ui->lineEdit_openni2OniPath->text());
settings.endGroup(); // Openni2 settings.endGroup(); // Openni2
@@ -3733,6 +3737,7 @@ Camera * PreferencesDialog::createCamera(bool useRawImages)
((CameraOpenNI2*)camera)->setAutoWhiteBalance(_ui->openni2_autoWhiteBalance->isChecked()); ((CameraOpenNI2*)camera)->setAutoWhiteBalance(_ui->openni2_autoWhiteBalance->isChecked());
((CameraOpenNI2*)camera)->setAutoExposure(_ui->openni2_autoExposure->isChecked()); ((CameraOpenNI2*)camera)->setAutoExposure(_ui->openni2_autoExposure->isChecked());
((CameraOpenNI2*)camera)->setMirroring(_ui->openni2_mirroring->isChecked()); ((CameraOpenNI2*)camera)->setMirroring(_ui->openni2_mirroring->isChecked());
((CameraOpenNI2*)camera)->setOpenNI2StampsAndIDsUsed(_ui->openni2_stampsIdsUsed->isChecked());
if(CameraOpenNI2::exposureGainAvailable()) if(CameraOpenNI2::exposureGainAvailable())
{ {
((CameraOpenNI2*)camera)->setExposure(_ui->openni2_exposure->value()); ((CameraOpenNI2*)camera)->setExposure(_ui->openni2_exposure->value());
+27 -7
View File
@@ -63,7 +63,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>-1003</y> <y>-315</y>
<width>760</width> <width>760</width>
<height>1705</height> <height>1705</height>
</rect> </rect>
@@ -86,7 +86,7 @@
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>19</number> <number>3</number>
</property> </property>
<widget class="QWidget" name="page_22"> <widget class="QWidget" name="page_22">
<layout class="QVBoxLayout" name="verticalLayout_29"> <layout class="QVBoxLayout" name="verticalLayout_29">
@@ -1769,7 +1769,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
<item> <item>
<widget class="QStackedWidget" name="stackedWidget_src"> <widget class="QStackedWidget" name="stackedWidget_src">
<property name="currentIndex"> <property name="currentIndex">
<number>3</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="page_41"> <widget class="QWidget" name="page_41">
<layout class="QVBoxLayout" name="verticalLayout_64"> <layout class="QVBoxLayout" name="verticalLayout_64">
@@ -1874,7 +1874,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
<item> <item>
<widget class="QStackedWidget" name="stackedWidget_rgbd"> <widget class="QStackedWidget" name="stackedWidget_rgbd">
<property name="currentIndex"> <property name="currentIndex">
<number>6</number> <number>4</number>
</property> </property>
<widget class="QWidget" name="page_32"> <widget class="QWidget" name="page_32">
<layout class="QVBoxLayout" name="verticalLayout_63"> <layout class="QVBoxLayout" name="verticalLayout_63">
@@ -2009,7 +2009,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="0"> <item row="7" column="0">
<spacer name="verticalSpacer_33"> <spacer name="verticalSpacer_33">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@@ -2042,7 +2042,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="6" column="0">
<widget class="QCheckBox" name="openni2_mirroring"> <widget class="QCheckBox" name="openni2_mirroring">
<property name="text"> <property name="text">
<string/> <string/>
@@ -2052,7 +2052,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="6" column="1">
<widget class="QLabel" name="label_223"> <widget class="QLabel" name="label_223">
<property name="text"> <property name="text">
<string>Mirroring.</string> <string>Mirroring.</string>
@@ -2086,6 +2086,26 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1">
<widget class="QLabel" name="label_264">
<property name="text">
<string>Use timestamps and frame IDs from OpenNI2.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="openni2_stampsIdsUsed">
<property name="text">
<string/>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>