ZED: Fixed compilation error with ZED SDK3 (#499). Added textureness confidence thr parameter (default 90, working only with ZED SDK3)

This commit is contained in:
matlabbe
2020-02-03 17:59:07 -05:00
parent 8810c9e694
commit e2e2227895
4 changed files with 53 additions and 19 deletions

View File

@@ -59,7 +59,8 @@ public:
float imageRate=0.0f, float imageRate=0.0f,
const Transform & localTransform = Transform::getIdentity(), const Transform & localTransform = Transform::getIdentity(),
bool selfCalibration = true, bool selfCalibration = true,
bool odomForce3DoF = false); bool odomForce3DoF = false,
int texturenessConfidenceThr = 90); // introduced with ZED SDK 3
CameraStereoZed( CameraStereoZed(
const std::string & svoFilePath, const std::string & svoFilePath,
int quality = 1, // 0=NONE, 1=PERFORMANCE, 2=QUALITY int quality = 1, // 0=NONE, 1=PERFORMANCE, 2=QUALITY
@@ -69,7 +70,8 @@ public:
float imageRate=0.0f, float imageRate=0.0f,
const Transform & localTransform = Transform::getIdentity(), const Transform & localTransform = Transform::getIdentity(),
bool selfCalibration = true, bool selfCalibration = true,
bool odomForce3DoF = false); bool odomForce3DoF = false,
int texturenessConfidenceThr = 90); // introduced with ZED SDK 3
virtual ~CameraStereoZed(); virtual ~CameraStereoZed();
virtual bool init(const std::string & calibrationFolder = ".", const std::string & cameraName = ""); virtual bool init(const std::string & calibrationFolder = ".", const std::string & cameraName = "");
@@ -95,6 +97,7 @@ private:
bool selfCalibration_; bool selfCalibration_;
int sensingMode_; int sensingMode_;
int confidenceThr_; int confidenceThr_;
int texturenessConfidenceThr_; // introduced with ZED SDK 3
bool computeOdometry_; bool computeOdometry_;
bool lost_; bool lost_;
bool force3DoF_; bool force3DoF_;

View File

