Image Component Library (ICL)
Public Types | Public Member Functions | Private Attributes | List of all members
icl::geom::PointCloudCreator Class Reference

Utility class that allows to create 3D (optionally colored) point clouds from given 2D core::depth images. More...

#include <PointCloudCreator.h>

Public Types

enum  DepthImageMode { DistanceToCamCenter, DistanceToCamPlane, KinectRAW11Bit }
 Representation of the given core::depth images. More...
 

Public Member Functions

 PointCloudCreator ()
 creates a null instance More...
 
 PointCloudCreator (const Camera &depthCam, DepthImageMode mode=DistanceToCamPlane)
 creates a new instance with given core::depth camera (no rgbd mapping is available then) More...
 
 PointCloudCreator (const Camera &depthCam, const Camera &colorCam, DepthImageMode mode=DistanceToCamPlane)
 creates a new instance with given core::depth camera and color camera for rgbd mapping More...
 
 PointCloudCreator (const PointCloudCreator &other)
 deep copy constructor More...
 
PointCloudCreatoroperator= (const PointCloudCreator &other)
 deep copy assginment operator More...
 
 ~PointCloudCreator ()
 Destructor. More...
 
void init (const Camera &depthCam, DepthImageMode mode=DistanceToCamPlane)
 initializes with given core::depth camera (no rgbd mapping is available then) More...
 
void init (const Camera &depthCam, const Camera &colorCam, DepthImageMode mode=DistanceToCamPlane)
 initializes with given core::depth camera and color camera for rgbd mapping More...
 
void create (const core::Img32f &depthImage, PointCloudObjectBase &destination, const core::Img8u *rgbImage=0, float depthScaling=1, bool addDepthFeature=false)
 creates a point cloud More...
 
const CameragetDepthCamera () const
 returns the current core::depth camera More...
 
const CameragetColorCamera () const
 returns the current camera camera (if this was not given, an exception is thrown) More...
 
void setCameras (const Camera &depthCam, const Camera &colorCam)
 sets new cameras (reinitializes data structures internally) More...
 
void setDepthCamera (const Camera &depthCam)
 sets the internally used depthCamera More...
 
bool hasColorCamera () const
 returns whether a color camera was given (and therefore whether RGBD-mapping is supported) More...
 
void mapImage (const core::ImgBase *src, core::ImgBase **dst, const core::Img32f *depthImageMM=0)
 maps another given image just like the rgbImage would be mapped More...
 
void setUseCL (bool use)
 Enables/disables openCL accelaration. More...
 
RGBDMapping getMapping () const
 returns the internal mapping More...
 
void setFixes (float focalLengthMultiplier=1, float positionOffsetAlongNorm=0)
 sets up internal heuristical fixes applied to the used depth camera parameters More...
 
core::DataSegment< float, 2 > getColorTexturePoints ()
 returns for each pointcloud point the corresponding color image point More...
 
core::DataSegment< float, 2 > getNormalizedColorTexturePoints ()
 returns the normalized color texture points (normalized with color image size to range 0 to 1) More...
 

Private Attributes

Data * m_data
 

Detailed Description

Utility class that allows to create 3D (optionally colored) point clouds from given 2D core::depth images.

The PointCloudCreator utility class can be used to two differenct modes. It's basic functionality is to transform a core::depth-image into a 3D point cloud. For this, a Camera instances is needed, which can be obtained from ICL's camera calibration tool icl-cam-calib-2 for real core::depth cameras such as Kinect.

If also a second camera file is provided for the color camera, then the PointCloudCreator class can also be used for mapping optionally given RGB-byte images to the contained point's colors.

Member Enumeration Documentation

◆ DepthImageMode

Representation of the given core::depth images.

Depth image values can either be understood as distance values to the the camera center or as distances from the camera's viewing plane

Enumerator
DistanceToCamCenter 

distances are given w.r.t. the camera center

DistanceToCamPlane 

distances are given w.r.t. the camera plance

KinectRAW11Bit 

default kinect raw values in range [0,2047]

Constructor & Destructor Documentation

◆ PointCloudCreator() [1/4]

icl::geom::PointCloudCreator::PointCloudCreator ( )

creates a null instance

◆ PointCloudCreator() [2/4]

icl::geom::PointCloudCreator::PointCloudCreator ( const Camera depthCam,
DepthImageMode  mode = DistanceToCamPlane 
)

creates a new instance with given core::depth camera (no rgbd mapping is available then)

◆ PointCloudCreator() [3/4]

icl::geom::PointCloudCreator::PointCloudCreator ( const Camera depthCam,
const Camera colorCam,
DepthImageMode  mode = DistanceToCamPlane 
)

