Skip to content

Python code to compute the difference between two images

License

Notifications You must be signed in to change notification settings

asztr/image_difference

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

image_difference

A flexible Python code to compute the signed RMSE difference between two images.

Usage

$ python image_difference.py <image1> <image2>  

Optional Parameters:

	[--output <string>] output filename (default: rms.png)  
	[--scale <float>] scale multiplier for difference  
	[--cbar_size <float>] size of colorbar (default: 0.8)  
	[--cmap <string>] matplotlib colormap (default: 'RdBu')  
	[--cbar_pad <float>] padding of the colorbar (default: 0.01)
	[--cbar_sens <float>] colorbar sensitivity (higher values -> higher color gradient close to zero) (default: 1.0)
	[--numeric] print total difference  
	[--divergent <bool>] divergent error: difference values with sign (default: True)
	[--mode {error_only, cbar_only, both}] output content (error and colorbar or only one component) (default: both)
	[--pct_ticks] show colorbar values as percentages
	[--vmin <float>] Minimum value in the colorbar
	[--vmax <float>] Maximum value in the colorbar

Examples

In the default mode of operation the code generates an image with the color difference between two images:

$ python image_difference.py image1.png image2.png  

Colorbar sensitivity

For plots where most of the information is contained in a subset of the colorbar range (e.g. low values of error), it might be useful to change the sensitivity parameter:

./image_difference.py image1.png image2.png --cbar_sens <value>

Colormap

With the --cmap option we can specify the colormap. All matplotlib cmaps are supported, although in the default case (with positive and negative error values) divergent colormaps with a white center are recommended. For a list of colormaps: https://matplotlib.org/users/colormaps.html

About

Python code to compute the difference between two images

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages