Page 1 of 1

IM review | compare

Posted: 2013-08-01T08:18:21-07:00
by rengel
There are nine metrics implemented. This is very handy and one may only wonder, why the compare function does not work with only two or maybe beyond referenced metrics only with one image.

Concentrating on referenced metrics (i.e. compare A with B) it might be nice, not to be forced to write a third image, but to get the measurement result for other purposes. This both is not possible at this time or I stood on my own feet.

This works & pipes the output of the "-list filter" option to a text-file

Code: Select all

convert -list filter >file.txt
This returns a blank text-file

Code: Select all

compare -verbose -metric PSNR IMAGE-A IMAGE-B IMAGE-C >file.txt
On the page http://www.imagemagick.org/script/comma ... ptions.php is a small spelling irritation with "-list metrics" and not "-list metric". But that is a tine one, that's true :D

Best regards,
rengel

Re: IM review | compare

Posted: 2013-08-01T09:14:59-07:00
by fmw42
it might be nice, not to be forced to write a third image
Just use null:

compare -metric rmse imageA imageB null:


You need to send the result to std error, but I am not sure why this does not work

compare -metric rmse rose: rose: null: 2>&1 >tmp.txt

But you can put the result into a variable

val=`compare -metric rmse rose: rose: null: 2>&1`
echo $val
0 (0)

If you want to write to a file, then you can send the variable to a file

echo $val > tmp.txt


You can combine the two by

echo `compare -metric rmse rose: rose: null: 2>&1` > tmp1.txt

Re: IM review | compare

Posted: 2013-08-02T03:15:17-07:00
by rengel
Thank you for your useful hints concerning redirections. I followed your instructions and found this line suitable for me.

Code: Select all

compare -verbose -metric PSNR IMAGE-A IMAGE-B null 2>im-metric-PSNR.txt
My problem, especially when calling from other apps, is the STDOUT returning nothing and the information I'm looking for is returned as STDERR.