Fixed odm_georef normals handling, wrong pdal path for 2.5D meshing step

pull/803/head
Piero Toffanin 2018-04-09 16:32:42 -04:00
rodzic b4fa9e9efa
commit d4a4415dce
2 zmienionych plików z 26 dodań i 6 usunięć

Wyświetl plik

@ -1377,9 +1377,31 @@ void Georef::transformPointCloud(const char *inputFile, const Eigen::Transform<S
file.parse_header(ss);
std::shared_ptr<PlyData> vertices = file.request_properties_from_element("vertex", { "x", "y", "z" });
std::shared_ptr<PlyData> normals = file.request_properties_from_element("vertex", { "nx", "ny", "nz" });
std::shared_ptr<PlyData> colors = file.request_properties_from_element("vertex", { "diffuse_red", "diffuse_green", "diffuse_blue" });
std::shared_ptr<PlyData> normals;
std::shared_ptr<PlyData> colors;
// Not all point clouds have normals and colors
// and different naming conventions apply
try{
normals = file.request_properties_from_element("vertex", { "nx", "ny", "nz" });
}catch(const std::exception &){}
if (!normals){
try{
normals = file.request_properties_from_element("vertex", { "normal_x", "normal_y", "normal_z" });
}catch(const std::exception &){}
}
try{
colors = file.request_properties_from_element("vertex", { "diffuse_red", "diffuse_green", "diffuse_blue" });
}catch(const std::exception &){}
if (!colors){
try{
colors = file.request_properties_from_element("vertex", { "red", "green", "blue" });
}catch(const std::exception &){}
}
file.read(ss);
log_ << "Successfully loaded " << vertices->count << " points with corresponding normals from file.\n";
@ -1424,8 +1446,8 @@ void Georef::transformPointCloud(const char *inputFile, const Eigen::Transform<S
PlyFile outFile;
outFile.add_properties_to_element("vertex", { "x", "y", "z" }, Type::FLOAT64, verts.size() * 3, reinterpret_cast<uint8_t*>(verts.data()), Type::INVALID, 0);
outFile.add_properties_to_element("vertex", { "nx", "ny", "nz" }, Type::FLOAT32, verts.size() * 3, reinterpret_cast<uint8_t*>(normals->buffer.get()), Type::INVALID, 0);
outFile.add_properties_to_element("vertex", { "red", "green", "blue" }, Type::UINT8, verts.size() * 3, reinterpret_cast<uint8_t*>(colors->buffer.get()), Type::INVALID, 0);
if (normals) outFile.add_properties_to_element("vertex", { "nx", "ny", "nz" }, Type::FLOAT32, verts.size() * 3, reinterpret_cast<uint8_t*>(normals->buffer.get()), Type::INVALID, 0);
if (colors) outFile.add_properties_to_element("vertex", { "red", "green", "blue" }, Type::UINT8, verts.size() * 3, reinterpret_cast<uint8_t*>(colors->buffer.get()), Type::INVALID, 0);
outFile.get_comments().push_back("generated by OpenDroneMap");
outFile.write(outputStream, false);

Wyświetl plik

@ -129,8 +129,6 @@ class ODMGeoreferencingCell(ecto.Cell):
'provided a GCP file. ')
doPointCloudGeo = False # skip the rest of the georeferencing
odm_georeferencing_model_ply_geo = os.path.join(tree.odm_georeferencing,
tree.odm_georeferencing_model_ply_geo)
if doPointCloudGeo:
# update images metadata
geo_ref = reconstruction.georef