Compute the absolute difference in pixels between two images.
*/
status=MagickTrue;
- fuzz=GetFuzzyColorDistance(image,reconstruct_image);
- fuzz*=fuzz;
+ fuzz=MagickMin(GetPixelChannels(image),GetPixelChannels(reconstruct_image))*
+ GetFuzzyColorDistance(image,reconstruct_image);
rows=MagickMax(image->rows,reconstruct_image->rows);
columns=MagickMax(image->columns,reconstruct_image->columns);
image_view=AcquireVirtualCacheView(image,exception);
{
double
Da,
+ distance,
Sa;
MagickBooleanType
continue;
}
difference=MagickFalse;
+ distance=0.0;
Sa=QuantumScale*GetPixelAlpha(image,p);
Da=QuantumScale*GetPixelAlpha(reconstruct_image,q);
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
double
- distance;
+ pixel;
PixelChannel channel = GetPixelChannelChannel(image,i);
PixelTrait traits = GetPixelChannelTraits(image,channel);
((reconstruct_traits & UpdatePixelTrait) == 0))
continue;
if (channel == AlphaPixelChannel)
- distance=(double) p[i]-GetPixelChannel(reconstruct_image,channel,q);
+ pixel=(double) p[i]-GetPixelChannel(reconstruct_image,channel,q);
else
- distance=Sa*p[i]-Da*GetPixelChannel(reconstruct_image,channel,q);
- if ((distance*distance) > fuzz)
+ pixel=Sa*p[i]-Da*GetPixelChannel(reconstruct_image,channel,q);
+ distance+=pixel*pixel;
+ if (distance > fuzz)
{
channel_distortion[i]++;
difference=MagickTrue;