Leptonica
1.83.1
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
55
/*-------------------------------------------------------------------------*
56
* Sel and Sel array *
57
*-------------------------------------------------------------------------*/
58
#define SEL_VERSION_NUMBER 1
59
61
struct
Sel
62
{
63
l_int32
sy
;
64
l_int32
sx
;
65
l_int32
cy
;
66
l_int32
cx
;
67
l_int32 **
data
;
68
char
*
name
;
69
};
70
typedef
struct
Sel
SEL
;
71
73
struct
Sela
74
{
75
l_int32
n
;
76
l_int32
nalloc
;
77
struct
Sel
**
sel
;
78
};
79
typedef
struct
Sela
SELA
;
80
81
82
/*-------------------------------------------------------------------------*
83
* Kernel *
84
*-------------------------------------------------------------------------*/
85
#define KERNEL_VERSION_NUMBER 2
86
88
struct
L_Kernel
89
{
90
l_int32
sy
;
91
l_int32
sx
;
92
l_int32
cy
;
93
l_int32
cx
;
94
l_float32 **
data
;
95
};
96
typedef
struct
L_Kernel
L_KERNEL
;
97
98
99
/*-------------------------------------------------------------------------*
100
* Morphological boundary condition flags *
101
* *
102
* Two types of boundary condition for erosion. *
103
* The global variable MORPH_BC takes on one of these two values. *
104
* See notes in morph.c for usage. *
105
*-------------------------------------------------------------------------*/
107
enum
{
108
SYMMETRIC_MORPH_BC = 0,
109
ASYMMETRIC_MORPH_BC = 1
110
};
111
112
/*-------------------------------------------------------------------------*
113
* Structuring element vals *
114
*-------------------------------------------------------------------------*/
116
enum
{
117
SEL_DONT_CARE = 0,
118
SEL_HIT = 1,
119
SEL_MISS = 2
120
};
121
122
/*-------------------------------------------------------------------------*
123
* Runlength flags for granulometry *
124
*-------------------------------------------------------------------------*/
126
enum
{
127
L_RUN_OFF = 0,
128
L_RUN_ON = 1
129
};
130
131
/*-------------------------------------------------------------------------*
132
* Direction flags for grayscale morphology, granulometry, *
133
* composable Sels, convolution, etc. *
134
*-------------------------------------------------------------------------*/
136
enum
{
137
L_HORIZ = 1,
138
L_VERT = 2,
139
L_BOTH_DIRECTIONS = 3
140
};
141
142
/*-------------------------------------------------------------------------*
143
* Morphological operation flags *
144
*-------------------------------------------------------------------------*/
146
enum
{
147
L_MORPH_DILATE = 1,
148
L_MORPH_ERODE = 2,
149
L_MORPH_OPEN = 3,
150
L_MORPH_CLOSE = 4,
151
L_MORPH_HMT = 5
152
};
153
154
/*-------------------------------------------------------------------------*
155
* Grayscale intensity scaling flags *
156
*-------------------------------------------------------------------------*/
158
enum
{
159
L_LINEAR_SCALE = 1,
160
L_LOG_SCALE = 2
161
};
162
163
/*-------------------------------------------------------------------------*
164
* Morphological tophat flags *
165
*-------------------------------------------------------------------------*/
167
enum
{
168
L_TOPHAT_WHITE = 0,
169
L_TOPHAT_BLACK = 1
170
};
171
172
/*-------------------------------------------------------------------------*
173
* Arithmetic and logical operator flags *
174
* (use on grayscale images and Numas) *
175
*-------------------------------------------------------------------------*/
177
enum
{
178
L_ARITH_ADD = 1,
179
L_ARITH_SUBTRACT = 2,
180
L_ARITH_MULTIPLY = 3,
/* on numas only */
181
L_ARITH_DIVIDE = 4,
/* on numas only */
182
L_UNION = 5,
/* on numas only */
183
L_INTERSECTION = 6,
/* on numas only */
184
L_SUBTRACTION = 7,
/* on numas only */
185
L_EXCLUSIVE_OR = 8
/* on numas only */
186
};
187
188
/*-------------------------------------------------------------------------*
189
* Min/max selection flags *
190
*-------------------------------------------------------------------------*/
192
enum
{
193
L_CHOOSE_MIN = 1,
/* useful in a downscaling "erosion" */
194
L_CHOOSE_MAX = 2,
/* useful in a downscaling "dilation" */
195
L_CHOOSE_MAXDIFF = 3,
/* useful in a downscaling contrast */
196
L_CHOOSE_MIN_BOOST = 4,
/* use a modification of the min value */
197
L_CHOOSE_MAX_BOOST = 5
/* use a modification of the max value */
198
};
199
200
/*-------------------------------------------------------------------------*
201
* Exterior value b.c. for distance function flags *
202
*-------------------------------------------------------------------------*/
204
enum
{
205
L_BOUNDARY_BG = 1,
/* assume bg outside image */
206
L_BOUNDARY_FG = 2
/* assume fg outside image */
207
};
208
209
/*-------------------------------------------------------------------------*
210
* Image comparison flags *
211
*-------------------------------------------------------------------------*/
213
enum
{
214
L_COMPARE_XOR = 1,
215
L_COMPARE_SUBTRACT = 2,
216
L_COMPARE_ABS_DIFF = 3
217
};
218
219
/*-------------------------------------------------------------------------*
220
* Standard size of border added around images for special processing *
221
*-------------------------------------------------------------------------*/
222
static
const
l_int32
ADDED_BORDER
= 32;
225
#endif
/* LEPTONICA_MORPH_H */
ADDED_BORDER
static const l_int32 ADDED_BORDER
Definition:
morph.h:222
L_Kernel
Definition:
morph.h:89
L_Kernel::cx
l_int32 cx
Definition:
morph.h:93
L_Kernel::sx
l_int32 sx
Definition:
morph.h:91
L_Kernel::cy
l_int32 cy
Definition:
morph.h:92
L_Kernel::data
l_float32 ** data
Definition:
morph.h:94
L_Kernel::sy
l_int32 sy
Definition:
morph.h:90
Sel
Definition:
morph.h:62
Sel::sx
l_int32 sx
Definition:
morph.h:64
Sel::cy
l_int32 cy
Definition:
morph.h:65
Sel::cx
l_int32 cx
Definition:
morph.h:66
Sel::data
l_int32 ** data
Definition:
morph.h:67
Sel::name
char * name
Definition:
morph.h:68
Sel::sy
l_int32 sy
Definition:
morph.h:63
Sela
Definition:
morph.h:74
Sela::sel
struct Sel ** sel
Definition:
morph.h:77
Sela::nalloc
l_int32 nalloc
Definition:
morph.h:76
Sela::n
l_int32 n
Definition:
morph.h:75
src
morph.h
Generated by
1.9.1