Skip to content
an automated river analysis and mapping engine
Python
Branch: master
Clone or download
Latest commit 0420f10 Aug 12, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples add export shapefile function Jun 15, 2017
rivamap Minor changes for Python3.x Aug 12, 2019
README.md Update README.md Aug 12, 2019
setup.py add setup file May 6, 2016

README.md

RivaMap: An Automated River Analysis and Mapping Engine

Related papers

  • F. Isikdogan, A.C. Bovik, and P. Passalacqua, "RivaMap: an automated river analysis and mapping engine," Remote Sensing of Environment, Special Issue on Big Remotely Sensed Data, 2017. [Read at ScienceDirect], [PDF]
  • F. Isikdogan, A.C. Bovik, and P. Passalacqua, "Automatic channel network extraction from remotely sensed images by singularity analysis," IEEE Geoscience and Remote Sensing Letters, 12, 11, 2218-2221, 2015. [Read at IEEExplore], [PDF]

Dependencies and Installation

Dependencies:

  • OpenCV 2.4
  • Python 2.7 Code updated and runs Python 3.7 now (8/12/2019 -Jay)
  • Numpy
  • Scipy
  • Matplotlib
  • GDAL
  • pyshp

Installing from PyPI:

$ sudo pip install rivamap

Installing from GitHub:

$ git clone https://github.com/isikdogan/rivamap.git
$ sudo python setup.py install

Example Use:

See example.ipynb

Example Results

Example Result Example Result Example Result Example Result

Reference

Function

Description

preprocess.mndwi

Computes the modified normalized difference water index.

Inputs:
green: green band (e.g. Landsat 8 band 3)
mir: middle infrared band (e.g. Landsat 8 band 6)

Returns:
mndwi: mndwi response

preprocess.contrastStretch

Applies contrast stretch to an input image. Inputs and outputs an image.

preprocess.im2double

Converts image datatype to float. Inputs and outputs an image.

preprocess.double2im

Converts double data array to image. Inputs and outputs an image.

singularity_index.SingularityIndexFilters

Creates the filters that are needed for computing the modified multiscale singularity index response. The filters can be used for processing many input images once the filters are created.

Keyword arguments:
minScale: minimum scale sigma (default 1.2 pixels)
nrScales: number of scales (default 15)

singularity_index.applyMMSI

Applies the filters to a given input image to compute the modified multiscale singularity index response. Estimates the width and the dominant orientation angle for each spatial location.

Inputs:
I1: input image (e.g. Landsat NIR band or MNDWI)
filters: an instance of SingularityIndexFilters class that contains precomputed filters
togglePolarity: changes polarity, use if the rivers are darker than land in the input image (i.e. SAR images)

Returns:
psi: the singularity index response
widthMap: estimated width at each spatial location (x,y)
orient: local orientation at each spatial location (x,y)

delineate.extractCenterlines

Uses the previously computed singularity index response (psi) and the dominant orientation (orient) to extract centerlines.

Inputs: (can be obtained by running applyMMSI function)
psi: the singularity index response
orient: local orientation at each spatial location (x,y)

Returns:
nms: Non-maxima suppressed singularity index response (centerlines)

delineate.thresholdCenterlines

Uses a continuity-preserving hysteresis thresholding to classify centerlines.

Inputs:
nms: Non-maxima suppressed singularity index response

Keyword Arguments:
bimodal: true if the areas of rivers in the image are sufficiently large that the distribution of psi is bimodal
tLow: lower threshold (automatically set if bimodal=True)
tHigh: higher threshold (automatically set if bimodal=True)

Returns:
centerlines: a binary matrix that indicates centerline locations

georef.loadGeoMetadata

Reads metadata from a GeoTIFF file.

Inputs:
filepath: the path to the file

Returns:
gm: metadata

georef.saveAsGeoTiff

Saves a raster image as a GeoTIFF file

Inputs:
gm: georeferencing metadata
I: raster image
filepath: save destination

georef.pix2lonlat

Convers pixel coordinates into longitude and latitude.

Inputs:
gm: georeferencing metadata
x, y: pixel coordinates

Returns:
lon, lat: longitude and latitude

georef.lonlat2pix

Convers longitude and latitude into pixel coordinates.

Inputs:
gm: georeferencing metadata
lon, lat: longitude and latitude

Returns:
x, y: pixel coordinates

georef.exportCSVfile

Exports (coordinate, width) pairs to a comma separated text file.

Inputs:
centerlines: a binary matrix that indicates centerline locations
widthMap: estimated width at each spatial location (x,y)
gm: georeferencing metadata filepath: the path to the file

georef.exportShapeFile [NEW]

Exports line segments to a ShapeFile.

Inputs:
centerlines: a binary matrix that indicates centerline locations
widthMap: estimated width at each spatial location (x,y)
gm: georeferencing metadata filepath: the path to the file

visualization.generateRasterMap

Generates a raster map of channels. It draws a line of length w(x, y) and orientation θ(x, y) at each spatial location.

Inputs:
centerlines: a binary matrix that indicates centerline locations
orient: local orientation at each spatial location (x,y)
widthMap: estimated width at each spatial location (x,y)

Keyword Arguments:
thickness: thickness of the lines (default 3)

Returns:
raster: the raster map

visualization.generateVectorMap

Generates a vector map of channels. It draws a line of length w(x, y) and orientation θ(x, y) at each spatial location.

Inputs:
centerlines: a binary matrix that indicates centerline locations
orient: local orientation at each spatial location (x,y)
widthMap: estimated width at each spatial location (x,y)
saveDest: output figure save destination

Keyword Arguments:
thickness: thickness of the lines (default 0.2)

Returns:
None (saves the figure at saveDest)

visualization.quiverPlot

Generates a quiver plot that shows channel orientation and singularity index response strength.

Inputs:
psi: singularity index response
orient: local orientation at each spatial location (x,y)
saveDest: output figure save destination

Returns:
None (saves the figure at saveDest)

You can’t perform that action at this time.