mirror of
https://github.com/ImageMagick/ImageMagick.git
synced 2026-06-08 15:37:13 +02:00
fix correlation image for PSNR metric
This commit is contained in:
+10
-1
@@ -3246,6 +3246,7 @@ static Image *DPCSimilarityImage(const Image *image,const Image *reconstruct,
|
||||
exception);
|
||||
if (status == MagickFalse)
|
||||
ThrowDPCSimilarityException();
|
||||
dot_product_image->depth=MAGICKCORE_QUANTUM_DEPTH;
|
||||
status=SIMMaximaImage(dot_product_image,&maxima,offset,exception);
|
||||
if (status == MagickFalse)
|
||||
ThrowDPCSimilarityException();
|
||||
@@ -3364,6 +3365,7 @@ static Image *MSESimilarityImage(const Image *image,const Image *reconstruct,
|
||||
status=GrayscaleImage(mean_image,AveragePixelIntensityMethod,exception);
|
||||
if (status == MagickFalse)
|
||||
ThrowMSESimilarityException();
|
||||
mean_image->depth=MAGICKCORE_QUANTUM_DEPTH;
|
||||
/*
|
||||
Crop to difference of reconstruction and test images.
|
||||
*/
|
||||
@@ -3534,6 +3536,7 @@ static Image *NCCSimilarityImage(const Image *image,const Image *reconstruct,
|
||||
status=GrayscaleImage(ncc_image,AveragePixelIntensityMethod,exception);
|
||||
if (status == MagickFalse)
|
||||
ThrowNCCSimilarityException();
|
||||
ncc_image->depth=MAGICKCORE_QUANTUM_DEPTH;
|
||||
status=SIMMaximaImage(ncc_image,&maxima,offset,exception);
|
||||
if (status == MagickFalse)
|
||||
ThrowNCCSimilarityException();
|
||||
@@ -3673,6 +3676,7 @@ static Image *PhaseSimilarityImage(const Image *image,const Image *reconstruct,
|
||||
status=GrayscaleImage(phase_image,AveragePixelIntensityMethod,exception);
|
||||
if (status == MagickFalse)
|
||||
ThrowPhaseSimilarityException();
|
||||
phase_image->depth=MAGICKCORE_QUANTUM_DEPTH;
|
||||
status=SIMMaximaImage(phase_image,&maxima,offset,exception);
|
||||
if (status == MagickFalse)
|
||||
ThrowPhaseSimilarityException();
|
||||
@@ -3793,6 +3797,11 @@ static Image *PSNRSimilarityImage(const Image *image,const Image *reconstruct,
|
||||
if (status == MagickFalse)
|
||||
ThrowPSNRSimilarityException();
|
||||
status=GrayscaleImage(mean_image,AveragePixelIntensityMethod,exception);
|
||||
if (status == MagickFalse)
|
||||
ThrowPSNRSimilarityException();
|
||||
mean_image->depth=MAGICKCORE_QUANTUM_DEPTH;
|
||||
status=SIMMultiplyImage(mean_image,1.0/48.1647,
|
||||
(const ChannelStatistics *) NULL,exception);
|
||||
if (status == MagickFalse)
|
||||
ThrowPSNRSimilarityException();
|
||||
/*
|
||||
@@ -3817,7 +3826,7 @@ static Image *PSNRSimilarityImage(const Image *image,const Image *reconstruct,
|
||||
status=NegateImage(psnr_image,MagickFalse,exception);
|
||||
if (status == MagickFalse)
|
||||
ThrowPSNRSimilarityException();
|
||||
*similarity_metric=QuantumScale*minima/48.1647;
|
||||
*similarity_metric=QuantumScale*minima;
|
||||
DestroyImage(alpha_image);
|
||||
DestroyImage(beta_image);
|
||||
return(psnr_image);
|
||||
|
||||
@@ -1767,7 +1767,7 @@ MagickExport ChannelPerceptualHash *GetImagePerceptualHash(const Image *image,
|
||||
if (perceptual_hash == (ChannelPerceptualHash *) NULL)
|
||||
return((ChannelPerceptualHash *) NULL);
|
||||
artifact=GetImageArtifact(image,"phash:colorspaces");
|
||||
if (artifact != NULL)
|
||||
if (artifact != (const char *) NULL)
|
||||
colorspaces=AcquireString(artifact);
|
||||
else
|
||||
colorspaces=AcquireString("xyY,HSB");
|
||||
|
||||
Reference in New Issue
Block a user