Point Cloud Library (PCL)  1.9.0-dev
label_blob2.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  * @file blob2.h
39  * @brief This file contains the Blob2 structure and the inline <<-operator for it
40  */
41 
42 #ifndef PCL_GPU_PEOPLE_LABEL_BLOB2_H_
43 #define PCL_GPU_PEOPLE_LABEL_BLOB2_H_
44 
45 #include <pcl/PointIndices.h>
46 #include <pcl/gpu/people/label_common.h>
47 
48 namespace pcl
49 {
50  namespace gpu
51  {
52  namespace people
53  {
54  /**
55  * @brief This structure contains all parameters to describe blobs and their parent/child relations
56  * @todo: clean this out in the end, perhaps place the children in a separate struct
57  */
58  struct Blob2
59  {
60  int id; // specific identification number of this blob
61  part_t label; // labels which part this blob is, defined in common.
62  int lid; // label id, which number of this type of part is this
63 
64  Eigen::Vector4f mean; // mean in xyz
65  Eigen::Matrix3f cov; // covariance in 3x3 matrix
66  Eigen::Vector3f eigenval; // eigenvalue of blob
67  Eigen::Matrix3f eigenvect; // eigenvector of blob
68 
69  //These variables are added in order to be able to build trees with them
70  int child_id[MAX_CHILD]; // id of the best found child
71  int child_lid[MAX_CHILD]; // lid of the best found child
72  float child_dist[MAX_CHILD]; // result of evaluation function of this child
73  char child_label[MAX_CHILD]; // makes displaying the tree easier
74 
75  pcl::PointIndices indices; // The indices of the pointcloud
76  Eigen::Vector4f min; // The min of the bounding box
77  Eigen::Vector4f max; // The max of the bounding box
78  };
79 
80  inline std::ostream& operator << (std::ostream& os, const Blob2& b)
81  {
82  os << " Blob2 id " << b.id << " label " << b.label << " lid " << b.lid << std::endl;
83  os << " mean " << b.mean(0) << " , " << b.mean(1) << " , " << b.mean(2) << " , " << b.mean(3) << std::endl;
84  os << " cov " << std::endl << b.cov << std::endl;
85  os << " eigenval " << b.eigenval(0) << " , " << b.eigenval(1) << " , " << b.eigenval(2) << std::endl;
86  os << " eigenvect " << std::endl << b.eigenvect << std::endl;
87  os << " min " << b.min(0) << " , " << b.min(1) << " , " << b.min(2) << " , " << b.min(3) << std::endl;
88  os << " max " << b.max(0) << " , " << b.max(1) << " , " << b.max(2) << " , " << b.max(3) << std::endl;
89  os << " indices length " << b.indices.indices.size() << std::endl;
90  for(int i = 0; i < MAX_CHILD; i++)
91  {
92  os << " child " << i << " id " << b.child_id[i] << " lid " << b.child_lid[i] << " dist " << b.child_dist[i] << " label " << b.child_label[i] << std::endl;
93  }
94  return (os);
95  }
96  } // end namespace people
97  } // end namespace gpu
98 } // end namespace pcl
99 
100 #endif
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
part_t
Our code is forseen to use maximal use 32 labels.
Definition: label_common.h:76
Eigen::Vector4f min
Definition: label_blob2.h:76
int child_id[MAX_CHILD]
Definition: label_blob2.h:70
std::vector< int > indices
Definition: PointIndices.h:19
char child_label[MAX_CHILD]
Definition: label_blob2.h:73
std::ostream & operator<<(std::ostream &os, const Blob2 &b)
Definition: label_blob2.h:80
pcl::PointIndices indices
Definition: label_blob2.h:75
int child_lid[MAX_CHILD]
Definition: label_blob2.h:71
Eigen::Vector4f max
Definition: label_blob2.h:77
Eigen::Matrix3f cov
Definition: label_blob2.h:65
Eigen::Vector3f eigenval
Definition: label_blob2.h:66
float child_dist[MAX_CHILD]
Definition: label_blob2.h:72
Eigen::Matrix3f eigenvect
Definition: label_blob2.h:67
Eigen::Vector4f mean
Definition: label_blob2.h:64
This structure contains all parameters to describe blobs and their parent/child relations.
Definition: label_blob2.h:58