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