Page 1 of 1

How to convert and get a metric in one command?

Posted: 2008-03-21T13:58:02-07:00
by wobsie
I'm comparing, thresholding, and calculating a metric in two steps:

1) generate a grayscale difference image and threshold it:
convert img1.jpg img2.jpg -compose difference -composite gray -threshold 25% diff.jpg

2) get average intensity:
identify -format "%[mean]" diff.jpg

This gives me a single number that summarizes how different the two images are. My question is, is there a way to do this in a single command? And is there a way to do it w/o generating an image? I just want the number.

Thanks.

Re: How to convert and get a metric in one command?

Posted: 2008-03-21T15:14:18-07:00
by wobsie
I got it!

convert img1.jpg img2.jpg -compose difference -composite gray -threshold 25% -format "%[mean]" info:

Phew. Sorry to take up space here.

Re: How to convert and get a metric in one command?

Posted: 2008-03-24T21:33:50-07:00
by anthony
For other notes and methods for getting various image metrics for compareing lots and lots of images, look at IM Examples Metrics.
http://imagemagick.org/Usage/compare/

I have been struggling to find ways of finding matching or simular images of various sorts and thes notes represent my struggles.