Calculating and comparing an absolute error metric for images

Discuss digital image processing techniques and algorithms. We encourage its application to ImageMagick but you can discuss any software solutions here.
Locked
LucasTizma
Posts: 2
Joined: 2015-03-27T21:27:28-07:00
Authentication code: 6789

Calculating and comparing an absolute error metric for images

Post by LucasTizma »

So I'm using compare to compare two images using the AE metric:

Code: Select all

compare -metric AE -fuzz 15% image1.png image2.png /dev/null
What I don't know how to do now is to output a comparable "value" for each image. Currently, I am iterating through many combinations of the same image and running compare on each combination, which is taking a long time.

1. Can I first run through every image individually and get ImageMagick to output some sort of value/hash/whatever that I can save?
2. Can I then run through all the permutations of the images I have and simply use the output from 1 to more quickly compute a similarity percentage?

I was previously using pHash to output a hash for every image then used a script to compare all these hashes, which was super fast. However, I don't know how to do something similar using ImageMagick's absolute error comparison metric.

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Calculating and comparing an absolute error metric for images

Post by snibgo »

LucasTizma wrote:I was previously using pHash to output a hash for every image then used a script to compare all these hashes, which was super fast. However, I don't know how to do something similar using ImageMagick's absolute error comparison metric.
All comparison metrics compare two images with each other. They don't (and can't) create a value for a single image.
snibgo's IM pages: im.snibgo.com

LucasTizma
Posts: 2
Joined: 2015-03-27T21:27:28-07:00
Authentication code: 6789

Re: Calculating and comparing an absolute error metric for images

Post by LucasTizma »

pHash does create a unique, comparable hash just based on the image alone, not a comparison. These hashes can be compared quickly. I wasn't sure if other metrics could do the same. But I suppose not.

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Calculating and comparing an absolute error metric for images

Post by fmw42 »

IM has a phash. See viewtopic.php?f=4&t=24906. Also

identify -moments -verbose zelda3.jpg

will display the 7 pairs of phash values

or

convert zelda3.jpg -moments -verbose info: > moments.json

will write them to a json file.

If you are on Linux, Mac OS or Windows with Cygwin, I have two scripts that convert the phash values into one string of digits and another script that will compare two strings of numbers via a rmse metric. See my link below and phashconvert and phashcompare. You cannot compare them using the hamming distance, though. The phash is for color images, not grayscale.

Locked