Page 1 of 1

compare syntax

Posted: 2006-08-14T00:19:44-07:00
by Greg Coats
compare says its -metric option can be used to measure differences between two images. But when I enter the compare command, it always claims the image is missing. What is the syntax for measuring the rmse difference between two images with compare?

Usage: compare [options ...] image reconstruct difference
Where options include:
-metric type measure differences between images with this metric

compare -metric rmse a.tif b.tif
compare: missing an image filename `red.tif'.

Posted: 2006-08-14T07:50:24-07:00
by magick
Try
  • compare -metric rmse a.tif b.tif diff.tif

Posted: 2006-08-15T23:41:53-07:00
by anthony
Three images are needed as the thrid image is an output comparision image.

If you don't want this output image use "null:" when means 'throw it away'.
though for some scripts that image may be important.

The metric is however much more important and I have only looked at it superficially, with some results on the IM Examples Pages. Basically the metric tells IM how to calculate how different the same pixel from two images are, especially relative to an overall average color of a specific image.

ANy input you or other may have is of course welcom, as this is one area of IM that more information on how to use is desperiatally needed.

Posted: 2006-08-17T21:13:46-07:00
by Greg Coats
I work a lot with TIF and JPEG2000 images, and need to quantify the difference between the original TIF an an irreversible or lossy compressed JP2 image, and I use the GeoJasPer utility geoimgcmp to do that. I do not have any interest in looking at a difference image. Here is an example.

$ geoimgcmp --help
Image Comparison Utility
usage:
geojasper/geoimgcmp -f reference_image_file -F other_image_file [-m metric]
The metric argument may assume one of the following values:
psnr .... peak signal to noise ratio
mse ..... mean squared error
rmse .... root mean squared error
pae ..... peak absolute error
mae ..... mean absolute error
equal ... equality (boolean)

$ geoimgcmp -f 18stj940125.tif -F 18stj940125.jp2 -m rmse
GeoTiff found, size: 471
TIFF file decoded!
GeoJp2 info found...
5.061495 red channel
5.007268 green channel
5.847721 blue channel

The source code for GeoJasPer and the executables for Win32, Linux, and Mac OS X universal binaries for PowerPC Macs and Intel Macs are available for free download from
http://homepage.mac.com/gregcoats/jp2.html
GeoJasPer is the successor to JasPer and incorporates many improvements, including handling images with 16 bit channels, and images with more than 3 channels, but the most noteably improvement is that geojasper writes and reads JP2 images ten times faster than jasper.
Greg

Posted: 2006-08-17T21:26:14-07:00
by anthony
I looks as if GeoJasPer is actually using ImageMagick to do its work :-)

Code: Select all

compare  -metric rmse   image1.tif image2.jpg null:
The "null:" means throw away the difference image!