Page 1 of 1

compare returns always 0

Posted: 2011-08-29T22:15:16-07:00
by em4work
i run the following script on 2 machines:
1. centos5 ImageMagick 6.7.1-6
2. centos6 ImageMagick 6.7.1-9

both has the same script and run on same jpgs. the jpgs are identical except for a different date text written on both
on the centos5 i get "Error is 25.458516, Mean Error is 0.000388"
on centos6 the error always 0.000

the script:
use Image::Magick;
$g1 = Image::Magick->new;
$g2 = Image::Magick->new;
$w = $g1->Read( filename=>"11.jpg");
$w = $g2->Read( filename=>"12.jpg");
$w = $g1->Compare(image=>$g2); # compare
printf ("Errors is %f\n", $g1->Get('error'));
printf ("Mean Error is %f\n", $g1->Get('mean-error'));

off course the problem is on the centos6, cause the jpgs has difference
any ideas?

Re: compare returns always 0

Posted: 2011-08-30T05:38:42-07:00
by magick
Here is the correct code:

Code: Select all

$g3 = $g1->Compare( image=>$g2, metric=>'RMSE' ); # compare
if (ref($g3)) {
    printf ("Errors is %f\n", $g3->Get( 'error' ));