From f4fe4e4a26984b22570d4f938e37c44bd4fe30dd Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Wed, 19 Jun 2019 08:17:42 -0400 Subject: [PATCH] Use only median_filter per scipy docs (faster) Former-commit-id: e3bbfecc04849809e8987a95585edf1e019e4f87 --- opendm/dem/commands.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/opendm/dem/commands.py b/opendm/dem/commands.py index 935cf065..5ff0feb1 100644 --- a/opendm/dem/commands.py +++ b/opendm/dem/commands.py @@ -9,7 +9,7 @@ from opendm.system import run from opendm import point_cloud from opendm import io from opendm.concurrency import get_max_memory -from scipy import ndimage, signal +from scipy import ndimage from datetime import datetime from opendm import log try: @@ -299,15 +299,9 @@ def median_smoothing(geotiff_path, output_path, smoothing_iterations=1): # Median filter (careful, changing the value 5 might require tweaking) # the lines below. There's another numpy function that takes care of # these edge cases, but it's slower. - used_fallback = False for i in range(smoothing_iterations): log.ODM_INFO("Smoothing iteration %s" % str(i + 1)) - try: - arr = signal.medfilt2d(arr, 5) - except MemoryError: - log.ODM_WARNING("medfilt2d ran out of memory, switching to slower median_filter") - used_fallback = True - arr = ndimage.median_filter(arr, size=5, output=dtype) + arr = ndimage.median_filter(arr, size=5, output=dtype) # Fill corner points with nearest value if arr.shape >= (4, 4):