Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
bulb.h
1
2
/***************************************************************************
3
* bulb.h - class defining a light bulb as mirror
4
*
5
* Created: Thu Jul 21 14:25:00 2005
6
* Copyright 2005-2012 Tim Niemueller [www.niemueller.de]
7
* 2005 Martin Heracles
8
****************************************************************************/
9
10
/* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version. A runtime exception applies to
14
* this software (see LICENSE.GPL_WRE file mentioned below for details).
15
*
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU Library General Public License for more details.
20
*
21
* Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22
*/
23
24
#ifndef __FIREVISION_MODELS_MIRROR_BULB_H_
25
#define __FIREVISION_MODELS_MIRROR_BULB_H_
26
27
#include <fvmodels/mirror/mirrormodel.h>
28
29
#include <string>
30
31
namespace
firevision {
32
#if 0
/* just to make Emacs auto-indent happy */
33
}
34
#endif
35
36
class
SharedMemoryLookupTable;
37
38
class
Bulb
:
public
MirrorModel
39
{
40
friend
class
BulbGenerator;
41
public
:
42
43
// This constructor loads an existing bulb model (lut) from file "filename".
44
Bulb
(
const
char
*filename);
45
Bulb
(
const
char
*filename,
46
const
char
*lut_id,
bool
destroy_on_delete =
false
);
47
48
Bulb
(
unsigned
int
width,
unsigned
int
height);
49
Bulb
(
unsigned
int
width,
unsigned
int
height,
50
const
char
*lut_id,
bool
destroy_on_delete =
false
);
51
52
Bulb
(
const
Bulb
&bulb);
53
54
virtual
~
Bulb
();
55
56
virtual
void
warp2unwarp(
unsigned
int
warp_x,
unsigned
int
warp_y,
57
unsigned
int
*unwarp_x,
unsigned
int
*unwarp_y);
58
virtual
void
unwarp2warp(
unsigned
int
unwarp_x,
unsigned
int
unwarp_y,
59
unsigned
int
*warp_x,
unsigned
int
*warp_y );
60
61
virtual
const
char
* getName();
62
63
virtual
bool
isValid();
64
65
66
virtual
void
setWorldPoint(
unsigned
int
image_x,
67
unsigned
int
image_y,
68
float
world_r,
69
float
world_phi);
70
71
72
virtual
fawkes::polar_coord_2d_t
getWorldPointRelative(
unsigned
int
image_x,
73
unsigned
int
image_y )
const
;
74
75
virtual
fawkes::cart_coord_2d_t
getWorldPointGlobal(
unsigned
int
image_x,
76
unsigned
int
image_y,
77
float
pose_x,
float
pose_y,
78
float
pose_ori )
const
;
79
80
virtual
void
reset();
81
82
virtual
fawkes::point_t
getCenter()
const
;
83
virtual
void
setCenter(
unsigned
int
image_x,
84
unsigned
int
image_y );
85
virtual
void
setOrientation(
float
angle);
86
virtual
float
getOrientation()
const
;
87
88
virtual
bool
isValidPoint(
unsigned
int
image_x,
unsigned
int
image_y )
const
;
89
90
91
bool
isNonZero(
unsigned
int
image_x,
92
unsigned
int
image_y )
const
;
93
94
unsigned
int
numNonZero()
const
;
95
96
97
float
getAngle(
unsigned
int
image_x,
98
unsigned
int
image_y )
const
;
99
100
float
getDistanceInImage(
unsigned
int
image_p1_x,
unsigned
int
image_p1_y,
101
unsigned
int
image_p2_x,
unsigned
int
image_p2_y );
102
103
float
convertAngleI2W (
float
angle_in_image)
const
;
104
105
106
void
load(
const
char
* filename);
107
void
save(
const
char
* filename);
108
109
static
std::string composeFilename(
const
char
* format);
110
111
const
fawkes::polar_coord_2d_t
* get_lut()
const
;
112
113
protected
:
114
115
/** bulb file header. */
116
typedef
struct
{
117
unsigned
int
width
;
/**< width of LUT */
118
unsigned
int
height
;
/**< height of LUT */
119
unsigned
int
center_x
;
/**< x coordinate of mirror center in image */
120
unsigned
int
center_y
;
/**< y coordinate of mirror center in image */
121
float
orientation
;
/**< orientation of camera in image */
122
float
dist_min
;
/**< minimum distance from mirror center */
123
float
dist_max
;
/**< maximum distance from mirror center */
124
}
bulb_file_header_t
;
125
126
127
private
:
128
void
create();
129
void
erase();
130
void
init();
131
132
private
:
133
134
// dimension of lut (and image)
135
unsigned
int
width;
136
unsigned
int
height;
137
unsigned
int
bytes_per_sample;
138
139
// center of omni camera device
140
unsigned
int
image_center_x;
141
unsigned
int
image_center_y;
142
143
// orientation of omni camera device
144
float
orientation;
145
146
// distance of closest and of farthest sample point
147
float
distance_min;
148
float
distance_max;
149
150
bool
valid;
151
152
char
*lut_id;
153
fawkes::polar_coord_2d_t
*lut;
154
unsigned
int
lut_bytes;
155
bool
destroy_on_delete;
156
157
SharedMemoryLookupTable
*shm_lut;
158
159
160
};
161
162
}
// end namespace firevision
163
164
#endif
src
libs
fvmodels
mirror
bulb.h
Generated by
1.8.3.1