creates a new instance with given core::depth camera and color camera for rgbd mapping

◆ PointCloudCreator() [4/4]

icl::geom::PointCloudCreator::PointCloudCreator ( const PointCloudCreator other)

deep copy constructor

◆ ~PointCloudCreator()

icl::geom::PointCloudCreator::~PointCloudCreator ( )

Destructor.

Member Function Documentation

◆ create()

void icl::geom::PointCloudCreator::create ( const core::Img32f depthImage,
PointCloudObjectBase destination,
const core::Img8u rgbImage = 0,
float  depthScaling = 1,
bool  addDepthFeature = false 
)

creates a point cloud

If the PointCloudCreator instance is set up to provide color information and the destionation point cloud does not support color information, the detination point cloud is tried to be adapted using PointCloudObjectBase::canAddFeature and PointCloudObjectBase::addFeature. If add depthFeature is set to true, the destination pointcloud is tryed to be endowed with a depth feature segment

◆ getColorCamera()

const Camera& icl::geom::PointCloudCreator::getColorCamera ( ) const

returns the current camera camera (if this was not given, an exception is thrown)

◆ getColorTexturePoints()

core::DataSegment<float,2> icl::geom::PointCloudCreator::getColorTexturePoints ( )

returns for each pointcloud point the corresponding color image point

Returns
the DataSegment with the corresponding color image points

◆ getDepthCamera()

const Camera& icl::geom::PointCloudCreator::getDepthCamera ( ) const

returns the current core::depth camera

◆ getMapping()

RGBDMapping icl::geom::PointCloudCreator::getMapping ( ) const

returns the internal mapping

Only if both- depth and camera camera parameters are available. Please note, that the returned shallowly copies the internal depth camera viewray array

◆ getNormalizedColorTexturePoints()

core::DataSegment<float,2> icl::geom::PointCloudCreator::getNormalizedColorTexturePoints ( )

returns the normalized color texture points (normalized with color image size to range 0 to 1)

Returns
the DataSegment with normalized color image points

◆ hasColorCamera()

bool icl::geom::PointCloudCreator::hasColorCamera ( ) const

returns whether a color camera was given (and therefore whether RGBD-mapping is supported)

◆ init() [1/2]

void icl::geom::PointCloudCreator::init ( const Camera depthCam,
DepthImageMode  mode = DistanceToCamPlane 
)

initializes with given core::depth camera (no rgbd mapping is available then)

◆ init() [2/2]

void icl::geom::PointCloudCreator::init ( const Camera depthCam,
const Camera colorCam,
DepthImageMode  mode = DistanceToCamPlane 
)

initializes with given core::depth camera and color camera for rgbd mapping

◆ mapImage()

void icl::geom::PointCloudCreator::mapImage ( const core::ImgBase src,
core::ImgBase **  dst,
const core::Img32f depthImageMM = 0 
)

maps another given image just like the rgbImage would be mapped

Parameters
srcimage assumed to be captured from the perspective of the color camera
dstdestimation image (automatically adapted)
depthImageMMoptionally given depth image (if NULL, then the last depthImage passed to the "create"-is used, which should usually be the right one)

◆ operator=()

PointCloudCreator& icl::geom::PointCloudCreator::operator= ( const PointCloudCreator other)

deep copy assginment operator

◆ setCameras()

void icl::geom::PointCloudCreator::setCameras ( const Camera depthCam,
const Camera colorCam 
)

sets new cameras (reinitializes data structures internally)

This functions is relatively complex, so it should be performed only when it is needed

◆ setDepthCamera()

void icl::geom::PointCloudCreator::setDepthCamera ( const Camera depthCam)

sets the internally used depthCamera

This functions is relatively complex, so it should be performed only when it is needed. After using this function, the creator will have no color camera any more

◆ setFixes()

void icl::geom::PointCloudCreator::setFixes ( float  focalLengthMultiplier = 1,
float  positionOffsetAlongNorm = 0 
)

sets up internal heuristical fixes applied to the used depth camera parameters

Parameters
focalLengthMultiplieris used as multiplicative adaption to the orginal depth camera's focal length. 1 is the neutral value for this
positionOffsetAlongNormis used as additive displacement for the used depth camera along the camera's view normal

◆ setUseCL()

void icl::geom::PointCloudCreator::setUseCL ( bool  use)

Enables/disables openCL accelaration.

In case of having no opencl support, this function does nothing

Member Data Documentation

◆ m_data

Data* icl::geom::PointCloudCreator::m_data
private

The documentation for this class was generated from the following file: