This utility compares two graphics files based on metrics.
Includes metrics:
- MSE / MAX^2, MAX = 255
- PSNR
- SDSNR
- SSIM
- VIFP1
- SMALLFRY
- SHARPENBAD
- Correlation
- NHW neatness
- NHW convolutional
- NHW relative
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).
submodules:
$ git submodule init
$ git submodule update
build dependencies:
- build-essential
- cmake
$ sudo apt-get install build-essential cmake
$ mkdir build
$ cd build
$ cmake ..
$ make
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]
dependencies.c
- API stbmetricsnhw.h
- NHW metricsmetricspsnr.h
- metrics PSNR and MSEmetricsum.h
- "Universal Scale" of metrics (UM)smallfry.h
- metrics SMALLFRY, SHARPENBAD and Correlationssim.h
- metrics SSIM and VIFP1stb/
- stbstbimmetrics.c
- CLI program.ycbcr.h
- YCbCr color space.
"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:
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
MSE: 0.013604, UM: 0.208771
PSNR: 18.663233, UM: 0.470890
SDSNR: 13.888971, UM: 0.454668
Corelation: 0.953666, UM: 0.285007
SSIM: 0.618509, UM: 0.050606
VIFP1: 0.170903, UM: 0.053111
SMALLFRY: 83.753342, UM: 0.341786
SHARPENBAD: 0.389942, UM: 0.138531
NHW-N: 0.072673, UM: 0.550836
NHW-C: 0.145290, UM: 0.422748
NHW-R: 0.116387, UM: 0.381794
See all demo of stb-image-metrics.