Image Component Library (ICL)
PointCloudObject.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLGeom/src/ICLGeom/PointCloudObject.h **
10 ** Module : ICLGeom **
11 ** Authors: Christof Elbrechter, Patrick Nobou **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #include <ICLUtils/CompatMacros.h>
35 
36 namespace icl{
37  namespace geom{
38 
40 
53  protected:
54  bool m_organized;
56  bool m_hasNormals;
57  bool m_hasColors;
58  bool m_hasLabels;
59  bool m_hasDepth;
60  std::vector<int> m_labels;
61  std::vector<float> m_depth;
62  public:
63 
64 
66  PointCloudObject(bool withNormals=false, bool withColors=false, bool withLabels=false, bool withDepth=false);
67 
69  PointCloudObject(int numPoints, bool withNormals=false, bool withColors=true, bool withLabels=false, bool withDepth=false);
70 
72 
77  PointCloudObject(int width, int height, bool organized=true, bool withNormals=false,
78  bool withColors=true, bool withLabels=false, bool withDepth=false);
79 
81  virtual bool supports(FeatureType t) const;
82 
84  virtual bool isOrganized() const;
85 
87  virtual utils::Size getSize() const ;
88 
90  virtual int getDim() const;
91 
93 
94  virtual void setSize(const utils::Size &size);
95 
97  virtual core::DataSegment<float,3> selectXYZ();
98 
100  virtual core::DataSegment<float,4> selectXYZH();
101 
103  virtual core::DataSegment<float,4> selectRGBA32f();
104 
106 
107  virtual core::DataSegment<float,4> selectNormal();
108 
110 
111  virtual core::DataSegment<icl32s,1> selectLabel();
112 
113 
115 
116  virtual core::DataSegment<float,1> selectDepth();
117 
119  virtual void customRender();
120 
122  virtual bool canAddFeature(FeatureType t) const;
123 
125 
127  virtual void addFeature(FeatureType t) ;
128 
130  virtual PointCloudObject *copy() const {
131  return new PointCloudObject(*this);
132  }
133 
135 
138  void push_back(const Vec &point){
139  addVertex(point,GeomColor(0,100,255,255));
140  if(m_hasNormals) m_normals.push_back(Vec(0,0,0,1));
141  if(m_hasDepth) m_depth.push_back(0);
142  }
143 
145 
146  void push_back(const Vec &point, const GeomColor &color){
147  addVertex(point,color);
148  if(m_hasNormals) m_normals.push_back(Vec(0,0,0,1));
149  if(m_hasDepth) m_depth.push_back(0);
150  }
151 
153 
154  void push_back(const Vec &point, const Vec &normal, const GeomColor &color, float depth=0){
155  addVertex(point,color);
156  if(m_hasNormals) m_normals.push_back(normal);
157  if(m_hasDepth) m_depth.push_back(depth);
158  }
159 
160  private:
161 
165 
166  };
167 
168 
169 
170  } // namespace geom
171 }
172 
void push_back(const Vec &point, const GeomColor &color)
adds xyz point with given color
Definition: PointCloudObject.h:146
undocument this line if you encounter any issues!
Definition: Any.h:37
Base class for point cloud data types.
Definition: PointCloudObjectBase.h:98
#define ICLGeom_API
Definition: CompatMacros.h:179
std::vector< int > m_labels
label mask (activated in constructor)
Definition: PointCloudObject.h:60
bool m_hasColors
flag whether the point cloud has colors
Definition: PointCloudObject.h:57
std::vector< float > m_depth
optional feature for the depth mask (Depth-feature)
Definition: PointCloudObject.h:61
Base implementation of the SceneObjectBase interface for compability with common icl::SceneObjects.
Definition: PointCloudObject.h:52
FeatureType
List of well known features.
Definition: PointCloudObjectBase.h:150
virtual PointCloudObject * copy() const
deep copy function
Definition: PointCloudObject.h:130
Size class of the ICL.
Definition: Size.h:61
ICLGeom_API void addNormal(const Vec &n)
adds a new normal to this object
void push_back(const Vec &point)
just a simple wrapper for top-top level classe's addVertex method
Definition: PointCloudObject.h:138
bool m_hasLabels
flag indicating whether labels are supported
Definition: PointCloudObject.h:58
void push_back(const Vec &point, const Vec &normal, const GeomColor &color, float depth=0)
adds xyz point with given normal and color and optional depth value
Definition: PointCloudObject.h:154
Vec4D32f Vec
Short typedef for 4D float vectors.
Definition: GeomDefs.h:87
depth
determines the pixel type of an image (8Bit-int or 32Bit-float)
Definition: Types.h:60
bool m_hasNormals
flag whether normals are given
Definition: PointCloudObject.h:56
core::Color4D32f GeomColor
color for geometry primitives
Definition: GeomDefs.h:45
ICLQt_API void color(float r, float g=-1, float b=-1, float alpha=255)
sets the current color to given r,g,b,alpha value
ICLGeom_API void addVertex(const Vec &p, const GeomColor &color=GeomColor(255, 0, 0, 255))
adds a new vertex to this object
bool m_organized
internal 2D organized flag
Definition: PointCloudObject.h:54
utils::Size m_dim2D
2D dimension
Definition: PointCloudObject.h:55
The DataSegment class defines a strided data segment (or 1D or 2D ordred array of vectors)
Definition: DataSegment.h:147
bool m_hasDepth
flag indicating whether a depth-feature is supported
Definition: PointCloudObject.h:59