1 /*
2   Copyright (C) 2008 GraphicsMagick Group
3 
4   This program is covered by multiple licenses, which are described in
5   Copyright.txt. You should have received a copy of Copyright.txt with this
6   package; otherwise see http://www.graphicsmagick.org/www/Copyright.html.
7 
8   GraphicsMagick Image Comparison Methods.
9 */
10 #ifndef _MAGICK_COMPARE_H
11 #define _MAGICK_COMPARE_H
12 
13 #if defined(__cplusplus) || defined(c_plusplus)
14 extern "C" {
15 #endif /* defined(__cplusplus) || defined(c_plusplus) */
16 
17 /*
18   Pixel differencing algorithms.
19 */
20 typedef enum
21 {
22   UndefinedHighlightStyle,
23   AssignHighlightStyle,
24   ThresholdHighlightStyle,
25   TintHighlightStyle,
26   XorHighlightStyle
27 } HighlightStyle;
28 
29 typedef struct _DifferenceImageOptions
30 {
31   ChannelType              channel; /* Channel(s) to difference */
32   HighlightStyle           highlight_style; /* Pixel annotation style */
33   PixelPacket              highlight_color; /* Changed pixel highlight color */
34 } DifferenceImageOptions;
35 
36 extern MagickExport void
37   InitializeDifferenceImageOptions(DifferenceImageOptions *options,
38                                    ExceptionInfo *exception);
39 
40 extern MagickExport Image
41   *DifferenceImage(const Image *reference_image,const Image *compare_image,
42                    const DifferenceImageOptions *difference_options,
43                    ExceptionInfo *exception);
44 
45 /*
46   Pixel error metrics.
47 */
48 typedef enum
49 {
50   UndefinedMetric,
51   MeanAbsoluteErrorMetric,
52   MeanSquaredErrorMetric,
53   PeakAbsoluteErrorMetric,
54   PeakSignalToNoiseRatioMetric,
55   RootMeanSquaredErrorMetric
56 } MetricType;
57 
58 /*
59   Pixel difference statistics.
60 */
61 typedef struct _DifferenceStatistics
62 {
63   double
64     red,
65     green,
66     blue,
67     opacity,
68     combined;
69 } DifferenceStatistics;
70 
71 extern MagickExport void
72   InitializeDifferenceStatistics(DifferenceStatistics *difference_statistics,
73                                  ExceptionInfo *exception);
74 
75 extern MagickExport MagickPassFail
76   GetImageChannelDifference(const Image *reference_image,
77                             const Image *compare_image,
78                             const MetricType metric,
79                             DifferenceStatistics *statistics,
80                             ExceptionInfo *exception),
81   GetImageChannelDistortion(const Image *reference_image,
82                             const Image *compare_image,
83                             const ChannelType channel,
84                             const MetricType metric,
85                             double *distortion,
86                             ExceptionInfo *exception),
87   GetImageDistortion(const Image *reference_image,
88                      const Image *compare_image,
89                      const MetricType metric,
90                      double *distortion,
91                      ExceptionInfo *exception);
92 
93 extern MagickExport MagickBool
94   IsImagesEqual(Image *,const Image *);
95 
96 #if defined(__cplusplus) || defined(c_plusplus)
97 }
98 #endif /* defined(__cplusplus) || defined(c_plusplus) */
99 
100 #endif /* _MAGICK_COMPARE_H */
101 
102 /*
103  * Local Variables:
104  * mode: c
105  * c-basic-offset: 2
106  * fill-column: 78
107  * End:
108  */
109