From 67cc338df3b82bea94dc596453952eb86cd29dcc Mon Sep 17 00:00:00 2001 From: Cristy Date: Sat, 26 Apr 2025 12:41:22 -0400 Subject: [PATCH] push a notification for some edge case metrics --- MagickCore/compare.c | 8 -------- MagickWand/compare.c | 7 +++++++ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/MagickCore/compare.c b/MagickCore/compare.c index 207a48ca7e..514b6019f1 100644 --- a/MagickCore/compare.c +++ b/MagickCore/compare.c @@ -174,14 +174,6 @@ MagickExport Image *CompareImages(Image *image,const Image *reconstruct_image, if (IsEventLogging() != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); *distortion=0.0; - if ((metric == DotProductCorrelationErrorMetric) || - (metric == PhaseCorrelationErrorMetric)) - { - (void) ThrowMagickException(exception,GetMagickModule(), - MissingDelegateError,"DelegateLibrarySupportNotBuiltIn", - "'%s' (DPC/Phase metrics require HDRI/FFT delegates)",image->filename); - return((Image *) NULL); - } status=GetImageDistortion(image,reconstruct_image,metric,distortion, exception); if (status == MagickFalse) diff --git a/MagickWand/compare.c b/MagickWand/compare.c index 0ad63caf7c..5658b4170d 100644 --- a/MagickWand/compare.c +++ b/MagickWand/compare.c @@ -1266,8 +1266,15 @@ WandExport MagickBooleanType CompareImagesCommand(ImageInfo *image_info, similarity_metric=fabs(similarity_metric); break; } + case PeakAbsoluteErrorMetric: case PerceptualHashErrorMetric: { + if ((subimage_search != MagickFalse) && + (image->columns == reconstruct_image->columns) && + (image->rows == reconstruct_image->rows)) + (void) ThrowMagickException(exception,GetMagickModule(),ImageWarning, + "subimage search is not sufficiently robust for PAE/PHASH metrics", + "`%s'",image->filename); if (distortion == INFINITY) (void) ThrowMagickException(exception,GetMagickModule(),ImageWarning, "images have no discernible similarity","`%s'",image->filename);