Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evaluate ImageMagick comparison and its different metrics #22

Open
1 task
nuest opened this issue Oct 16, 2018 · 0 comments
Open
1 task

Evaluate ImageMagick comparison and its different metrics #22

nuest opened this issue Oct 16, 2018 · 0 comments

Comments

@nuest
Copy link
Member

nuest commented Oct 16, 2018

ImageMagick has different metrics to calculate differences between images: https://www.imagemagick.org/script/command-line-options.php#metric

Might be able to get this running in node and should compare it to our current metrics based on blink-diff: https://www.npmjs.com/search?q=magick&ranking=popularity

The function is also easily available in R via magick: https://rdrr.io/cran/magick/man/analysis.html - thanks to @jeroen for the pointer!

library(magick)

> image1 <- image_read("~/Desktop/index1.png")
> image2 <- image_read("~/Desktop/index2.png")
> print(image1)
  format width height colorspace matte filesize density
1    PNG  1344    960       sRGB FALSE    84130   76x76
> image_compare_dist(image1, image2)
$distortion
[1] 0.9503712

> image_compare(image1, image2)
  format width height colorspace matte filesize density
1    PNG  1344    960       sRGB  TRUE        0   76x76
> image_compare(image1, image2, fuzz = 5)
  format width height colorspace matte filesize density
1    PNG  1344    960       sRGB  TRUE        0   76x76
> image_compare(image1, image2, fuzz = 50)
  format width height colorspace matte filesize density
1    PNG  1344    960       sRGB  TRUE        0   76x76
> image_compare_dist(image1, image2, fuzz = 50)
$distortion
[1] 0.9503712

> image_compare_dist(image1, image2, metric = "phash")
$distortion
[1] 0.2836806

> image_compare(image1, image2, metric = "phash")
  format width height colorspace matte filesize density
1    PNG  1344    960       sRGB  TRUE        0   76x76

image

It has similar challenges though, but the numeric metric could help and be more effective than the current "pixel counting".

  • build a test case where the line in the plot differs and has the exact same distortion number than a plot where only the font introduces errors
> metric_types()
 [1] "Undefined" "AE"        "Fuzz"      "MAE"       "MEPP"      "MSE"       "NCC"      
 [8] "PAE"       "PHASH"     "PSNR"      "RMSE"
> image_compare_dist(image1, image2, metric = "PAE")
$distortion
[1] 1

> image_compare_dist(image1, image2, metric = "PSNR")
$distortion
[1] 25.01049

> image_compare_dist(image1, image2, metric = "MEPP")
$distortion
[1] 1329365910

The different metrics give different output numbers, but the image is not perceivably different.

Used images for testing:

index2

index1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant