Camera test view: show intensity/rgb/normals if input scans have them

This commit is contained in:
matlabbe
2021-01-25 17:16:46 -05:00
parent 7e298e1999
commit 6b119c1f90
2 changed files with 28 additions and 2 deletions
+1 -1
View File
@@ -3262,6 +3262,7 @@ LaserScan loadScan(const std::string & path)
if(cloud->fields[i].name.compare("z") == 0) if(cloud->fields[i].name.compare("z") == 0)
{ {
zOffset = cloud->fields[i].offset; zOffset = cloud->fields[i].offset;
break;
} }
} }
if(zOffset>=0) if(zOffset>=0)
@@ -3283,7 +3284,6 @@ LaserScan loadScan(const std::string & path)
} }
} }
} }
return laserScanFromPointCloud(*cloud, true, is2D); return laserScanFromPointCloud(*cloud, true, is2D);
} }
return LaserScan(); return LaserScan();
+27 -1
View File
@@ -147,7 +147,33 @@ void CameraViewer::showImage(const rtabmap::SensorData & data)
showScanCheckbox_->setEnabled(true); showScanCheckbox_->setEnabled(true);
if(showScanCheckbox_->isChecked()) if(showScanCheckbox_->isChecked())
{ {
cloudView_->addCloud("scan", util3d::downsample(util3d::laserScanToPointCloud(data.laserScanRaw()), decimationSpin_->value()!=0?fabs(decimationSpin_->value()):1), data.laserScanRaw().localTransform(), Qt::yellow); if(data.laserScanRaw().hasNormals())
{
if(data.laserScanRaw().hasIntensity())
{
cloudView_->addCloud("scan", util3d::downsample(util3d::laserScanToPointCloudINormal(data.laserScanRaw()), decimationSpin_->value()!=0?fabs(decimationSpin_->value()):1), data.laserScanRaw().localTransform(), Qt::yellow);
}
else if(data.laserScanRaw().hasRGB())
{
cloudView_->addCloud("scan", util3d::downsample(util3d::laserScanToPointCloudRGBNormal(data.laserScanRaw()), decimationSpin_->value()!=0?fabs(decimationSpin_->value()):1), data.laserScanRaw().localTransform(), Qt::yellow);
}
else
{
cloudView_->addCloud("scan", util3d::downsample(util3d::laserScanToPointCloudNormal(data.laserScanRaw()), decimationSpin_->value()!=0?fabs(decimationSpin_->value()):1), data.laserScanRaw().localTransform(), Qt::yellow);
}
}
else if(data.laserScanRaw().hasIntensity())
{
cloudView_->addCloud("scan", util3d::downsample(util3d::laserScanToPointCloudI(data.laserScanRaw()), decimationSpin_->value()!=0?fabs(decimationSpin_->value()):1), data.laserScanRaw().localTransform(), Qt::yellow);
}
else if(data.laserScanRaw().hasRGB())
{
cloudView_->addCloud("scan", util3d::downsample(util3d::laserScanToPointCloudRGB(data.laserScanRaw()), decimationSpin_->value()!=0?fabs(decimationSpin_->value()):1), data.laserScanRaw().localTransform(), Qt::yellow);
}
else
{
cloudView_->addCloud("scan", util3d::downsample(util3d::laserScanToPointCloud(data.laserScanRaw()), decimationSpin_->value()!=0?fabs(decimationSpin_->value()):1), data.laserScanRaw().localTransform(), Qt::yellow);
}
} }
} }