DbViewer: added option to show disparity instead of right image in main views for stereo data

This commit is contained in:
matlabbe
2021-11-20 16:36:54 -05:00
parent 6684bafe34
commit 090ae0c444
3 changed files with 221 additions and 190 deletions
+1 -1
View File
@@ -211,7 +211,7 @@ IF(WITH_PYTHON AND Python3_FOUND)
${CMAKE_CURRENT_SOURCE_DIR}/python ${CMAKE_CURRENT_SOURCE_DIR}/python
${INCLUDE_DIRS} ${INCLUDE_DIRS}
) )
ENDIF(Python3_FOUND) ENDIF(WITH_PYTHON AND Python3_FOUND)
+22 -11
View File
@@ -67,6 +67,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/core/Compression.h" #include "rtabmap/core/Compression.h"
#include "rtabmap/core/Graph.h" #include "rtabmap/core/Graph.h"
#include "rtabmap/core/Stereo.h" #include "rtabmap/core/Stereo.h"
#include "rtabmap/core/StereoDense.h"
#include "rtabmap/core/Optimizer.h" #include "rtabmap/core/Optimizer.h"
#include "rtabmap/core/RegistrationVis.h" #include "rtabmap/core/RegistrationVis.h"
#include "rtabmap/core/RegistrationIcp.h" #include "rtabmap/core/RegistrationIcp.h"
@@ -393,6 +394,7 @@ DatabaseViewer::DatabaseViewer(const QString & ini, QWidget * parent) :
connect(ui_->doubleSpinBox_voxelSize, SIGNAL(valueChanged(double)), this, SLOT(updateConstraintView())); connect(ui_->doubleSpinBox_voxelSize, SIGNAL(valueChanged(double)), this, SLOT(updateConstraintView()));
connect(ui_->doubleSpinBox_voxelSize, SIGNAL(valueChanged(double)), this, SLOT(update3dView())); connect(ui_->doubleSpinBox_voxelSize, SIGNAL(valueChanged(double)), this, SLOT(update3dView()));
connect(ui_->checkBox_cameraProjection, SIGNAL(stateChanged(int)), this, SLOT(update3dView())); connect(ui_->checkBox_cameraProjection, SIGNAL(stateChanged(int)), this, SLOT(update3dView()));
connect(ui_->checkBox_showDisparityInsteadOfRight, SIGNAL(stateChanged(int)), this, SLOT(update3dView()));
connect(ui_->spinBox_decimation, SIGNAL(valueChanged(int)), this, SLOT(updateConstraintView())); connect(ui_->spinBox_decimation, SIGNAL(valueChanged(int)), this, SLOT(updateConstraintView()));
connect(ui_->spinBox_decimation, SIGNAL(valueChanged(int)), this, SLOT(update3dView())); connect(ui_->spinBox_decimation, SIGNAL(valueChanged(int)), this, SLOT(update3dView()));
connect(ui_->groupBox_posefiltering, SIGNAL(clicked(bool)), this, SLOT(updateGraphView())); connect(ui_->groupBox_posefiltering, SIGNAL(clicked(bool)), this, SLOT(updateGraphView()));
@@ -421,6 +423,7 @@ DatabaseViewer::DatabaseViewer(const QString & ini, QWidget * parent) :
connect(ui_->doubleSpinBox_gainCompensationRadius, SIGNAL(valueChanged(double)), this, SLOT(configModified())); connect(ui_->doubleSpinBox_gainCompensationRadius, SIGNAL(valueChanged(double)), this, SLOT(configModified()));
connect(ui_->doubleSpinBox_voxelSize, SIGNAL(valueChanged(double)), this, SLOT(configModified())); connect(ui_->doubleSpinBox_voxelSize, SIGNAL(valueChanged(double)), this, SLOT(configModified()));
connect(ui_->checkBox_cameraProjection, SIGNAL(stateChanged(int)), this, SLOT(configModified())); connect(ui_->checkBox_cameraProjection, SIGNAL(stateChanged(int)), this, SLOT(configModified()));
connect(ui_->checkBox_showDisparityInsteadOfRight, SIGNAL(stateChanged(int)), this, SLOT(configModified()));
connect(ui_->spinBox_decimation, SIGNAL(valueChanged(int)), this, SLOT(configModified())); connect(ui_->spinBox_decimation, SIGNAL(valueChanged(int)), this, SLOT(configModified()));
connect(ui_->groupBox_posefiltering, SIGNAL(clicked(bool)), this, SLOT(configModified())); connect(ui_->groupBox_posefiltering, SIGNAL(clicked(bool)), this, SLOT(configModified()));
connect(ui_->doubleSpinBox_posefilteringRadius, SIGNAL(valueChanged(double)), this, SLOT(configModified())); connect(ui_->doubleSpinBox_posefilteringRadius, SIGNAL(valueChanged(double)), this, SLOT(configModified()));
@@ -553,7 +556,7 @@ void DatabaseViewer::readSettings()
ui_->doubleSpinBox_voxelSize->setValue(settings.value("voxelSize", ui_->doubleSpinBox_voxelSize->value()).toDouble()); ui_->doubleSpinBox_voxelSize->setValue(settings.value("voxelSize", ui_->doubleSpinBox_voxelSize->value()).toDouble());
ui_->spinBox_decimation->setValue(settings.value("decimation", ui_->spinBox_decimation->value()).toInt()); ui_->spinBox_decimation->setValue(settings.value("decimation", ui_->spinBox_decimation->value()).toInt());
ui_->checkBox_cameraProjection->setChecked(settings.value("camProj", ui_->checkBox_cameraProjection->isChecked()).toBool()); ui_->checkBox_cameraProjection->setChecked(settings.value("camProj", ui_->checkBox_cameraProjection->isChecked()).toBool());
ui_->checkBox_showDisparityInsteadOfRight->setChecked(settings.value("showDisp", ui_->checkBox_showDisparityInsteadOfRight->isChecked()).toBool());
settings.endGroup(); settings.endGroup();
settings.beginGroup("grid"); settings.beginGroup("grid");
@@ -641,6 +644,7 @@ void DatabaseViewer::writeSettings()
settings.setValue("voxelSize", ui_->doubleSpinBox_voxelSize->value()); settings.setValue("voxelSize", ui_->doubleSpinBox_voxelSize->value());
settings.setValue("decimation", ui_->spinBox_decimation->value()); settings.setValue("decimation", ui_->spinBox_decimation->value());
settings.setValue("camProj", ui_->checkBox_cameraProjection->isChecked()); settings.setValue("camProj", ui_->checkBox_cameraProjection->isChecked());
settings.setValue("showDisp", ui_->checkBox_showDisparityInsteadOfRight->isChecked());
settings.endGroup(); settings.endGroup();
// save Grid settings // save Grid settings
@@ -731,6 +735,7 @@ void DatabaseViewer::restoreDefaultSettings()
ui_->doubleSpinBox_voxelSize->setValue(0.0); ui_->doubleSpinBox_voxelSize->setValue(0.0);
ui_->spinBox_decimation->setValue(1); ui_->spinBox_decimation->setValue(1);
ui_->checkBox_cameraProjection->setChecked(false); ui_->checkBox_cameraProjection->setChecked(false);
ui_->checkBox_showDisparityInsteadOfRight->setChecked(false);
ui_->groupBox_posefiltering->setChecked(false); ui_->groupBox_posefiltering->setChecked(false);
ui_->doubleSpinBox_posefilteringRadius->setValue(0.1); ui_->doubleSpinBox_posefilteringRadius->setValue(0.1);
@@ -4398,7 +4403,7 @@ void DatabaseViewer::update(int value,
data.uncompressData(); data.uncompressData();
if(!data.imageRaw().empty()) if(!data.imageRaw().empty())
{ {
img = uCvMat2QImage(ui_->label_indexB==labelIndex?data.imageRaw():data.imageRaw()); img = uCvMat2QImage(data.imageRaw());
} }
if(!data.depthOrRightRaw().empty()) if(!data.depthOrRightRaw().empty())
{ {
@@ -4410,6 +4415,15 @@ void DatabaseViewer::update(int value,
depth = util2d::fillDepthHoles(depth, ui_->spinBox_mesh_fillDepthHoles->value(), float(ui_->spinBox_mesh_depthError->value())/100.0f); depth = util2d::fillDepthHoles(depth, ui_->spinBox_mesh_fillDepthHoles->value(), float(ui_->spinBox_mesh_depthError->value())/100.0f);
} }
} }
if( !data.imageRaw().empty() &&
!data.rightRaw().empty() &&
data.stereoCameraModel().isValidForProjection() &&
ui_->checkBox_showDisparityInsteadOfRight->isChecked())
{
rtabmap::StereoDense * denseStereo = rtabmap::StereoDense::create(ui_->parameters_toolbox->getParameters());
depth = util2d::depthFromDisparity(denseStereo->computeDisparity(data.imageRaw(), data.rightRaw()), data.stereoCameraModel().left().fx(), data.stereoCameraModel().baseline(), CV_32FC1);
delete denseStereo;
}
imgDepth = depth; imgDepth = depth;
} }
@@ -5606,16 +5620,13 @@ void DatabaseViewer::sliderBMoved(int value)
void DatabaseViewer::update3dView() void DatabaseViewer::update3dView()
{ {
if(ui_->dockWidget_view3d->isVisible()) if(lastSliderIndexBrowsed_ == ui_->horizontalSlider_B->value())
{ {
if(lastSliderIndexBrowsed_ == ui_->horizontalSlider_B->value()) sliderBValueChanged(ui_->horizontalSlider_B->value());
{ }
sliderBValueChanged(ui_->horizontalSlider_B->value()); else
} {
else sliderAValueChanged(ui_->horizontalSlider_A->value());
{
sliderAValueChanged(ui_->horizontalSlider_A->value());
}
} }
} }
+198 -178
View File
@@ -1543,9 +1543,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>-344</y>
<width>518</width> <width>518</width>
<height>911</height> <height>934</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@@ -1554,31 +1554,48 @@
<layout class="QVBoxLayout" name="verticalLayout_16"> <layout class="QVBoxLayout" name="verticalLayout_16">
<item> <item>
<layout class="QGridLayout" name="gridLayout_9" columnstretch="0,0"> <layout class="QGridLayout" name="gridLayout_9" columnstretch="0,0">
<item row="7" column="0"> <item row="11" column="0">
<widget class="QComboBox" name="comboBox_octomap_rendering_type"> <widget class="QSpinBox" name="spinBox_decimation">
<item> <property name="prefix">
<property name="text">
<string>Point Cloud</string>
</property>
</item>
<item>
<property name="text">
<string>Cube</string>
</property>
</item>
<item>
<property name="text">
<string>Volume</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="checkBox_grid_empty">
<property name="text">
<string/> <string/>
</property> </property>
<property name="checked"> <property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>16</number>
</property>
<property name="value">
<number>16</number>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_octomap_empty_3">
<property name="text">
<string>Ground cell color</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QLabel" name="label_57">
<property name="text">
<string>Crop radius when filtering empty space from 2d occupancy grid.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLabel" name="label_55">
<property name="text">
<string>Local grid: regenerate from saved grid instead of sensors</string>
</property>
<property name="wordWrap">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
@@ -1605,62 +1622,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="3" column="1">
<widget class="QLabel" name="label_octomap_empty_3"> <widget class="QLabel" name="label_octomap_empty_4">
<property name="text"> <property name="text">
<string>Ground cell color</string> <string>Empty cell color</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QSpinBox" name="spinBox_decimation">
<property name="prefix">
<string/>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>16</number>
</property>
<property name="value">
<number>16</number>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QCheckBox" name="checkBox_grid_showProbMap">
<property name="text">
<string/>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QSpinBox" name="spinBox_grid_depth">
<property name="prefix">
<string/>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>16</number>
</property>
<property name="value">
<number>16</number>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QLabel" name="label_56">
<property name="text">
<string>Decimation (for images)</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
@@ -1677,23 +1642,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="4" column="0">
<widget class="QLabel" name="label_octomap_empty_2"> <widget class="QCheckBox" name="checkBox_octomap">
<property name="text"> <property name="text">
<string>Obstacle cell color</string> <string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="14" column="1">
<widget class="QLabel" name="label_59">
<property name="text">
<string>Show probabilistic occupancy grid in Graph View.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
@@ -1715,48 +1667,62 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="4" column="1"> <item row="0" column="1">
<widget class="QLabel" name="label_53"> <widget class="QLabel" name="label_octomap_empty">
<property name="text"> <property name="text">
<string>OctoMap</string> <string>Show empty space</string>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QLabel" name="label_57">
<property name="text">
<string>Crop radius when filtering empty space from 2d occupancy grid.</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="10" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_11"> <widget class="QLabel" name="label_51">
<item> <property name="text">
<widget class="QToolButton" name="toolButton_obstacleColor"> <string>Gain compensation radius (Constraints view)</string>
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_obstacleColor">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="13" column="0">
<widget class="QSpinBox" name="spinBox_cropRadius">
<property name="suffix">
<string> pixels</string>
</property> </property>
<property name="value"> <property name="wordWrap">
<number>1</number> <bool>true</bool>
</property>
</widget>
</item>
<item row="14" column="1">
<widget class="QLabel" name="label_59">
<property name="text">
<string>Show probabilistic occupancy grid in Graph View.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QComboBox" name="comboBox_octomap_rendering_type">
<item>
<property name="text">
<string>Point Cloud</string>
</property>
</item>
<item>
<property name="text">
<string>Cube</string>
</property>
</item>
<item>
<property name="text">
<string>Volume</string>
</property>
</item>
</widget>
</item>
<item row="11" column="1">
<widget class="QLabel" name="label_56">
<property name="text">
<string>Decimation (for images)</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
@@ -1770,28 +1736,36 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="13" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_12"> <widget class="QSpinBox" name="spinBox_cropRadius">
<item> <property name="suffix">
<widget class="QToolButton" name="toolButton_emptyColor"> <string> pixels</string>
<property name="text"> </property>
<string>...</string> <property name="value">
</property> <number>1</number>
</widget> </property>
</item> </widget>
<item>
<widget class="QLineEdit" name="lineEdit_emptyColor">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item> </item>
<item row="0" column="1"> <item row="8" column="0">
<widget class="QLabel" name="label_octomap_empty"> <widget class="QSpinBox" name="spinBox_grid_depth">
<property name="prefix">
<string/>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>16</number>
</property>
<property name="value">
<number>16</number>
</property>
</widget>
</item>
<item row="15" column="1">
<widget class="QLabel" name="label_60">
<property name="text"> <property name="text">
<string>Show empty space</string> <string>Create RGB-D cloud from RGB projection on scan.</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
@@ -1820,40 +1794,69 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="3" column="0">
<widget class="QCheckBox" name="checkBox_octomap"> <layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<widget class="QToolButton" name="toolButton_emptyColor">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_emptyColor">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="14" column="0">
<widget class="QCheckBox" name="checkBox_grid_showProbMap">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
<property name="checked">
<bool>false</bool>
</property>
</widget> </widget>
</item> </item>
<item row="9" column="1"> <item row="1" column="0">
<widget class="QLabel" name="label_55"> <layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<widget class="QToolButton" name="toolButton_obstacleColor">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_obstacleColor">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_octomap_empty_2">
<property name="text"> <property name="text">
<string>Local grid: regenerate from saved grid instead of sensors</string> <string>Obstacle cell color</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="15" column="0">
<widget class="QLabel" name="label_octomap_empty_4"> <widget class="QCheckBox" name="checkBox_cameraProjection">
<property name="text"> <property name="text">
<string>Empty cell color</string> <string/>
</property> </property>
<property name="wordWrap"> <property name="checked">
<bool>true</bool> <bool>false</bool>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QLabel" name="label_51">
<property name="text">
<string>Gain compensation radius (Constraints view)</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
@@ -1867,6 +1870,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1">
<widget class="QLabel" name="label_53">
<property name="text">
<string>OctoMap</string>
</property>
</widget>
</item>
<item row="7" column="1"> <item row="7" column="1">
<widget class="QLabel" name="label_octomap_cubes"> <widget class="QLabel" name="label_octomap_cubes">
<property name="text"> <property name="text">
@@ -1877,18 +1887,28 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="15" column="1"> <item row="0" column="0">
<widget class="QLabel" name="label_60"> <widget class="QCheckBox" name="checkBox_grid_empty">
<property name="text"> <property name="text">
<string>Create RGB-D cloud from RGB projection on scan.</string> <string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="16" column="1">
<widget class="QLabel" name="label_logger_level_2">
<property name="text">
<string>For stereo data, show disparity instead of right image in main views.</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="15" column="0"> <item row="16" column="0">
<widget class="QCheckBox" name="checkBox_cameraProjection"> <widget class="QCheckBox" name="checkBox_showDisparityInsteadOfRight">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
@@ -2138,7 +2158,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>226</width> <width>298</width>
<height>192</height> <height>192</height>
</rect> </rect>
</property> </property>
@@ -2292,8 +2312,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>185</width> <width>432</width>
<height>485</height> <height>196</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">