Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
icl::geom::PointCloudObjectBase Class Reference

Base class for point cloud data types. More...

#include <PointCloudObjectBase.h>

Inheritance diagram for icl::geom::PointCloudObjectBase:
icl::geom::SceneObject icl::geom::PCLPointCloudObject< PCLPointType > icl::geom::PointCloudObject

List of all members.

Public Types

enum  FeatureType {
  Intensity, Label, BGR, BGRA,
  BGRA32s, XYZ, XYZH, Normal,
  RGBA32f, NUM_FEATURES
}
 List of well known features. More...

Public Member Functions

 PointCloudObjectBase ()
 Default constructor.
virtual void setTime (const utils::Time &t)
 sets the current timestamp
virtual const utils::TimegetTime () const
 returns the current timestamp
virtual bool supports (FeatureType t) const =0
 interface for supported features
virtual bool canAddFeature (FeatureType t) const
 interface function for dynamic Point cloud types that can dynamically add features
virtual void addFeature (FeatureType t) throw (utils::ICLException)
 interface for adding a feature to an existing point cloud instance
virtual bool isOrganized () const =0
 interface for supported features
virtual utils::Size getSize () const =0 throw (utils::ICLException)
 returns the 2D size of the pointcloud (throws exception if not ordered)
virtual int getDim () const =0
 return the linearily ordered number of point in the point cloud
virtual void setSize (const utils::Size &size)=0
 adapts the 2D size and enables the 'organized mode'
void setDim (int dim)
 sets the number of contained points (and enables the unorganized mode)
virtual core::DataSegment
< float, 3 > 
selectXYZ ()
 well know features XYZ (three floats, this feature must usually be available)
virtual core::DataSegment
< float, 4 > 
selectXYZH ()
 common way to store XYZ-data (4th float define homogeneous part)
virtual core::DataSegment
< float, 1 > 
selectIntensity ()
 well known feature Intensity (single float values)
virtual core::DataSegment
< icl32s, 1 > 
selectLabel ()
 well known feature Intensity (single 32bit int values)
virtual core::DataSegment
< icl8u, 3 > 
selectBGR ()
 well known feature Intensity (three byte vectors ordered BGR)
virtual core::DataSegment
< icl8u, 4 > 
selectBGRA ()
 well known feature Intensity (four byte vectors ordered BGRA)
virtual core::DataSegment
< icl32s, 1 > 
selectBGRA32s ()
 well known feature Intensity (single int value encoding byte-wise BGRA)
virtual core::DataSegment
< float, 4 > 
selectNormal ()
 well known feature Normal (4 float values)
virtual core::DataSegment
< float, 4 > 
selectRGBA32f ()
 well known feature RGBA (4 float values, ordred RGBA)
virtual core::DataSegmentBase select (const std::string &featureName)
 dynamic feature selection function
const core::DataSegment< float, 3 > selectXYZ () const
 const xyz data
const core::DataSegment< float, 4 > selectXYZH () const
 const xyzh data
const core::DataSegment< float, 1 > selectIntensity () const
 const intensity data
const core::DataSegment
< icl32s, 1 > 
selectLabel () const
 const label data
const core::DataSegment< icl8u, 3 > selectBGR () const
 const bgr data
const core::DataSegment< icl8u, 4 > selectBGRA () const
 const rgba data
const core::DataSegment
< icl32s, 1 > 
selectBGRA32s () const
 const bgra32s data
const core::DataSegment< float, 4 > selectNormal () const
 const normals data
const core::DataSegment< float, 4 > selectRGBA32f () const
 const rgba32f data
const core::DataSegmentBase select (const std::string &featureName) const
 const dynamic/custom data
void setColorsFromImage (const core::ImgBase &image) throw (utils::ICLException)
 tints the point cloud pixel from the given image data
void extractColorsToImage (core::ImgBase &image, bool withAlpha=false) const throw (utils::ICLException)
 extracts the color information and stores it into the given image
void setDefaultVertexColor (const GeomColor &color)
 sets the color that is used to render points if color information is available
virtual GeomColor getDefaultVertexColor () const
 implements the SceneObject's virtual getter function for this feature
virtual std::vector< std::string > getSupportedDynamicFeatures () const
 For subclasses that provide Dynamic features, this function must be implemented.
virtual void customRender ()
 custom rendering method
void setUseDrawNormalLines (bool use, float lineLength=40, int granularity=4)
 set use draw normal lines
