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