]> granicus.if.org Git - imagemagick/blob - magick/morphology.h
(no commit message)
[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,    /* equivelent to UnityKernel */
30   UnityKernel,        /* The no-op or 'original image' kernel */
31   GaussianKernel,     /* Convolution Kernels, Gaussian Based */
32   DoGKernel,
33   LoGKernel,
34   BlurKernel,
35   CometKernel,
36   LaplacianKernel,    /* Convolution Kernels, by Name */
37   SobelKernel,
38   FreiChenKernel,
39   RobertsKernel,
40   PrewittKernel,
41   CompassKernel,
42   KirschKernel,
43   DiamondKernel,      /* Shape Kernels */
44   SquareKernel,
45   RectangleKernel,
46   DiskKernel,
47   PlusKernel,
48   CrossKernel,
49   RingKernel,
50   PeaksKernel,         /* Hit And Miss Kernels */
51   EdgesKernel,
52   CornersKernel,
53   ThinDiagonalsKernel,
54   LineEndsKernel,
55   LineJunctionsKernel,
56   RidgesKernel,
57   ConvexHullKernel,
58   SkeletonKernel,
59   ChebyshevKernel,    /* Distance Measuring Kernels */
60   ManhattanKernel,
61   EuclideanKernel,
62   UserDefinedKernel   /* User Specified Kernel Array */
63 } KernelInfoType;
64
65 typedef enum
66 {
67   UndefinedMorphology,
68 /* Convolve / Correlate weighted sums */
69   ConvolveMorphology,          /* Weighted Sum with reflected kernel */
70   CorrelateMorphology,         /* Weighted Sum using a sliding window */
71 /* Low-level Morphology methods */
72   ErodeMorphology,             /* Minimum Value in Neighbourhood */
73   DilateMorphology,            /* Maximum Value in Neighbourhood */
74   ErodeIntensityMorphology,    /* Pixel Pick using GreyScale Erode */
75   DilateIntensityMorphology,   /* Pixel Pick using GreyScale Dialate */
76   DistanceMorphology,          /* Add Kernel Value, take Minimum */
77 /* Second-level Morphology methods */
78   OpenMorphology,              /* Dilate then Erode */
79   CloseMorphology,             /* Erode then Dilate */
80   OpenIntensityMorphology,     /* Pixel Pick using GreyScale Open */
81   CloseIntensityMorphology,    /* Pixel Pick using GreyScale Close */
82   SmoothMorphology,            /* Open then Close */
83 /* Difference Morphology methods */
84   EdgeInMorphology,            /* Dilate difference from Original */
85   EdgeOutMorphology,           /* Erode difference from Original */
86   EdgeMorphology,              /* Dilate difference with Erode */
87   TopHatMorphology,            /* Close difference from Original */
88   BottomHatMorphology,         /* Open difference from Original */
89 /* Recursive Morphology methods */
90   HitAndMissMorphology,        /* Foreground/Background pattern matching */
91   ThinningMorphology,          /* Remove matching pixels from image */
92   ThickenMorphology            /* Add matching pixels from image */
93 } MorphologyMethod;
94
95 typedef struct KernelInfo
96 {
97   KernelInfoType
98     type;
99
100   size_t
101     width,
102     height;
103
104   ssize_t
105     x,
106     y;
107
108   double
109     *values,
110     minimum,
111     maximum,
112     negative_range,
113     positive_range,
114     angle;
115
116   struct KernelInfo
117     *next;
118
119   size_t
120     signature;
121 } KernelInfo;
122
123
124 extern MagickExport KernelInfo
125   *AcquireKernelInfo(const char *),
126   *AcquireKernelBuiltIn(const KernelInfoType,const GeometryInfo *),
127   *CloneKernelInfo(const KernelInfo *),
128   *DestroyKernelInfo(KernelInfo *);
129
130 extern MagickExport Image
131   *MorphologyImage(const Image *,const MorphologyMethod,const ssize_t,
132     const KernelInfo *,ExceptionInfo *),
133   *MorphologyImageChannel(const Image *,const ChannelType,
134     const MorphologyMethod,const ssize_t,const KernelInfo *,ExceptionInfo *);
135
136 extern MagickExport void
137   ScaleGeometryKernelInfo(KernelInfo *,const char *),
138   ShowKernelInfo(KernelInfo *);
139
140 #if defined(__cplusplus) || defined(c_plusplus)
141 }
142 #endif
143
144 #endif