virtual PointCloudObjectBasecopy () const
 deep copy interface (needs to be implemented by subclasses)
virtual void deepCopy (PointCloudObjectBase &dst) const
 deeply copies all well-known features that are shared by this and dst
virtual bool equals (const PointCloudObjectBase &dst, bool compareOnlySharedFeatures=false, bool allowDifferentColorTypes=true, float tollerance=1.0e-5) const
 returns whether two points clouds are equal
std::map< std::string,
std::string > & 
getMetaData ()
 returns the meta data associated with this point cloud object
const std::map< std::string,
std::string > & 
getMetaData () const
 returns the meta data associated with this point cloud object (const)
const std::string & getMetaData (const std::string &key) const throw (utils::ICLException)
 returns the meta data associated with a given key
bool hasMetaData (const std::string &key) const
 returns whether meta data to the given key is associated
bool hasAnyMetaData () const
 returns whether any meta data is available
void setMetaData (const std::string &key, const std::string &value)
 sets the meta data entry for given key to value
void clearAllMetaData ()
 deletes all meta data entries
void clearMetaData (const std::string &key)
 clears the meta data for a given key
std::vector< std::string > getAllMetaDataEntries () const
 returns a list of all available meta data entires

Protected Member Functions

template<class T , int N>
core::DataSegment< T, N > & error (const std::string &fname) throw (utils::ICLException)
 internally used utility method that throws verbose exceptions
core::DataSegmentBaseerror_dyn (const std::string &featureName) throw (utils::ICLException)
 internally used utility method that throws verbose exceptions
virtual void drawNormalLines ()
 draw normal lines

Protected Attributes

GeomColor m_defaultPointColor
 default color used to render points that have no color information
std::map< std::string,
std::string > 
m_metaData
 internal map of meta data
bool useDrawNormalLines
float normalLineLength
int normalLineGranularity

Private Attributes

utils::Time timestamp
 timestamp associated with the point cloud

Detailed Description

Base class for point cloud data types.

The PointCloudObjectBase class provides a generic but abstract interface for point cloud data types. By inheriting the SceneObject class, it allows for easy visualization as an object in an instance of an icl::Scene. The interface includes querying important, but abstract information about the acutal point cloud, such as it's size or which features are supported. In addition to this, it's select*** methods allow for accessing the internal point feature information in a generic manner.

2D Organization

expression here, to avoid misconceptions with the PCL nomenclature. Organized point clouds are assumed to have a 2D row-major data layout, which is usually the case for point clouds acquired form 3D cameras such as kinect. utils::Point clouds whose height is less than 1 are assumed to be just 1D, i.e. they contain just an unordered set of 3D points and features.

Feature Selection

The generic feature selection mechanism uses the DataSegment utility class template. Each accessed feature (such as xyz or rgb) is provided in form of a DataSegment whose entries have a compile-time type and dimension. The data segment can then easily be used to iterate through the data.

Feature Types

Basically, the PointCloudObjectBase supports two different types of features:

  1. well known features
  2. arbitrary dynamic features

Well Known Features

For the very common features, such as xyz or rgb/gbr color, a special interfaces are provided. These methods have a pre-defined DataSegment type, i.e. the type and dimension of their entries is fixed, and must not be changed in sub-classes.

Color Features

In particular, using color information is unfortunately more complex then using the other features, because there are different well known predefined color feature types. A method, that works generically on an object's color, must usually check which color feature type is available, and then use the corresponding select method to access the data. Particularly the types BGRA and RGBA32f have to be treated differently, because BGRA uses byte color values in range [0,255] and swapped blue and red channels while RGBA32f uses normal rgb-ordered float color values in range [0,1].

Dynamic Features

For all non-common features, a dynamic string-base interface is provided. The select(const std:string&) method returns an abstract data segment instance of type DataSegmentBase, which provides binary access to it's referenced data and run-time information about it's actual type and feature dimension.


Member Enumeration Documentation

List of well known features.

Enumerator:
Intensity 

scalar components 4 bytes each!

single float intensity

Label 

single int32 label

BGR 

[uchar b,g,r, padding]

BGRA 

[uchar b,g,r, alpha]

BGRA32s 

bgra packed as one icl32s

XYZ 

[float x,y,z, padding]

XYZH 

[float x,y,z, homogenous part]

Normal 

[float nx,ny,nz,curvature]

RGBA32f 

[float r,g,b,a ]

NUM_FEATURES 

Constructor & Destructor Documentation

Default constructor.

Enables locking in the wrapped SceneObject class


Member Function Documentation

virtual void icl::geom::PointCloudObjectBase::addFeature ( FeatureType  t) throw (utils::ICLException) [inline, virtual]

interface for adding a feature to an existing point cloud instance

if the given feature cannot be added, an exception is thrown. To avoid this, call canAddFeature before using this function. Implementations of this function are supposed ignore this call in cases where the feature is actually already supported

Reimplemented in icl::geom::PointCloudObject.

virtual bool icl::geom::PointCloudObjectBase::canAddFeature ( FeatureType  t) const [inline, virtual]

interface function for dynamic Point cloud types that can dynamically add features

For features that are already supported, the output is undefined

Reimplemented in icl::geom::PointCloudObject.

deletes all meta data entries

void icl::geom::PointCloudObjectBase::clearMetaData ( const std::string &  key)

clears the meta data for a given key

virtual PointCloudObjectBase* icl::geom::PointCloudObjectBase::copy ( ) const [inline, virtual]

deep copy interface (needs to be implemented by subclasses)

Reimplemented from icl::geom::SceneObject.

Reimplemented in icl::geom::PCLPointCloudObject< PCLPointType >, and icl::geom::PointCloudObject.

custom rendering method

The basic implementation of this method uses the XYZ data segment to render points using an OpenGL vertex array. If any color information is available, it is used to tint the drawn points using OpenGL color pointer. Miss-ordered BGR types are rendered using an OpenGL fragment shaded to swap the transferred blue and red channels

Reimplemented from icl::geom::SceneObject.

Reimplemented in icl::geom::PointCloudObject.

virtual void icl::geom::PointCloudObjectBase::deepCopy ( PointCloudObjectBase dst) const [virtual]

deeply copies all well-known features that are shared by this and dst

virtual void icl::geom::PointCloudObjectBase::drawNormalLines ( ) [protected, virtual]

draw normal lines

virtual bool icl::geom::PointCloudObjectBase::equals ( const PointCloudObjectBase dst,
bool  compareOnlySharedFeatures = false,
bool  allowDifferentColorTypes = true,
float  tollerance = 1.0e-5 
) const [virtual]

returns whether two points clouds are equal

template<class T , int N>
core::DataSegment<T,N>& icl::geom::PointCloudObjectBase::error ( const std::string &  fname) throw (utils::ICLException) [inline, protected]

internally used utility method that throws verbose exceptions

core::DataSegmentBase& icl::geom::PointCloudObjectBase::error_dyn ( const std::string &  featureName) throw (utils::ICLException) [inline, protected]

internally used utility method that throws verbose exceptions

void icl::geom::PointCloudObjectBase::extractColorsToImage ( core::ImgBase image,
bool  withAlpha = false 
) const throw (utils::ICLException)

extracts the color information and stores it into the given image

The image size and color format is adapted if necessary

std::vector<std::string> icl::geom::PointCloudObjectBase::getAllMetaDataEntries ( ) const

returns a list of all available meta data entires

implements the SceneObject's virtual getter function for this feature

Reimplemented from icl::geom::SceneObject.

virtual int icl::geom::PointCloudObjectBase::getDim ( ) const [pure virtual]

return the linearily ordered number of point in the point cloud

Implemented in icl::geom::PCLPointCloudObject< PCLPointType >, and icl::geom::PointCloudObject.

std::map<std::string,std::string>& icl::geom::PointCloudObjectBase::getMetaData ( )

returns the meta data associated with this point cloud object

const std::map<std::string,std::string>& icl::geom::PointCloudObjectBase::getMetaData ( ) const

returns the meta data associated with this point cloud object (const)

const std::string& icl::geom::PointCloudObjectBase::getMetaData ( const std::string &  key) const throw (utils::ICLException)

returns the meta data associated with a given key

returns the 2D size of the pointcloud (throws exception if not ordered)

Implemented in icl::geom::PCLPointCloudObject< PCLPointType >, and icl::geom::PointCloudObject.

virtual std::vector<std::string> icl::geom::PointCloudObjectBase::getSupportedDynamicFeatures ( ) const [inline, virtual]

For subclasses that provide Dynamic features, this function must be implemented.

virtual const utils::Time& icl::geom::PointCloudObjectBase::getTime ( ) const [inline, virtual]

returns the current timestamp

returns whether any meta data is available

bool icl::geom::PointCloudObjectBase::hasMetaData ( const std::string &  key) const

returns whether meta data to the given key is associated

