Export: fixed calibration not exported if camera name is not set. For multi-camera, added index suffix to yaml.

This commit is contained in:
matlabbe
2021-04-09 16:20:08 -04:00
parent b92f55be43
commit f4207979ad
3 changed files with 15 additions and 4 deletions
+5 -1
View File
@@ -366,7 +366,11 @@ bool CameraModel::load(const std::string & directory, const std::string & camera
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()))
{
UINFO("Saving calibration to file \"%s\"", filePath.c_str());
+1 -1
View File
@@ -354,7 +354,7 @@ void OccupancyGrid::createLocalMap(
}
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
+9 -2
View File
@@ -671,7 +671,7 @@ int main(int argc, char * argv[])
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;
UDirectory::makeDir(dir);
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)
{
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();
if(node.sensorData().stereoCameraModel().isValidForProjection())