#image #comparison #ssim

bin+lib dssim

Measures structural similarity between images using a multi-scale variant of the SSIM algorithm

11 stable releases

2.9.9 Apr 15, 2018
2.9.8 Apr 7, 2018
2.9.7 Dec 22, 2017
2.9.1 Nov 16, 2017
0.0.5 Aug 7, 2015

#15 in Images

Download history 36/week @ 2019-03-26 25/week @ 2019-04-02 12/week @ 2019-04-09 8/week @ 2019-04-16 20/week @ 2019-04-23 8/week @ 2019-04-30 26/week @ 2019-05-07 39/week @ 2019-05-14 130/week @ 2019-05-21 292/week @ 2019-05-28 144/week @ 2019-06-04 101/week @ 2019-06-11 100/week @ 2019-06-18 242/week @ 2019-06-25 92/week @ 2019-07-02

215 downloads per month
Used in 1 crate

AGPL-3.0

230KB
1.5K SLoC

RGBA Structural Similarity

This tool computes (dis)similarity between two or more PNG images using an algorithm approximating human vision.

Comparison is done using the SSIM algorithm at multiple weighed resolutions.

The value returned is 1/SSIM-1, where 0 means identical image, and >0 (unbounded) is amount of difference. Values are not directly comparable with other tools. See below on interpreting the values.

Features

  • Comparison is done in in L*a*b* color space (D65 white point, sRGB gamma) with chroma subsampling. Other implementations use "RGB" or grayscale without gamma correction.
  • Supports alpha channel.
  • No OpenCV or MATLAB needed.
    • DSSIM version 1.x uses C (C99) and libpng or Cocoa on macOS.
    • DSSIM version 2.x is easy to build with Rust.

Usage

dssim file-original.png file-modified.png

Will output something like "0.02341" (smaller is better) followed by a filename.

You can supply multiple filenames to compare them all with the first file:

dssim file.png modified1.png modified2.png modified3.png

You can save an image visualising the difference between the files:

dssim -o difference.png file.png file-modified.png

It's also usable as a library.

Interpreting the values

The amount of difference goes from 0 to infinity. It's not a percentage.

If you're comparing two different image compression codecs, then ensure you either:

  • compress images to the same file size, and then use DSSIM to compare which one is closests to the original, or
  • compress images to the same DSSIM value, and compare file sizes to see how much file size gain each option gives.

More about benchmarking image compression.

When you quote results, please include DSSIM version, since the scale has changed between versions. The version is printed when you run dssim -h.

Build or Download

You need Rust

cargo build --release

Will give you ./target/release/dssim.

Accuracy

Scores for version 2.9 measured against TID2013 database:

TID2013 Category Spearman correlation
Noise -0.930
Actual -0.937
Simple -0.945
Exotic -0.844
New -0.800
Color -0.808
Full -0.860

License

DSSIM is dual-licensed under AGPL or commercial license.

Dependencies

~2MB
~41K SLoC