@@ -250,7 +250,8 @@ CameraStereoZed::CameraStereoZed(
float imageRate, float imageRate,
const Transform & localTransform, const Transform & localTransform,
bool selfCalibration, bool selfCalibration,
bool odomForce3DoF) : bool odomForce3DoF,
int texturenessConfidenceThr) :
Camera(imageRate, localTransform) Camera(imageRate, localTransform)
#ifdef RTABMAP_ZED #ifdef RTABMAP_ZED
, ,
@@ -263,6 +264,7 @@ CameraStereoZed::CameraStereoZed(
selfCalibration_(selfCalibration), selfCalibration_(selfCalibration),
sensingMode_(sensingMode), sensingMode_(sensingMode),
confidenceThr_(confidenceThr), confidenceThr_(confidenceThr),
texturenessConfidenceThr_(texturenessConfidenceThr),
computeOdometry_(computeOdometry), computeOdometry_(computeOdometry),
lost_(true), lost_(true),
force3DoF_(odomForce3DoF), force3DoF_(odomForce3DoF),
@@ -286,6 +288,7 @@ CameraStereoZed::CameraStereoZed(
UASSERT(qual >= sl::DEPTH_MODE::NONE && qual < sl::DEPTH_MODE::LAST); UASSERT(qual >= sl::DEPTH_MODE::NONE && qual < sl::DEPTH_MODE::LAST);
UASSERT(sens >= sl::SENSING_MODE::STANDARD && sens < sl::SENSING_MODE::LAST); UASSERT(sens >= sl::SENSING_MODE::STANDARD && sens < sl::SENSING_MODE::LAST);
UASSERT(confidenceThr_ >= 0 && confidenceThr_ <=100); UASSERT(confidenceThr_ >= 0 && confidenceThr_ <=100);
UASSERT(texturenessConfidenceThr_ >= 0 && texturenessConfidenceThr_ <=100);
#endif #endif
#endif #endif
} }
@@ -299,7 +302,8 @@ CameraStereoZed::CameraStereoZed(
float imageRate, float imageRate,
const Transform & localTransform, const Transform & localTransform,
bool selfCalibration, bool selfCalibration,
bool odomForce3DoF) : bool odomForce3DoF,
int texturenessConfidenceThr) :
Camera(imageRate, localTransform) Camera(imageRate, localTransform)
#ifdef RTABMAP_ZED #ifdef RTABMAP_ZED
, ,
@@ -312,6 +316,7 @@ CameraStereoZed::CameraStereoZed(
selfCalibration_(selfCalibration), selfCalibration_(selfCalibration),
sensingMode_(sensingMode), sensingMode_(sensingMode),
confidenceThr_(confidenceThr), confidenceThr_(confidenceThr),
texturenessConfidenceThr_(texturenessConfidenceThr),
computeOdometry_(computeOdometry), computeOdometry_(computeOdometry),
lost_(true), lost_(true),
force3DoF_(odomForce3DoF), force3DoF_(odomForce3DoF),
@@ -335,6 +340,7 @@ CameraStereoZed::CameraStereoZed(
UASSERT(qual >= sl::DEPTH_MODE::NONE && qual < sl::DEPTH_MODE::LAST); UASSERT(qual >= sl::DEPTH_MODE::NONE && qual < sl::DEPTH_MODE::LAST);
UASSERT(sens >= sl::SENSING_MODE::STANDARD && sens < sl::SENSING_MODE::LAST); UASSERT(sens >= sl::SENSING_MODE::STANDARD && sens < sl::SENSING_MODE::LAST);
UASSERT(confidenceThr_ >= 0 && confidenceThr_ <=100); UASSERT(confidenceThr_ >= 0 && confidenceThr_ <=100);
UASSERT(texturenessConfidenceThr_ >= 0 && texturenessConfidenceThr_ <=100);
#endif #endif
#endif #endif
} }
@@ -542,8 +548,7 @@ SensorData CameraStereoZed::captureImage(CameraInfo * info)
#if ZED_SDK_MAJOR_VERSION < 3 #if ZED_SDK_MAJOR_VERSION < 3
sl::RuntimeParameters rparam((sl::SENSING_MODE)sensingMode_, quality_ > 0, quality_ > 0, sl::REFERENCE_FRAME_CAMERA); sl::RuntimeParameters rparam((sl::SENSING_MODE)sensingMode_, quality_ > 0, quality_ > 0, sl::REFERENCE_FRAME_CAMERA);
#else #else
sl::RuntimeParameters rparam((sl::SENSING_MODE)sensingMode_, quality_ > 0, quality_ > 0, sl::REFERENCE_FRAME::CAMERA); sl::RuntimeParameters rparam((sl::SENSING_MODE)sensingMode_, quality_ > 0, confidenceThr_, texturenessConfidenceThr_, sl::REFERENCE_FRAME::CAMERA);
rparam.confidence_threshold = confidenceThr_;
#endif #endif
if(zed_) if(zed_)

View File

