OctoMap::createCloud() added cloud probability output option.

CameraRealSense2: added new warnings to debug easier timestamps problems.
GUI: added gravity visualization.
DbViewer: empty clouds in OctoMap mode have color depending on probability of occupancy.
Brought general changes from local xvision branch.
This commit is contained in:
matlabbe
2020-01-22 10:34:21 -05:00
parent f9e818c900
commit ccc5a5be5a
14 changed files with 367 additions and 65 deletions

View File

@@ -52,7 +52,6 @@ CameraViewer::CameraViewer(QWidget * parent, const ParametersMap & parameters) :
imageView_(new ImageView(this)),
cloudView_(new CloudViewer(this)),
processingImages_(false),
validDecimationValue_(2),
parameters_(parameters)
{
qRegisterMetaType<rtabmap::SensorData>("rtabmap::SensorData");
@@ -66,7 +65,7 @@ CameraViewer::CameraViewer(QWidget * parent, const ParametersMap & parameters) :
QLabel * decimationLabel = new QLabel("Decimation", this);
decimationSpin_ = new QSpinBox(this);
decimationSpin_->setMinimum(1);
decimationSpin_->setMinimum(-16);
decimationSpin_->setMaximum(16);
decimationSpin_->setValue(2);
@@ -78,6 +77,8 @@ CameraViewer::CameraViewer(QWidget * parent, const ParametersMap & parameters) :
showScanCheckbox_ = new QCheckBox("Show scan", this);
showScanCheckbox_->setEnabled(false);
imageSizeLabel_ = new QLabel(this);
QDialogButtonBox * buttonBox = new QDialogButtonBox(this);
buttonBox->setStandardButtons(QDialogButtonBox::Close);
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
@@ -88,6 +89,7 @@ CameraViewer::CameraViewer(QWidget * parent, const ParametersMap & parameters) :
layout2->addWidget(decimationSpin_);
layout2->addWidget(showCloudCheckbox_);
layout2->addWidget(showScanCheckbox_);
layout2->addWidget(imageSizeLabel_);
layout2->addStretch(1);
layout2->addWidget(buttonBox);
@@ -107,37 +109,19 @@ CameraViewer::~CameraViewer()
void CameraViewer::showImage(const rtabmap::SensorData & data)
{
if(!data.imageRaw().empty() || !data.depthOrRightRaw().empty())
{
if(data.imageRaw().cols % decimationSpin_->value() == 0 &&
data.imageRaw().rows % decimationSpin_->value() == 0 &&
data.depthOrRightRaw().cols % decimationSpin_->value() == 0 &&
data.depthOrRightRaw().rows % decimationSpin_->value() == 0)
{
validDecimationValue_ = decimationSpin_->value();
}
else
{
UWARN("Decimation (%d) must be a denominator of the width and height of "
"the image (color=%d/%d depth=%d/%d). Using last valid decimation value (%d).",
decimationSpin_->value(),
data.imageRaw().cols,
data.imageRaw().rows,
data.depthOrRightRaw().cols,
data.depthOrRightRaw().rows,
validDecimationValue_);
}
}
processingImages_ = true;
QString sizes;
if(!data.imageRaw().empty())
{
imageView_->setImage(uCvMat2QImage(util2d::decimate(data.imageRaw(), validDecimationValue_)));
imageView_->setImage(uCvMat2QImage(data.imageRaw()));
sizes.append(QString("Color=%1x%2").arg(data.imageRaw().cols).arg(data.imageRaw().rows));
}
if(!data.depthOrRightRaw().empty())
{
imageView_->setImageDepth(util2d::decimate(data.depthOrRightRaw(), validDecimationValue_));
imageView_->setImageDepth(data.depthOrRightRaw());
sizes.append(QString(" Depth=%1x%2").arg(data.depthOrRightRaw().cols).arg(data.depthOrRightRaw().rows));
}
imageSizeLabel_->setText(sizes);
if(!data.depthOrRightRaw().empty() &&
(data.stereoCameraModel().isValidForProjection() || (data.cameraModels().size() && data.cameraModels().at(0).isValidForProjection())))
@@ -147,12 +131,12 @@ void CameraViewer::showImage(const rtabmap::SensorData & data)
if(!data.imageRaw().empty() && !data.depthOrRightRaw().empty())
{
showCloudCheckbox_->setEnabled(true);
cloudView_->addCloud("cloud", util3d::cloudRGBFromSensorData(data, validDecimationValue_, 0, 0, 0, parameters_));
cloudView_->addCloud("cloud", util3d::cloudRGBFromSensorData(data, decimationSpin_->value()!=0?decimationSpin_->value():1, 0, 0, 0, parameters_));
}
else if(!data.depthOrRightRaw().empty())
{
showCloudCheckbox_->setEnabled(true);
cloudView_->addCloud("cloud", util3d::cloudFromSensorData(data, validDecimationValue_, 0, 0, 0, parameters_));
cloudView_->addCloud("cloud", util3d::cloudFromSensorData(data, decimationSpin_->value()!=0?fabs(decimationSpin_->value()):1, 0, 0, 0, parameters_));
}
}
}
@@ -162,7 +146,7 @@ void CameraViewer::showImage(const rtabmap::SensorData & data)
showScanCheckbox_->setEnabled(true);
if(showScanCheckbox_->isChecked())
{
cloudView_->addCloud("scan", util3d::downsample(util3d::laserScanToPointCloud(data.laserScanRaw()), validDecimationValue_), Transform::getIdentity(), Qt::yellow);
cloudView_->addCloud("scan", util3d::downsample(util3d::laserScanToPointCloud(data.laserScanRaw()), decimationSpin_->value()!=0?fabs(decimationSpin_->value()):1), Transform::getIdentity(), Qt::yellow);
}
}