mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
Export: added --output name option.
This commit is contained in:
@@ -56,6 +56,7 @@ void showUsage()
|
|||||||
printf("\nUsage:\n"
|
printf("\nUsage:\n"
|
||||||
"rtabmap-export [options] database.db\n"
|
"rtabmap-export [options] database.db\n"
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
|
" --output Output name (default: name of the database is used).\n"
|
||||||
" --bin Export PLY in binary format.\n"
|
" --bin Export PLY in binary format.\n"
|
||||||
" --las Export cloud in LAS instead of PLY (PDAL dependency required).\n"
|
" --las Export cloud in LAS instead of PLY (PDAL dependency required).\n"
|
||||||
" --mesh Create a mesh.\n"
|
" --mesh Create a mesh.\n"
|
||||||
@@ -133,6 +134,7 @@ int main(int argc, char * argv[])
|
|||||||
bool camProjection = false;
|
bool camProjection = false;
|
||||||
bool exportPoses = false;
|
bool exportPoses = false;
|
||||||
bool exportImages = false;
|
bool exportImages = false;
|
||||||
|
std::string outputName;
|
||||||
cv::Vec3f min, max;
|
cv::Vec3f min, max;
|
||||||
for(int i=1; i<argc; ++i)
|
for(int i=1; i<argc; ++i)
|
||||||
{
|
{
|
||||||
@@ -140,6 +142,18 @@ int main(int argc, char * argv[])
|
|||||||
{
|
{
|
||||||
showUsage();
|
showUsage();
|
||||||
}
|
}
|
||||||
|
else if(std::strcmp(argv[i], "--output") == 0)
|
||||||
|
{
|
||||||
|
++i;
|
||||||
|
if(i<argc-1)
|
||||||
|
{
|
||||||
|
outputName = argv[i];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
showUsage();
|
||||||
|
}
|
||||||
|
}
|
||||||
else if(std::strcmp(argv[i], "--bin") == 0)
|
else if(std::strcmp(argv[i], "--bin") == 0)
|
||||||
{
|
{
|
||||||
binary = true;
|
binary = true;
|
||||||
@@ -563,7 +577,7 @@ int main(int argc, char * argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string outputDirectory = UDirectory::getDir(dbPath);
|
std::string outputDirectory = UDirectory::getDir(dbPath);
|
||||||
std::string baseName = uSplit(UFile::getName(dbPath), '.').front();
|
std::string baseName = outputName.empty()?uSplit(UFile::getName(dbPath), '.').front():outputName;
|
||||||
|
|
||||||
if(ba)
|
if(ba)
|
||||||
{
|
{
|
||||||
@@ -874,9 +888,9 @@ int main(int argc, char * argv[])
|
|||||||
printf("Camera projection... done! (%fs)\n", timer.ticks());
|
printf("Camera projection... done! (%fs)\n", timer.ticks());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(saveInDb)
|
|
||||||
{
|
|
||||||
if(!(mesh || texture))
|
if(!(mesh || texture))
|
||||||
|
{
|
||||||
|
if(saveInDb)
|
||||||
{
|
{
|
||||||
printf("Saving in db... (%d points)\n", !cloudToExport->empty()?(int)cloudToExport->size():(int)cloudIToExport->size());
|
printf("Saving in db... (%d points)\n", !cloudToExport->empty()?(int)cloudToExport->size():(int)cloudIToExport->size());
|
||||||
if(!cloudToExport->empty())
|
if(!cloudToExport->empty())
|
||||||
@@ -885,7 +899,6 @@ int main(int argc, char * argv[])
|
|||||||
driver->saveOptimizedMesh(util3d::laserScanFromPointCloud(*cloudIToExport, Transform(), false).data());
|
driver->saveOptimizedMesh(util3d::laserScanFromPointCloud(*cloudIToExport, Transform(), false).data());
|
||||||
printf("Saving in db... done!\n");
|
printf("Saving in db... done!\n");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string ext = las?"las":"ply";
|
std::string ext = las?"las":"ply";
|
||||||
@@ -909,6 +922,7 @@ int main(int argc, char * argv[])
|
|||||||
#endif
|
#endif
|
||||||
printf("Saving %s... done!\n", outputPath.c_str());
|
printf("Saving %s... done!\n", outputPath.c_str());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Meshing...
|
// Meshing...
|
||||||
if(mesh || texture)
|
if(mesh || texture)
|
||||||
|
|||||||
Reference in New Issue
Block a user