iceWing
Main Page
Namespaces
Data Structures
Files
File List
Globals
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
main
region.h
Go to the documentation of this file.
1
/* -*- mode: C; tab-width: 4; c-basic-offset: 4; -*- */
2
3
/*
4
* Author: Frank Loemker
5
*
6
* Copyright (C) 1999-2009
7
* Frank Loemker, Applied Computer Science, Faculty of Technology,
8
* Bielefeld University, Germany
9
*
10
* This file is part of iceWing, a graphical plugin shell.
11
*
12
* iceWing is free software; you can redistribute it and/or modify
13
* it under the terms of the GNU General Public License as published by
14
* the Free Software Foundation; either version 2 of the License, or
15
* (at your option) any later version.
16
*
17
* iceWing is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU General Public License for more details.
21
*
22
* You should have received a copy of the GNU General Public License
23
* along with this program; if not, write to the Free Software
24
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25
*/
26
27
#ifndef iw_region_H
28
#define iw_region_H
29
30
#include <gtk/gtk.h>
31
#include "
tools/tools.h
"
32
#include "
gui/Gimage.h
"
33
#include "main/sfb_iw.h"
34
35
typedef
struct
_regCalcData
iwRegCalcData
;
36
37
typedef
enum
{
38
IW_REG_INCLUSION
= 1 << 0,
/* Calculate inclusion */
39
IW_REG_NO_ZERO
= 1 << 1
/* Ignore regions with a label of 0 */
40
}
iwRegMode
;
41
42
typedef
enum
{
43
IW_REG_THIN_OFF
= 1 << 0,
/* Don't perform any thinning */
44
IW_REG_THIN_ABS
= 1 << 1,
/* Only leave every nth point */
45
IW_REG_THIN_DIST
= 1 << 2
/* Only leave points which are farther away than the threshold */
46
}
iwRegThinning
;
47
48
typedef
struct
{
49
int
pixelcount
;
/* Number of pixels */
50
int
color
;
/* Region color */
51
int
com_x,
com_y
;
/* COM of the region */
52
int
summe_x,
summe_y
;
/* Coordinate sum for the COM calculation */
53
}
iwRegCOMinfo
;
54
55
typedef
struct
{
56
Region_t
r
;
57
int
id
;
/* On output this is put in the HypothesenKopf_t */
58
int
alter
;
/* Number of 40ms-slides the region is tracked */
59
int
labindex
;
/* Index from regionlab for region r */
60
float
judgement
;
/* Judgement from the classifier */
61
float
judge_kalman
;
/* Judgement from the kalman filter (time and distance) */
62
float
judge_motion
;
/* Judgement from motion information */
63
float
avgConf
;
64
void
*
data
;
65
}
iwRegion
;
66
67
#include "
plugin_comm.h
"
68
69
typedef
void
* (*iwRegDataFunc) (
plugDefinition
*plug,
iwRegion
*region,
int
mode);
70
71
#define IW_REG_DATA_SET 0
72
#define IW_REG_DATA_CONVERT 1
73
#define IW_REG_DATA_IDENT "regionData"
74
75
#ifdef __cplusplus
76
extern
"C"
{
77
#endif
78
79
/*********************************************************************
80
Do a region labeling of the image color (size: xsize x ysize) and
81
write the result to region.
82
Return: Number of regions.
83
*********************************************************************/
84
int
iw_reg_label
(
int
xsize,
int
ysize,
const
uchar *color, gint32 *region);
85
86
/*********************************************************************
87
Do a region labeling of the image color (size: xsize x ysize) and
88
write the result to region. Calculate pixel count, color, and COM
89
of the regions.
90
pixel count < minPixelCount -> Pixel count of the region = 0
91
Return value is a pointer to a static variable!
92
*********************************************************************/
93
iwRegCOMinfo
*
iw_reg_label_with_calc
(
int
xsize,
int
ysize,
const
uchar *color,
94
gint32 *region,
int
*nregions,
int
minPixelCount);
95
96
/*********************************************************************
97
Maintain the struct holding settings for the region calculation.
98
The different settings are:
99
color : Classified image (supported: 1 plane, IW_8U, IW_16U, and
100
IW_32S), used to get a color index
101
orig_img: Original color image, used to get the average region color
102
confimg : Confidence mapped image from the color classifier.
103
!= NULL: regionen->avgConf = average confidence value of
104
the region
105
minPixelCount: Minimal size of calculated regions
106
iwRegMode|iwRegThinning: See the flags above.
107
maxdist : Distance value for the modes IW_REG_THIN_ABS and
108
IW_REG_THIN_DIST.
109
*********************************************************************/
110
iwRegCalcData
*
iw_reg_data_create
(
void
);
111
void
iw_reg_data_free
(
iwRegCalcData
*data);
112
void
iw_reg_data_set_images
(
iwRegCalcData
*data,
113
iwImage
*color, uchar **orig_img, uchar *confimg);
114
void
iw_reg_data_set_minregion
(
iwRegCalcData
*data,
int
minPixelCount);
115
void
iw_reg_data_set_mode
(
iwRegCalcData
*data,
iwRegMode
mode);
116
void
iw_reg_data_set_thinning
(
iwRegCalcData
*data,
iwRegThinning
mode,
float
maxdist);
117
118
/*********************************************************************
119
Calculate regions from the image "image".
120
xlen, ylen: Size of image
121
image : Region labeld image
122
num_reg : in : Number of labeld regions
123
out : Number of calculated regions
124
data : Additional settings for the region calculation.
125
*********************************************************************/
126
iwRegion
*
iw_reg_calc_data
(
int
xlen,
int
ylen, gint32 *image,
int
*num_reg,
127
iwRegCalcData
*data);
128
iwRegion
*
iw_reg_calc
(
int
xlen,
int
ylen, uchar *color,
129
gint32 *image, uchar **orig_img, uchar *confimg,
130
int
*num_reg,
int
doEinschluss,
int
minPixelCount);
131
iwRegion
*
iw_reg_calc_img
(
int
xlen,
int
ylen,
iwImage
*color,
132
gint32 *image, uchar **orig_img, uchar *confimg,
133
int
*num_reg,
iwRegMode
mode,
int
minPixelCount);
134
135
/*********************************************************************
136
Stretch region reg by scale pixels in all directions and
137
restrict the region to a size of width x height.
138
*********************************************************************/
139
void
iw_reg_stretch
(
int
width,
int
height,
iwRegion
*reg,
int
scale);
140
141
/*********************************************************************
142
Return bounding box of polygon p.
143
*********************************************************************/
144
void
iw_reg_boundingbox
(
const
Polygon_t *p,
int
*x1,
int
*y1,
int
*x2,
int
*y2);
145
146
/*********************************************************************
147
Upsample regions by factor (upw,uph).
148
*********************************************************************/
149
void
iw_reg_upsample
(
int
nregions,
iwRegion
*regions,
float
upw,
float
uph);
150
151
/*********************************************************************
152
Free regions allocated with iw_reg_copy(). Attention: This works
153
only correctly for regions allocated with iw_reg_copy().
154
*********************************************************************/
155
void
iw_reg_free
(
int
nregions,
iwRegion
*regions);
156
157
/*********************************************************************
158
Return a copy of regions. Attention: Single regions can't be freed
159
as all points and polygons are malloced en bloc.
160
*********************************************************************/
161
iwRegion
*
iw_reg_copy
(
int
nregions,
const
iwRegion
*regions);
162
163
#ifdef __cplusplus
164
}
165
#endif
166
167
#endif
/* iw_region_H */
Generated by
1.8.1