/stb-image-metrics

This utility compares two graphics files based on metrics.

Primary LanguageCThe UnlicenseUnlicense

stb-image-metrics

This utility compares two graphics files based on metrics.

Includes metrics:

The value of MSE metrics is from 0.0 (minimum difference) to 1.0 (maximum difference).

The value of PSNR and SDSNR metrics is from 0.0 (maximum difference) to inf.

The value of SSIM and VIFP1 metrics is from 1.0 (minimum difference) to 0.0 (maximum difference).

The value of SHARPENBAD metrics is from 1.0 (minimum difference) to 0.0 (maximum difference).

The value of Correlation metrics is from 1.0 (minimum difference) to 0.0 (maximum difference).

The value of NHW metrics is from 0.0 (minimum difference) to 1.0 (maximum difference).

build

load submodules

submodules:

$ git submodule init
$ git submodule update

install dependencies

build dependencies:

  • build-essential
  • cmake
$ sudo apt-get install build-essential cmake

compilation

$ mkdir build
$ cd build
$ cmake ..
$ make

use

The first and second parameters indicate the paths to the original and compared images. The third (optional) specifies the path to the metric image {PNG}.

stbnhwmetrics ${IMAGE_ORIG_PATH} ${IMAGE_COMPARE_PATH} [metric.out.png]

structure

Metrics

"Universal Scale" of metrics (UM):

  0.0
  ... (DIRTY) ...
  0.5
  ... (LOW) ...
  0.75
  ... (MEDIUM) ...
  0.875
  ... (SUBHIGH) ...
  0.9375
  ... (HIGH) ...
  0.96875
  ... (VERYHIGH) ...
  1.0

Trends:

  UM = 0.0713 * sqrt(sqrt(1.0 / MSE))
  UM = 0.109 * sqrt(PNSR)
  UM = 0.122 * sqrt(SDNSR)
  UM = 1.0 * cor_sigma(cor_sigma(COR))
  UM = 2.18 * cor_sigma(cor_sigma(SSIM))
  UM = 3.61 * cor_sigma(VIFP1)
  UM = 3.0 * (SMALLFRY / 100 - 0.5) * (SMALLFRY / 100 - 0.5)
  UM = (1.0 + 0.75 / radius) * cor_sigma(SHARPENBAD)
  UM = 0.261 * sqrt(sqrt(1.0 / NHW-C))
  UM = 0.286 * sqrt(sqrt(1.0 / NHW-N))
  UM = 0.223 * sqrt(sqrt(1.0 / NHW-R))

  cor_sigma(M) = 1.0 - sqrt(1.0 - M * M)

Origin and Compare:

origin compare

Metrcics:

stbimmetrics lena.png lena.quant444.png lena.quant444.psnr.png 
Load: lena.png
image: 256x256:3
Load: lena.quant444.png
image: 256x256:3
type: psnr
metric: 18.663233
Save png: lena.quant444.psnr.png
  • metric MSE: 0.013604, UM: 0.208771
  • metric PSNR: 18.663233, UM: 0.470890
  • metric SDSNR: 13.888971, UM: 0.454668
  • metric Corelation: 0.953666, UM: 0.285007
  • metric SSIM: 0.618509, UM: 0.050606
  • metric VIFP1: 0.170903, UM: 0.053111
  • metric SMALLFRY: 83.753342, UM: 0.341786
  • metric SHARPENBAD: 0.389942, UM: 0.138531
  • metric NHW-N: 0.072673, UM: 0.550836
  • metric NHW-C: 0.145290, UM: 0.422748
  • metric NHW-R: 0.116387, UM: 0.381794

See all demo of stb-image-metrics.