]> granicus.if.org Git - imagemagick/blob - magick/morphology.h
Addition of new thinning kernels, skeleton
[imagemagick] / magick / morphology.h
1 /*
2   Copyright 1999-2011 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   OctagonKernel,
47   DiskKernel,
48   PlusKernel,
49   CrossKernel,
50   RingKernel,
51   PeaksKernel,         /* Hit And Miss Kernels */
52   EdgesKernel,
53   CornersKernel,
54   DiagonalsKernel,
55   LineEndsKernel,
56   LineJunctionsKernel,
57   RidgesKernel,
58   ConvexHullKernel,
59   ThinSEKernel,
60   SkeletonKernel,
61   ChebyshevKernel,    /* Distance Measuring Kernels */
62   ManhattanKernel,
63   OctagonalKernel,
64   EuclideanKernel,
65   UserDefinedKernel   /* User Specified Kernel Array */
66 } KernelInfoType;
67
68 typedef enum
69 {
70   UndefinedMorphology,
71 /* Convolve / Correlate weighted sums */
72   ConvolveMorphology,          /* Weighted Sum with reflected kernel */
73   CorrelateMorphology,         /* Weighted Sum using a sliding window */
74 /* Low-level Morphology methods */
75   ErodeMorphology,             /* Minimum Value in Neighbourhood */
76   DilateMorphology,            /* Maximum Value in Neighbourhood */
77   ErodeIntensityMorphology,    /* Pixel Pick using GreyScale Erode */
78   DilateIntensityMorphology,   /* Pixel Pick using GreyScale Dialate */
79   DistanceMorphology,          /* Add Kernel Value, take Minimum */
80 /* Second-level Morphology methods */
81   OpenMorphology,              /* Dilate then Erode */
82   CloseMorphology,             /* Erode then Dilate */
83   OpenIntensityMorphology,     /* Pixel Pick using GreyScale Open */
84   CloseIntensityMorphology,    /* Pixel Pick using GreyScale Close */
85   SmoothMorphology,            /* Open then Close */
86 /* Difference Morphology methods */
87   EdgeInMorphology,            /* Dilate difference from Original */
88   EdgeOutMorphology,           /* Erode difference from Original */
89   EdgeMorphology,              /* Dilate difference with Erode */
90   TopHatMorphology,            /* Close difference from Original */
91   BottomHatMorphology,         /* Open difference from Original */
92 /* Recursive Morphology methods */
93   HitAndMissMorphology,        /* Foreground/Background pattern matching */
94   ThinningMorphology,          /* Remove matching pixels from image */
95   ThickenMorphology            /* Add matching pixels from image */
96 } MorphologyMethod;
97
98 typedef struct KernelInfo
99 {
100   KernelInfoType
101     type;
102
103   size_t
104     width,
105     height;
106
107   ssize_t
108     x,
109     y;
110
111   double
112     *values,
113     minimum,
114     maximum,
115     negative_range,
116     positive_range,
117     angle;
118
119   struct KernelInfo
120     *next;
121
122   size_t
123     signature;
124 } KernelInfo;
125
126
127 extern MagickExport KernelInfo
128   *AcquireKernelInfo(const char *),
129   *AcquireKernelBuiltIn(const KernelInfoType,const GeometryInfo *),
130   *CloneKernelInfo(const KernelInfo *),
131   *DestroyKernelInfo(KernelInfo *);
132
133 extern MagickExport Image
134   *MorphologyImage(const Image *,const MorphologyMethod,const ssize_t,
135     const KernelInfo *,ExceptionInfo *),
136   *MorphologyImageChannel(const Image *,const ChannelType,
137     const MorphologyMethod,const ssize_t,const KernelInfo *,ExceptionInfo *);
138
139 extern MagickExport void
140   ScaleGeometryKernelInfo(KernelInfo *,const char *),
141   ShowKernelInfo(KernelInfo *);
142
143 #if defined(__cplusplus) || defined(c_plusplus)
144 }
145 #endif
146
147 #endif