Point Cloud Library (PCL)
1.15.1
Toggle main menu visibility
Loading...
Searching...
No Matches
people
include
pcl
gpu
people
tree.h
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Point Cloud Library (PCL) - www.pointclouds.org
5
* Copyright (c) 2010-2012, Willow Garage, Inc.
6
*
7
* All rights reserved.
8
*
9
* Redistribution and use in source and binary forms, with or without
10
* modification, are permitted provided that the following conditions
11
* are met:
12
*
13
* * Redistributions of source code must retain the above copyright
14
* notice, this list of conditions and the following disclaimer.
15
* * Redistributions in binary form must reproduce the above
16
* copyright notice, this list of conditions and the following
17
* disclaimer in the documentation and/or other materials provided
18
* with the distribution.
19
* * Neither the name of Willow Garage, Inc. nor the names of its
20
* contributors may be used to endorse or promote products derived
21
* from this software without specific prior written permission.
22
*
23
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
* POSSIBILITY OF SUCH DAMAGE.
35
*
36
* $Id: $
37
* @authors: Cedric Cagniart, Koen Buys
38
*/
39
40
#pragma once
41
42
#include "label_common.h"
43
#include <cstdint>
44
#include <iostream>
45
#include <vector>
46
47
namespace
pcl
48
{
49
namespace
gpu
50
{
51
namespace
people
52
{
53
namespace
trees
54
{
55
// this has nothing to do here...
56
constexpr
double
focal
= 1000.;
57
58
// ###############################################
59
// compile type values
60
enum
{
NUM_ATTRIBS
= 2000 };
61
enum
{
NUM_LABELS
= 32 };
62
63
// ###############################################
64
// base data types used in the structures
65
66
using
std::uint8_t;
67
using
std::int16_t;
68
using
std::uint16_t;
69
using
std::int32_t;
70
using
std::uint32_t;
71
72
using
Attrib
= std::int16_t;
73
using
Label
= std::uint8_t;
74
using
Label32
= std::uint32_t;
75
using
Depth
= std::uint16_t;
76
77
struct
AttribLocation
78
{
79
inline
AttribLocation
() {
du1
=
dv1
=
du2
=
dv2
=0;}
80
inline
AttribLocation
(
int
u1,
int
v1,
int
u2,
int
v2):
du1
(static_cast<std::int16_t>(u1)),
81
dv1
(static_cast<std::int16_t>(v1)),
82
du2
(static_cast<std::int16_t>(u2)),
83
dv2
(static_cast<std::int16_t>(v2))
84
{}
85
86
std::int16_t
du1
,
dv1
,
du2
,
dv2
;
87
};
88
89
////////////////////////////////////////////////
90
// Tree basic Structure
91
struct
Node
92
{
93
Node
() {}
94
Node
(
const
AttribLocation
& l,
const
Attrib
& t) :
loc
(l),
thresh
(t) {}
95
AttribLocation
loc
;
96
Attrib
thresh
;
97
};
98
99
struct
Histogram
100
{
101
float
label_prob
[
NUM_PARTS
];
102
};
103
104
////////////////////////////////////////////////
105
// tree_io - Reading and writing AttributeLocations
106
inline
std::ostream&
operator <<
(std::ostream& os,
const
AttribLocation
& aloc ) {
return
os<<aloc.
du1
<<
" "
<<aloc.
dv1
<<
" "
<<aloc.
du2
<<
" "
<<aloc.
dv2
<<
"\n"
; }
107
inline
std::istream&
operator >>
(std::istream& is,
AttribLocation
& aloc ) {
return
is >> aloc.
du1
>> aloc.
dv1
>> aloc.
du2
>> aloc.
dv2
; }
108
inline
std::istream&
operator >>
(std::istream& is,
Node
& n) {
return
is >> n.
loc
>> n.
thresh
; }
109
110
void
writeAttribLocs
(
const
std::string& filename,
const
std::vector<AttribLocation>& alocs );
111
void
readAttribLocs
(
const
std::string& filename, std::vector<AttribLocation>& alocs );
112
void
readThreshs
(
const
std::string& filename, std::vector<Attrib>& threshs );
113
void
writeThreshs
(
const
std::string& filename,
const
std::vector<Attrib>& threshs );
114
115
////////////////////////////////////////////////
116
// tree_run
117
118
/** The stream points to ascii data that goes:
119
* ##################
120
* TreeHeight
121
* du1 dv1 du2 dv2 thresh
122
* du1 dv1 du2 dv2 thresh
123
* ............
124
* label
125
* label
126
* ##################
127
*
128
* there are 2^threeheight -1 nodes ( [du1 dv1 du2 dv2 thresh] lines )
129
* there are 2^threeheight leaves ( [label] lines )
130
*/
131
int
loadTree
( std::istream& is, std::vector<Node>& tree, std::vector<Label>& leaves );
132
int
loadTree
(
const
std::string& filename, std::vector<Node>& tree, std::vector<Label>& leaves );
133
void
runThroughTree
(
int
maxDepth,
const
std::vector<Node>& tree,
const
std::vector<Label>& leaves,
int
W,
int
H,
const
std::uint16_t* dmap,
Label
* lmap );
134
135
}
// end namespace Trees
136
}
// end namespace people
137
}
// end namespace gpu
138
}
// end namespace pcl
pcl::gpu::people::trees
Definition
tree.h:54
pcl::gpu::people::trees::readAttribLocs
void readAttribLocs(const std::string &filename, std::vector< AttribLocation > &alocs)
pcl::gpu::people::trees::writeThreshs
void writeThreshs(const std::string &filename, const std::vector< Attrib > &threshs)
pcl::gpu::people::trees::readThreshs
void readThreshs(const std::string &filename, std::vector< Attrib > &threshs)
pcl::gpu::people::trees::runThroughTree
void runThroughTree(int maxDepth, const std::vector< Node > &tree, const std::vector< Label > &leaves, int W, int H, const std::uint16_t *dmap, Label *lmap)
pcl::gpu::people::trees::writeAttribLocs
void writeAttribLocs(const std::string &filename, const std::vector< AttribLocation > &alocs)
pcl::gpu::people::trees::Depth
std::uint16_t Depth
Definition
tree.h:75
pcl::gpu::people::trees::focal
constexpr double focal
Definition
tree.h:56
pcl::gpu::people::trees::NUM_ATTRIBS
@ NUM_ATTRIBS
Definition
tree.h:60
pcl::gpu::people::trees::NUM_LABELS
@ NUM_LABELS
Definition
tree.h:61
pcl::gpu::people::trees::operator>>
std::istream & operator>>(std::istream &is, AttribLocation &aloc)
Definition
tree.h:107
pcl::gpu::people::trees::Label32
std::uint32_t Label32
Definition
tree.h:74
pcl::gpu::people::trees::operator<<
std::ostream & operator<<(std::ostream &os, const AttribLocation &aloc)
Definition
tree.h:106
pcl::gpu::people::trees::loadTree
int loadTree(std::istream &is, std::vector< Node > &tree, std::vector< Label > &leaves)
The stream points to ascii data that goes: ################## TreeHeight du1 dv1 du2 dv2 thresh du1 d...
pcl::gpu::people::trees::Attrib
std::int16_t Attrib
Definition
tree.h:72
pcl::gpu::people::trees::Label
std::uint8_t Label
Definition
tree.h:73
pcl::gpu::people
Definition
bodyparts_detector.h:63
pcl::gpu::people::NUM_PARTS
@ NUM_PARTS
Definition
label_common.h:60
pcl::gpu
Definition
device_array.h:45
pcl
Definition
convolution.h:46
pcl::gpu::people::trees::AttribLocation
Definition
tree.h:78
pcl::gpu::people::trees::AttribLocation::dv2
std::int16_t dv2
Definition
tree.h:86
pcl::gpu::people::trees::AttribLocation::AttribLocation
AttribLocation()
Definition
tree.h:79
pcl::gpu::people::trees::AttribLocation::du1
std::int16_t du1
Definition
tree.h:86
pcl::gpu::people::trees::AttribLocation::dv1
std::int16_t dv1
Definition
tree.h:86
pcl::gpu::people::trees::AttribLocation::du2
std::int16_t du2
Definition
tree.h:86
pcl::gpu::people::trees::AttribLocation::AttribLocation
AttribLocation(int u1, int v1, int u2, int v2)
Definition
tree.h:80
pcl::gpu::people::trees::Histogram::Histogram
Histogram()
Definition
tree_train.h:26
pcl::gpu::people::trees::Histogram::label_prob
float label_prob[NUM_PARTS]
Definition
tree.h:101
pcl::gpu::people::trees::Node
Definition
tree.h:92
pcl::gpu::people::trees::Node::loc
AttribLocation loc
Definition
tree.h:95
pcl::gpu::people::trees::Node::thresh
Attrib thresh
Definition
tree.h:96
pcl::gpu::people::trees::Node::Node
Node(const AttribLocation &l, const Attrib &t)
Definition
tree.h:94
pcl::gpu::people::trees::Node::Node
Node()
Definition
tree.h:93