Compare images
Contents
Image *DifferenceImage( const Image *reference_image, const Image *compare_image, const DifferenceImageOptions *difference_options, ExceptionInfo *exception );
DifferenceImage() returns an annotated difference image based on the the difference between a reference image and a compare image.
The format of the DifferenceImage method is:
Image *DifferenceImage( const Image *reference_image, const Image *compare_image, const DifferenceImageOptions *difference_options, ExceptionInfo *exception );
the reference image.
the comparison image.
options to use when differencing.
the channel(s) to compare.
Return any errors or warnings in this structure.
MagickPassFail GetImageChannelDifference( const Image *reference_image, const Image *compare_image, const MetricType metric, DifferenceStatistics *statistics, ExceptionInfo *exception );
GetImageChannelDifference() updates a user provided statistics structure with per-channel, and totalized, difference statistics corresponding to a specified comparison metric.
The format of the GetImageChannelDifference method is:
MagickPassFail GetImageChannelDifference( const Image *reference_image, const Image *compare_image, const MetricType metric, DifferenceStatistics *statistics, ExceptionInfo *exception );
the reference image.
the comparison image.
metric to use when differencing.
the statistics structure to populate.
Return any errors or warnings in this structure.
MagickPassFail GetImageChannelDistortion( const Image *reference_image, const Image *compare_image, const ChannelType channel, const MetricType metric, double *distortion, ExceptionInfo *exception );
GetImageChannelDistortion() updates a distortion parameter with the distortion (error) computed according to the specified comparison metric. The value returned is only for the channel specified.
The format of the GetImageChannelDistortion method is:
MagickPassFail GetImageChannelDistortion( const Image *reference_image, const Image *compare_image, const ChannelType channel, const MetricType metric, double *distortion, ExceptionInfo *exception );
the reference image.
the comparison image.
the channel to obtain error data for.
metric to use when differencing.
updated with the computed distortion.
Return any errors or warnings in this structure.
MagickPassFail GetImageDistortion( const Image *reference_image, const Image *compare_image, const MetricType metric, double *distortion, ExceptionInfo *exception );
GetImageDistortion() updates a distortion parameter with the distortion (error) computed according to the specified comparison metric. The value returned reflects all enabled channels.
The format of the GetImageDistortion method is:
MagickPassFail GetImageDistortion( const Image *reference_image, const Image *compare_image, const MetricType metric, double *distortion, ExceptionInfo *exception );
the reference image.
the comparison image.
the channel to obtain error data for.
metric to use when differencing.
updated with the computed distortion.
Return any errors or warnings in this structure.
IsImagesEqual() measures the difference between colors at each pixel location of two images. A value other than 0 means the colors match exactly. Otherwise an error measure is computed by summing over all pixels in an image the distance squared in RGB space between each image pixel and its corresponding pixel in the reference image. The error measure is assigned to these image members:
o mean_error_per_pixel: The mean error for any single pixel in the image.
o normalized_mean_error: The normalized mean quantization error for any single pixel in the image. This distance measure is normalized to a range between 0 and 1. It is independent of the range of red, green, and blue values in the image.
o normalized_maximum_error: The normalized maximum quantization error for any single pixel in the image. This distance measure is normalized to a range between 0 and 1. It is independent of the range of red, green, and blue values in your image.
A small normalized mean square error, accessed as image->normalized_mean_error, suggests the images are very similiar in spatial layout and color.
The format of the IsImagesEqual method is:
MagickBool IsImagesEqual( Image *image, const Image *reference );
A description of each parameter follows.
The image.
The reference image.
void InitializeDifferenceImageOptions( DifferenceImageOptions *options, ExceptionInfo *exception );
InitializeDifferenceImageOptions() assigns default options to a user-provided DifferenceImageOptions structure. This function should always be used to initialize the DifferenceImageOptions structure prior to making any changes to it.
The format of the InitializeDifferenceImageOptions method is:
void InitializeDifferenceImageOptions( DifferenceImageOptions *options, ExceptionInfo *exception );
pointer to DifferenceImageOptions structure to initialize.
Return any errors or warnings in this structure.
void InitializeDifferenceStatistics( DifferenceStatistics *options, ExceptionInfo *exception );
InitializeDifferenceStatistics() assigns default options to a user-provided DifferenceStatistics structure.
The format of the InitializeDifferenceStatistics method is:
void InitializeDifferenceStatistics( DifferenceStatistics *options, ExceptionInfo *exception );
pointer to DifferenceStatistics structure to initialize.
Return any errors or warnings in this structure.
Copyright © GraphicsMagick Group 2002 - 2023