Image Component Library (ICL)
|
#include <Segmentation3D.h>
Public Member Functions | |
Segmentation3D (utils::Size size) | |
Constructor. | |
~Segmentation3D () | |
Destructor. | |
core::Img8u | segmentation (DataSegment< float, 4 > xyz, const core::Img8u &edgeImg, const core::Img32f &depthImg) |
One line call for the complex segmentation using probabilitstic surface composition. | |
core::Img8u | segmentationBlobs (DataSegment< float, 4 > xyz, const core::Img8u &edgeImg, const core::Img32f &depthImg) |
One line call for the simple support plane and blobs segmentation. | |
void | setUseCL (bool use) |
Sets openCL enabled/disabled. Enabling has no effect if no openCL context is available. (default true=enabled) | |
void | setUseROI (bool use) |
Sets ROI enabled/disabled. (default false=disabled) | |
void | setROI (float xMin, float xMax, float yMin, float yMax) |
Sets the ROI in world coordinates. | |
void | setMinClusterSize (unsigned int size) |
Sets the minimum cluster size for region growing (default 25) | |
void | setUseFastGrowing (bool use) |
Sets fast growing enabled/disabled. Fast growing uses the region detector, normal growing uses classical region growing. (default false=disabled) | |
void | setAssignmentRadius (int radius) |
Sets the assignment radius for the edge point assignment after region growing. (default 5) | |
void | setAssignmentMaxDistance (float maxDistance) |
Sets the maximum distance for the edge point assignment after region growing. (default 15) | |
void | setRANSACeuclDistance (int distance) |
Sets the maximum euclidean distance for RANSAC. (default 15) | |
void | setRANSACpasses (int passes) |
Sets the RANSAC passes (default 20) | |
void | setRANSACtolerance (int tolerance) |
Sets the RANSAC tolerance for the cutfree neighbours calculation. (default 30) | |
void | setRANSACsubset (int subset) |
Sets the subset for the RANSAC check (every n-th point). (default 2) | |
void | setBLOBSeuclDistance (int distance) |
Sets the minimum euclidean BLOB distance for remaining points or the blob segmentation. | |
bool | isCLReady () |
Returns the openCL status (true=openCL context ready, false=no openCL context available) | |
bool | isCLActive () |
Returns the openCL activation status (true=openCL enabled, false=openCL disabled). The status can be set by setUseCL(bool use). | |
core::Img8u | getSegmentColorImage () |
Returns the color segment image. (Use one line calls) | |
std::vector< std::vector< int > > | getCluster () |
Returns the cluster. | |
std::vector< std::vector< int > > | getBlobs () |
Returns the blobs of the complex segmentation. | |
math::DynMatrix< bool > | getNeigboursMatrix () |
Returns the boolean neighbourhood matrix. | |
math::DynMatrix< float > | getProbabilityMatrix () |
Returns the probability matrix. | |
void | setXYZH (DataSegment< float, 4 > xyz) |
Sets the xyzh DataSegment from the PointCloudObject class. (Use one line calls) | |
void | setEdgeImage (const core::Img8u &edgeImage) |
Sets the edge image from the PointNormalEstimation class. (Use one line calls) | |
void | setDepthImage (const core::Img32f &depth) |
Sets the depth image. | |
void | clearData () |
Clears the data. Must be called before every iteration. (Use one line calls) | |
void | regionGrow () |
Region growing. (Use one line calls) | |
void | calculatePointAssignmentAndAdjacency () |
Calculates the edge point assignment and the neighbourhood matrix. (Use one line calls) | |
void | calculateCutfreeMatrix () |
Calculates the cutfree neighbouring cluster. (Use one line calls) | |
void | greedyComposition () |
Greedy composition with probability matrix. (Use one line calls) | |
void | calculateRemainingPoints () |
Calculates the assignment of the remaining points. (Use one line calls) | |
void | blobSegmentation () |
Calculates the blob segmentation (support plane and blobs). (Use one line calls) | |
void | colorPointcloud () |
Calculates the color segment image. (Use one line calls) | |
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 |
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::RegionDetector * | region |
bool | clReady |
bool | useCL |
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.
Constructs an object of this class. All default parameters are set. Use setters for desired values.
size | size of the input data |
Destructor.
Calculates the blob segmentation (support plane and blobs). (Use one line calls)
Calculates the cutfree neighbouring cluster. (Use one line calls)
Calculates the edge point assignment and the neighbourhood matrix. (Use one line calls)
Calculates the assignment of the remaining points. (Use one line calls)
void icl::geom::Segmentation3D::checkNeighbourDistance | ( | int | x, |
int | y, | ||
int | zuw, | ||
std::vector< int > * | data | ||
) | [private] |
void icl::geom::Segmentation3D::checkNeighbourDistanceRemaining | ( | int | x, |
int | y, | ||
int | zuw, | ||
std::vector< int > * | data | ||
) | [private] |
void icl::geom::Segmentation3D::checkNeighbourGrayThreshold | ( | int | x, |
int | y, | ||
int | zuw, | ||
int | threshold, | ||
std::vector< int > * | data | ||
) | [private] |
bool icl::geom::Segmentation3D::checkNotExist | ( | int | zw, |
std::vector< int > & | nb | ||
) | [private] |
void icl::geom::Segmentation3D::clearData | ( | ) |
Clears the data. Must be called before every iteration. (Use one line calls)
Calculates the color segment image. (Use one line calls)
float icl::geom::Segmentation3D::dist3 | ( | const Vec & | a, |
const Vec & | b | ||
) | [private] |
std::vector<std::vector<int> > icl::geom::Segmentation3D::getBlobs | ( | ) |
Returns the blobs of the complex segmentation.
std::vector<std::vector<int> > icl::geom::Segmentation3D::getCluster | ( | ) |
Returns the cluster.
Returns the boolean neighbourhood matrix.
Returns the probability matrix.
Returns the color segment image. (Use one line calls)
Greedy composition with probability matrix. (Use one line calls)
Returns the openCL activation status (true=openCL enabled, false=openCL disabled). The status can be set by setUseCL(bool use).
bool icl::geom::Segmentation3D::isCLReady | ( | ) |
Returns the openCL status (true=openCL context ready, false=no openCL context available)
Region growing. (Use one line calls)
void icl::geom::Segmentation3D::regionGrowBlobs | ( | ) | [private] |
core::Img8u icl::geom::Segmentation3D::segmentation | ( | DataSegment< float, 4 > | xyz, |
const core::Img8u & | edgeImg, | ||
const core::Img32f & | depthImg | ||
) |
One line call for the complex segmentation using probabilitstic surface composition.
xyz | the xyzh DataSegment from the PointCloudObject class |
edgeImg | the edge image from the PointNormalEstimation class |
depthImg | the input depth image |
core::Img8u icl::geom::Segmentation3D::segmentationBlobs | ( | DataSegment< float, 4 > | xyz, |
const core::Img8u & | edgeImg, | ||
const core::Img32f & | depthImg | ||
) |
One line call for the simple support plane and blobs segmentation.
xyz | the xyzh DataSegment from the PointCloudObject class |
edgeImg | the edge image from the PointNormalEstimation class |
depthImg | the input depth image |
void icl::geom::Segmentation3D::setAssignmentMaxDistance | ( | float | maxDistance | ) |
Sets the maximum distance for the edge point assignment after region growing. (default 15)
maxDistance | maximum distance in mm |
void icl::geom::Segmentation3D::setAssignmentRadius | ( | int | radius | ) |
Sets the assignment radius for the edge point assignment after region growing. (default 5)
radius the assignment radius in points
void icl::geom::Segmentation3D::setBLOBSeuclDistance | ( | int | distance | ) |
Sets the minimum euclidean BLOB distance for remaining points or the blob segmentation.
distance | the minimum euclidean distance for blob segmentation |
void icl::geom::Segmentation3D::setDepthImage | ( | const core::Img32f & | depth | ) |
Sets the depth image.
depth | the depth image |
void icl::geom::Segmentation3D::setEdgeImage | ( | const core::Img8u & | edgeImage | ) |
Sets the edge image from the PointNormalEstimation class. (Use one line calls)
edgeImage | the edge image |
void icl::geom::Segmentation3D::setMinClusterSize | ( | unsigned int | size | ) |
Sets the minimum cluster size for region growing (default 25)
size | minimum cluster size in points |
void icl::geom::Segmentation3D::setRANSACeuclDistance | ( | int | distance | ) |
Sets the maximum euclidean distance for RANSAC. (default 15)
distance | the maximum euclidean distance for RANSAC in mm |
void icl::geom::Segmentation3D::setRANSACpasses | ( | int | passes | ) |
Sets the RANSAC passes (default 20)
passes | the RANSAC passes |
void icl::geom::Segmentation3D::setRANSACsubset | ( | int | subset | ) |
Sets the subset for the RANSAC check (every n-th point). (default 2)
subset | the point subset for RANSAC |
void icl::geom::Segmentation3D::setRANSACtolerance | ( | int | tolerance | ) |
Sets the RANSAC tolerance for the cutfree neighbours calculation. (default 30)
tolerance | the tolerance in points |
void icl::geom::Segmentation3D::setROI | ( | float | xMin, |
float | xMax, | ||
float | yMin, | ||
float | yMax | ||
) |
Sets the ROI in world coordinates.
xMin | xMin in mm |
xMax | xMax in mm |
yMin | yMin in mm |
yMax | yMax in mm |
void icl::geom::Segmentation3D::setUseCL | ( | bool | use | ) |
Sets openCL enabled/disabled. Enabling has no effect if no openCL context is available. (default true=enabled)
use | enable/disable openCL |
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)
use | enable/disable fast growing |
void icl::geom::Segmentation3D::setUseROI | ( | bool | use | ) |
Sets ROI enabled/disabled. (default false=disabled)
use | enable/disable ROI |
void icl::geom::Segmentation3D::setXYZH | ( | DataSegment< float, 4 > | xyz | ) |
Sets the xyzh DataSegment from the PointCloudObject class. (Use one line calls)
xyz | the xyz DataSegment |
int* icl::geom::Segmentation3D::assignment [private] |
int* icl::geom::Segmentation3D::assignmentBlobs [private] |
float icl::geom::Segmentation3D::assignmentMaxDistance [private] |
int icl::geom::Segmentation3D::assignmentRadius [private] |
int* icl::geom::Segmentation3D::assignmentRemaining [private] |
std::vector<std::vector<int> > icl::geom::Segmentation3D::blobs [private] |
int icl::geom::Segmentation3D::BLOBSeuclDistance [private] |
bool icl::geom::Segmentation3D::clReady [private] |
std::vector<std::vector<int> > icl::geom::Segmentation3D::cluster [private] |
math::DynMatrix<bool> icl::geom::Segmentation3D::cutfree [private] |
int icl::geom::Segmentation3D::dim [private] |
bool* icl::geom::Segmentation3D::elements [private] |
bool* icl::geom::Segmentation3D::elementsBlobs [private] |
int icl::geom::Segmentation3D::h [private] |
unsigned int icl::geom::Segmentation3D::minClusterSize [private] |
math::DynMatrix<bool> icl::geom::Segmentation3D::neighbours [private] |
math::DynMatrix<float> icl::geom::Segmentation3D::probabilities [private] |
int icl::geom::Segmentation3D::RANSACeuclDistance [private] |
int icl::geom::Segmentation3D::RANSACpasses [private] |
int icl::geom::Segmentation3D::RANSACsubset [private] |
int icl::geom::Segmentation3D::RANSACtolerance [private] |
utils::Size icl::geom::Segmentation3D::s [private] |
bool icl::geom::Segmentation3D::useCL [private] |
bool icl::geom::Segmentation3D::useFastGrowing [private] |
bool icl::geom::Segmentation3D::useROI [private] |
int icl::geom::Segmentation3D::w [private] |
float icl::geom::Segmentation3D::xMaxROI [private] |
float icl::geom::Segmentation3D::xMinROI [private] |
DataSegment<float,4> icl::geom::Segmentation3D::xyzData [private] |
float icl::geom::Segmentation3D::yMaxROI [private] |
float icl::geom::Segmentation3D::yMinROI [private] |