Skip to content

Commit

Permalink
Merge pull request #1802 from smathermather/euclidean_merge_contrib
Browse files Browse the repository at this point in the history
Make euclidean merge available in contrib directory
  • Loading branch information
pierotofy authored Sep 18, 2024
2 parents af552c1 + d87fff3 commit 65fad52
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
13 changes: 13 additions & 0 deletions contrib/dem-blend/README.md
Original file line number Diff line number Diff line change
@@ -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
```
31 changes: 31 additions & 0 deletions contrib/dem-blend/dem-blend.py
Original file line number Diff line number Diff line change
@@ -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
)

0 comments on commit 65fad52

Please sign in to comment.