Point Cloud Library (PCL) 1.12.0
Loading...
Searching...
No Matches
label_common.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 * @author: Koen Buys
38 */
39
40#pragma once
41
42#include <pcl/gpu/containers/device_array.h>
43#include <cuda_runtime.h> // for float4, uchar4, delete this in future
44
45namespace pcl
46{
47 namespace gpu
48 {
49 namespace people
50 {
51 // Some types for the tree
52 enum
53 {
55 LEAF = -2,
56 ROOT = -1,
57 NO_DATA = 255 /** \brief We have no depth data for this part of the image **/
58 };
59
60 enum { NUM_PARTS = 25 }; /** \brief We have 25 body parts defined **/
61 enum { MAX_CHILD = 4 }; /** \brief a parent node has maximum 4 children **/
62 enum { NR_TREES = 4 }; /** \brief The maximum supported number of trees **/
63
64 // Some defines for geometry
65 enum { FOCAL = 525 }; /** \brief Focal length of rgb camera in pixels **/
66 enum { WIDTH = 640 };
67 enum { HEIGHT = 480 };
68 enum { RATIO = WIDTH/HEIGHT };
69 enum { XML_VERSION = 1}; /** \brief This indicates the current used xml file version (for people lib only) **/
70
71 enum { NUM_ATTRIBS = 2000 };
72 enum { NUM_LABELS = 32 }; /** \brief Our code is forseen to use maximal use 32 labels **/
73
74 /** @todo implement label 25 to 29 **/
75 enum part_t
76 {
77 Lfoot = 0,
78 Lleg = 1,
79 Lknee = 2,
80 Lthigh = 3,
81 Rfoot = 4,
82 Rleg = 5,
83 Rknee = 6,
84 Rthigh = 7,
85 Rhips = 8,
86 Lhips = 9,
87 Neck = 10,
88 Rarm = 11,
89 Relbow = 12,
91 Rhand = 14,
92 Larm = 15,
93 Lelbow = 16,
95 Lhand = 18,
96 FaceLB = 19,
97 FaceRB = 20,
98 FaceLT = 21,
99 FaceRT = 22,
100 Rchest = 23,
101 Lchest = 24,
107 Plane = 30,
108 NOLABEL = 31
109 };
110
113
118
119 /**
120 * @brief This LUT contains the max primary eigenvalue for each part
121 * @todo read this from XML file
122 **/
123 static const float LUT_max_part_size[] =
124 {
125 0.5f, // 0 Lfoot
126 0.7f, // 1 Lleg
127 0.6f, // 2 Lknee
128 0.6f, // 3 Lthigh
129 0.5f, // 4 Rfoot
130 0.7f, // 5 Rleg
131 0.6f, // 6 Rknee
132 0.6f, // 7 Rthigh
133 0.9f, // 8 Rhips
134 0.9f, // 9 Lhips
135 0.5f, // 10 Neck
136 0.7f, // 11 Rarm
137 0.5f, // 12 Relbow
138 0.7f, // 13 Rforearm
139 0.5f, // 14 Rhand
140 0.7f, // 15 Larm
141 0.5f, // 16 Lelbow
142 0.7f, // 17 Lforearm
143 0.5f, // 18 Lhand
144 0.5f, // 19 FaceLB
145 0.5f, // 20 FaceRB
146 0.5f, // 21 FaceLT
147 0.5f, // 22 FaceRT
148 0.9f, // 23 Rchest
149 0.9f // 24 Lchest
150 };
151
152 /**
153 * @brief This LUT contains the ideal length between this part and his children
154 **/
155 static const float LUT_ideal_length[][4] =
156 {
157 { -1.0f, -1.0f, -1.0f, -1.0f}, // 0 Lfoot
158 { 0.2f, -1.0f, -1.0f, -1.0f}, // 1 Lleg
159 { 0.2f, -1.0f, -1.0f, -1.0f}, // 2 Lknee
160 { 0.3f, -1.0f, -1.0f, -1.0f}, // 3 Lthigh
161 { -1.0f, -1.0f, -1.0f, -1.0f}, // 4 Rfoot
162 { 0.2f, -1.0f, -1.0f, -1.0f}, // 5 Rleg
163 { 0.2f, -1.0f, -1.0f, -1.0f}, // 6 Rknee
164 { 0.3f, -1.0f, -1.0f, -1.0f}, // 7 Rthigh
165 { 0.3f, -1.0f, -1.0f, -1.0f}, // 8 Rhips
166 { 0.3f, -1.0f, -1.0f, -1.0f}, // 9 Lhips
167 { 0.15f, 0.15f, 0.2f, 0.2f}, // 10 Neck
168 { 0.15f, -1.0f, -1.0f, -1.0f}, // 11 Rarm
169 { 0.1f, -1.0f, -1.0f, -1.0f}, // 12 Relbow
170 { 0.15f, -1.0f, -1.0f, -1.0f}, // 13 Rforearm
171 { -1.0f, -1.0f, -1.0f, -1.0f}, // 14 Rhand
172 { 0.15f, -1.0f, -1.0f, -1.0f}, // 15 Larm
173 { 0.1f, -1.0f, -1.0f, -1.0f}, // 16 Lelbow
174 { 0.15f, -1.0f, -1.0f, -1.0f}, // 17 Lforearm
175 { -1.0f, -1.0f, -1.0f, -1.0f}, // 18 Lhand
176 { 0.15f, -1.0f, -1.0f, -1.0f}, // 19 FaceLB
177 { 0.15f, -1.0f, -1.0f, -1.0f}, // 20 FaceRB
178 { -1.0f, -1.0f, -1.0f, -1.0f}, // 21 FaceLT
179 { -1.0f, -1.0f, -1.0f, -1.0f}, // 22 FaceRT
180 { 0.3f, 0.3f, -1.0f, -1.0f}, // 23 Rchest
181 { 0.3f, 0.3f, -1.0f, -1.0f} // 24 Lchest
182 };
183
184 /**
185 * @brief This LUT contains the max length between this part and his children
186 **/
187 static const float LUT_max_length_offset[][4] =
188 {
189 { 0.15f, 0.15f, 0.15f, 0.15f}, // 0 Lfoot
190 { 0.15f, 0.15f, 0.15f, 0.15f}, // 1 Lleg
191 { 0.15f, 0.15f, 0.15f, 0.15f}, // 2 Lknee
192 { 0.15f, 0.15f, 0.15f, 0.15f}, // 3 Lthigh
193 { 0.15f, 0.15f, 0.15f, 0.15f}, // 4 Rfoot
194 { 0.15f, 0.15f, 0.15f, 0.15f}, // 5 Rleg
195 { 0.15f, 0.15f, 0.15f, 0.15f}, // 6 Rknee
196 { 0.15f, 0.15f, 0.15f, 0.15f}, // 7 Rthigh
197 { 0.15f, 0.15f, 0.15f, 0.15f}, // 8 Rhips
198 { 0.15f, 0.15f, 0.15f, 0.15f}, // 9 Lhips
199 { 0.15f, 0.15f, 0.15f, 0.15f}, // 10 Neck
200 { 0.15f, 0.15f, 0.15f, 0.15f}, // 11 Rarm
201 { 0.15f, 0.15f, 0.15f, 0.15f}, // 12 Relbow
202 { 0.15f, 0.15f, 0.15f, 0.15f}, // 13 Rforearm
203 { 0.15f, 0.15f, 0.15f, 0.15f}, // 14 Rhand
204 { 0.15f, 0.15f, 0.15f, 0.15f}, // 15 Larm
205 { 0.15f, 0.15f, 0.15f, 0.15f}, // 16 Lelbow
206 { 0.15f, 0.15f, 0.15f, 0.15f}, // 17 Lforearm
207 { 0.15f, 0.15f, 0.15f, 0.15f}, // 18 Lhand
208 { 0.15f, 0.15f, 0.15f, 0.15f}, // 19 FaceLB
209 { 0.15f, 0.15f, 0.15f, 0.15f}, // 20 FaceRB
210 { 0.3f, 0.15f, 0.15f, 0.15f}, // 21 FaceLT
211 { 0.3f, 0.15f, 0.15f, 0.15f}, // 22 FaceRT
212 { 0.15f, 0.15f, 0.15f, 0.15f}, // 23 Rchest
213 { 0.15f, 0.15f, 0.15f, 0.15f} // 24 Lchest
214 };
215
216 /**
217 * @brief This LUT contains the number of children for each parent
218 **/
219 static const unsigned int LUT_nr_children[] =
220 {
221 0, // 0 Lfoot
222 1, // 1 Lleg
223 1, // 2 Lknee
224 1, // 3 Lthigh
225 0, // 4 Rfoot
226 1, // 5 Rleg
227 1, // 6 Rknee
228 1, // 7 Rthigh
229 1, // 8 Rhips
230 1, // 9 Lhips
231 4, // 10 Neck
232 1, // 11 Rarm
233 1, // 12 Relbow
234 1, // 13 Rforearm
235 0, // 14 Rhand
236 1, // 15 Larm
237 1, // 16 Lelbow
238 1, // 17 Lforearm
239 0, // 18 Lhand
240 1, // 19 FaceLB
241 1, // 20 FaceRB
242 0, // 21 FaceLT
243 0, // 22 FaceRT
244 2, // 23 Rchest
245 2 // 24 Lchest
246 };
247 } // End namespace people
248 } // End namespace gpu
249} // End namespace pcl
250
251
252// All typedefs to be used in device name space:
253// Moved to common because of multiple declarations conflicting
254// TODO solve this for Image, also declared as pcl::RGB
255namespace pcl
256{
257 namespace device
258 {
260 {
261 float probs[pcl::gpu::people::NUM_LABELS]; /** \brief A single float probability for each body part **/
262 };
263
265
266 }
267}
268
269/** @TODO get this to work:
270std::string part_k[NUM_PARTS] = {"Lfoot","Lleg", "Lknee","Lthigh",
271 "Rfoot","Rleg","Rknee","Rthigh",
272 "Rhips","Lhips","Neck",
273 "Rarm","Relbow","Rforearm","Rhand",
274 "Larm","Lelbow","Lforearm","Lhand",
275 "FaceLB","FaceRB","FaceLT","FaceRT",
276 "Rchest","Lchest"};
277
278inline std::ostream& operator << (std::ostream& os, const part_t& p)
279{
280 os << part_k[(int) p];
281 return (os);
282}
283 **/
DeviceArray2D class
DeviceArray2D< float4 > Cloud
static const float LUT_max_length_offset[][4]
This LUT contains the max length between this part and his children.
DeviceArray2D< uchar4 > Image
static const unsigned int LUT_nr_children[]
This LUT contains the number of children for each parent.
static const float LUT_ideal_length[][4]
This LUT contains the ideal length between this part and his children.
static const float LUT_max_part_size[]
This LUT contains the max primary eigenvalue for each part.
part_t
Our code is forseen to use maximal use 32 labels.
float probs[pcl::gpu::people::NUM_LABELS]