mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
Export: fixed calibration not exported if camera name is not set. For multi-camera, added index suffix to yaml.
This commit is contained in:
@@ -366,7 +366,11 @@ bool CameraModel::load(const std::string & directory, const std::string & camera
|
|||||||
|
|
||||||
bool CameraModel::save(const std::string & directory) const
|
bool CameraModel::save(const std::string & directory) const
|
||||||
{
|
{
|
||||||
std::string filePath = directory+"/"+name_+".yaml";
|
if(name_.empty())
|
||||||
|
{
|
||||||
|
UWARN("Camera name is empty, will use general \"camera\" as name.");
|
||||||
|
}
|
||||||
|
std::string filePath = directory+"/"+(name_.empty()?"camera":name_)+".yaml";
|
||||||
if(!filePath.empty() && (!K_.empty() || !D_.empty() || !R_.empty() || !P_.empty()))
|
if(!filePath.empty() && (!K_.empty() || !D_.empty() || !R_.empty() || !P_.empty()))
|
||||||
{
|
{
|
||||||
UINFO("Saving calibration to file \"%s\"", filePath.c_str());
|
UINFO("Saving calibration to file \"%s\"", filePath.c_str());
|
||||||
|
|||||||
@@ -354,7 +354,7 @@ void OccupancyGrid::createLocalMap(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UWARN("Cannot create local map, scan is empty (node=%d).", node.id());
|
UWARN("Cannot create local map, scan is empty (node=%d, %s=false).", node.id(), Parameters::kGridFromDepth().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -671,7 +671,7 @@ int main(int argc, char * argv[])
|
|||||||
|
|
||||||
if(exportImages && !rgb.empty())
|
if(exportImages && !rgb.empty())
|
||||||
{
|
{
|
||||||
std::string dirSuffix = (depth.type() != CV_16UC1 && depth.type() != CV_32FC1)?"rgb":"left";
|
std::string dirSuffix = (depth.type() != CV_16UC1 && depth.type() != CV_32FC1)?"left":"rgb";
|
||||||
std::string dir = outputDirectory+"/"+baseName+"_"+dirSuffix;
|
std::string dir = outputDirectory+"/"+baseName+"_"+dirSuffix;
|
||||||
UDirectory::makeDir(dir);
|
UDirectory::makeDir(dir);
|
||||||
std::string outputPath=dir+"/"+(exportImagesId?uNumber2Str(iter->first):uFormat("%f",node.getStamp()))+".jpg";
|
std::string outputPath=dir+"/"+(exportImagesId?uNumber2Str(iter->first):uFormat("%f",node.getStamp()))+".jpg";
|
||||||
@@ -707,7 +707,14 @@ int main(int argc, char * argv[])
|
|||||||
{
|
{
|
||||||
for(size_t i=0; i<models.size(); ++i)
|
for(size_t i=0; i<models.size(); ++i)
|
||||||
{
|
{
|
||||||
models[i].save(outputDirectory);
|
CameraModel model = models[i];
|
||||||
|
if(models.size() > 1) {
|
||||||
|
std::string prefix = model.name();
|
||||||
|
if(prefix.empty())
|
||||||
|
prefix = "camera";
|
||||||
|
model.setName(prefix + "_" + uNumber2Str((int)i));
|
||||||
|
}
|
||||||
|
model.save(outputDirectory);
|
||||||
}
|
}
|
||||||
calibSaved = !models.empty();
|
calibSaved = !models.empty();
|
||||||
if(node.sensorData().stereoCameraModel().isValidForProjection())
|
if(node.sensorData().stereoCameraModel().isValidForProjection())
|
||||||
|
|||||||
Reference in New Issue
Block a user