diff --git a/opendm/boundary.py b/opendm/boundary.py index 55dc81b3..86ea5ae2 100644 --- a/opendm/boundary.py +++ b/opendm/boundary.py @@ -22,7 +22,7 @@ def compute_boundary_from_shots(reconstruction_json, buffer=0, reconstruction_of for shot_image in reconstruction['shots']: shot = reconstruction['shots'][shot_image] - if shot['gps_dop'] < 999999: + if shot.get('gps_dop', 999999) < 999999: camera = reconstruction['cameras'][shot['camera']] p = ogr.Geometry(ogr.wkbPoint) diff --git a/opendm/dem/commands.py b/opendm/dem/commands.py index aedf80cc..aa096e8b 100755 --- a/opendm/dem/commands.py +++ b/opendm/dem/commands.py @@ -333,7 +333,7 @@ def median_smoothing(geotiff_path, output_path, smoothing_iterations=1): dtype = img.dtypes[0] arr = img.read()[0] - nodata_locs = numpy.where(arr == nodata) + nodata_locs = arr == nodata # Median filter (careful, changing the value 5 might require tweaking) # the lines below. There's another numpy function that takes care of diff --git a/stages/odm_filterpoints.py b/stages/odm_filterpoints.py index 75b4a0ad..416007ad 100644 --- a/stages/odm_filterpoints.py +++ b/stages/odm_filterpoints.py @@ -28,9 +28,12 @@ class ODMFilterPoints(types.ODM_Stage): if reconstruction.is_georeferenced(): if not 'boundary' in outputs: avg_gsd = gsd.opensfm_reconstruction_average_gsd(tree.opensfm_reconstruction) - outputs['boundary'] = compute_boundary_from_shots(tree.opensfm_reconstruction, avg_gsd * 20, reconstruction.get_proj_offset()) # 20 is arbitrary - if outputs['boundary'] is None: - log.ODM_WARNING("Cannot compute boundary from camera shots") + if avg_gsd is not None: + outputs['boundary'] = compute_boundary_from_shots(tree.opensfm_reconstruction, avg_gsd * 20, reconstruction.get_proj_offset()) # 20 is arbitrary + if outputs['boundary'] is None: + log.ODM_WANING("Cannot compute boundary from camera shots") + else: + log.ODM_WARNING("Cannot compute boundary (GSD cannot be estimated)") else: log.ODM_WARNING("--auto-boundary set but so is --boundary, will use --boundary") else: