diff --git a/contrib/dem-blend/README.md b/contrib/dem-blend/README.md new file mode 100644 index 000000000..9d61dc5ba --- /dev/null +++ b/contrib/dem-blend/README.md @@ -0,0 +1,13 @@ +# DEM Blending + +Blend sets of DEMs by calculating euclidean distance to null values and weighting the combination of elevation models. Based on the split-merge tool within ODM. + +Requirements: +* Directory full of images to blend together +* NoData should be coded as a value of -9999 + +## Usage + +```BASH +docker run -ti --rm -v /home/youruser/folder_with_dems:/input --entrypoint /code/contrib/dem-blend/dem-blend.py opendronemap/odm /input +``` diff --git a/contrib/dem-blend/dem-blend.py b/contrib/dem-blend/dem-blend.py new file mode 100755 index 000000000..6403c444a --- /dev/null +++ b/contrib/dem-blend/dem-blend.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 +# Authors: Piero Toffanin, Stephen Mather +# License: AGPLv3 + +import os +import glob +import sys +sys.path.insert(0, os.path.join("..", "..", os.path.dirname(__file__))) + +import argparse +import multiprocessing +from opendm.dem import merge + +parser = argparse.ArgumentParser(description='Merge and blend DEMs using OpenDroneMap\'s approach.') +parser.add_argument('input_dems', + type=str, + help='Path to input dems (.tif)') + +args = parser.parse_args() + +if not os.path.exists(args.input_dems): + print("%s does not exist" % args.input_dems) + exit(1) + +output_dem = os.path.join(args.input_dems, 'merged_blended_dem.tif') +input_dem_path = os.path.join(args.input_dems, '*.tif') +input_dems = glob.glob(input_dem_path) + +merge.euclidean_merge_dems(input_dems + ,output_dem=output_dem + )