Python script to transform a Digital Elevation Model (DEM) image into a map of rivers.
Python script to transform a Digital Elevation Model (DEM) image into a map of rivers.
You need Python 3 with numpy
and imageio
.
Script execution:rivermapper.py input_image.tif output_image.tif [-l sea_level] [-s random_seed] [-c contrast] [-d output_bit_depth]
or:rivermapper.py -i input_image.tif -o output_image.tif [-l sea_level] [-s random_seed] [-c contrast] [-d output_bit_depth]
Used RAM: around 10 Mo per milion pixels (400 Mo for a 6001x6001 SRTM image)
Time taken: it can take several minutes. The same SRTM image takes arount 20 minutes. Please be patient.
It should support most of image types (PNG, TIFF, JPG, BMP, …) and bit depths (8, 16, 32, 64).
Behaviour:
An example with the Corsica island:
The original image in zip file: corsica.zip
Enhanced DEM to show the mountains and the valleys:
Rivers map built with RiverMapper: