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

#include <Segmentation3D.h>

Public Member Functions

 Segmentation3D (utils::Size size)
 Constructor. More...
 
 ~Segmentation3D ()
 Destructor. More...
 
core::Img8u segmentation (core::DataSegment< float, 4 > xyz, const core::Img8u &edgeImg, const core::Img32f &depthImg)
 One line call for the complex segmentation using probabilitstic surface composition. More...
 
core::Img8u segmentationBlobs (core::DataSegment< float, 4 > xyz, const core::Img8u &edgeImg, const core::Img32f &depthImg)
 One line call for the simple support plane and blobs segmentation. More...
 
void setUseCL (bool use)
 Sets openCL enabled/disabled. Enabling has no effect if no openCL context is available. (default true=enabled) More...
 
void setUseROI (bool use)
 Sets ROI enabled/disabled. (default false=disabled) More...
 
void setROI (float xMin, float xMax, float yMin, float yMax)
 Sets the ROI in world coordinates. More...
 
void setMinClusterSize (unsigned int size)
 Sets the minimum cluster size for region growing (default 25) More...
 
void setUseFastGrowing (bool use)
 Sets fast growing enabled/disabled. Fast growing uses the region detector, normal growing uses classical region growing. (default false=disabled) More...
 
void setAssignmentRadius (int radius)
 Sets the assignment radius for the edge point assignment after region growing. (default 5) More...
 
void setAssignmentMaxDistance (float maxDistance)
 Sets the maximum distance for the edge point assignment after region growing. (default 15) More...
 
void setRANSACeuclDistance (int distance)
 Sets the maximum euclidean distance for RANSAC. (default 15) More...
 
void setRANSACpasses (int passes)
 Sets the RANSAC passes (default 20) More...
 
void setRANSACtolerance (int tolerance)
 Sets the RANSAC tolerance for the cutfree neighbours calculation. (default 30) More...
 
void setRANSACsubset (int subset)
 Sets the subset for the RANSAC check (every n-th point). (default 2) More...
 
void setBLOBSeuclDistance (int distance)
 Sets the minimum euclidean BLOB distance for remaining points or the blob segmentation. More...
 
bool isCLReady ()
 Returns the openCL status (true=openCL context ready, false=no openCL context available) More...
 
bool isCLActive ()
 Returns the openCL activation status (true=openCL enabled, false=openCL disabled). The status can be set by setUseCL(bool use). More...
 
core::Img8u getSegmentColorImage ()
 Returns the color segment image. (Use one line calls) More...
 
std::vector< std::vector< int > > getCluster ()
 Returns the cluster. More...
 
std::vector< std::vector< int > > getBlobs ()
 Returns the blobs of the complex segmentation. More...
 
const int * getAssignment ()
 Returns the internally used assignment array. More...
 
math::DynMatrix< bool > getNeigboursMatrix ()
 Returns the boolean neighbourhood matrix. More...
 
math::DynMatrix< float > getProbabilityMatrix ()
 Returns the probability matrix. More...
 
void setXYZH (core::DataSegment< float, 4 > xyz)
 Sets the xyzh DataSegment from the PointCloudObject class. (Use one line calls) More...
 
void setEdgeImage (const core::Img8u &edgeImage)
 Sets the edge image from the PointNormalEstimation class. (Use one line calls) More...
 
void setDepthImage (const core::Img32f &depth)
 Sets the depth image. More...
 
void clearData ()
 Clears the data. Must be called before every iteration. (Use one line calls) More...
 
void regionGrow ()
 Region growing. (Use one line calls) More...
 
void calculatePointAssignmentAndAdjacency ()
 Calculates the edge point assignment and the neighbourhood matrix. (Use one line calls) More...
 
void calculateCutfreeMatrix ()
 Calculates the cutfree neighbouring cluster. (Use one line calls) More...
 
void greedyComposition ()
 Greedy composition with probability matrix. (Use one line calls) More...
 
void calculateRemainingPoints ()
 Calculates the assignment of the remaining points. (Use one line calls) More...
 
void blobSegmentation ()
 Calculates the blob segmentation (support plane and blobs). (Use one line calls) More...
 
void colorPointcloud ()
 Calculates the color segment image. (Use one line calls) More...
 

Private Member Functions

void checkNeighbourGrayThreshold (int x, int y, int zuw, int threshold, std::vector< int > *data)
 
void checkNeighbourDistanceRemaining (int x, int y, int zuw, std::vector< int > *data)
 
void regionGrowBlobs ()
 
void checkNeighbourDistance (int x, int y, int zuw, std::vector< int > *data)
 
bool checkNotExist (int zw, std::vector< int > &nb)
 
float dist3 (const Vec &a, const Vec &b)
 

Private Attributes

int w
 
int h
 
int dim
 
utils::Size s
 
float xMinROI
 
float xMaxROI
 
float yMinROI
 
float yMaxROI
 
bool useROI
 
bool * elements
 
int * assignment
 
int * assignmentRemaining
 
bool * elementsBlobs
 
int * assignmentBlobs
 
core::DataSegment< float, 4 > xyzData
 
core::Img8u normalEdgeImage
 
core::Img32f depthImage
 
core::Img8u segmentColorImage
 
std::vector< std::vector< int > > cluster
 
std::vector< std::vector< int > > blobs
 
unsigned int minClusterSize
 
bool useFastGrowing
 
int assignmentRadius
 
float assignmentMaxDistance
 
int RANSACeuclDistance
 
int RANSACpasses
 
int RANSACtolerance
 
int RANSACsubset
 
int BLOBSeuclDistance
 
math::DynMatrix< bool > neighbours
 
math::DynMatrix< bool > cutfree
 
math::DynMatrix< float > probabilities
 
cv::RegionDetectorregion
 
bool clReady
 
bool useCL
 
unsigned char * segmentColorImageRArray
 
unsigned char * segmentColorImageGArray
 
unsigned char * segmentColorImageBArray
 
utils::CLProgram program
 
utils::CLKernel kernelSegmentColoring
 
utils::CLKernel kernelPointAssignment
 
utils::CLKernel kernelCheckRANSAC
 
utils::CLKernel kernelAssignRANSAC
 
utils::CLBuffer segmentColorImageRBuffer
 
utils::CLBuffer segmentColorImageGBuffer
 
utils::CLBuffer segmentColorImageBBuffer
 
utils::CLBuffer assignmentBuffer
 
utils::CLBuffer neighboursBuffer
 
utils::CLBuffer elementsBuffer
 
utils::CLBuffer assignmentOutBuffer
 
utils::CLBuffer xyzBuffer
 
utils::CLBuffer assignmentBlobsBuffer
 
utils::CLBuffer elementsBlobsBuffer
 

Detailed Description

This class includes segmentation algorithms for depth images. It uses OpenCL for hardware parallelization if a compatible GPU is found. The input is a depth image, a binarized edge image from the PointNormalEstimation class and the xyz DataSegment from the PointCloudObject class. The output is a color image (e.g. as input for setColorsFromImage() method of the PointCloudObject class).

Constructor & Destructor Documentation

◆ Segmentation3D()

icl::geom::Segmentation3D::Segmentation3D ( utils::Size  size)

Constructor.

Constructs an object of this class. All default parameters are set. Use setters for desired values.

Parameters
sizesize of the input data

◆ ~Segmentation3D()

icl::geom::Segmentation3D::~Segmentation3D ( )

Destructor.

Member Function Documentation

◆ blobSegmentation()

void icl::geom::Segmentation3D::blobSegmentation ( )

Calculates the blob segmentation (support plane and blobs). (Use one line calls)

◆ calculateCutfreeMatrix()

void icl::geom::Segmentation3D::calculateCutfreeMatrix ( )

Calculates the cutfree neighbouring cluster. (Use one line calls)

◆ calculatePointAssignmentAndAdjacency()

void icl::geom::Segmentation3D::calculatePointAssignmentAndAdjacency ( )

Calculates the edge point assignment and the neighbourhood matrix. (Use one line calls)

◆ calculateRemainingPoints()

void icl::geom::Segmentation3D::calculateRemainingPoints ( )

Calculates the assignment of the remaining points. (Use one line calls)

◆ checkNeighbourDistance()

void icl::geom::Segmentation3D::checkNeighbourDistance ( int  x,
int  y,
int  zuw,
std::vector< int > *  data 
)
private

◆ checkNeighbourDistanceRemaining()

void icl::geom::Segmentation3D::checkNeighbourDistanceRemaining ( int  x,
int  y,
int  zuw,
std::vector< int > *  data 
)
private

◆ checkNeighbourGrayThreshold()

void icl::geom::Segmentation3D::checkNeighbourGrayThreshold ( int  x,
int  y,
int  zuw,
int  threshold,
std::vector< int > *  data 
)
private

◆ checkNotExist()

bool icl::geom::Segmentation3D::checkNotExist ( int  zw,
std::vector< int > &  nb 
)
private

◆ clearData()

void icl::geom::Segmentation3D::clearData ( )

Clears the data. Must be called before every iteration. (Use one line calls)

◆ colorPointcloud()

void icl::geom::Segmentation3D::colorPointcloud ( )

Calculates the color segment image. (Use one line calls)

◆ dist3()

float icl::geom::Segmentation3D::dist3 ( const Vec a,
const Vec b 
)
private

◆ getAssignment()

const int* icl::geom::Segmentation3D::getAssignment ( )

Returns the internally used assignment array.

Returns
an integer per point, defining in which blob it lies.

◆ getBlobs()

std::vector<std::vector<int> > icl::geom::Segmentation3D::getBlobs ( )

Returns the blobs of the complex segmentation.

Returns
a vector of blobs. Every entry contains a vector with the cluster indices

◆ getCluster()

std::vector<std::vector<int> > icl::geom::Segmentation3D::getCluster ( )

Returns the cluster.

Returns
a vector of cluster. Every entry contains a vector with the point indices

◆ getNeigboursMatrix()

math::DynMatrix<bool> icl::geom::Segmentation3D::getNeigboursMatrix ( )

Returns the boolean neighbourhood matrix.

Returns
the neighbourhood/adjacency matrix

◆ getProbabilityMatrix()

math::DynMatrix<float> icl::geom::Segmentation3D::getProbabilityMatrix ( )

Returns the probability matrix.

Returns
returns the probability matrix for cluster composition

◆ getSegmentColorImage()

core::Img8u icl::geom::Segmentation3D::getSegmentColorImage ( )

Returns the color segment image. (Use one line calls)

Returns
the color segment image

◆ greedyComposition()

void icl::geom::Segmentation3D::greedyComposition ( )

Greedy composition with probability matrix. (Use one line calls)

◆ isCLActive()

bool icl::geom::Segmentation3D::isCLActive ( )

Returns the openCL activation status (true=openCL enabled, false=openCL disabled). The status can be set by setUseCL(bool use).

Returns
openCL enabled/disabled

◆ isCLReady()

bool icl::geom::Segmentation3D::isCLReady ( )

Returns the openCL status (true=openCL context ready, false=no openCL context available)

Returns
openCL context ready/unavailable

◆ regionGrow()

void icl::geom::Segmentation3D::regionGrow ( )

Region growing. (Use one line calls)

◆ regionGrowBlobs()

void icl::geom::Segmentation3D::regionGrowBlobs ( )
private

◆ segmentation()

core::Img8u icl::geom::Segmentation3D::segmentation ( core::DataSegment< float, 4 >  xyz,
const core::Img8u edgeImg,
const core::Img32f depthImg 
)

One line call for the complex segmentation using probabilitstic surface composition.

Parameters
xyzthe xyzh DataSegment from the PointCloudObject class
edgeImgthe edge image from the PointNormalEstimation class
depthImgthe input depth image
Returns
the color image of the segments

◆ segmentationBlobs()

core::Img8u icl::geom::Segmentation3D::segmentationBlobs ( core::DataSegment< float, 4 >  xyz,
const core::Img8u edgeImg,
const core::Img32f depthImg 
)

One line call for the simple support plane and blobs segmentation.

Parameters
xyzthe xyzh DataSegment from the PointCloudObject class
edgeImgthe edge image from the PointNormalEstimation class
depthImgthe input depth image
Returns
the color image of the segments

◆ setAssignmentMaxDistance()

void icl::geom::Segmentation3D::setAssignmentMaxDistance ( float  maxDistance)

Sets the maximum distance for the edge point assignment after region growing. (default 15)

Parameters
maxDistancemaximum distance in mm

◆ setAssignmentRadius()

void icl::geom::Segmentation3D::setAssignmentRadius ( int  radius)

Sets the assignment radius for the edge point assignment after region growing. (default 5)

@pram radius the assignment radius in points

◆ setBLOBSeuclDistance()

void icl::geom::Segmentation3D::setBLOBSeuclDistance ( int  distance)

Sets the minimum euclidean BLOB distance for remaining points or the blob segmentation.

Parameters
distancethe minimum euclidean distance for blob segmentation

◆ setDepthImage()

void icl::geom::Segmentation3D::setDepthImage ( const core::Img32f depth)

Sets the depth image.

Parameters
depththe depth image

◆ setEdgeImage()

void icl::geom::Segmentation3D::setEdgeImage ( const core::Img8u edgeImage)

Sets the edge image from the PointNormalEstimation class. (Use one line calls)

Parameters
edgeImagethe edge image

◆ setMinClusterSize()

void icl::geom::Segmentation3D::setMinClusterSize ( unsigned int  size)

Sets the minimum cluster size for region growing (default 25)

Parameters
sizeminimum cluster size in points

◆ setRANSACeuclDistance()

void icl::geom::Segmentation3D::setRANSACeuclDistance ( int  distance)

Sets the maximum euclidean distance for RANSAC. (default 15)

Parameters
distancethe maximum euclidean distance for RANSAC in mm

◆ setRANSACpasses()

void icl::geom::Segmentation3D::setRANSACpasses ( int  passes)

Sets the RANSAC passes (default 20)

Parameters
passesthe RANSAC passes

◆ setRANSACsubset()

void icl::geom::Segmentation3D::setRANSACsubset ( int  subset)

Sets the subset for the RANSAC check (every n-th point). (default 2)

Parameters
subsetthe point subset for RANSAC

◆ setRANSACtolerance()

void icl::geom::Segmentation3D::setRANSACtolerance ( int  tolerance)

Sets the RANSAC tolerance for the cutfree neighbours calculation. (default 30)

Parameters
tolerancethe tolerance in points

◆ setROI()

void icl::geom::Segmentation3D::setROI ( float  xMin,
float  xMax,
float  yMin,
float  yMax 
)

Sets the ROI in world coordinates.

Parameters
xMinxMin in mm
xMaxxMax in mm
yMinyMin in mm
yMaxyMax in mm

◆ setUseCL()

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

Sets openCL enabled/disabled. Enabling has no effect if no openCL context is available. (default true=enabled)

Parameters
useenable/disable openCL

◆ setUseFastGrowing()

void icl::geom::Segmentation3D::setUseFastGrowing ( bool  use)

Sets fast growing enabled/disabled. Fast growing uses the region detector, normal growing uses classical region growing. (default false=disabled)

Parameters
useenable/disable fast growing

◆ setUseROI()

void icl::geom::Segmentation3D::setUseROI ( bool  use)

Sets ROI enabled/disabled. (default false=disabled)

Parameters
useenable/disable ROI

◆ setXYZH()

void icl::geom::Segmentation3D::setXYZH ( core::DataSegment< float, 4 >  xyz)

Sets the xyzh DataSegment from the PointCloudObject class. (Use one line calls)

Parameters
xyzthe xyz DataSegment

Member Data Documentation

◆ assignment

int* icl::geom::Segmentation3D::assignment
private

◆ assignmentBlobs

int* icl::geom::Segmentation3D::assignmentBlobs
private

◆ assignmentBlobsBuffer

utils::CLBuffer icl::geom::Segmentation3D::assignmentBlobsBuffer
private

◆ assignmentBuffer

utils::CLBuffer icl::geom::Segmentation3D::assignmentBuffer
private

◆ assignmentMaxDistance

float icl::geom::Segmentation3D::assignmentMaxDistance
private

◆ assignmentOutBuffer

utils::CLBuffer icl::geom::Segmentation3D::assignmentOutBuffer
private

◆ assignmentRadius

int icl::geom::Segmentation3D::assignmentRadius
private

◆ assignmentRemaining

int* icl::geom::Segmentation3D::assignmentRemaining
private

◆ blobs

std::vector<std::vector<int> > icl::geom::Segmentation3D::blobs
private

◆ BLOBSeuclDistance

int icl::geom::Segmentation3D::BLOBSeuclDistance
private

◆ clReady

bool icl::geom::Segmentation3D::clReady
private

◆ cluster

std::vector<std::vector<int> > icl::geom::Segmentation3D::cluster
private

◆ cutfree

math::DynMatrix<bool> icl::geom::Segmentation3D::cutfree
private

◆ depthImage

core::Img32f icl::geom::Segmentation3D::depthImage
private

◆ dim

int icl::geom::Segmentation3D::dim
private

◆ elements

bool* icl::geom::Segmentation3D::elements
private

◆ elementsBlobs

bool* icl::geom::Segmentation3D::elementsBlobs
private

◆ elementsBlobsBuffer

utils::CLBuffer icl::geom::Segmentation3D::elementsBlobsBuffer
private

◆ elementsBuffer

utils::CLBuffer icl::geom::Segmentation3D::elementsBuffer
private

◆ h

int icl::geom::Segmentation3D::h
private

◆ kernelAssignRANSAC

utils::CLKernel icl::geom::Segmentation3D::kernelAssignRANSAC
private

◆ kernelCheckRANSAC

utils::CLKernel icl::geom::Segmentation3D::kernelCheckRANSAC
private

◆ kernelPointAssignment

utils::CLKernel icl::geom::Segmentation3D::kernelPointAssignment
private

◆ kernelSegmentColoring

utils::CLKernel icl::geom::Segmentation3D::kernelSegmentColoring
private

◆ minClusterSize

unsigned int icl::geom::Segmentation3D::minClusterSize
private

◆ neighbours

math::DynMatrix<bool> icl::geom::Segmentation3D::neighbours
private

◆ neighboursBuffer

utils::CLBuffer icl::geom::Segmentation3D::neighboursBuffer
private

◆ normalEdgeImage

core::Img8u icl::geom::Segmentation3D::normalEdgeImage
private

◆ probabilities

math::DynMatrix<float> icl::geom::Segmentation3D::probabilities
private

◆ program

utils::CLProgram icl::geom::Segmentation3D::program
private

◆ RANSACeuclDistance

int icl::geom::Segmentation3D::RANSACeuclDistance
private

◆ RANSACpasses

int icl::geom::Segmentation3D::RANSACpasses
private

◆ RANSACsubset

int icl::geom::Segmentation3D::RANSACsubset
private

◆ RANSACtolerance

int icl::geom::Segmentation3D::RANSACtolerance
private

◆ region

cv::RegionDetector* icl::geom::Segmentation3D::region
private

◆ s

utils::Size icl::geom::Segmentation3D::s
private

◆ segmentColorImage

core::Img8u icl::geom::Segmentation3D::segmentColorImage
private

◆ segmentColorImageBArray

unsigned char* icl::geom::Segmentation3D::segmentColorImageBArray
private

◆ segmentColorImageBBuffer

utils::CLBuffer icl::geom::Segmentation3D::segmentColorImageBBuffer
private

◆ segmentColorImageGArray

unsigned char* icl::geom::Segmentation3D::segmentColorImageGArray
private

◆ segmentColorImageGBuffer

utils::CLBuffer icl::geom::Segmentation3D::segmentColorImageGBuffer
private

◆ segmentColorImageRArray

unsigned char* icl::geom::Segmentation3D::segmentColorImageRArray
private

◆ segmentColorImageRBuffer

utils::CLBuffer icl::geom::Segmentation3D::segmentColorImageRBuffer
private

◆ useCL

bool icl::geom::Segmentation3D::useCL
private

◆ useFastGrowing

bool icl::geom::Segmentation3D::useFastGrowing
private

◆ useROI

bool icl::geom::Segmentation3D::useROI
private

◆ w

int icl::geom::Segmentation3D::w
private

◆ xMaxROI

float icl::geom::Segmentation3D::xMaxROI
private

◆ xMinROI

float icl::geom::Segmentation3D::xMinROI
private

◆ xyzBuffer

utils::CLBuffer icl::geom::Segmentation3D::xyzBuffer
private

◆ xyzData

core::DataSegment<float,4> icl::geom::Segmentation3D::xyzData
private

◆ yMaxROI

float icl::geom::Segmentation3D::yMaxROI
private

◆ yMinROI

float icl::geom::Segmentation3D::yMinROI
private

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