compare syntax

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Greg Coats
Posts: 31
Joined: 2004-10-28T11:18:28-07:00
Location: Virginia, USA

compare syntax

Post 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'.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

Try
  • compare -metric rmse a.tif b.tif diff.tif
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Greg Coats
Posts: 31
Joined: 2004-10-28T11:18:28-07:00
Location: Virginia, USA

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post 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!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply