Page 1 of 1

Command line Compare 2 images

Posted: 2010-03-14T07:53:43-07:00
by mariosserhan
Hi there

Image Magick is indeed a great software with many many feautures.

I am trying for some weeks now to find a way to compare 2 images
in command line and instead of returning me the comparison image
i want to return me the percentage of similarity of these 2 images but without
luck.

Does anybody know if this is doable and maybe show us a command tip??

Re: Command line Compare 2 images

Posted: 2010-03-14T10:10:21-07:00
by snibgo
See the documentation on "compare", eg

Code: Select all

compare -metric RMSE first.png second.png NULL:
will return a numerical measure of the difference between the two frames. Higher numbers are more different.

Can you define exactly what you mean by "percentage of similarity"?

Re: Command line Compare 2 images

Posted: 2010-03-14T10:32:45-07:00
by mariosserhan
Hi snibgo Thanks for answering

Sorry for not being very straight with my answer.
What i mean is if there is a command that will take as input 2 images
and will return a percentage of how much they are similar
meaning 2 identical images as input will return a 100 or something output

I answered before checking out your suggestion just for making clear
what i mean, i am going to check out your suggestion :)

Thanks Again
Marios

Re: Command line Compare 2 images

Posted: 2010-03-14T10:46:18-07:00
by snibgo
I understand that 100% means the images are identical. But I don't know what you want 50% or 0% to mean.

The command above will return zero when the images are identical.

Re: Command line Compare 2 images

Posted: 2010-03-14T11:11:06-07:00
by mariosserhan
I just used the command you posted me and it actually works great it compares
the 2 images and it returns a number that i wanted (i dont know if its a percentage
but i dont realy care) now i am going to make some test to see what exactly these
numbers are, you said that 0 are identical above, then the bigger the number the
more the distance between the 2 images, so i have something to work now.

Thanks a lot :D

Re: Command line Compare 2 images

Posted: 2010-03-14T11:57:05-07:00
by fmw42
see compare statistics at the bottom of this page http://www.imagemagick.org/Usage/compare/#compare

Re: Command line Compare 2 images

Posted: 2010-03-14T13:38:30-07:00
by mariosserhan
thanks fmw42 that was helpfull
it has realy good staff for me there

Re: Command line Compare 2 images

Posted: 2015-10-15T23:48:56-07:00
by susamcsx
mariosserhan wrote:I just used the command you posted me and it actually works great it compares
the 2 images and it returns a number that i wanted (i dont know if its a percentage
but i dont realy care) now i am going to make some test to see what exactly these
numbers are, you said that 0 are identical above, then the bigger the number the
more the distance between the 2 images, so i have something to work now.

Thanks a lot :D

hello,how about your result of the number,i have the same question with you