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

View File

@@ -67,6 +67,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/core/Compression.h"
#include "rtabmap/core/Graph.h"
#include "rtabmap/core/Stereo.h"
#include "rtabmap/core/StereoDense.h"
#include "rtabmap/core/Optimizer.h"
#include "rtabmap/core/RegistrationVis.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(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(update3dView()));
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_voxelSize, SIGNAL(valueChanged(double)), 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_->groupBox_posefiltering, SIGNAL(clicked(bool)), 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_->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_showDisparityInsteadOfRight->setChecked(settings.value("showDisp", ui_->checkBox_showDisparityInsteadOfRight->isChecked()).toBool());
settings.endGroup();
settings.beginGroup("grid");
@@ -641,6 +644,7 @@ void DatabaseViewer::writeSettings()
settings.setValue("voxelSize", ui_->doubleSpinBox_voxelSize->value());
settings.setValue("decimation", ui_->spinBox_decimation->value());
settings.setValue("camProj", ui_->checkBox_cameraProjection->isChecked());
settings.setValue("showDisp", ui_->checkBox_showDisparityInsteadOfRight->isChecked());
settings.endGroup();
// save Grid settings
@@ -731,6 +735,7 @@ void DatabaseViewer::restoreDefaultSettings()
ui_->doubleSpinBox_voxelSize->setValue(0.0);
ui_->spinBox_decimation->setValue(1);
ui_->checkBox_cameraProjection->setChecked(false);
ui_->checkBox_showDisparityInsteadOfRight->setChecked(false);
ui_->groupBox_posefiltering->setChecked(false);
ui_->doubleSpinBox_posefilteringRadius->setValue(0.1);
@@ -4398,7 +4403,7 @@ void DatabaseViewer::update(int value,
SensorData data;
dbDriver_->getNodeData(id, data);
data.uncompressData();
if(!data.imageRaw().empty())
if(!data.imageRaw().empty())
{
img = uCvMat2QImage(data.imageRaw());
}
@@ -4410,6 +4415,15 @@ void DatabaseViewer::update(int value,
if(ui_->spinBox_mesh_fillDepthHoles->value() > 0)
{
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;
@@ -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())
{
sliderBValueChanged(ui_->horizontalSlider_B->value());
}
else
{
if(lastSliderIndexBrowsed_ == ui_->horizontalSlider_B->value())
{
sliderBValueChanged(ui_->horizontalSlider_B->value());
}
else
{
sliderAValueChanged(ui_->horizontalSlider_A->value());
}

View File

@@ -1543,9 +1543,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<y>-344</y>
<width>518</width>
<height>911</height>
<height>934</height>
</rect>
</property>
<attribute name="label">
@@ -1554,31 +1554,48 @@
<layout class="QVBoxLayout" name="verticalLayout_16">
<item>
<layout class="QGridLayout" name="gridLayout_9" columnstretch="0,0">
<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="0" column="0">
<widget class="QCheckBox" name="checkBox_grid_empty">
<property name="text">
<item row="11" column="0">
<widget class="QSpinBox" name="spinBox_decimation">
<property name="prefix">
<string/>
</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>
</property>
</widget>
@@ -1605,62 +1622,10 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_octomap_empty_3">
<item row="3" column="1">
<widget class="QLabel" name="label_octomap_empty_4">
<property name="text">
<string>Ground 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>
<string>Empty cell color</string>
</property>
<property name="wordWrap">
<bool>true</bool>
@@ -1677,23 +1642,10 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_octomap_empty_2">
<item row="4" column="0">
<widget class="QCheckBox" name="checkBox_octomap">
<property name="text">
<string>Obstacle cell color</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>
<string/>
</property>
</widget>
</item>
@@ -1715,48 +1667,62 @@
</item>
</layout>
</item>
<item row="4" column="1">
<widget class="QLabel" name="label_53">
<item row="0" column="1">
<widget class="QLabel" name="label_octomap_empty">
<property name="text">
<string>OctoMap</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>
<string>Show empty space</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<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="13" column="0">
<widget class="QSpinBox" name="spinBox_cropRadius">
<property name="suffix">
<string> pixels</string>
<item row="10" column="1">
<widget class="QLabel" name="label_51">
<property name="text">
<string>Gain compensation radius (Constraints view)</string>
</property>
<property name="value">
<number>1</number>
<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>
</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>
</widget>
</item>
@@ -1770,28 +1736,36 @@
</property>
</widget>
</item>
<item row="3" column="0">
<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 row="13" column="0">
<widget class="QSpinBox" name="spinBox_cropRadius">
<property name="suffix">
<string> pixels</string>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_octomap_empty">
<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="15" column="1">
<widget class="QLabel" name="label_60">
<property name="text">
<string>Show empty space</string>
<string>Create RGB-D cloud from RGB projection on scan.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
@@ -1820,40 +1794,69 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="checkBox_octomap">
<item row="3" column="0">
<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">
<string/>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLabel" name="label_55">
<item row="1" column="0">
<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">
<string>Local grid: regenerate from saved grid instead of sensors</string>
<string>Obstacle cell color</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_octomap_empty_4">
<item row="15" column="0">
<widget class="QCheckBox" name="checkBox_cameraProjection">
<property name="text">
<string>Empty cell color</string>
<string/>
</property>
<property name="wordWrap">
<bool>true</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 name="checked">
<bool>false</bool>
</property>
</widget>
</item>
@@ -1867,6 +1870,13 @@
</property>
</widget>
</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">
<widget class="QLabel" name="label_octomap_cubes">
<property name="text">
@@ -1877,18 +1887,28 @@
</property>
</widget>
</item>
<item row="15" column="1">
<widget class="QLabel" name="label_60">
<item row="0" column="0">
<widget class="QCheckBox" name="checkBox_grid_empty">
<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 name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="15" column="0">
<widget class="QCheckBox" name="checkBox_cameraProjection">
<item row="16" column="0">
<widget class="QCheckBox" name="checkBox_showDisparityInsteadOfRight">
<property name="text">
<string/>
</property>
@@ -2138,7 +2158,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>226</width>
<width>298</width>
<height>192</height>
</rect>
</property>
@@ -2292,8 +2312,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>185</width>
<height>485</height>
<width>432</width>
<height>196</height>
</rect>
</property>
<attribute name="label">