kopia lustrzana https://github.com/OpenDroneMap/ODM
medfilt --> medfilt2d
rodzic
be2815ac1c
commit
af37b8c659
|
@ -303,9 +303,9 @@ def median_smoothing(geotiff_path, output_path, smoothing_iterations=1):
|
|||
for i in range(smoothing_iterations):
|
||||
log.ODM_INFO("Smoothing iteration %s" % str(i + 1))
|
||||
try:
|
||||
arr = signal.medfilt(arr, 5)
|
||||
arr = signal.medfilt2d(arr, 5)
|
||||
except MemoryError:
|
||||
log.ODM_WARNING("medfilt ran out of memory, switching to slower median_filter")
|
||||
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)
|
||||
|
||||
|
@ -322,11 +322,7 @@ def median_smoothing(geotiff_path, output_path, smoothing_iterations=1):
|
|||
|
||||
# write output
|
||||
with rasterio.open(output_path, 'w', **img.profile) as imgout:
|
||||
# No need to cast if we used the fallback filter (save memory)
|
||||
if used_fallback:
|
||||
imgout.write(arr, 1)
|
||||
else:
|
||||
imgout.write(arr.astype(dtype), 1)
|
||||
imgout.write(arr, 1)
|
||||
|
||||
log.ODM_INFO('Completed smoothing to create %s in %s' % (os.path.relpath(output_path), datetime.now() - start))
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue