• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

src/H03-May-2022-1,7171,338

.cargo-checksum.jsonH A D03-May-202289 11

.cargo_vcs_info.jsonH A D01-Jan-197074 65

Cargo.tomlH A D01-Jan-19701.4 KiB4539

Cargo.toml.orig-cargoH A D01-Jan-1970805 3025

LICENSEH A D01-Jan-197033.7 KiB662544

README.mdH A D01-Jan-19703.9 KiB9156

README.md

1# RGBA Structural Similarity
2
3This tool computes (dis)similarity between two or more images using an algorithm approximating human vision. Comparison is done using a variant of [the SSIM algorithm](https://ece.uwaterloo.ca/~z70wang/research/ssim/).
4
5The 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](#interpreting-the-values) on interpreting the values.
6
7## Features
8
9* Improved algorithm
10    * Compares at multiple weighed resolutions, and scaling is done in linear-light RGB. It's sensitive to distortions of various sizes and blends colors correctly to detect e.g. chroma subsampling errors.
11    * Uses L\*a\*b\* color space for the SSIM algorithm. It measures brightness and color much better than metrics from average of RGB channels.
12* Supports alpha channel.
13* Supports images with color profiles.
14* Takes advantage of multi-core CPUs.
15* Can be used as a library in C, Rust, and WASM.
16* No OpenCV or MATLAB needed.
17
18## Usage
19
20    dssim file-original.png file-modified.png
21
22Will output something like "0.02341" (smaller is better) followed by a filename.
23
24You can supply multiple filenames to compare them all with the first file:
25
26    dssim file.png modified1.png modified2.png modified3.png
27
28You can save an image visualising the difference between the files:
29
30    dssim -o difference.png file.png file-modified.png
31
32It's also usable [as a library](https://docs.rs/dssim).
33
34Please be mindful about color profiles in the images. Different profiles, or lack of support for profiles in other tools, can make images appear different even when the pixels are the same.
35
36### Interpreting the values
37
38The amount of difference goes from 0 to infinity. It's not a percentage.
39
40If you're comparing two different image compression codecs, then ensure you either:
41
42* compress images to the same file size, and then use DSSIM to compare which one is closests to the original, or
43* compress images to the same DSSIM value, and compare file sizes to see how much file size gain each option gives.
44
45[More about benchmarking image compression](https://kornel.ski/faircomparison).
46
47When you quote results, please include the DSSIM version. The scale has changed between versions.
48The version is printed when you run `dssim -h`.
49
50## Download
51
52[Download from releases page](https://github.com/kornelski/dssim/releases). It's also available in Mac Homebrew and Ubuntu Snaps.
53
54### Build from source
55
56You'll need [Rust 1.48](https://rustup.rs) or later. Clone the repo and run:
57
58    cargo build --release
59
60Will give you `./target/release/dssim`.
61
62## Accuracy
63
64Scores for version 3.0 [measured][2] against [TID2013][1] database:
65
66TID2013  | Spearman | Kendall
67---------|----------|--------
68Noise    |  -0.9392 | -0.7789
69Actual   |  -0.9448 | -0.7913
70Simple   |  -0.9499 | -0.8082
71Exotic   |  -0.8436 | -0.6574
72New      |  -0.8717 | -0.6963
73Color    |  -0.8789 | -0.7032
74Full     |  -0.8711 | -0.6984
75
76[1]: http://www.ponomarenko.info/tid2013.htm
77[2]: https://lib.rs/crates/tid2013stats
78
79## License
80
81DSSIM is dual-licensed under [AGPL](LICENSE) or [commercial](https://supso.org/projects/dssim) license.
82
83## The algorithm improvements in DSSIM
84
85* The comparison is done on multiple weighed scales (based on IWSSIM) to measure features of different sizes. A single-scale SSIM is biased towards differences smaller than its gaussian kernel.
86* Scaling is done in linear-light RGB to model physical effects of viewing distance/lenses. Scaling in sRGB or Lab would have incorrect gamma and mask distortions caused by chroma subsampling.
87* a/b channels of Lab are compared with lower spatial precision to simulate eyes' higher sensitivity to brightness than color changes.
88* The lightness component of SSIM is ignored when comparing color channels.
89* SSIM score is pooled using mean absolute deviation. You can get per-pixel SSIM from the API to implement custom pooling.
90
91