Skip to content

Commit bf7d86c

Browse files
author
Cristy
committed
correct FUZZ metric
1 parent 41f19eb commit bf7d86c

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

magick/compare.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ static MagickBooleanType GetAESimilarity(const Image *image,
451451
{
452452
error=Sa*(double) GetPixelRed(p)-Da*(double)
453453
GetPixelRed(q);
454-
if ((error*error) > fuzz)
454+
if ((error*error) >= fuzz)
455455
{
456456
channel_similarity[RedChannel]++;
457457
count++;
@@ -461,7 +461,7 @@ static MagickBooleanType GetAESimilarity(const Image *image,
461461
{
462462
error=Sa*(double) GetPixelGreen(p)-Da*(double)
463463
GetPixelGreen(q);
464-
if ((error*error) > fuzz)
464+
if ((error*error) >= fuzz)
465465
{
466466
channel_similarity[GreenChannel]++;
467467
count++;
@@ -471,7 +471,7 @@ static MagickBooleanType GetAESimilarity(const Image *image,
471471
{
472472
error=Sa*(double) GetPixelBlue(p)-Da*(double)
473473
GetPixelBlue(q);
474-
if ((error*error) > fuzz)
474+
if ((error*error) >= fuzz)
475475
{
476476
channel_similarity[BlueChannel]++;
477477
count++;
@@ -482,7 +482,7 @@ static MagickBooleanType GetAESimilarity(const Image *image,
482482
{
483483
error=(double) GetPixelOpacity(p)-(double)
484484
GetPixelOpacity(q);
485-
if ((error*error) > fuzz)
485+
if ((error*error) >= fuzz)
486486
{
487487
channel_similarity[OpacityChannel]++;
488488
count++;
@@ -493,7 +493,7 @@ static MagickBooleanType GetAESimilarity(const Image *image,
493493
{
494494
error=Sa*(double) indexes[x]-Da*(double)
495495
reconstruct_indexes[x];
496-
if ((error*error) > fuzz)
496+
if ((error*error) >= fuzz)
497497
{
498498
channel_similarity[IndexChannel]++;
499499
count++;
@@ -593,7 +593,7 @@ static MagickBooleanType GetFUZZSimilarity(const Image *image,
593593
if ((channel & RedChannel) != 0)
594594
{
595595
error=QuantumScale*(Sa*GetPixelRed(p)-Da*GetPixelRed(q));
596-
if ((error*error) > fuzz)
596+
if ((error*error) >= fuzz)
597597
{
598598
channel_similarity[RedChannel]+=error*error;
599599
channel_similarity[CompositeChannels]+=error*error;
@@ -603,7 +603,7 @@ static MagickBooleanType GetFUZZSimilarity(const Image *image,
603603
if ((channel & GreenChannel) != 0)
604604
{
605605
error=QuantumScale*(Sa*GetPixelGreen(p)-Da*GetPixelGreen(q));
606-
if ((error*error) > fuzz)
606+
if ((error*error) >= fuzz)
607607
{
608608
channel_similarity[GreenChannel]+=error*error;
609609
channel_similarity[CompositeChannels]+=error*error;
@@ -613,7 +613,7 @@ static MagickBooleanType GetFUZZSimilarity(const Image *image,
613613
if ((channel & BlueChannel) != 0)
614614
{
615615
error=QuantumScale*(Sa*GetPixelBlue(p)-Da*GetPixelBlue(q));
616-
if ((error*error) > fuzz)
616+
if ((error*error) >= fuzz)
617617
{
618618
channel_similarity[BlueChannel]+=error*error;
619619
channel_similarity[CompositeChannels]+=error*error;
@@ -623,7 +623,7 @@ static MagickBooleanType GetFUZZSimilarity(const Image *image,
623623
if (((channel & OpacityChannel) != 0) && (image->matte != MagickFalse))
624624
{
625625
error=QuantumScale*((double) GetPixelOpacity(p)-GetPixelOpacity(q));
626-
if ((error*error) > fuzz)
626+
if ((error*error) >= fuzz)
627627
{
628628
channel_similarity[OpacityChannel]+=error*error;
629629
channel_similarity[CompositeChannels]+=error*error;
@@ -635,7 +635,7 @@ static MagickBooleanType GetFUZZSimilarity(const Image *image,
635635
{
636636
error=QuantumScale*(Sa*GetPixelIndex(indexes+x)-Da*
637637
GetPixelIndex(reconstruct_indexes+x));
638-
if ((error*error) > fuzz)
638+
if ((error*error) >= fuzz)
639639
{
640640
channel_similarity[BlackChannel]+=error*error;
641641
channel_similarity[CompositeChannels]+=error*error;

0 commit comments

Comments
 (0)