MagickCore  6.9.12-19
Convert, Edit, Or Compose Bitmap Images
morphology.h
Go to the documentation of this file.
1 /*
2  Copyright 1999-2021 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. You may
6  obtain a copy of the License at
7 
8  https://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 #include "magick/geometry.h"
22 
23 #if defined(__cplusplus) || defined(c_plusplus)
24 extern "C" {
25 #endif
26 
27 typedef enum
28 {
29  UndefinedKernel, /* equivalent to UnityKernel */
30  UnityKernel, /* The no-op or 'original image' kernel */
31  GaussianKernel, /* Convolution Kernels, Gaussian Based */
36  LaplacianKernel, /* Convolution Kernels, by Name */
43  DiamondKernel, /* Shape Kernels */
51  PeaksKernel, /* Hit And Miss Kernels */
61  ChebyshevKernel, /* Distance Measuring Kernels */
65  UserDefinedKernel, /* User Specified Kernel Array */
68 
69 typedef enum
70 {
72 /* Convolve / Correlate weighted sums */
73  ConvolveMorphology, /* Weighted Sum with reflected kernel */
74  CorrelateMorphology, /* Weighted Sum using a sliding window */
75 /* Low-level Morphology methods */
76  ErodeMorphology, /* Minimum Value in Neighbourhood */
77  DilateMorphology, /* Maximum Value in Neighbourhood */
78  ErodeIntensityMorphology, /* Pixel Pick using GreyScale Erode */
79  DilateIntensityMorphology, /* Pixel Pick using GreyScale Dialate */
80  DistanceMorphology, /* Add Kernel Value, take Minimum */
81 /* Second-level Morphology methods */
82  OpenMorphology, /* Dilate then Erode */
83  CloseMorphology, /* Erode then Dilate */
84  OpenIntensityMorphology, /* Pixel Pick using GreyScale Open */
85  CloseIntensityMorphology, /* Pixel Pick using GreyScale Close */
86  SmoothMorphology, /* Open then Close */
87 /* Difference Morphology methods */
88  EdgeInMorphology, /* Dilate difference from Original */
89  EdgeOutMorphology, /* Erode difference from Original */
90  EdgeMorphology, /* Dilate difference with Erode */
91  TopHatMorphology, /* Close difference from Original */
92  BottomHatMorphology, /* Open difference from Original */
93 /* Recursive Morphology methods */
94  HitAndMissMorphology, /* Foreground/Background pattern matching */
95  ThinningMorphology, /* Remove matching pixels from image */
96  ThickenMorphology, /* Add matching pixels from image */
97 /* Experimental Morphology methods */
98  VoronoiMorphology, /* distance matte channel copy nearest color */
99  IterativeDistanceMorphology /* Add Kernel Value, take Minimum */
101 
102 typedef struct KernelInfo
103 {
106 
107  size_t
109  height;
110 
111  ssize_t
112  x,
113  y;
114 
115  double
117  minimum,
118  maximum,
121  angle;
122 
123  struct KernelInfo
124  *next;
125 
126  size_t
128 } KernelInfo;
129 
131  *AcquireKernelInfo(const char *),
133  *CloneKernelInfo(const KernelInfo *),
135 
136 extern MagickExport Image
137  *MorphologyImage(const Image *,const MorphologyMethod,const ssize_t,
138  const KernelInfo *,ExceptionInfo *),
140  const MorphologyMethod,const ssize_t,const KernelInfo *,ExceptionInfo *);
141 
142 extern MagickExport void
143  ScaleGeometryKernelInfo(KernelInfo *,const char *),
144  ScaleKernelInfo(KernelInfo *,const double,const GeometryFlags),
145  ShowKernelInfo(const KernelInfo *),
146  UnityAddKernelInfo(KernelInfo *,const double);
147 
148 #if defined(__cplusplus) || defined(c_plusplus)
149 }
150 #endif
151 
152 #endif
Definition: morphology.h:92
Definition: morphology.h:56
Definition: morphology.h:88
Definition: morphology.h:44
Definition: morphology.h:95
double minimum
Definition: morphology.h:116
Definition: morphology.h:86
Definition: morphology.h:39
MagickExport KernelInfo * DestroyKernelInfo(KernelInfo *kernel)
Definition: morphology.c:2252
Definition: morphology.h:47
MagickExport Image * MorphologyImage(const Image *image, const MorphologyMethod method, const ssize_t iterations, const KernelInfo *kernel, ExceptionInfo *exception)
Definition: morphology.c:4356
Definition: exception.h:102
Definition: morphology.h:46
struct KernelInfo * next
Definition: morphology.h:123
MagickExport Image * MorphologyImageChannel(const Image *image, const ChannelType channel, const MorphologyMethod method, const ssize_t iterations, const KernelInfo *kernel, ExceptionInfo *exception)
Definition: morphology.c:4368
Definition: morphology.h:29
Definition: morphology.h:55
MagickExport KernelInfo * AcquireKernelInfo(const char *kernel_string)
Definition: morphology.c:484
double * values
Definition: morphology.h:116
Definition: morphology.h:65
Definition: morphology.h:71
MagickExport void ScaleGeometryKernelInfo(KernelInfo *kernel, const char *geometry)
Definition: morphology.c:4676
Definition: morphology.h:43
MagickExport void ScaleKernelInfo(KernelInfo *kernel, const double scaling_factor, const GeometryFlags normalize_flags)
Definition: morphology.c:4781
struct KernelInfo KernelInfo
MorphologyMethod
Definition: morphology.h:69
Definition: morphology.h:98
Definition: morphology.h:63
ssize_t y
Definition: morphology.h:112
Definition: image.h:152
double angle
Definition: morphology.h:116
Definition: morphology.h:54
Definition: morphology.h:49
Definition: morphology.h:102
KernelInfoType type
Definition: morphology.h:105
size_t signature
Definition: morphology.h:127
MagickExport void ShowKernelInfo(const KernelInfo *kernel)
Definition: morphology.c:4868
size_t width
Definition: morphology.h:108
MagickExport KernelInfo * AcquireKernelBuiltIn(const KernelInfoType type, const GeometryInfo *args)
Definition: morphology.c:950
Definition: morphology.h:89
Definition: morphology.h:94
Definition: morphology.h:78
Definition: morphology.h:79
Definition: morphology.h:64
Definition: morphology.h:99
ssize_t x
Definition: morphology.h:112
Definition: morphology.h:82
Definition: morphology.h:90
Definition: morphology.h:62
Definition: morphology.h:74
Definition: morphology.h:45
Definition: morphology.h:36
Definition: morphology.h:40
Definition: morphology.h:51
Definition: morphology.h:37
Definition: morphology.h:57
Definition: morphology.h:91
Definition: morphology.h:30
Definition: morphology.h:52
GeometryFlags
Definition: geometry.h:25
ChannelType
Definition: magick-type.h:164
Definition: morphology.h:80
Definition: morphology.h:59
Definition: morphology.h:34
Definition: morphology.h:73
Definition: morphology.h:84
double maximum
Definition: morphology.h:116
size_t height
Definition: morphology.h:108
Definition: morphology.h:83
Definition: morphology.h:58
MagickExport KernelInfo * CloneKernelInfo(const KernelInfo *kernel)
Definition: morphology.c:2196
Definition: geometry.h:106
Definition: morphology.h:66
double negative_range
Definition: morphology.h:116
Definition: morphology.h:33
Definition: morphology.h:77
Definition: morphology.h:42
Definition: morphology.h:53
Definition: morphology.h:38
double positive_range
Definition: morphology.h:116
Definition: morphology.h:50
Definition: morphology.h:85
MagickExport void UnityAddKernelInfo(KernelInfo *kernel, const double scale)
Definition: morphology.c:4948
Definition: morphology.h:60
Definition: morphology.h:41
KernelInfoType
Definition: morphology.h:27
Definition: morphology.h:32
#define MagickExport
Definition: method-attribute.h:80
Definition: morphology.h:96
Definition: morphology.h:48
Definition: morphology.h:35
Definition: morphology.h:61
Definition: morphology.h:76
Definition: morphology.h:31