Report for non-georeferenced datasets

pull/1225/head
Piero Toffanin 2021-01-15 08:27:36 -05:00
rodzic d38a04c854
commit 1788b498bb
2 zmienionych plików z 15 dodań i 12 usunięć

Wyświetl plik

@ -172,6 +172,9 @@ def filter(input_point_cloud, output_point_cloud, standard_deviation=2.5, meank=
if not os.path.exists(output_point_cloud):
log.ODM_WARNING("{} not found, filtering has failed.".format(output_point_cloud))
def export_info_json(pointcloud_path, info_file_path):
system.run('pdal info --dimensions "X,Y,Z" "{0}" > "{1}"'.format(pointcloud_path, info_file_path))
def export_summary_json(pointcloud_path, summary_file_path):
system.run('pdal info --summary "{0}" > "{1}"'.format(pointcloud_path, summary_file_path))

Wyświetl plik

@ -10,7 +10,7 @@ from opendm import types
from opendm.shots import get_geojson_shots_from_opensfm
from opendm.osfm import OSFMContext
from opendm import gsd
from opendm.point_cloud import export_summary_json
from opendm.point_cloud import export_info_json
from opendm.cropper import Cropper
from opendm.orthophoto import get_orthophoto_vars, get_max_memory
from opendm.tiles.tiler import generate_colored_hillshade
@ -28,12 +28,12 @@ def hms(seconds):
return '{}s'.format(round(s, 0))
def generate_point_cloud_stats(input_point_cloud, pc_summary_file):
if not os.path.exists(pc_summary_file):
export_summary_json(input_point_cloud, pc_summary_file)
def generate_point_cloud_stats(input_point_cloud, pc_info_file):
if not os.path.exists(pc_info_file):
export_info_json(input_point_cloud, pc_info_file)
if os.path.exists(pc_summary_file):
with open(pc_summary_file, 'r') as f:
if os.path.exists(pc_info_file):
with open(pc_info_file, 'r') as f:
return json.loads(f.read())
class ODMReport(types.ODM_Stage):
@ -82,17 +82,17 @@ class ODMReport(types.ODM_Stage):
point_cloud_file = tree.odm_georeferencing_model_laz
views_dimension = "UserData"
# pc_summary_file should have been generated by cropper
pc_summary_file = os.path.join(tree.odm_georeferencing, "odm_georeferenced_model.summary.json")
odm_stats['point_cloud_statistics'] = generate_point_cloud_stats(tree.odm_georeferencing_model_laz, pc_summary_file)
# pc_info_file should have been generated by cropper
pc_info_file = os.path.join(tree.odm_georeferencing, "odm_georeferenced_model.info.json")
odm_stats['point_cloud_statistics'] = generate_point_cloud_stats(tree.odm_georeferencing_model_laz, pc_info_file)
else:
ply_pc = os.path.join(tree.odm_filterpoints, "point_cloud.ply")
if os.path.exists(ply_pc):
point_cloud_file = ply_pc
views_dimension = "views"
pc_summary_file = os.path.join(tree.odm_filterpoints, "point_cloud.summary.json")
odm_stats['point_cloud_statistics'] = generate_point_cloud_stats(ply_pc, pc_summary_file)
pc_info_file = os.path.join(tree.odm_filterpoints, "point_cloud.info.json")
odm_stats['point_cloud_statistics'] = generate_point_cloud_stats(ply_pc, pc_info_file)
else:
log.ODM_WARNING("No point cloud found")
@ -117,7 +117,7 @@ class ODMReport(types.ODM_Stage):
# Generate overlap diagram
if odm_stats.get('point_cloud_statistics') and point_cloud_file and views_dimension:
bounds = odm_stats['point_cloud_statistics'].get('summary', {}).get('bounds')
bounds = odm_stats['point_cloud_statistics'].get('stats', {}).get('bbox', {}).get('native', {}).get('bbox')
if bounds:
image_target_size = 1400 # pixels
osfm_stats_dir = os.path.join(tree.opensfm, "stats")