Point Cloud Library (PCL)
1.15.1
Toggle main menu visibility
Loading...
Searching...
No Matches
pcl
recognition
face_detection
face_common.h
1
#pragma once
2
3
#include <pcl/features/integral_image2D.h>
4
#include <
pcl/memory.h
>
5
#include <
pcl/pcl_macros.h
>
6
7
#include <Eigen/Core>
8
9
namespace
pcl
10
{
11
namespace
face_detection
12
{
13
class
TrainingExample
14
{
15
public
:
16
std::vector<pcl::IntegralImage2D<float, 1>::Ptr>
iimages_
;
//also pointer to the respective integral image
17
int
row_
,
col_
;
18
int
wsize_
;
19
int
label_
;
20
21
//save pose head information
22
Eigen::Vector3f
trans_
;
23
Eigen::Vector3f
rot_
;
24
PCL_MAKE_ALIGNED_OPERATOR_NEW
25
};
26
27
class
FeatureType
28
{
29
public
:
30
int
row1_
,
col1_
;
31
int
row2_
,
col2_
;
32
33
int
wsizex1_
,
wsizey1_
;
34
int
wsizex2_
,
wsizey2_
;
35
36
float
threshold_
;
37
int
used_ii_
;
38
39
FeatureType
()
40
{
41
used_ii_
= 0;
42
}
43
44
void
serialize
(std::ostream & stream)
const
45
{
46
stream.write (
reinterpret_cast<
const
char
*
>
(&
row1_
),
sizeof
(
row1_
));
47
stream.write (
reinterpret_cast<
const
char
*
>
(&
col1_
),
sizeof
(
col1_
));
48
stream.write (
reinterpret_cast<
const
char
*
>
(&
row2_
),
sizeof
(
row2_
));
49
stream.write (
reinterpret_cast<
const
char
*
>
(&
col2_
),
sizeof
(
col2_
));
50
stream.write (
reinterpret_cast<
const
char
*
>
(&
wsizex1_
),
sizeof
(
wsizex1_
));
51
stream.write (
reinterpret_cast<
const
char
*
>
(&
wsizex2_
),
sizeof
(
wsizex2_
));
52
stream.write (
reinterpret_cast<
const
char
*
>
(&
wsizey1_
),
sizeof
(
wsizey1_
));
53
stream.write (
reinterpret_cast<
const
char
*
>
(&
wsizey2_
),
sizeof
(
wsizey2_
));
54
stream.write (
reinterpret_cast<
const
char
*
>
(&
threshold_
),
sizeof
(
threshold_
));
55
stream.write (
reinterpret_cast<
const
char
*
>
(&
used_ii_
),
sizeof
(
used_ii_
));
56
}
57
58
inline
void
deserialize
(std::istream & stream)
59
{
60
stream.read (
reinterpret_cast<
char
*
>
(&
row1_
),
sizeof
(
row1_
));
61
stream.read (
reinterpret_cast<
char
*
>
(&
col1_
),
sizeof
(
col1_
));
62
stream.read (
reinterpret_cast<
char
*
>
(&
row2_
),
sizeof
(
row2_
));
63
stream.read (
reinterpret_cast<
char
*
>
(&
col2_
),
sizeof
(
col2_
));
64
stream.read (
reinterpret_cast<
char
*
>
(&
wsizex1_
),
sizeof
(
wsizex1_
));
65
stream.read (
reinterpret_cast<
char
*
>
(&
wsizex2_
),
sizeof
(
wsizex2_
));
66
stream.read (
reinterpret_cast<
char
*
>
(&
wsizey1_
),
sizeof
(
wsizey1_
));
67
stream.read (
reinterpret_cast<
char
*
>
(&
wsizey2_
),
sizeof
(
wsizey2_
));
68
stream.read (
reinterpret_cast<
char
*
>
(&
threshold_
),
sizeof
(
threshold_
));
69
stream.read (
reinterpret_cast<
char
*
>
(&
used_ii_
),
sizeof
(
used_ii_
));
70
}
71
};
72
73
template
<
class
FeatureType>
74
class
RFTreeNode
75
{
76
public
:
77
float
threshold
;
78
FeatureType
feature
;
79
std::vector<RFTreeNode>
sub_nodes
;
80
float
value
;
81
float
variance
;
82
83
Eigen::Vector3d
trans_mean_
;
84
Eigen::Vector3d
rot_mean_
;
85
86
float
purity_
;
87
Eigen::Matrix3d
covariance_trans_
;
88
Eigen::Matrix3d
covariance_rot_
;
89
90
PCL_MAKE_ALIGNED_OPERATOR_NEW
91
92
void
serialize
(::std::ostream & stream)
const
93
{
94
95
const
int
num_of_sub_nodes =
static_cast<
int
>
(
sub_nodes
.size ());
96
stream.write (
reinterpret_cast<
const
char
*
>
(&num_of_sub_nodes),
sizeof
(num_of_sub_nodes));
97
98
if
(!
sub_nodes
.empty ())
99
{
100
feature
.serialize (stream);
101
stream.write (
reinterpret_cast<
const
char
*
>
(&
threshold
),
sizeof
(
threshold
));
102
}
103
104
stream.write (
reinterpret_cast<
const
char
*
>
(&
value
),
sizeof
(
value
));
105
stream.write (
reinterpret_cast<
const
char
*
>
(&
variance
),
sizeof
(
variance
));
106
107
for
(std::size_t i = 0; i < 3; i++)
108
stream.write (
reinterpret_cast<
const
char
*
>
(&
trans_mean_
[i]),
sizeof
(
trans_mean_
[i]));
109
110
for
(std::size_t i = 0; i < 3; i++)
111
stream.write (
reinterpret_cast<
const
char
*
>
(&
rot_mean_
[i]),
sizeof
(
rot_mean_
[i]));
112
113
for
(std::size_t i = 0; i < 3; i++)
114
for
(std::size_t j = 0; j < 3; j++)
115
stream.write (
reinterpret_cast<
const
char
*
>
(&
covariance_trans_
(i, j)),
sizeof
(
covariance_trans_
(i, j)));
116
117
for
(std::size_t i = 0; i < 3; i++)
118
for
(std::size_t j = 0; j < 3; j++)
119
stream.write (
reinterpret_cast<
const
char
*
>
(&
covariance_rot_
(i, j)),
sizeof
(
covariance_rot_
(i, j)));
120
121
for
(
int
sub_node_index = 0; sub_node_index < num_of_sub_nodes; ++sub_node_index)
122
{
123
sub_nodes
[sub_node_index].serialize (stream);
124
}
125
}
126
127
inline
void
deserialize
(::std::istream & stream)
128
{
129
int
num_of_sub_nodes;
130
stream.read (
reinterpret_cast<
char
*
>
(&num_of_sub_nodes),
sizeof
(num_of_sub_nodes));
131
132
if
(num_of_sub_nodes > 0)
133
{
134
feature
.deserialize (stream);
135
stream.read (
reinterpret_cast<
char
*
>
(&
threshold
),
sizeof
(
threshold
));
136
}
137
138
stream.read (
reinterpret_cast<
char
*
>
(&
value
),
sizeof
(
value
));
139
stream.read (
reinterpret_cast<
char
*
>
(&
variance
),
sizeof
(
variance
));
140
141
for
(std::size_t i = 0; i < 3; i++)
142
stream.read (
reinterpret_cast<
char
*
>
(&
trans_mean_
[i]),
sizeof
(
trans_mean_
[i]));
143
144
for
(std::size_t i = 0; i < 3; i++)
145
stream.read (
reinterpret_cast<
char
*
>
(&
rot_mean_
[i]),
sizeof
(
rot_mean_
[i]));
146
147
for
(std::size_t i = 0; i < 3; i++)
148
for
(std::size_t j = 0; j < 3; j++)
149
stream.read (
reinterpret_cast<
char
*
>
(&
covariance_trans_
(i, j)),
sizeof
(
covariance_trans_
(i, j)));
150
151
for
(std::size_t i = 0; i < 3; i++)
152
for
(std::size_t j = 0; j < 3; j++)
153
stream.read (
reinterpret_cast<
char
*
>
(&
covariance_rot_
(i, j)),
sizeof
(
covariance_rot_
(i, j)));
154
155
sub_nodes
.resize (num_of_sub_nodes);
156
157
if
(num_of_sub_nodes > 0)
158
{
159
for
(
int
sub_node_index = 0; sub_node_index < num_of_sub_nodes; ++sub_node_index)
160
{
161
sub_nodes
[sub_node_index].deserialize (stream);
162
}
163
}
164
}
165
};
166
}
167
}
pcl::face_detection::FeatureType
Definition
face_common.h:28
pcl::face_detection::FeatureType::threshold_
float threshold_
Definition
face_common.h:36
pcl::face_detection::FeatureType::row1_
int row1_
Definition
face_common.h:30
pcl::face_detection::FeatureType::wsizex1_
int wsizex1_
Definition
face_common.h:33
pcl::face_detection::FeatureType::wsizex2_
int wsizex2_
Definition
face_common.h:34
pcl::face_detection::FeatureType::wsizey2_
int wsizey2_
Definition
face_common.h:34
pcl::face_detection::FeatureType::wsizey1_
int wsizey1_
Definition
face_common.h:33
pcl::face_detection::FeatureType::col2_
int col2_
Definition
face_common.h:31
pcl::face_detection::FeatureType::used_ii_
int used_ii_
Definition
face_common.h:37
pcl::face_detection::FeatureType::row2_
int row2_
Definition
face_common.h:31
pcl::face_detection::FeatureType::deserialize
void deserialize(std::istream &stream)
Definition
face_common.h:58
pcl::face_detection::FeatureType::serialize
void serialize(std::ostream &stream) const
Definition
face_common.h:44
pcl::face_detection::FeatureType::FeatureType
FeatureType()
Definition
face_common.h:39
pcl::face_detection::FeatureType::col1_
int col1_
Definition
face_common.h:30
pcl::face_detection::RFTreeNode
Definition
face_common.h:75
pcl::face_detection::RFTreeNode< face_detection::FeatureType >::value
float value
Definition
face_common.h:80
pcl::face_detection::RFTreeNode< face_detection::FeatureType >::rot_mean_
Eigen::Vector3d rot_mean_
Definition
face_common.h:84
pcl::face_detection::RFTreeNode::deserialize
void deserialize(::std::istream &stream)
Definition
face_common.h:127
pcl::face_detection::RFTreeNode< face_detection::FeatureType >::covariance_rot_
Eigen::Matrix3d covariance_rot_
Definition
face_common.h:88
pcl::face_detection::RFTreeNode< face_detection::FeatureType >::sub_nodes
std::vector< RFTreeNode > sub_nodes
Definition
face_common.h:79
pcl::face_detection::RFTreeNode::serialize
PCL_MAKE_ALIGNED_OPERATOR_NEW void serialize(::std::ostream &stream) const
Definition
face_common.h:92
pcl::face_detection::RFTreeNode< face_detection::FeatureType >::variance
float variance
Definition
face_common.h:81
pcl::face_detection::RFTreeNode< face_detection::FeatureType >::threshold
float threshold
Definition
face_common.h:77
pcl::face_detection::RFTreeNode< face_detection::FeatureType >::trans_mean_
Eigen::Vector3d trans_mean_
Definition
face_common.h:83
pcl::face_detection::RFTreeNode< face_detection::FeatureType >::feature
FeatureType feature
Definition
face_common.h:78
pcl::face_detection::RFTreeNode< face_detection::FeatureType >::covariance_trans_
Eigen::Matrix3d covariance_trans_
Definition
face_common.h:87
pcl::face_detection::RFTreeNode< face_detection::FeatureType >::purity_
float purity_
Definition
face_common.h:86
pcl::face_detection::TrainingExample
Definition
face_common.h:14
pcl::face_detection::TrainingExample::trans_
Eigen::Vector3f trans_
Definition
face_common.h:22
pcl::face_detection::TrainingExample::iimages_
std::vector< pcl::IntegralImage2D< float, 1 >::Ptr > iimages_
Definition
face_common.h:16
pcl::face_detection::TrainingExample::wsize_
int wsize_
Definition
face_common.h:18
pcl::face_detection::TrainingExample::label_
int label_
Definition
face_common.h:19
pcl::face_detection::TrainingExample::rot_
Eigen::Vector3f rot_
Definition
face_common.h:23
pcl::face_detection::TrainingExample::col_
int col_
Definition
face_common.h:17
pcl::face_detection::TrainingExample::row_
int row_
Definition
face_common.h:17
PCL_MAKE_ALIGNED_OPERATOR_NEW
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Definition
memory.h:86
memory.h
Defines functions, macros and traits for allocating and using memory.
pcl::face_detection
Definition
face_common.h:12
pcl
Definition
convolution.h:46
pcl_macros.h
Defines all the PCL and non-PCL macros used.