Page 1 of 1

Image comparison in C++

Posted: 2007-08-22T17:43:42-07:00
by apollomok
Hi,

I am using the ImageMagick C++ API.
I try to differentiate the Color/Black & White image as the description in this link:
http://www.imagemagick.org/Usage/compare/#type_general

So, in Code:
Magick::Image source( "color.jpg" );
Magick::Image image = source;
image.type( GrayscaleType );
source.compare( image );
source.meanErrorPerPixel();
source.normalizedMaxError();
source.normalizedMeanError();

However, all meanErrorPerPixel, normalizedMaxError, and normalizedMeanError return zero.

The comparison seems working if replacing the line "image.type( GrayscaleType );" with "image.solarize();"

So, what happened? and how to make it work?

Thanks!

Re: Image comparison in C++

Posted: 2007-08-22T17:57:42-07:00
by magick
The problem is that the colorspaces differ (RGB vs. Grayscale), however for this special case it should compute the error. We will add a patch to ImageMagick-6.3.5-7 Beta by tommorrow.

Re: Image comparison in C++

Posted: 2007-08-31T00:01:31-07:00
by apollomok
Hi,

I downloaded and compiled the latest ImageMagick-6.3.5-7 Beta code.
I am getting the same result. I wonder if the problem hasn't been fixed?

Thanks!