jterrace / pyssim

A Python module for computing the Structural Similarity Image Metric (SSIM)
MIT License
340 stars 62 forks source link

pyssim

This module implements the Structural Similarity Image Metric (SSIM). Original code written by Antoine Vacavant from http://isit.u-clermont1.fr/~anvacava/code.html, with modifications by Christopher Godfrey and Jeff Terrace.

Build Status

Installation

pip install pyssim

Running

$ pyssim --help
usage: pyssim [-h] image1.png image path with* or image2.png

Compares an image with a list of images using the SSIM metric.
  Example:
    pyssim test-images/test1-1.png "test-images/*"

positional arguments:
  image1.png
  image path with* or image2.png

optional arguments:
  -h, --help            show this help message and exit
  --cw                  compute the complex wavelet SSIM
  --width WIDTH         scales the image before computing SSIM
  --height HEIGHT       scales the image before computing SSIM

Compatibility

pyssim is known to work with Python 2.7, 3.4 and 3.5 and we test these versions on Travis CI to make sure they keep working.

Development

To run from a local git client:

PYTHONPATH="." python ssim

To run the lint checks:

pylint --rcfile=.pylintrc -r n ssim setup.py

To test:

$ PYTHONPATH="." python ssim test-images/test1-1.png "test-images/*"
test-images/test1-1.png - test-images/test1-1.png: 1
test-images/test1-1.png - test-images/test1-2.png: 0.9980119
test-images/test1-1.png - test-images/test2-1.png: 0.6726952
test-images/test1-1.png - test-images/test2-2.png: 0.6485879

References