@@ -701,6 +701,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
connect(_ui->comboBox_cameraStereo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateStereoDisparityVisibility())); connect(_ui->comboBox_cameraStereo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateStereoDisparityVisibility()));
connect(_ui->comboBox_stereoZed_sensingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(makeObsoleteSourcePanel())); connect(_ui->comboBox_stereoZed_sensingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->spinBox_stereoZed_confidenceThr, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel())); connect(_ui->spinBox_stereoZed_confidenceThr, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->spinBox_stereoZed_texturenessConfidenceThr, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->checkbox_stereoZed_odom, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel())); connect(_ui->checkbox_stereoZed_odom, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->toolButton_zedSvoPath, SIGNAL(clicked()), this, SLOT(selectSourceSvoPath())); connect(_ui->toolButton_zedSvoPath, SIGNAL(clicked()), this, SLOT(selectSourceSvoPath()));
connect(_ui->lineEdit_zedSvoPath, SIGNAL(textChanged(const QString &)), this, SLOT(makeObsoleteSourcePanel())); connect(_ui->lineEdit_zedSvoPath, SIGNAL(textChanged(const QString &)), this, SLOT(makeObsoleteSourcePanel()));
@@ -1848,6 +1849,7 @@ void PreferencesDialog::resetSettings(QGroupBox * groupBox)
_ui->checkbox_stereoZed_selfCalibration->setChecked(true); _ui->checkbox_stereoZed_selfCalibration->setChecked(true);
_ui->comboBox_stereoZed_sensingMode->setCurrentIndex(0); _ui->comboBox_stereoZed_sensingMode->setCurrentIndex(0);
_ui->spinBox_stereoZed_confidenceThr->setValue(100); _ui->spinBox_stereoZed_confidenceThr->setValue(100);
_ui->spinBox_stereoZed_texturenessConfidenceThr->setValue(90);
_ui->checkbox_stereoZed_odom->setChecked(false); _ui->checkbox_stereoZed_odom->setChecked(false);
_ui->lineEdit_zedSvoPath->clear(); _ui->lineEdit_zedSvoPath->clear();
_ui->checkbox_stereoRealSense2_odom->setChecked(false); _ui->checkbox_stereoRealSense2_odom->setChecked(false);
@@ -2285,6 +2287,7 @@ void PreferencesDialog::readCameraSettings(const QString & filePath)
_ui->checkbox_stereoZed_selfCalibration->setChecked(settings.value("self_calibration", _ui->checkbox_stereoZed_selfCalibration->isChecked()).toBool()); _ui->checkbox_stereoZed_selfCalibration->setChecked(settings.value("self_calibration", _ui->checkbox_stereoZed_selfCalibration->isChecked()).toBool());
_ui->comboBox_stereoZed_sensingMode->setCurrentIndex(settings.value("sensing_mode", _ui->comboBox_stereoZed_sensingMode->currentIndex()).toInt()); _ui->comboBox_stereoZed_sensingMode->setCurrentIndex(settings.value("sensing_mode", _ui->comboBox_stereoZed_sensingMode->currentIndex()).toInt());
_ui->spinBox_stereoZed_confidenceThr->setValue(settings.value("confidence_thr", _ui->spinBox_stereoZed_confidenceThr->value()).toInt()); _ui->spinBox_stereoZed_confidenceThr->setValue(settings.value("confidence_thr", _ui->spinBox_stereoZed_confidenceThr->value()).toInt());
_ui->spinBox_stereoZed_texturenessConfidenceThr->setValue(settings.value("textureness_confidence_thr", _ui->spinBox_stereoZed_texturenessConfidenceThr->value()).toInt());
_ui->checkbox_stereoZed_odom->setChecked(settings.value("odom", _ui->checkbox_stereoZed_odom->isChecked()).toBool()); _ui->checkbox_stereoZed_odom->setChecked(settings.value("odom", _ui->checkbox_stereoZed_odom->isChecked()).toBool());
_ui->lineEdit_zedSvoPath->setText(settings.value("svo_path", _ui->lineEdit_zedSvoPath->text()).toString()); _ui->lineEdit_zedSvoPath->setText(settings.value("svo_path", _ui->lineEdit_zedSvoPath->text()).toString());
settings.endGroup(); // StereoZed settings.endGroup(); // StereoZed
@@ -2749,6 +2752,7 @@ void PreferencesDialog::writeCameraSettings(const QString & filePath) const
settings.setValue("self_calibration", _ui->checkbox_stereoZed_selfCalibration->isChecked()); settings.setValue("self_calibration", _ui->checkbox_stereoZed_selfCalibration->isChecked());
settings.setValue("sensing_mode", _ui->comboBox_stereoZed_sensingMode->currentIndex()); settings.setValue("sensing_mode", _ui->comboBox_stereoZed_sensingMode->currentIndex());
settings.setValue("confidence_thr", _ui->spinBox_stereoZed_confidenceThr->value()); settings.setValue("confidence_thr", _ui->spinBox_stereoZed_confidenceThr->value());
settings.setValue("textureness_confidence_thr", _ui->spinBox_stereoZed_texturenessConfidenceThr->value());
settings.setValue("odom", _ui->checkbox_stereoZed_odom->isChecked()); settings.setValue("odom", _ui->checkbox_stereoZed_odom->isChecked());
settings.setValue("svo_path", _ui->lineEdit_zedSvoPath->text()); settings.setValue("svo_path", _ui->lineEdit_zedSvoPath->text());
settings.endGroup(); // StereoZed settings.endGroup(); // StereoZed
@@ -5619,7 +5623,8 @@ Camera * PreferencesDialog::createCamera(bool useRawImages, bool useColor)
this->getGeneralInputRate(), this->getGeneralInputRate(),
this->getSourceLocalTransform(), this->getSourceLocalTransform(),
_ui->checkbox_stereoZed_selfCalibration->isChecked(), _ui->checkbox_stereoZed_selfCalibration->isChecked(),
_ui->loopClosure_bowForce2D->isChecked()); _ui->loopClosure_bowForce2D->isChecked(),
_ui->spinBox_stereoZed_texturenessConfidenceThr->value());
} }
else else
{ {
@@ -5633,7 +5638,8 @@ Camera * PreferencesDialog::createCamera(bool useRawImages, bool useColor)
this->getGeneralInputRate(), this->getGeneralInputRate(),
this->getSourceLocalTransform(), this->getSourceLocalTransform(),
_ui->checkbox_stereoZed_selfCalibration->isChecked(), _ui->checkbox_stereoZed_selfCalibration->isChecked(),
_ui->loopClosure_bowForce2D->isChecked()); _ui->loopClosure_bowForce2D->isChecked(),
_ui->spinBox_stereoZed_texturenessConfidenceThr->value());
} }
((CameraStereoZed*)camera)->publishInterIMU(_ui->checkbox_publishInterIMU->isChecked()); ((CameraStereoZed*)camera)->publishInterIMU(_ui->checkbox_publishInterIMU->isChecked());
} }