virtual bool icl::geom::PointCloudObjectBase::isOrganized ( ) const [pure virtual]

interface for supported features

Implemented in icl::geom::PCLPointCloudObject< PCLPointType >, and icl::geom::PointCloudObject.

virtual core::DataSegmentBase icl::geom::PointCloudObjectBase::select ( const std::string &  featureName) [inline, virtual]

dynamic feature selection function

This can be implemented in subclasses to grant access to less common feature types such as feature point descriptors

Reimplemented in icl::geom::PCLPointCloudObject< PCLPointType >.

const core::DataSegmentBase icl::geom::PointCloudObjectBase::select ( const std::string &  featureName) const [inline]

const dynamic/custom data

well known feature Intensity (three byte vectors ordered BGR)

Reimplemented in icl::geom::PCLPointCloudObject< PCLPointType >.

const bgr data

well known feature Intensity (four byte vectors ordered BGRA)

Reimplemented in icl::geom::PCLPointCloudObject< PCLPointType >.

const rgba data

well known feature Intensity (single int value encoding byte-wise BGRA)

Reimplemented in icl::geom::PCLPointCloudObject< PCLPointType >.

const bgra32s data

well known feature Intensity (single float values)

Reimplemented in icl::geom::PCLPointCloudObject< PCLPointType >.

const intensity data

well known feature Intensity (single 32bit int values)

Reimplemented in icl::geom::PCLPointCloudObject< PCLPointType >, and icl::geom::PointCloudObject.

const label data

virtual core::DataSegment<float,4> icl::geom::PointCloudObjectBase::selectNormal ( ) [inline, virtual]

well known feature Normal (4 float values)

in the PCL, the 4th value is sometimes used to store a local curvature value

Reimplemented in icl::geom::PCLPointCloudObject< PCLPointType >, and icl::geom::PointCloudObject.

const normals data

virtual core::DataSegment<float,4> icl::geom::PointCloudObjectBase::selectRGBA32f ( ) [inline, virtual]

well known feature RGBA (4 float values, ordred RGBA)

Reimplemented in icl::geom::PCLPointCloudObject< PCLPointType >, and icl::geom::PointCloudObject.

const rgba32f data

virtual core::DataSegment<float,3> icl::geom::PointCloudObjectBase::selectXYZ ( ) [inline, virtual]

well know features XYZ (three floats, this feature must usually be available)

Reimplemented in icl::geom::PCLPointCloudObject< PCLPointType >, and icl::geom::PointCloudObject.

const xyz data

virtual core::DataSegment<float,4> icl::geom::PointCloudObjectBase::selectXYZH ( ) [inline, virtual]

common way to store XYZ-data (4th float define homogeneous part)

Reimplemented in icl::geom::PCLPointCloudObject< PCLPointType >, and icl::geom::PointCloudObject.

const xyzh data

tints the point cloud pixel from the given image data

The image size must be equal to the point cloud size

sets the color that is used to render points if color information is available

void icl::geom::PointCloudObjectBase::setDim ( int  dim) [inline]

sets the number of contained points (and enables the unorganized mode)

void icl::geom::PointCloudObjectBase::setMetaData ( const std::string &  key,
const std::string &  value 
)

sets the meta data entry for given key to value

virtual void icl::geom::PointCloudObjectBase::setSize ( const utils::Size size) [pure virtual]

adapts the 2D size and enables the 'organized mode'

Implementations of this method should ensure, that the function behaves lazy, i.e. if the object has already the desired size, nothing should be done.
Furthermore, if the given height is 0 or smaller, the point-cloud should be set to the un-organized mode

Implemented in icl::geom::PCLPointCloudObject< PCLPointType >, and icl::geom::PointCloudObject.

virtual void icl::geom::PointCloudObjectBase::setTime ( const utils::Time t) [inline, virtual]

sets the current timestamp

void icl::geom::PointCloudObjectBase::setUseDrawNormalLines ( bool  use,
float  lineLength = 40,
int  granularity = 4 
)

set use draw normal lines

virtual bool icl::geom::PointCloudObjectBase::supports ( FeatureType  t) const [pure virtual]

interface for supported features

Implemented in icl::geom::PCLPointCloudObject< PCLPointType >, and icl::geom::PointCloudObject.


Member Data Documentation

default color used to render points that have no color information

std::map<std::string,std::string> icl::geom::PointCloudObjectBase::m_metaData [protected]

internal map of meta data

timestamp associated with the point cloud


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines