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