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