]> granicus.if.org Git - imagemagick/blob - magick/morphology.h
Parsing of Multiple Morphology Kernels and use of them by HitAndMiss
[imagemagick] / magick / morphology.h
1 /*
2   Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization
3   dedicated to making software imaging solutions freely available.
4   
5   You may not use this file except in compliance with the License.
6   obtain a copy of the License at
7   
8     http://www.imagemagick.org/script/license.php
9   
10   Unless required by applicable law or agreed to in writing, software
11   distributed under the License is distributed on an "AS IS" BASIS,
12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   See the License for the specific language governing permissions and
14   limitations under the License.
15
16   MagickCore morphology methods.
17 */
18 #ifndef _MAGICKCORE_MORPHOLOGY_H
19 #define _MAGICKCORE_MORPHOLOGY_H
20
21 #if defined(__cplusplus) || defined(c_plusplus)
22 extern "C" {
23 #endif
24
25 #include <magick/geometry.h>
26
27 typedef enum
28 {
29   UndefinedKernel,    /* also the 'no-op' kernel */
30   GaussianKernel,     /* Convolution Kernels */
31   BlurKernel,
32   CometKernel,
33   LaplacianKernel,
34   LOGKernel,
35   DOGKernel,
36   RectangleKernel,    /* Shape Kernels */
37   SquareKernel,
38   DiamondKernel,
39   DiskKernel,
40   PlusKernel,
41   ChebyshevKernel,    /* Distance Measuring Kernels */
42   ManhattenKernel,
43   EuclideanKernel,
44   UserDefinedKernel   /* user specified kernel values */
45 } KernelInfoType;
46
47 typedef enum
48 {
49   UndefinedMorphology,
50 /* Convolve / Correlate weighted sums */
51   ConvolveMorphology,          /* Weighted Sum with reflected kernel */
52   CorrelateMorphology,         /* Weighted Sum using a sliding window */
53 /* Low-level Morphology methods */
54   ErodeMorphology,             /* Minimum Value in Neighbourhood */
55   DilateMorphology,            /* Maximum Value in Neighbourhood */
56   ErodeIntensityMorphology,    /* Pixel Pick using GreyScale Erode */
57   DilateIntensityMorphology,   /* Pixel Pick using GreyScale Dialate */
58   DistanceMorphology,          /* Add Kernel Value, take Minimum */
59 /* Second-level Morphology methods */
60   OpenMorphology,              /* Dilate then Erode */
61   CloseMorphology,             /* Erode then Dilate */
62   OpenIntensityMorphology,     /* Pixel Pick using GreyScale Open */
63   CloseIntensityMorphology,    /* Pixel Pick using GreyScale Close */
64 /* Difference Morphology methods */
65   EdgeInMorphology,            /* Dilate difference from Original */
66   EdgeOutMorphology,           /* Erode difference from Original */
67   EdgeMorphology,              /* Dilate difference with Erode */
68   TopHatMorphology,            /* Close difference from Original */
69   BottomHatMorphology,         /* Open difference from Original */
70 /* Recursive Morphology methods */
71   HitAndMissMorphology,        /* Foreground/Background pattern matching */
72   ThinningMorphology,          /* Remove matching pixels from image */
73   ThickenMorphology            /* Add matching pixels from image */
74 } MorphologyMethod;
75
76 typedef struct KernelInfo
77 {
78   KernelInfoType
79     type;
80
81   unsigned long
82     width,
83     height;
84
85   long
86     x,
87     y;
88
89   double
90     *values,
91     minimum,
92     maximum,
93     negative_range,
94     positive_range;
95
96   struct KernelInfo
97     *next;
98
99   unsigned long
100     signature;
101 } KernelInfo;
102
103 extern MagickExport KernelInfo
104   *AcquireKernelInfo(const char *),
105   *AcquireKernelBuiltIn(const KernelInfoType,const GeometryInfo *),
106   *CloneKernelInfo(const KernelInfo *),
107   *DestroyKernelInfo(KernelInfo *);
108
109 extern MagickExport Image
110   *MorphologyImage(const Image *,const MorphologyMethod,const long,
111     const KernelInfo *,ExceptionInfo *),
112   *MorphologyImageChannel(const Image *,const ChannelType,
113     const MorphologyMethod,const long,const KernelInfo *,ExceptionInfo *);
114
115 extern MagickExport void
116   ScaleKernelInfo(KernelInfo *,const double,const GeometryFlags),
117   ShowKernelInfo(KernelInfo *);
118
119 #if defined(__cplusplus) || defined(c_plusplus)
120 }
121 #endif
122
123 #endif