Page 1 of 1

compare -metric

Posted: 2010-10-15T07:53:40-07:00
by dos
hi all, i was using the "compare -metric rmse x.png y.png null:". the results i got are "4632.57 (0.0706886)".
more verbose results:

Code: Select all

x.png PNG 970x865 970x865+0+0 8-bit DirectClass 68.9KB 0.016u 0:00.014
y.png PNG 970x865 970x865+0+0 8-bit DirectClass 173KB 0.031u 0:00.031
Image: x.png
  Channel distortion: RMSE
    red: 3739.74 (0.0570648)
    green: 4016.91 (0.0612941)
    blue: 5853.29 (0.0893155)
    all: 4632.57 (0.0706886)
x.png=> PNG 970x865 970x865+0+0 8-bit DirectClass 0.188u 0:00.062
Can anyone explain in detail the results I got? Can you also tell what are max. and min. values for output? If you could refer me to documentation which explains the outputs for rmse in detail... thanks in advance!

Re: compare -metric

Posted: 2010-10-15T09:57:20-07:00
by fmw42
4632.57 (0.0706886)
The first number is the rmse value pixel values in the range 0 to QuantumRange which looks like Q16 IM or 655535. The second number is normalized to the range 0 to 1. So in this case in percent it would be 7% rmse error.

Re: compare -metric

Posted: 2010-10-16T04:26:26-07:00
by anthony
RMSE => Square Root Mean Squared Error.

It means for each pixel get the color differance, and square it, average all the squared differences, then return the square root of that.

Other metrics include...
MAE -- Mean Absolute error - or just the average of all teh color differences
MSE -- Mean Squares Error

As such RMSE = sqrt(MSE)

For maximum color difference use
PAE -- Peak Absolute Error
PSNR -- Peak Signal Noise Ratio, which is a logarithmic 'decibel' scale.

And you also have
AE Just a count of pixels that differ by more than -fuzz amount (default to zero meaning ANY DIFFERENCE).

Re: compare -metric

Posted: 2011-04-04T05:10:06-07:00
by lizac
Hi! Do you know how can I retrieve those values from the first post?
Ex. I want to use the 3739.74 and test it if it's equal to Zero or not in Vbcrispt? If it's zero then the image has no difference.

I'm using Bat actually. Not sure if this is correct.
FOR /F "tokens=*" %%G IN ('compare -metric AE first.png second.png null:') DO SET _value=%%G

and the comparison will take place in vbscript. I actually don't know how to convert this vbcsript. Any help from you will be very much appreciated. Thanks!

Re: compare -metric

Posted: 2011-04-04T09:41:53-07:00
by fmw42
the values are written or accessible from standard error (in unix 2>&1)

val=$(compare .... 2>&1)

sorry I don't know the windows equivalent

Re: compare -metric

Posted: 2011-04-05T02:10:05-07:00
by lizac
Hi! fmw42.

Thanks again for your response and to my other post. You are so kind.

Anyways, I just hope that anyone who knows windows scripting would be able to jump in and share their knowledge.
My dilemma is this is a time-constraint project and studying from top gives me a lot of time pressure.

Thank you so much again!

Re: compare -metric

Posted: 2011-04-05T04:45:42-07:00
by lizac
Hi! This has answered my inquiry. If anyone would be interested to know.

http://studio.imagemagick.org/discourse ... 982#p68260