From: cristy Date: Tue, 5 Jul 2011 14:39:26 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~7361 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8a9106f4d81487da0f318bd13b4caa4cd24f23af;p=imagemagick --- diff --git a/MagickCore/compare.c b/MagickCore/compare.c index 9d177c6f4..1575b065e 100644 --- a/MagickCore/compare.c +++ b/MagickCore/compare.c @@ -73,19 +73,18 @@ % % % % % % -% C o m p a r e I m a g e C h a n n e l s % +% C o m p a r e I m a g e % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% CompareImageChannels() compares one or more image channels of an image -% to a reconstructed image and returns the difference image. +% CompareImages() compares one or more pixel channels of an image to a +% reconstructed image and returns the difference image. % -% The format of the CompareImageChannels method is: +% The format of the CompareImages method is: % -% Image *CompareImageChannels(const Image *image, -% const Image *reconstruct_image,const ChannelType channel, +% Image *CompareImages(const Image *image,const Image *reconstruct_image, % const MetricType metric,double *distortion,ExceptionInfo *exception) % % A description of each parameter follows: @@ -94,8 +93,6 @@ % % o reconstruct_image: the reconstruct image. % -% o channel: the channel. -% % o metric: the metric. % % o distortion: the computed distortion between the images. @@ -103,21 +100,8 @@ % o exception: return any errors or warnings in this structure. % */ - MagickExport Image *CompareImages(Image *image,const Image *reconstruct_image, const MetricType metric,double *distortion,ExceptionInfo *exception) -{ - Image - *highlight_image; - - highlight_image=CompareImageChannels(image,reconstruct_image,CompositeChannels, - metric,distortion,exception); - return(highlight_image); -} - -MagickExport Image *CompareImageChannels(Image *image, - const Image *reconstruct_image,const ChannelType channel, - const MetricType metric,double *distortion,ExceptionInfo *exception) { CacheView *highlight_view, @@ -155,8 +139,8 @@ MagickExport Image *CompareImageChannels(Image *image, if ((reconstruct_image->columns != image->columns) || (reconstruct_image->rows != image->rows)) ThrowImageException(ImageError,"ImageSizeDiffers"); - status=GetImageChannelDistortion(image,reconstruct_image,channel,metric, - distortion,exception); + status=GetImageDistortion(image,reconstruct_image,metric,distortion, + exception); if (status == MagickFalse) return((Image *) NULL); difference_image=CloneImage(image,0,0,MagickTrue,exception); @@ -244,7 +228,7 @@ MagickExport Image *CompareImageChannels(Image *image, SetPixelInfo(image,p,&pixel); SetPixelInfo(reconstruct_image,q,&reconstruct_pixel); difference=MagickFalse; - if (channel == CompositeChannels) + if (image->sync == MagickTrue) { if (IsFuzzyEquivalencePixelInfo(&pixel,&reconstruct_pixel) == MagickFalse) difference=MagickTrue; @@ -297,20 +281,20 @@ MagickExport Image *CompareImageChannels(Image *image, % % % % % % -% G e t I m a g e C h a n n e l D i s t o r t i o n % +% G e t I m a g e D i s t o r t i o n % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% GetImageChannelDistortion() compares one or more image channels of an image -% to a reconstructed image and returns the specified distortion metric. +% GetImageDistortion() compares one or more pixel channels of an image to a +% reconstructed image and returns the specified distortion metric. % -% The format of the CompareImageChannels method is: +% The format of the CompareImages method is: % -% MagickBooleanType GetImageChannelDistortion(const Image *image, -% const Image *reconstruct_image,const ChannelType channel, -% const MetricType metric,double *distortion,ExceptionInfo *exception) +% MagickBooleanType GetImageDistortion(const Image *image, +% const Image *reconstruct_image,const MetricType metric, +% double *distortion,ExceptionInfo *exception) % % A description of each parameter follows: % @@ -318,8 +302,6 @@ MagickExport Image *CompareImageChannels(Image *image, % % o reconstruct_image: the reconstruct image. % -% o channel: the channel. -% % o metric: the metric. % % o distortion: the computed distortion between the images. @@ -328,21 +310,8 @@ MagickExport Image *CompareImageChannels(Image *image, % */ -MagickExport MagickBooleanType GetImageDistortion(Image *image, - const Image *reconstruct_image,const MetricType metric,double *distortion, - ExceptionInfo *exception) -{ - MagickBooleanType - status; - - status=GetImageChannelDistortion(image,reconstruct_image,CompositeChannels, - metric,distortion,exception); - return(status); -} - static MagickBooleanType GetAbsoluteDistortion(const Image *image, - const Image *reconstruct_image,const ChannelType channel,double *distortion, - ExceptionInfo *exception) + const Image *reconstruct_image,double *distortion,ExceptionInfo *exception) { CacheView *image_view, @@ -431,8 +400,7 @@ static MagickBooleanType GetAbsoluteDistortion(const Image *image, return(status); } -static size_t GetNumberChannels(const Image *image, - const ChannelType channel) +static size_t GetNumberChannels(const Image *image) { size_t channels; @@ -454,8 +422,7 @@ static size_t GetNumberChannels(const Image *image, } static MagickBooleanType GetFuzzDistortion(const Image *image, - const Image *reconstruct_image,const ChannelType channel, - double *distortion,ExceptionInfo *exception) + const Image *reconstruct_image,double *distortion,ExceptionInfo *exception) { CacheView *image_view, @@ -560,17 +527,15 @@ static MagickBooleanType GetFuzzDistortion(const Image *image, if (((GetPixelAlphaTraits(image) & ActivePixelTrait) != 0) && ((image->matte != MagickFalse) || (reconstruct_image->matte != MagickFalse))) - distortion[CompositeChannels]/=(double) - (GetNumberChannels(image,channel)-1); + distortion[CompositeChannels]/=(double) (GetNumberChannels(image)-1); else - distortion[CompositeChannels]/=(double) GetNumberChannels(image,channel); + distortion[CompositeChannels]/=(double) GetNumberChannels(image); distortion[CompositeChannels]=sqrt(distortion[CompositeChannels]); return(status); } static MagickBooleanType GetMeanAbsoluteDistortion(const Image *image, - const Image *reconstruct_image,const ChannelType channel, - double *distortion,ExceptionInfo *exception) + const Image *reconstruct_image,double *distortion,ExceptionInfo *exception) { CacheView *image_view, @@ -670,13 +635,12 @@ static MagickBooleanType GetMeanAbsoluteDistortion(const Image *image, image_view=DestroyCacheView(image_view); for (i=0; i <= (ssize_t) CompositeChannels; i++) distortion[i]/=((double) image->columns*image->rows); - distortion[CompositeChannels]/=(double) GetNumberChannels(image,channel); + distortion[CompositeChannels]/=(double) GetNumberChannels(image); return(status); } static MagickBooleanType GetMeanErrorPerPixel(Image *image, - const Image *reconstruct_image,const ChannelType channel,double *distortion, - ExceptionInfo *exception) + const Image *reconstruct_image,double *distortion,ExceptionInfo *exception) { CacheView *image_view, @@ -805,8 +769,7 @@ static MagickBooleanType GetMeanErrorPerPixel(Image *image, } static MagickBooleanType GetMeanSquaredDistortion(const Image *image, - const Image *reconstruct_image,const ChannelType channel, - double *distortion,ExceptionInfo *exception) + const Image *reconstruct_image,double *distortion,ExceptionInfo *exception) { CacheView *image_view, @@ -907,13 +870,13 @@ static MagickBooleanType GetMeanSquaredDistortion(const Image *image, image_view=DestroyCacheView(image_view); for (i=0; i <= (ssize_t) CompositeChannels; i++) distortion[i]/=((double) image->columns*image->rows); - distortion[CompositeChannels]/=(double) GetNumberChannels(image,channel); + distortion[CompositeChannels]/=(double) GetNumberChannels(image); return(status); } static MagickBooleanType GetNormalizedCrossCorrelationDistortion( - const Image *image,const Image *reconstruct_image,const ChannelType channel, - double *distortion,ExceptionInfo *exception) + const Image *image,const Image *reconstruct_image,double *distortion, + ExceptionInfo *exception) { #define SimilarityImageTag "Similarity/Image" @@ -1048,7 +1011,7 @@ static MagickBooleanType GetNormalizedCrossCorrelationDistortion( distortion[CompositeChannels]+=distortion[BlackChannel]* distortion[BlackChannel]; distortion[CompositeChannels]=sqrt(distortion[CompositeChannels]/ - GetNumberChannels(image,channel)); + GetNumberChannels(image)); /* Free resources. */ @@ -1060,8 +1023,7 @@ static MagickBooleanType GetNormalizedCrossCorrelationDistortion( } static MagickBooleanType GetPeakAbsoluteDistortion(const Image *image, - const Image *reconstruct_image,const ChannelType channel, - double *distortion,ExceptionInfo *exception) + const Image *reconstruct_image,double *distortion,ExceptionInfo *exception) { CacheView *image_view, @@ -1172,14 +1134,12 @@ static MagickBooleanType GetPeakAbsoluteDistortion(const Image *image, } static MagickBooleanType GetPeakSignalToNoiseRatio(const Image *image, - const Image *reconstruct_image,const ChannelType channel, - double *distortion,ExceptionInfo *exception) + const Image *reconstruct_image,double *distortion,ExceptionInfo *exception) { MagickBooleanType status; - status=GetMeanSquaredDistortion(image,reconstruct_image,channel,distortion, - exception); + status=GetMeanSquaredDistortion(image,reconstruct_image,distortion,exception); if ((GetPixelRedTraits(image) & ActivePixelTrait) != 0) distortion[RedChannel]=20.0*log10((double) 1.0/sqrt( distortion[RedChannel])); @@ -1203,14 +1163,12 @@ static MagickBooleanType GetPeakSignalToNoiseRatio(const Image *image, } static MagickBooleanType GetRootMeanSquaredDistortion(const Image *image, - const Image *reconstruct_image,const ChannelType channel, - double *distortion,ExceptionInfo *exception) + const Image *reconstruct_image,double *distortion,ExceptionInfo *exception) { MagickBooleanType status; - status=GetMeanSquaredDistortion(image,reconstruct_image,channel,distortion, - exception); + status=GetMeanSquaredDistortion(image,reconstruct_image,distortion,exception); if ((GetPixelRedTraits(image) & ActivePixelTrait) != 0) distortion[RedChannel]=sqrt(distortion[RedChannel]); if ((GetPixelGreenTraits(image) & ActivePixelTrait) != 0) @@ -1227,9 +1185,9 @@ static MagickBooleanType GetRootMeanSquaredDistortion(const Image *image, return(status); } -MagickExport MagickBooleanType GetImageChannelDistortion(Image *image, - const Image *reconstruct_image,const ChannelType channel, - const MetricType metric,double *distortion,ExceptionInfo *exception) +MagickExport MagickBooleanType GetImageDistortion(Image *image, + const Image *reconstruct_image,const MetricType metric,double *distortion, + ExceptionInfo *exception) { double *channel_distortion; @@ -1267,31 +1225,31 @@ MagickExport MagickBooleanType GetImageChannelDistortion(Image *image, { case AbsoluteErrorMetric: { - status=GetAbsoluteDistortion(image,reconstruct_image,channel, - channel_distortion,exception); + status=GetAbsoluteDistortion(image,reconstruct_image,channel_distortion, + exception); break; } case FuzzErrorMetric: { - status=GetFuzzDistortion(image,reconstruct_image,channel, - channel_distortion,exception); + status=GetFuzzDistortion(image,reconstruct_image,channel_distortion, + exception); break; } case MeanAbsoluteErrorMetric: { - status=GetMeanAbsoluteDistortion(image,reconstruct_image,channel, + status=GetMeanAbsoluteDistortion(image,reconstruct_image, channel_distortion,exception); break; } case MeanErrorPerPixelMetric: { - status=GetMeanErrorPerPixel(image,reconstruct_image,channel, - channel_distortion,exception); + status=GetMeanErrorPerPixel(image,reconstruct_image,channel_distortion, + exception); break; } case MeanSquaredErrorMetric: { - status=GetMeanSquaredDistortion(image,reconstruct_image,channel, + status=GetMeanSquaredDistortion(image,reconstruct_image, channel_distortion,exception); break; } @@ -1299,24 +1257,24 @@ MagickExport MagickBooleanType GetImageChannelDistortion(Image *image, default: { status=GetNormalizedCrossCorrelationDistortion(image,reconstruct_image, - channel,channel_distortion,exception); + channel_distortion,exception); break; } case PeakAbsoluteErrorMetric: { - status=GetPeakAbsoluteDistortion(image,reconstruct_image,channel, + status=GetPeakAbsoluteDistortion(image,reconstruct_image, channel_distortion,exception); break; } case PeakSignalToNoiseRatioMetric: { - status=GetPeakSignalToNoiseRatio(image,reconstruct_image,channel, + status=GetPeakSignalToNoiseRatio(image,reconstruct_image, channel_distortion,exception); break; } case RootMeanSquaredErrorMetric: { - status=GetRootMeanSquaredDistortion(image,reconstruct_image,channel, + status=GetRootMeanSquaredDistortion(image,reconstruct_image, channel_distortion,exception); break; } @@ -1331,19 +1289,19 @@ MagickExport MagickBooleanType GetImageChannelDistortion(Image *image, % % % % % % -% G e t I m a g e C h a n n e l D i s t o r t i o n s % +% G e t I m a g e D i s t o r t i o n s % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% GetImageChannelDistrortion() compares the image channels of an image to a +% GetImageDistrortion() compares the pixel channels of an image to a % reconstructed image and returns the specified distortion metric for each % channel. % -% The format of the CompareImageChannels method is: +% The format of the CompareImages method is: % -% double *GetImageChannelDistortions(const Image *image, +% double *GetImageDistortions(const Image *image, % const Image *reconstruct_image,const MetricType metric, % ExceptionInfo *exception) % @@ -1358,7 +1316,7 @@ MagickExport MagickBooleanType GetImageChannelDistortion(Image *image, % o exception: return any errors or warnings in this structure. % */ -MagickExport double *GetImageChannelDistortions(Image *image, +MagickExport double *GetImageDistortions(Image *image, const Image *reconstruct_image,const MetricType metric, ExceptionInfo *exception) { @@ -1401,31 +1359,31 @@ MagickExport double *GetImageChannelDistortions(Image *image, { case AbsoluteErrorMetric: { - status=GetAbsoluteDistortion(image,reconstruct_image,CompositeChannels, - channel_distortion,exception); + status=GetAbsoluteDistortion(image,reconstruct_image,channel_distortion, + exception); break; } case FuzzErrorMetric: { - status=GetFuzzDistortion(image,reconstruct_image,CompositeChannels, - channel_distortion,exception); + status=GetFuzzDistortion(image,reconstruct_image,channel_distortion, + exception); break; } case MeanAbsoluteErrorMetric: { - status=GetMeanAbsoluteDistortion(image,reconstruct_image,CompositeChannels, + status=GetMeanAbsoluteDistortion(image,reconstruct_image, channel_distortion,exception); break; } case MeanErrorPerPixelMetric: { - status=GetMeanErrorPerPixel(image,reconstruct_image,CompositeChannels, - channel_distortion,exception); + status=GetMeanErrorPerPixel(image,reconstruct_image,channel_distortion, + exception); break; } case MeanSquaredErrorMetric: { - status=GetMeanSquaredDistortion(image,reconstruct_image,CompositeChannels, + status=GetMeanSquaredDistortion(image,reconstruct_image, channel_distortion,exception); break; } @@ -1433,24 +1391,24 @@ MagickExport double *GetImageChannelDistortions(Image *image, default: { status=GetNormalizedCrossCorrelationDistortion(image,reconstruct_image, - CompositeChannels,channel_distortion,exception); + channel_distortion,exception); break; } case PeakAbsoluteErrorMetric: { - status=GetPeakAbsoluteDistortion(image,reconstruct_image,CompositeChannels, + status=GetPeakAbsoluteDistortion(image,reconstruct_image, channel_distortion,exception); break; } case PeakSignalToNoiseRatioMetric: { - status=GetPeakSignalToNoiseRatio(image,reconstruct_image,CompositeChannels, + status=GetPeakSignalToNoiseRatio(image,reconstruct_image, channel_distortion,exception); break; } case RootMeanSquaredErrorMetric: { - status=GetRootMeanSquaredDistortion(image,reconstruct_image,CompositeChannels, + status=GetRootMeanSquaredDistortion(image,reconstruct_image, channel_distortion,exception); break; } diff --git a/MagickCore/compare.h b/MagickCore/compare.h index bccb13363..714fea447 100644 --- a/MagickCore/compare.h +++ b/MagickCore/compare.h @@ -39,20 +39,15 @@ typedef enum } MetricType; extern MagickExport double - *GetImageChannelDistortions(Image *,const Image *,const MetricType, - ExceptionInfo *); + *GetImageDistortions(Image *,const Image *,const MetricType,ExceptionInfo *); extern MagickExport Image - *CompareImageChannels(Image *,const Image *,const ChannelType, - const MetricType,double *,ExceptionInfo *), *CompareImages(Image *,const Image *,const MetricType,double *, ExceptionInfo *), *SimilarityImage(Image *,const Image *,RectangleInfo *,double *, ExceptionInfo *); extern MagickExport MagickBooleanType - GetImageChannelDistortion(Image *,const Image *,const ChannelType, - const MetricType,double *,ExceptionInfo *), GetImageDistortion(Image *,const Image *,const MetricType,double *, ExceptionInfo *), IsImagesEqual(Image *,const Image *); diff --git a/MagickCore/layer.c b/MagickCore/layer.c index b4e440d66..2c90494e4 100644 --- a/MagickCore/layer.c +++ b/MagickCore/layer.c @@ -508,7 +508,7 @@ MagickExport Image *DisposeImages(const Image *image,ExceptionInfo *exception) % ComparePixels() Compare the two pixels and return true if the pixels % differ according to the given LayerType comparision method. % -% This currently only used internally by CompareImageBounds(). It is +% This currently only used internally by CompareImagesBounds(). It is % doubtful that this sub-routine will be useful outside this module. % % The format of the ComparePixels method is: @@ -572,16 +572,16 @@ static MagickBooleanType ComparePixels(const ImageLayerMethod method, % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% CompareImageBounds() Given two images return the smallest rectangular area +% CompareImagesBounds() Given two images return the smallest rectangular area % by which the two images differ, accourding to the given 'Compare...' % layer method. % % This currently only used internally in this module, but may eventually % be used by other modules. % -% The format of the CompareImageBounds method is: +% The format of the CompareImagesBounds method is: % -% RectangleInfo *CompareImageBounds(const ImageLayerMethod method, +% RectangleInfo *CompareImagesBounds(const ImageLayerMethod method, % const Image *image1, const Image *image2, ExceptionInfo *exception) % % A description of each parameter follows: @@ -595,7 +595,7 @@ static MagickBooleanType ComparePixels(const ImageLayerMethod method, % */ -static RectangleInfo CompareImageBounds(const Image *image1,const Image *image2, +static RectangleInfo CompareImagesBounds(const Image *image1,const Image *image2, const ImageLayerMethod method,ExceptionInfo *exception) { RectangleInfo @@ -725,7 +725,7 @@ static RectangleInfo CompareImageBounds(const Image *image1,const Image *image2, % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% CompareImageLayers() compares each image with the next in a sequence and +% CompareImagesLayers() compares each image with the next in a sequence and % returns the minimum bounding region of all the pixel differences (of the % ImageLayerMethod specified) it discovers. % @@ -736,9 +736,9 @@ static RectangleInfo CompareImageBounds(const Image *image1,const Image *image2, % No GIF dispose methods are applied, so GIF animations must be coalesced % before applying this image operator to find differences to them. % -% The format of the CompareImageLayers method is: +% The format of the CompareImagesLayers method is: % -% Image *CompareImageLayers(const Image *images, +% Image *CompareImagesLayers(const Image *images, % const ImageLayerMethod method,ExceptionInfo *exception) % % A description of each parameter follows: @@ -752,7 +752,7 @@ static RectangleInfo CompareImageBounds(const Image *image1,const Image *image2, % */ -MagickExport Image *CompareImageLayers(const Image *image, +MagickExport Image *CompareImagesLayers(const Image *image, const ImageLayerMethod method, ExceptionInfo *exception) { Image @@ -818,7 +818,7 @@ MagickExport Image *CompareImageLayers(const Image *image, } (void) CompositeImage(image_a,CopyCompositeOp,next,next->page.x, next->page.y); - bounds[i]=CompareImageBounds(image_b,image_a,method,exception); + bounds[i]=CompareImagesBounds(image_b,image_a,method,exception); image_b=DestroyImage(image_b); i++; @@ -1014,7 +1014,7 @@ static Image *OptimizeLayerFrames(const Image *image, (void) FormatLocaleFile(stderr, "frame %.20g :-\n", (double) i); #endif disposals[0]=NoneDispose; - bounds[0]=CompareImageBounds(prev_image,curr,CompareAnyLayer,exception); + bounds[0]=CompareImagesBounds(prev_image,curr,CompareAnyLayer,exception); #if DEBUG_OPT_FRAME (void) FormatLocaleFile(stderr, "overlay: %.20gx%.20g%+.20g%+.20g\n\n", (double) bounds[i].width,(double) bounds[i].height, @@ -1039,7 +1039,7 @@ static Image *OptimizeLayerFrames(const Image *image, /* Assume none disposal is the best */ - bounds[i]=CompareImageBounds(curr->previous,curr,CompareAnyLayer,exception); + bounds[i]=CompareImagesBounds(curr->previous,curr,CompareAnyLayer,exception); cleared=IsBoundsCleared(curr->previous,curr,&bounds[i],exception); disposals[i-1]=NoneDispose; #if DEBUG_OPT_FRAME @@ -1069,7 +1069,7 @@ static Image *OptimizeLayerFrames(const Image *image, /* Compare a none disposal against a previous disposal */ - try_bounds=CompareImageBounds(prev_image,curr,CompareAnyLayer,exception); + try_bounds=CompareImagesBounds(prev_image,curr,CompareAnyLayer,exception); try_cleared=IsBoundsCleared(prev_image,curr,&try_bounds,exception); #if DEBUG_OPT_FRAME (void) FormatLocaleFile(stderr, "test_prev: %.20gx%.20g%+.20g%+.20g%s\n", @@ -1108,9 +1108,9 @@ static Image *OptimizeLayerFrames(const Image *image, prev_image=DestroyImage(prev_image); return((Image *) NULL); } - dup_bounds=CompareImageBounds(dup_image,curr,CompareClearLayer,exception); + dup_bounds=CompareImagesBounds(dup_image,curr,CompareClearLayer,exception); ClearBounds(dup_image,&dup_bounds); - try_bounds=CompareImageBounds(dup_image,curr,CompareAnyLayer,exception); + try_bounds=CompareImagesBounds(dup_image,curr,CompareAnyLayer,exception); if ( cleared || dup_bounds.width*dup_bounds.height +try_bounds.width*try_bounds.height @@ -1140,7 +1140,7 @@ static Image *OptimizeLayerFrames(const Image *image, } bgnd_bounds=bounds[i-1]; /* interum bounds of the previous image */ ClearBounds(bgnd_image,&bgnd_bounds); - try_bounds=CompareImageBounds(bgnd_image,curr,CompareAnyLayer,exception); + try_bounds=CompareImagesBounds(bgnd_image,curr,CompareAnyLayer,exception); try_cleared=IsBoundsCleared(bgnd_image,curr,&try_bounds,exception); #if DEBUG_OPT_FRAME (void) FormatLocaleFile(stderr, "background: %s\n", @@ -1154,7 +1154,7 @@ static Image *OptimizeLayerFrames(const Image *image, include the pixels that are cleared. This guaranteed to work, though may not be the most optimized solution. */ - try_bounds=CompareImageBounds(curr->previous,curr,CompareClearLayer,exception); + try_bounds=CompareImagesBounds(curr->previous,curr,CompareClearLayer,exception); #if DEBUG_OPT_FRAME (void) FormatLocaleFile(stderr, "expand_clear: %.20gx%.20g%+.20g%+.20g%s\n", (double) try_bounds.width,(double) try_bounds.height, @@ -1211,18 +1211,18 @@ static Image *OptimizeLayerFrames(const Image *image, * to see, or writet he image at this point it is hard to tell what is wrong! * Only CompareOverlay seemed to return something sensible. */ - try_bounds=CompareImageBounds(bgnd_image,curr,CompareClearLayer,exception); + try_bounds=CompareImagesBounds(bgnd_image,curr,CompareClearLayer,exception); (void) FormatLocaleFile(stderr, "expand_ctst: %.20gx%.20g%+.20g%+.20g\n", (double) try_bounds.width,(double) try_bounds.height, (double) try_bounds.x,(double) try_bounds.y ); - try_bounds=CompareImageBounds(bgnd_image,curr,CompareAnyLayer,exception); + try_bounds=CompareImagesBounds(bgnd_image,curr,CompareAnyLayer,exception); try_cleared=IsBoundsCleared(bgnd_image,curr,&try_bounds,exception); (void) FormatLocaleFile(stderr, "expand_any : %.20gx%.20g%+.20g%+.20g%s\n", (double) try_bounds.width,(double) try_bounds.height, (double) try_bounds.x,(double) try_bounds.y, try_cleared?" (pixels cleared)":""); #endif - try_bounds=CompareImageBounds(bgnd_image,curr,CompareOverlayLayer,exception); + try_bounds=CompareImagesBounds(bgnd_image,curr,CompareOverlayLayer,exception); #if DEBUG_OPT_FRAME try_cleared=IsBoundsCleared(bgnd_image,curr,&try_bounds,exception); (void) FormatLocaleFile(stderr, "expand_test: %.20gx%.20g%+.20g%+.20g%s\n", @@ -1609,7 +1609,7 @@ MagickExport void RemoveDuplicateLayers(Image **images, if ( curr->columns != next->columns || curr->rows != next->rows || curr->page.x != next->page.x || curr->page.y != next->page.y ) continue; - bounds=CompareImageBounds(curr,next,CompareAnyLayer,exception); + bounds=CompareImagesBounds(curr,next,CompareAnyLayer,exception); if ( bounds.x < 0 ) { /* the two images are the same, merge time delays and delete one. diff --git a/MagickCore/layer.h b/MagickCore/layer.h index 9da131c3e..20540db5b 100644 --- a/MagickCore/layer.h +++ b/MagickCore/layer.h @@ -57,7 +57,7 @@ typedef enum extern MagickExport Image *CoalesceImages(const Image *,ExceptionInfo *), *DisposeImages(const Image *,ExceptionInfo *), - *CompareImageLayers(const Image *,const ImageLayerMethod,ExceptionInfo *), + *CompareImagesLayers(const Image *,const ImageLayerMethod,ExceptionInfo *), *MergeImageLayers(Image *,const ImageLayerMethod,ExceptionInfo *), *OptimizeImageLayers(const Image *,ExceptionInfo *), *OptimizePlusImageLayers(const Image *,ExceptionInfo *); diff --git a/MagickCore/magick-config.h b/MagickCore/magick-config.h index 9002a55f6..2f9648ec3 100644 --- a/MagickCore/magick-config.h +++ b/MagickCore/magick-config.h @@ -12,9 +12,7 @@ /* #undef AUTOTRACE_DELEGATE */ /* Define if coders and filters are to be built as modules. */ -#ifndef MAGICKCORE_BUILD_MODULES -#define MAGICKCORE_BUILD_MODULES 1 -#endif +/* #undef BUILD_MODULES */ /* Define if you have the bzip2 library */ #ifndef MAGICKCORE_BZLIB_DELEGATE @@ -56,9 +54,7 @@ #endif /* Define if you have DJVU library */ -#ifndef MAGICKCORE_DJVU_DELEGATE -#define MAGICKCORE_DJVU_DELEGATE 1 -#endif +/* #undef DJVU_DELEGATE */ /* Directory where ImageMagick documents live. */ #ifndef MAGICKCORE_DOCUMENTATION_PATH @@ -80,9 +76,7 @@ #endif /* Define if you have FFTW library */ -#ifndef MAGICKCORE_FFTW_DELEGATE -#define MAGICKCORE_FFTW_DELEGATE 1 -#endif +/* #undef FFTW_DELEGATE */ /* Location of filter modules */ #ifndef MAGICKCORE_FILTER_PATH @@ -421,15 +415,15 @@ #endif /* Define if you have the header file. */ -/* #undef HAVE_LCMS2_H */ +#ifndef MAGICKCORE_HAVE_LCMS2_H +#define MAGICKCORE_HAVE_LCMS2_H 1 +#endif /* Define if you have the header file. */ /* #undef HAVE_LCMS2_LCMS2_H */ /* Define if you have the header file. */ -#ifndef MAGICKCORE_HAVE_LCMS_H -#define MAGICKCORE_HAVE_LCMS_H 1 -#endif +/* #undef HAVE_LCMS_H */ /* Define if you have the header file. */ /* #undef HAVE_LCMS_LCMS_H */ @@ -1152,9 +1146,7 @@ #endif /* Define if you have JBIG library */ -#ifndef MAGICKCORE_JBIG_DELEGATE -#define MAGICKCORE_JBIG_DELEGATE 1 -#endif +/* #undef JBIG_DELEGATE */ /* Define if you have JPEG version 2 "Jasper" library */ #ifndef MAGICKCORE_JP2_DELEGATE @@ -1183,9 +1175,7 @@ #endif /* Define if you have LQR library */ -#ifndef MAGICKCORE_LQR_DELEGATE -#define MAGICKCORE_LQR_DELEGATE 1 -#endif +/* #undef LQR_DELEGATE */ /* Define if using libltdl to support dynamically loadable modules */ #ifndef MAGICKCORE_LTDL_DELEGATE @@ -1197,7 +1187,7 @@ /* Define to the system default library search path. */ #ifndef MAGICKCORE_LT_DLSEARCH_PATH -#define MAGICKCORE_LT_DLSEARCH_PATH "/lib64:/usr/lib64:/lib:/usr/lib:/usr/lib64/R/lib:/usr/lib64/atlas:/opt/modules/pkg/intel/f77/10.0.025/lib:/usr/local/lib:/usr/lib64/mysql:/usr/lib64/qt-3.3/lib:/usr/lib64/xulrunner-2" +#define MAGICKCORE_LT_DLSEARCH_PATH "/lib64:/usr/lib64:/lib:/usr/lib:/usr/lib64/atlas:/usr/lib64/mysql:/usr/lib64/qt-3.3/lib:/usr/lib64/tcl8.5/tclx8.4:/usr/lib64/tcl8.5:/usr/lib/wine/:/usr/lib64/wine/:/usr/lib64/xulrunner-2" #endif /* The archive extension */ @@ -1248,9 +1238,7 @@ /* #undef NO_MINUS_C_MINUS_O */ /* Define if you have OPENEXR library */ -#ifndef MAGICKCORE_OPENEXR_DELEGATE -#define MAGICKCORE_OPENEXR_DELEGATE 1 -#endif +/* #undef OPENEXR_DELEGATE */ /* Define to the address where bug reports for this package should be sent. */ #ifndef MAGICKCORE_PACKAGE_BUGREPORT @@ -1305,9 +1293,7 @@ #endif /* Define if you have RSVG library */ -#ifndef MAGICKCORE_RSVG_DELEGATE -#define MAGICKCORE_RSVG_DELEGATE 1 -#endif +/* #undef RSVG_DELEGATE */ /* Define to the type of arg 1 for `select'. */ #ifndef MAGICKCORE_SELECT_TYPE_ARG1 @@ -1444,9 +1430,7 @@ /* Define if you have WEBP library */ -#ifndef MAGICKCORE_WEBP_DELEGATE -#define MAGICKCORE_WEBP_DELEGATE 1 -#endif +/* #undef WEBP_DELEGATE */ /* Define to use the Windows GDI32 library */ /* #undef WINGDI32_DELEGATE */ @@ -1455,9 +1439,7 @@ /* #undef WITH_DMALLOC */ /* Define if you have WMF library */ -#ifndef MAGICKCORE_WMF_DELEGATE -#define MAGICKCORE_WMF_DELEGATE 1 -#endif +/* #undef WMF_DELEGATE */ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ diff --git a/MagickCore/methods.h b/MagickCore/methods.h index bd545a154..c787e45e3 100644 --- a/MagickCore/methods.h +++ b/MagickCore/methods.h @@ -183,8 +183,8 @@ extern "C" { #define CombineImages PrependMagickMethod(CombineImages) #define CompareHashmapStringInfo PrependMagickMethod(CompareHashmapStringInfo) #define CompareHashmapString PrependMagickMethod(CompareHashmapString) -#define CompareImageChannels PrependMagickMethod(CompareImageChannels) -#define CompareImageLayers PrependMagickMethod(CompareImageLayers) +#define CompareImages PrependMagickMethod(CompareImages) +#define CompareImagesLayers PrependMagickMethod(CompareImagesLayers) #define CompareImages PrependMagickMethod(CompareImages) #define CompareSplayTreeStringInfo PrependMagickMethod(CompareSplayTreeStringInfo) #define CompareSplayTreeString PrependMagickMethod(CompareSplayTreeString) @@ -421,8 +421,8 @@ extern "C" { #define GetImageAttribute PrependMagickMethod(GetImageAttribute) #define GetImageBoundingBox PrependMagickMethod(GetImageBoundingBox) #define GetImageDepth PrependMagickMethod(GetImageDepth) -#define GetImageChannelDistortion PrependMagickMethod(GetImageChannelDistortion) -#define GetImageChannelDistortions PrependMagickMethod(GetImageChannelDistortions) +#define GetImageDistortion PrependMagickMethod(GetImageDistortion) +#define GetImageDistortions PrependMagickMethod(GetImageDistortions) #define GetImageChannelExtrema PrependMagickMethod(GetImageChannelExtrema) #define GetImageChannelKurtosis PrependMagickMethod(GetImageChannelKurtosis) #define GetImageChannelMean PrependMagickMethod(GetImageChannelMean) diff --git a/MagickCore/pixel.c b/MagickCore/pixel.c index 489215d74..325615c30 100644 --- a/MagickCore/pixel.c +++ b/MagickCore/pixel.c @@ -4435,32 +4435,26 @@ MagickExport MagickBooleanType IsFuzzyEquivalencePixelPacket(const Image *image, %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % SetPixelComponentMap() sets the pixel component map from the specified -% string map. +% channel mask. % % The format of the SetPixelComponentMap method is: % -% void SetPixelComponentMap(Image *image,const char *components) +% void SetPixelComponentMap(Image *image,const ChannelType channel) % % A description of each parameter follows: % % o image: the image. % -% o components: One or more pixel components separated by commas. +% o channel: the channel mask. % */ -MagickExport void SetPixelComponentMap(Image *image,const char *components) +MagickExport void SetPixelComponentMap(Image *image,const ChannelType channel) { register ssize_t i; - ssize_t - channel; - for (i=0; i < MaxPixelComponents; i++) image->component_map[i].traits=UndefinedPixelTrait; - channel=(ChannelType) ParseChannelOption(components); - if (channel < 0) - channel=DefaultChannels; image->sync=(channel & SyncChannels) != 0 ? MagickTrue : MagickFalse; if ((channel & RedChannel) != 0) SetPixelRedTraits(image,ActivePixelTrait); diff --git a/MagickCore/pixel.h b/MagickCore/pixel.h index 523bb2ea9..b614ea9ae 100644 --- a/MagickCore/pixel.h +++ b/MagickCore/pixel.h @@ -160,7 +160,7 @@ extern MagickExport PixelInfo extern MagickExport void StandardPixelComponentMap(Image *), GetPixelInfo(const Image *,PixelInfo *), - SetPixelComponentMap(Image *,const char *); + SetPixelComponentMap(Image *,const ChannelType); #if defined(__cplusplus) || defined(c_plusplus) } diff --git a/MagickCore/version.h b/MagickCore/version.h index 52875919c..aa2cfd838 100644 --- a/MagickCore/version.h +++ b/MagickCore/version.h @@ -27,14 +27,14 @@ extern "C" { */ #define MagickPackageName "ImageMagick" #define MagickCopyright "Copyright (C) 1999-2011 ImageMagick Studio LLC" -#define MagickSVNRevision "exported" +#define MagickSVNRevision "4693" #define MagickLibVersion 0x700 #define MagickLibVersionText "7.0.0" #define MagickLibVersionNumber 5,0,0 #define MagickLibAddendum "-0" #define MagickLibInterface 5 #define MagickLibMinInterface 5 -#define MagickReleaseDate "2011-07-04" +#define MagickReleaseDate "2011-07-05" #define MagickChangeDate "20110701" #define MagickAuthoritativeURL "http://www.imagemagick.org" #if defined(MAGICKCORE_OPENMP_SUPPORT) diff --git a/MagickWand/compare.c b/MagickWand/compare.c index ad328ca12..18d29f8ea 100644 --- a/MagickWand/compare.c +++ b/MagickWand/compare.c @@ -57,13 +57,13 @@ % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% CompareImageCommand() compares two images and returns the difference between +% CompareImagesCommand() compares two images and returns the difference between % them as a distortion metric and as a new image visually annotating their % differences. % -% The format of the CompareImageCommand method is: +% The format of the CompareImagesCommand method is: % -% MagickBooleanType CompareImageCommand(ImageInfo *image_info,int argc, +% MagickBooleanType CompareImagesCommand(ImageInfo *image_info,int argc, % char **argv,char **metadata,ExceptionInfo *exception) % % A description of each parameter follows: @@ -171,7 +171,7 @@ static MagickBooleanType CompareUsage(void) return(MagickFalse); } -WandExport MagickBooleanType CompareImageCommand(ImageInfo *image_info, +WandExport MagickBooleanType CompareImagesCommand(ImageInfo *image_info, int argc,char **argv,char **metadata,ExceptionInfo *exception) { #define DefaultDissimilarityThreshold 0.31830988618379067154 @@ -209,9 +209,6 @@ WandExport MagickBooleanType CompareImageCommand(ImageInfo *image_info, const char *format; - ChannelType - channels; - double dissimilarity_threshold, distortion, @@ -273,7 +270,6 @@ WandExport MagickBooleanType CompareImageCommand(ImageInfo *image_info, } if (argc < 3) return(CompareUsage()); - channels=CompositeChannels; difference_image=NewImageList(); similarity_image=NewImageList(); dissimilarity_threshold=DefaultDissimilarityThreshold; @@ -397,7 +393,7 @@ WandExport MagickBooleanType CompareImageCommand(ImageInfo *image_info, if (channel < 0) ThrowCompareException(OptionError,"UnrecognizedChannelType", argv[i]); - channels=(ChannelType) channel; + SetPixelComponentMap(image,(ChannelType) channel); break; } if (LocaleCompare("colorspace",option+1) == 0) @@ -954,8 +950,8 @@ WandExport MagickBooleanType CompareImageCommand(ImageInfo *image_info, } if ((reconstruct_image->columns == image->columns) && (reconstruct_image->rows == image->rows)) - difference_image=CompareImageChannels(image,reconstruct_image,channels, - metric,&distortion,exception); + difference_image=CompareImages(image,reconstruct_image,metric,&distortion, + exception); else if (similarity_image == (Image *) NULL) ThrowCompareException(OptionError,"ImageWidthsOrHeightsDiffer", @@ -970,14 +966,14 @@ WandExport MagickBooleanType CompareImageCommand(ImageInfo *image_info, */ composite_image=CloneImage(image,0,0,MagickTrue,exception); if (composite_image == (Image *) NULL) - difference_image=CompareImageChannels(image,reconstruct_image, - channels,metric,&distortion,exception); + difference_image=CompareImages(image,reconstruct_image,metric, + &distortion,exception); else { (void) CompositeImage(composite_image,CopyCompositeOp, reconstruct_image,offset.x,offset.y); - difference_image=CompareImageChannels(image,composite_image, - channels,metric,&distortion,exception); + difference_image=CompareImages(image,composite_image,metric, + &distortion,exception); if (difference_image != (Image *) NULL) { difference_image->page.x=offset.x; @@ -1052,7 +1048,7 @@ WandExport MagickBooleanType CompareImageCommand(ImageInfo *image_info, double *channel_distortion; - channel_distortion=GetImageChannelDistortions(image,reconstruct_image, + channel_distortion=GetImageDistortions(image,reconstruct_image, metric,&image->exception); (void) FormatLocaleFile(stderr,"Image: %s\n",image->filename); if ((reconstruct_image->columns != image->columns) || diff --git a/MagickWand/compare.h b/MagickWand/compare.h index 6ec0b6e64..a698510e6 100644 --- a/MagickWand/compare.h +++ b/MagickWand/compare.h @@ -23,7 +23,7 @@ extern "C" { #endif extern WandExport MagickBooleanType - CompareImageCommand(ImageInfo *,int,char **,char **,ExceptionInfo *); + CompareImagesCommand(ImageInfo *,int,char **,char **,ExceptionInfo *); #if defined(__cplusplus) || defined(c_plusplus) } diff --git a/MagickWand/magick-image.c b/MagickWand/magick-image.c index 110ff1bc3..5f7ce97cf 100644 --- a/MagickWand/magick-image.c +++ b/MagickWand/magick-image.c @@ -1760,76 +1760,19 @@ WandExport MagickBooleanType MagickCommentImage(MagickWand *wand, % % % % % % -% M a g i c k C o m p a r e I m a g e C h a n n e l s % -% % -% % -% % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% MagickCompareImageChannels() compares one or more image channels of an image -% to a reconstructed image and returns the difference image. -% -% The format of the MagickCompareImageChannels method is: -% -% MagickWand *MagickCompareImageChannels(MagickWand *wand, -% const MagickWand *reference,const ChannelType channel, -% const MetricType metric,double *distortion) -% -% A description of each parameter follows: -% -% o wand: the magick wand. -% -% o reference: the reference wand. -% -% o channel: the channel. -% -% o metric: the metric. -% -% o distortion: the computed distortion between the images. -% -*/ -WandExport MagickWand *MagickCompareImageChannels(MagickWand *wand, - const MagickWand *reference,const ChannelType channel,const MetricType metric, - double *distortion) -{ - Image - *compare_image; - - assert(wand != (MagickWand *) NULL); - assert(wand->signature == WandSignature); - if (wand->debug != MagickFalse) - (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL)) - { - (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, - "ContainsNoImages","`%s'",wand->name); - return((MagickWand *) NULL); - } - compare_image=CompareImageChannels(wand->images,reference->images,channel, - metric,distortion,&wand->images->exception); - if (compare_image == (Image *) NULL) - return((MagickWand *) NULL); - return(CloneMagickWandFromImages(wand,compare_image)); -} - -/* -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % -% % -% % % M a g i c k C o m p a r e I m a g e L a y e r s % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% MagickCompareImageLayers() compares each image with the next in a sequence +% MagickCompareImagesLayers() compares each image with the next in a sequence % and returns the maximum bounding region of any pixel differences it % discovers. % -% The format of the MagickCompareImageLayers method is: +% The format of the MagickCompareImagesLayers method is: % -% MagickWand *MagickCompareImageLayers(MagickWand *wand, +% MagickWand *MagickCompareImagesLayers(MagickWand *wand, % const ImageLayerMethod method) % % A description of each parameter follows: @@ -1839,7 +1782,7 @@ WandExport MagickWand *MagickCompareImageChannels(MagickWand *wand, % o method: the compare method. % */ -WandExport MagickWand *MagickCompareImageLayers(MagickWand *wand, +WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand, const ImageLayerMethod method) { Image @@ -1851,7 +1794,7 @@ WandExport MagickWand *MagickCompareImageLayers(MagickWand *wand, (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); if (wand->images == (Image *) NULL) return((MagickWand *) NULL); - layers_image=CompareImageLayers(wand->images,method,wand->exception); + layers_image=CompareImagesLayers(wand->images,method,wand->exception); if (layers_image == (Image *) NULL) return((MagickWand *) NULL); return(CloneMagickWandFromImages(wand,layers_image)); @@ -2409,7 +2352,7 @@ WandExport MagickWand *MagickDeconstructImages(MagickWand *wand) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); if (wand->images == (Image *) NULL) return((MagickWand *) NULL); - deconstruct_image=CompareImageLayers(wand->images,CompareAnyLayer, + deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer, wand->exception); if (deconstruct_image == (Image *) NULL) return((MagickWand *) NULL); @@ -4161,112 +4104,6 @@ WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand, % % % % % % -% M a g i c k G e t I m a g e C h a n n e l D i s t o r t i o n % -% % -% % -% % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% MagickGetImageChannelDistortion() compares one or more image channels of an -% image to a reconstructed image and returns the specified distortion metric. -% -% The format of the MagickGetImageChannelDistortion method is: -% -% MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand, -% const MagickWand *reference,const ChannelType channel, -% const MetricType metric,double *distortion) -% -% A description of each parameter follows: -% -% o wand: the magick wand. -% -% o reference: the reference wand. -% -% o channel: the channel. -% -% o metric: the metric. -% -% o distortion: the computed distortion between the images. -% -*/ -WandExport MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand, - const MagickWand *reference,const ChannelType channel,const MetricType metric, - double *distortion) -{ - MagickBooleanType - status; - - assert(wand != (MagickWand *) NULL); - assert(wand->signature == WandSignature); - if (wand->debug != MagickFalse) - (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - assert(reference != (MagickWand *) NULL); - assert(reference->signature == WandSignature); - if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL)) - ThrowWandException(WandError,"ContainsNoImages",wand->name); - status=GetImageChannelDistortion(wand->images,reference->images,channel, - metric,distortion,&wand->images->exception); - return(status); -} - -/* -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % -% % -% % -% M a g i c k G e t I m a g e C h a n n e l D i s t o r t i o n s % -% % -% % -% % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% MagickGetImageChannelDistortions() compares one or more image channels of an -% image to a reconstructed image and returns the specified distortion metrics. -% -% Use MagickRelinquishMemory() to free the metrics when you are done with them. -% -% The format of the MagickGetImageChannelDistortion method is: -% -% double *MagickGetImageChannelDistortion(MagickWand *wand, -% const MagickWand *reference,const MetricType metric) -% -% A description of each parameter follows: -% -% o wand: the magick wand. -% -% o reference: the reference wand. -% -% o metric: the metric. -% -*/ -WandExport double *MagickGetImageChannelDistortions(MagickWand *wand, - const MagickWand *reference,const MetricType metric) -{ - double - *channel_distortion; - - assert(wand != (MagickWand *) NULL); - assert(wand->signature == WandSignature); - if (wand->debug != MagickFalse) - (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - assert(reference != (MagickWand *) NULL); - assert(reference->signature == WandSignature); - if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL)) - { - (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, - "ContainsNoImages","`%s'",wand->name); - return((double *) NULL); - } - channel_distortion=GetImageChannelDistortions(wand->images,reference->images, - metric,&wand->images->exception); - return(channel_distortion); -} - -/* -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % -% % -% % % M a g i c k G e t I m a g e C h a n n e l F e a t u r e s % % % % % @@ -4806,6 +4643,43 @@ WandExport size_t MagickGetImageDepth(MagickWand *wand) % % % % % % +% M a g i c k G e t I m a g e D i s p o s e % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% MagickGetImageDispose() gets the image disposal method. +% +% The format of the MagickGetImageDispose method is: +% +% DisposeType MagickGetImageDispose(MagickWand *wand) +% +% A description of each parameter follows: +% +% o wand: the magick wand. +% +*/ +WandExport DisposeType MagickGetImageDispose(MagickWand *wand) +{ + assert(wand != (MagickWand *) NULL); + assert(wand->signature == WandSignature); + if (wand->debug != MagickFalse) + (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); + if (wand->images == (Image *) NULL) + { + (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, + "ContainsNoImages","`%s'",wand->name); + return(UndefinedDispose); + } + return((DisposeType) wand->images->dispose); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % % M a g i c k G e t I m a g e D i s t o r t i o n % % % % % @@ -4838,7 +4712,6 @@ WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand, MagickBooleanType status; - assert(wand != (MagickWand *) NULL); assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) @@ -4855,36 +4728,52 @@ WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand, % % % % % % -% M a g i c k G e t I m a g e D i s p o s e % +% M a g i c k G e t I m a g e D i s t o r t i o n s % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% MagickGetImageDispose() gets the image disposal method. +% MagickGetImageDistortions() compares one or more pixel channels of an +% image to a reconstructed image and returns the specified distortion metrics. % -% The format of the MagickGetImageDispose method is: +% Use MagickRelinquishMemory() to free the metrics when you are done with them. % -% DisposeType MagickGetImageDispose(MagickWand *wand) +% The format of the MagickGetImageDistortion method is: +% +% double *MagickGetImageDistortion(MagickWand *wand, +% const MagickWand *reference,const MetricType metric) % % A description of each parameter follows: % % o wand: the magick wand. % +% o reference: the reference wand. +% +% o metric: the metric. +% */ -WandExport DisposeType MagickGetImageDispose(MagickWand *wand) +WandExport double *MagickGetImageDistortions(MagickWand *wand, + const MagickWand *reference,const MetricType metric) { + double + *channel_distortion; + assert(wand != (MagickWand *) NULL); assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - if (wand->images == (Image *) NULL) + assert(reference != (MagickWand *) NULL); + assert(reference->signature == WandSignature); + if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL)) { (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, "ContainsNoImages","`%s'",wand->name); - return(UndefinedDispose); + return((double *) NULL); } - return((DisposeType) wand->images->dispose); + channel_distortion=GetImageDistortions(wand->images,reference->images, + metric,&wand->images->exception); + return(channel_distortion); } /* diff --git a/MagickWand/magick-image.h b/MagickWand/magick-image.h index 07f0ebc72..ee0719d91 100644 --- a/MagickWand/magick-image.h +++ b/MagickWand/magick-image.h @@ -48,7 +48,7 @@ extern WandExport DisposeType MagickGetImageDispose(MagickWand *); extern WandExport double - *MagickGetImageChannelDistortions(MagickWand *,const MagickWand *, + *MagickGetImageDistortions(MagickWand *,const MagickWand *, const MetricType), MagickGetImageFuzz(MagickWand *), MagickGetImageGamma(MagickWand *), @@ -172,8 +172,6 @@ extern WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *,PixelWand *), MagickGetImageBluePrimary(MagickWand *,double *,double *), MagickGetImageBorderColor(MagickWand *,PixelWand *), - MagickGetImageChannelDistortion(MagickWand *,const MagickWand *, - const ChannelType,const MetricType,double *), MagickGetImageChannelKurtosis(MagickWand *,const ChannelType,double *, double *), MagickGetImageChannelMean(MagickWand *,const ChannelType,double *,double *), @@ -373,11 +371,9 @@ extern WandExport MagickWand *MagickAppendImages(MagickWand *,const MagickBooleanType), *MagickCoalesceImages(MagickWand *), *MagickCombineImages(MagickWand *,const ChannelType), - *MagickCompareImageChannels(MagickWand *,const MagickWand *,const ChannelType, - const MetricType,double *), *MagickCompareImages(MagickWand *,const MagickWand *,const MetricType, double *), - *MagickCompareImageLayers(MagickWand *,const ImageLayerMethod), + *MagickCompareImagesLayers(MagickWand *,const ImageLayerMethod), *MagickDeconstructImages(MagickWand *), *MagickEvaluateImages(MagickWand *,const MagickEvaluateOperator), *MagickFxImage(MagickWand *,const char *), diff --git a/MagickWand/mogrify.c b/MagickWand/mogrify.c index 478434308..aa29b8914 100644 --- a/MagickWand/mogrify.c +++ b/MagickWand/mogrify.c @@ -84,7 +84,7 @@ % o image_info: the image info. % % o command: Choose from ConvertImageCommand, IdentifyImageCommand, -% MogrifyImageCommand, CompositeImageCommand, CompareImageCommand, +% MogrifyImageCommand, CompositeImageCommand, CompareImagesCommand, % ConjureImageCommand, StreamImageCommand, ImportImageCommand, % DisplayImageCommand, or AnimateImageCommand. % @@ -978,7 +978,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, channel=DefaultChannels; else channel=(ChannelType) ParseChannelOption(argv[i+1]); - SetPixelComponentMap(*image,argv[i+1]); + SetPixelComponentMap(*image,channel); break; } if (LocaleCompare("charcoal",option+1) == 0) @@ -7503,7 +7503,7 @@ This has been merged completely into MogrifyImage() *deconstruct_image; (void) SyncImagesSettings(mogrify_info,*images); - deconstruct_image=CompareImageLayers(*images,CompareAnyLayer, + deconstruct_image=CompareImagesLayers(*images,CompareAnyLayer, exception); if (deconstruct_image == (Image *) NULL) { @@ -7760,7 +7760,7 @@ This has been merged completely into MogrifyImage() case CompareOverlayLayer: default: { - layers=CompareImageLayers(*images,method,exception); + layers=CompareImagesLayers(*images,method,exception); break; } case MergeLayer: diff --git a/PerlMagick/Magick.xs b/PerlMagick/Magick.xs index 91d00da71..a07b43584 100644 --- a/PerlMagick/Magick.xs +++ b/PerlMagick/Magick.xs @@ -3065,7 +3065,7 @@ void Compare(ref,...) Image::Magick ref=NO_INIT ALIAS: - CompareImage = 1 + CompareImages = 1 compare = 2 compareimage = 3 PPCODE: @@ -3076,9 +3076,6 @@ Compare(ref,...) char *attribute; - ChannelType - channel; - double distortion; @@ -3141,7 +3138,6 @@ Compare(ref,...) /* Get attribute. */ - channel=DefaultChannels; reconstruct_image=image; metric=RootMeanSquaredErrorMetric; for (i=2; i < items; i+=2) @@ -3164,7 +3160,7 @@ Compare(ref,...) "UnrecognizedType",SvPV(ST(i),na)); return; } - channel=(ChannelType) option; + SetPixelComponentMap(image,(ChannelType) option); break; } ThrowPerlException(exception,OptionError,"UnrecognizedAttribute", @@ -3224,8 +3220,8 @@ Compare(ref,...) } } } - difference_image=CompareImageChannels(image,reconstruct_image,channel, - metric,&distortion,exception); + difference_image=CompareImages(image,reconstruct_image,metric,&distortion, + exception); if (difference_image != (Image *) NULL) { difference_image->error.mean_error_per_pixel=distortion; @@ -3264,7 +3260,7 @@ void CompareLayers(ref) Image::Magick ref=NO_INIT ALIAS: - CompareImageLayers = 1 + CompareImagesLayers = 1 comparelayers = 2 compareimagelayers = 3 PPCODE: @@ -3360,7 +3356,7 @@ CompareLayers(ref) } } } - image=CompareImageLayers(image,method,exception); + image=CompareImagesLayers(image,method,exception); if ((image == (Image *) NULL) || (exception->severity >= ErrorException)) goto PerlException; for ( ; image; image=image->next) @@ -6048,9 +6044,6 @@ GetPixel(ref,...) char *attribute; - ChannelType - channel; - ExceptionInfo *exception; @@ -6094,7 +6087,6 @@ GetPixel(ref,...) PackageName); goto PerlException; } - channel=DefaultChannels; normalize=MagickTrue; region.x=0; region.y=0; @@ -6122,7 +6114,7 @@ GetPixel(ref,...) SvPV(ST(i),na)); return; } - channel=(ChannelType) option; + SetPixelComponentMap(image,(ChannelType) option); break; } ThrowPerlException(exception,OptionError,"UnrecognizedAttribute", @@ -6725,7 +6717,7 @@ Layers(ref,...) case CompareOverlayLayer: default: { - layers=CompareImageLayers(image,method,exception); + layers=CompareImagesLayers(image,method,exception); break; } case MergeLayer: @@ -8720,7 +8712,7 @@ Mogrify(ref,...) invert=MagickFalse; if (attribute_flag[6] != 0) invert=(MagickBooleanType) argument_list[6].integer_reference; - SetPixelComponentMap(image,"alpha"); + SetPixelComponentMap(image,AlphaChannel); (void) FloodfillPaintImage(image,AlphaChannel,draw_info,&target, geometry.x,geometry.y,invert); StandardPixelComponentMap(image); @@ -9082,7 +9074,7 @@ Mogrify(ref,...) } case 65: /* Deconstruct */ { - image=CompareImageLayers(image,CompareAnyLayer,exception); + image=CompareImagesLayers(image,CompareAnyLayer,exception); break; } case 66: /* GaussianBlur */ diff --git a/config/configure.xml b/config/configure.xml index 6c115378b..a52548649 100644 --- a/config/configure.xml +++ b/config/configure.xml @@ -11,7 +11,7 @@ - + diff --git a/tests/validate.c b/tests/validate.c index cd3d94728..e414d2661 100644 --- a/tests/validate.c +++ b/tests/validate.c @@ -120,7 +120,7 @@ static size_t ValidateCompareCommand(ImageInfo *image_info, (*fail)++; continue; } - status=CompareImageCommand(image_info,number_arguments,arguments, + status=CompareImagesCommand(image_info,number_arguments,arguments, (char **) NULL,exception); for (j=0; j < number_arguments; j++) arguments[j]=DestroyString(arguments[j]); @@ -612,7 +612,7 @@ static size_t ValidateImageFormatsInMemory(ImageInfo *image_info, if (reference_image->colorspace != RGBColorspace) fuzz+=0.3; fuzz+=MagickEpsilon; - difference_image=CompareImageChannels(reference_image,reconstruct_image, + difference_image=CompareImages(reference_image,reconstruct_image, CompositeChannels,MeanSquaredErrorMetric,&distortion,exception); reconstruct_image=DestroyImage(reconstruct_image); reference_image=DestroyImage(reference_image); @@ -828,7 +828,7 @@ static size_t ValidateImageFormatsOnDisk(ImageInfo *image_info, if (reference_image->colorspace != RGBColorspace) fuzz+=0.3; fuzz+=MagickEpsilon; - difference_image=CompareImageChannels(reference_image,reconstruct_image, + difference_image=CompareImages(reference_image,reconstruct_image, CompositeChannels,MeanSquaredErrorMetric,&distortion,exception); reconstruct_image=DestroyImage(reconstruct_image); reference_image=DestroyImage(reference_image); @@ -1006,7 +1006,7 @@ static size_t ValidateImportExportPixels(ImageInfo *image_info, /* Compare reference to reconstruct image. */ - difference_image=CompareImageChannels(reference_image,reconstruct_image, + difference_image=CompareImages(reference_image,reconstruct_image, CompositeChannels,MeanSquaredErrorMetric,&distortion,exception); reconstruct_image=DestroyImage(reconstruct_image); reference_image=DestroyImage(reference_image); diff --git a/utilities/compare.c b/utilities/compare.c index 403ff36da..32af5da11 100644 --- a/utilities/compare.c +++ b/utilities/compare.c @@ -76,7 +76,7 @@ int main(int argc,char **argv) exception=AcquireExceptionInfo(); image_info=AcquireImageInfo(); metadata=(char *) NULL; - status=MagickCommandGenesis(image_info,CompareImageCommand,argc,argv, + status=MagickCommandGenesis(image_info,CompareImagesCommand,argc,argv, &metadata,exception); if (metadata != (char *) NULL) metadata=DestroyString(metadata);