0.19.2: Refactored SensorData interface. DBReader: Fixed GPS not published. #345: both g2o and gtsam working with GPS. g2o: added gravity edges.

This commit is contained in:
matlabbe
2019-04-09 20:05:24 -04:00
parent e7b3a7735d
commit 77ae8e108a
24 changed files with 878 additions and 480 deletions

View File

@@ -6506,7 +6506,7 @@ void DatabaseViewer::refineConstraint(int from, int to, bool silent)
}
SensorData assembledData;
// scans are in base frame but for 2d scans, set the height so that correspondences matching works
assembledData.setLaserScanRaw(LaserScan(
assembledData.setLaserScan(LaserScan(
assembledScan,
fromScan.maxPoints()?fromScan.maxPoints():maxPoints,
fromScan.rangeMax(),
@@ -6549,8 +6549,8 @@ void DatabaseViewer::refineConstraint(int from, int to, bool silent)
0,
ui_->parameters_toolbox->getParameters());
int maxLaserScans = cloudFrom->size();
dataFrom.setLaserScanRaw(LaserScan(util3d::laserScanFromPointCloud(*util3d::removeNaNFromPointCloud(cloudFrom), Transform()), maxLaserScans, 0, LaserScan::kXYZ));
dataTo.setLaserScanRaw(LaserScan(util3d::laserScanFromPointCloud(*util3d::removeNaNFromPointCloud(cloudTo), Transform()), maxLaserScans, 0, LaserScan::kXYZ));
dataFrom.setLaserScan(LaserScan(util3d::laserScanFromPointCloud(*util3d::removeNaNFromPointCloud(cloudFrom), Transform()), maxLaserScans, 0, LaserScan::kXYZ));
dataTo.setLaserScan(LaserScan(util3d::laserScanFromPointCloud(*util3d::removeNaNFromPointCloud(cloudTo), Transform()), maxLaserScans, 0, LaserScan::kXYZ));
if(!dataFrom.laserScanCompressed().isEmpty() || !dataTo.laserScanCompressed().isEmpty())
{

View File

@@ -2950,12 +2950,12 @@ std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr, pcl::Indic
if(_ui->checkBox_regenerate->isChecked())
{
SensorData data;
cv::Mat image, depth;
LaserScan scan;
if(cachedSignatures.contains(iter->first))
{
const Signature & s = cachedSignatures.find(iter->first).value();
data = s.sensorData();
cv::Mat image,depth;
data.uncompressData(
_ui->checkBox_fromDepth->isChecked()?&image:0,
_ui->checkBox_fromDepth->isChecked()?&depth:0,
@@ -2963,6 +2963,7 @@ std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr, pcl::Indic
}
else if(_dbDriver)
{
cv::Mat image,depth;
_dbDriver->getNodeData(iter->first, data, _ui->checkBox_fromDepth->isChecked(), !_ui->checkBox_fromDepth->isChecked(), false, false);
data.uncompressData(
_ui->checkBox_fromDepth->isChecked()?&image:0,
@@ -2970,30 +2971,35 @@ std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr, pcl::Indic
!_ui->checkBox_fromDepth->isChecked()?&scan:0);
}
if(_ui->checkBox_fromDepth->isChecked() && !image.empty() && !depth.empty())
if(_ui->checkBox_fromDepth->isChecked() && !data.imageRaw().empty() && !data.depthOrRightRaw().empty())
{
if(_ui->spinBox_fillDepthHoles->value() > 0)
cv::Mat depth = data.depthRaw();
if(!depth.empty() && _ui->spinBox_fillDepthHoles->value() > 0)
{
depth = util2d::fillDepthHoles(depth, _ui->spinBox_fillDepthHoles->value(), float(_ui->spinBox_fillDepthHolesError->value())/100.f);
}
if(!_ui->lineEdit_distortionModel->text().isEmpty() &&
if(!depth.empty() &&
!_ui->lineEdit_distortionModel->text().isEmpty() &&
QFileInfo(_ui->lineEdit_distortionModel->text()).exists())
{
clams::DiscreteDepthDistortionModel model;
model.load(_ui->lineEdit_distortionModel->text().toStdString());
depth = depth.clone();// make sure we are not modifying data in cached signatures.
model.undistort(depth);
data.setDepthOrRightRaw(depth);
}
// bilateral filtering
if(_ui->checkBox_bilateral->isChecked())
if(!depth.empty() && _ui->checkBox_bilateral->isChecked())
{
depth = util2d::fastBilateralFiltering(depth,
_ui->doubleSpinBox_bilateral_sigmaS->value(),
_ui->doubleSpinBox_bilateral_sigmaR->value());
data.setDepthOrRightRaw(depth);
}
if(!depth.empty())
{
data.setRGBDImage(data.imageRaw(), depth, data.cameraModels());
}
UASSERT(iter->first == data.id());

View File

@@ -2047,16 +2047,7 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
{
Signature & s = *_cachedSignatures.find(stat.refImageId());
_cachedMemoryUsage -= s.sensorData().getMemoryUsed();
s.sensorData().setImageRaw(cv::Mat());
s.sensorData().setDepthOrRightRaw(cv::Mat());
s.sensorData().setUserDataRaw(cv::Mat());
s.sensorData().setLaserScanRaw(
LaserScan(
cv::Mat(),
signature.sensorData().laserScanRaw().maxPoints(),
signature.sensorData().laserScanRaw().rangeMax(),
signature.sensorData().laserScanRaw().format(),
signature.sensorData().laserScanRaw().localTransform()));
s.sensorData().clearRawData();
s.sensorData().clearOccupancyGridRaw();
_cachedMemoryUsage += s.sensorData().getMemoryUsed();
}
@@ -2898,7 +2889,7 @@ std::pair<pcl::PointCloud<pcl::PointXYZRGB>::Ptr, pcl::IndicesPtr> MainWindow::c
}
}
UINFO("Time rectification: %fs", time.ticks());
data.setImageRaw(rectifiedImages);
data.setRGBDImage(rectifiedImages, data.depthOrRightRaw(), data.cameraModels());
image = rectifiedImages;
}
}