mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 09:30:25 +08:00
DbViewer: exporting map info in yaml file when exporting 2d occupancy grid (#978)
This commit is contained in:
@@ -3135,7 +3135,26 @@ void DatabaseViewer::exportSaved2DMap()
|
||||
path += ".pgm";
|
||||
}
|
||||
cv::imwrite(path.toStdString(), map8U);
|
||||
QMessageBox::information(this, tr("Export 2D map"), tr("Exported %1!").arg(path));
|
||||
|
||||
QFileInfo info(path);
|
||||
QString yaml = info.absolutePath() + "/" + info.baseName() + ".yaml";
|
||||
|
||||
float occupancyThr = Parameters::defaultGridGlobalOccupancyThr();
|
||||
Parameters::parse(ui_->parameters_toolbox->getParameters(), Parameters::kGridGlobalOccupancyThr(), occupancyThr);
|
||||
|
||||
std::ofstream file;
|
||||
file.open (yaml.toStdString());
|
||||
file << "image: " << info.baseName().toStdString() << ".pgm" << std::endl;
|
||||
file << "resolution: " << cellSize << std::endl;
|
||||
file << "origin: [" << xMin << ", " << yMin << ", 0.0]" << std::endl;
|
||||
file << "negate: 0" << std::endl;
|
||||
file << "occupied_thresh: " << occupancyThr << std::endl;
|
||||
file << "free_thresh: 0.196" << std::endl;
|
||||
file << std::endl;
|
||||
file.close();
|
||||
|
||||
|
||||
QMessageBox::information(this, tr("Export 2D map"), tr("Exported %1 and %2!").arg(path).arg(yaml));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user