View File

@@ -63,9 +63,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>-1139</y> <y>-365</y>
<width>680</width> <width>680</width>
<height>3083</height> <height>3157</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_16"> <layout class="QVBoxLayout" name="verticalLayout_16">
@@ -95,7 +95,7 @@
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>5</number>
</property> </property>
<widget class="QWidget" name="page_22"> <widget class="QWidget" name="page_22">
<layout class="QVBoxLayout" name="verticalLayout_29" stretch="0,1"> <layout class="QVBoxLayout" name="verticalLayout_29" stretch="0,1">
@@ -3063,7 +3063,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>0</number> <number>1</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">
@@ -3197,7 +3197,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>9</number> <number>8</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">
@@ -4630,7 +4630,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
<item> <item>
<widget class="QStackedWidget" name="stackedWidget_stereo"> <widget class="QStackedWidget" name="stackedWidget_stereo">
<property name="currentIndex"> <property name="currentIndex">
<number>7</number> <number>4</number>
</property> </property>
<widget class="QWidget" name="page_49"> <widget class="QWidget" name="page_49">
<layout class="QVBoxLayout" name="verticalLayout_91"> <layout class="QVBoxLayout" name="verticalLayout_91">
@@ -4892,7 +4892,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
<string>Zed sdk</string> <string>Zed sdk</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_37" columnstretch="0,1"> <layout class="QGridLayout" name="gridLayout_37" columnstretch="0,1">
<item row="7" column="0"> <item row="8" column="0">
<spacer name="verticalSpacer_54"> <spacer name="verticalSpacer_54">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@@ -4905,7 +4905,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="6" column="1"> <item row="7" column="1">
<widget class="QLabel" name="label_305"> <widget class="QLabel" name="label_305">
<property name="text"> <property name="text">
<string>Path to a *.SVO file.</string> <string>Path to a *.SVO file.</string>
@@ -5031,7 +5031,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">
<layout class="QHBoxLayout" name="horizontalLayout_8"> <layout class="QHBoxLayout" name="horizontalLayout_8">
<item> <item>
<widget class="QToolButton" name="toolButton_zedSvoPath"> <widget class="QToolButton" name="toolButton_zedSvoPath">
@@ -5062,14 +5062,14 @@ 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="checkbox_stereoZed_odom"> <widget class="QCheckBox" name="checkbox_stereoZed_odom">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="6" column="1">
<widget class="QLabel" name="label_316"> <widget class="QLabel" name="label_316">
<property name="text"> <property name="text">
<string>Use ZED visual odometry.</string> <string>Use ZED visual odometry.</string>
@@ -5102,6 +5102,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_570">
<property name="text">
<string>[SDK3] Threshold to reject depth values based on their textureness confidence. A lower value means more confidence and precision (but less density). An upper value reduces filtering (more density, less certainty.).</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QSpinBox" name="spinBox_stereoZed_texturenessConfidenceThr">
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>