Skip to content

createprobmapoverlay.py

Chris Churas edited this page Jun 2, 2017 · 17 revisions

Creates new image by overlaying a probability map, set to a user specified color, semi-transparently on top of a base image.

Example usage:

createprobmapoverlay.py baseimage.png probmap.png overlay.png

For help run:

createprobmapoverlay.py --help

Examples below use the following image from Pixabay as input converted to grayscale with createchmimage.py:

grayonly corgi

and some of the examples use this probability map image:

corgi probmap

How to download the above two images using wget:

wget https://raw.githubusercontent.com/wiki/CRBS/chmutil/images/corgi_small_grayonly.png
wget https://raw.githubusercontent.com/wiki/CRBS/chmutil/images/corgi_small_probmap.png

Example usage no options

The command below takes the images above and overlays them with default parameters. createprobmapoverlay.py by default uses blue for the overlay color and a threshold of 30% and a default opacity of 70.

createprobmapoverlay.py corgi_small_grayonly.png corgi_small_probmap.png \ 
corgi_small_overlay.png

corgi blue overlay

Example usage with opacity option

The command below takes the images above and overlays them with added --opacity option set to 250. --opacity values can range between 0 and 255, where 0 means completely transparent and 255 is opaque.

createprobmapoverlay.py corgi_small_grayonly.png corgi_small_probmap.png \
 corgi_small_overlay250.png --opacity 250

corgi blue overlay