Leptonica
1.77.0
Image processing and image analysis suite
morph.h
Go to the documentation of this file.
1
/*====================================================================*
2
- Copyright (C) 2001 Leptonica. All rights reserved.
3
-
4
- Redistribution and use in source and binary forms, with or without
5
- modification, are permitted provided that the following conditions
6
- are met:
7
- 1. Redistributions of source code must retain the above copyright
8
- notice, this list of conditions and the following disclaimer.
9
- 2. Redistributions in binary form must reproduce the above
10
- copyright notice, this list of conditions and the following
11
- disclaimer in the documentation and/or other materials
12
- provided with the distribution.
13
-
14
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANY
18
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22
- OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
*====================================================================*/
26
27
#ifndef LEPTONICA_MORPH_H
28
#define LEPTONICA_MORPH_H
29
56
/*-------------------------------------------------------------------------*
57
* Sel and Sel array *
58
*-------------------------------------------------------------------------*/
59
#define SEL_VERSION_NUMBER 1
60
62
struct
Sel
63
{
64
l_int32
sy
;
65
l_int32
sx
;
66
l_int32
cy
;
67
l_int32
cx
;
68
l_int32 **
data
;
69
char
*
name
;
70
};
71
typedef
struct
Sel
SEL
;
72
74
struct
Sela
75
{
76
l_int32
n
;
77
l_int32
nalloc
;
78
struct
Sel
**
sel
;
79
};
80
typedef
struct
Sela
SELA
;
81
82
83
/*-------------------------------------------------------------------------*
84
* Kernel *
85
*-------------------------------------------------------------------------*/
86
#define KERNEL_VERSION_NUMBER 2
87
89
struct
L_Kernel
90
{
91
l_int32
sy
;
92
l_int32
sx
;
93
l_int32
cy
;
94
l_int32
cx
;
95
l_float32 **
data
;
96
};
97
typedef
struct
L_Kernel
L_KERNEL
;
98
99
100
/*-------------------------------------------------------------------------*
101
* Morphological boundary condition flags *
102
* *
103
* Two types of boundary condition for erosion. *
104
* The global variable MORPH_BC takes on one of these two values. *
105
* See notes in morph.c for usage. *
106
*-------------------------------------------------------------------------*/
107
109
enum
{
110
SYMMETRIC_MORPH_BC = 0,
111
ASYMMETRIC_MORPH_BC = 1
112
};
113
114
/*-------------------------------------------------------------------------*
115
* Structuring element types *
116
*-------------------------------------------------------------------------*/
117
119
enum
{
120
SEL_DONT_CARE = 0,
121
SEL_HIT = 1,
122
SEL_MISS = 2
123
};
124
125
/*-------------------------------------------------------------------------*
126
* Runlength flags for granulometry *
127
*-------------------------------------------------------------------------*/
128
130
enum
{
131
L_RUN_OFF = 0,
132
L_RUN_ON = 1
133
};
134
135
/*-------------------------------------------------------------------------*
136
* Direction flags for grayscale morphology, granulometry, *
137
* composable Sels, convolution, etc. *
138
*-------------------------------------------------------------------------*/
139
141
enum
{
142
L_HORIZ = 1,
143
L_VERT = 2,
144
L_BOTH_DIRECTIONS = 3
145
};
146
147
/*-------------------------------------------------------------------------*
148
* Morphological operation flags *
149
*-------------------------------------------------------------------------*/
150
152
enum
{
153
L_MORPH_DILATE = 1,
154
L_MORPH_ERODE = 2,
155
L_MORPH_OPEN = 3,
156
L_MORPH_CLOSE = 4,
157
L_MORPH_HMT = 5
158
};
159
160
/*-------------------------------------------------------------------------*
161
* Grayscale intensity scaling flags *
162
*-------------------------------------------------------------------------*/
163
165
enum
{
166
L_LINEAR_SCALE = 1,
167
L_LOG_SCALE = 2
168
};
169
170
/*-------------------------------------------------------------------------*
171
* Morphological tophat flags *
172
*-------------------------------------------------------------------------*/
173
175
enum
{
176
L_TOPHAT_WHITE = 0,
177
L_TOPHAT_BLACK = 1
178
};
179
180
/*-------------------------------------------------------------------------*
181
* Arithmetic and logical operator flags *
182
* (use on grayscale images and Numas) *
183
*-------------------------------------------------------------------------*/
184
186
enum
{
187
L_ARITH_ADD = 1,
188
L_ARITH_SUBTRACT = 2,
189
L_ARITH_MULTIPLY = 3,
/* on numas only */
190
L_ARITH_DIVIDE = 4,
/* on numas only */
191
L_UNION = 5,
/* on numas only */
192
L_INTERSECTION = 6,
/* on numas only */
193
L_SUBTRACTION = 7,
/* on numas only */
194
L_EXCLUSIVE_OR = 8
/* on numas only */
195
};
196
197
/*-------------------------------------------------------------------------*
198
* Min/max selection flags *
199
*-------------------------------------------------------------------------*/
200
202
enum
{
203
L_CHOOSE_MIN = 1,
/* useful in a downscaling "erosion" */
204
L_CHOOSE_MAX = 2,
/* useful in a downscaling "dilation" */
205
L_CHOOSE_MAXDIFF = 3,
/* useful in a downscaling contrast */
206
L_CHOOSE_MIN_BOOST = 4,
/* use a modification of the min value */
207
L_CHOOSE_MAX_BOOST = 5
/* use a modification of the max value */
208
};
209
210
/*-------------------------------------------------------------------------*
211
* Distance function b.c. flags *
212
*-------------------------------------------------------------------------*/
213
215
enum
{
216
L_BOUNDARY_BG = 1,
/* assume bg outside image */
217
L_BOUNDARY_FG = 2
/* assume fg outside image */
218
};
219
220
/*-------------------------------------------------------------------------*
221
* Image comparison flags *
222
*-------------------------------------------------------------------------*/
223
225
enum
{
226
L_COMPARE_XOR = 1,
227
L_COMPARE_SUBTRACT = 2,
228
L_COMPARE_ABS_DIFF = 3
229
};
230
231
/*-------------------------------------------------------------------------*
232
* Color content flags *
233
*-------------------------------------------------------------------------*/
234
236
enum
{
237
L_MAX_DIFF_FROM_AVERAGE_2 = 1,
238
L_MAX_MIN_DIFF_FROM_2 = 2,
239
L_MAX_DIFF = 3
240
};
241
242
/*-------------------------------------------------------------------------*
243
* Standard size of border added around images for special processing *
244
*-------------------------------------------------------------------------*/
245
static
const
l_int32
ADDED_BORDER
= 32;
248
#endif
/* LEPTONICA_MORPH_H */
ADDED_BORDER
static const l_int32 ADDED_BORDER
Definition:
morph.h:245
L_Kernel::data
l_float32 ** data
Definition:
morph.h:95
Sela::nalloc
l_int32 nalloc
Definition:
morph.h:77
Sel::sy
l_int32 sy
Definition:
morph.h:64
Sel::data
l_int32 ** data
Definition:
morph.h:68
L_Kernel::sy
l_int32 sy
Definition:
morph.h:91
Sel::name
char * name
Definition:
morph.h:69
Sel
Definition:
morph.h:62
Sel::sx
l_int32 sx
Definition:
morph.h:65
L_Kernel::cx
l_int32 cx
Definition:
morph.h:94
Sel::cx
l_int32 cx
Definition:
morph.h:67
Sel::cy
l_int32 cy
Definition:
morph.h:66
Sela::n
l_int32 n
Definition:
morph.h:76
L_Kernel
Definition:
morph.h:89
Sela::sel
struct Sel ** sel
Definition:
morph.h:78
L_Kernel::cy
l_int32 cy
Definition:
morph.h:93
Sela
Definition:
morph.h:74
L_Kernel::sx
l_int32 sx
Definition:
morph.h:92
src
morph.h
Generated by
1.8.14