![]() |
Image Component Library (ICL)
|
Support class for segmentation algorithms. More...
#include <SegmenterUtils.h>
Public Types | |
| enum | Mode { BEST, GPU, CPU } |
Public Member Functions | |
| SegmenterUtils (Mode mode=BEST) | |
| Constructor. More... | |
| ~SegmenterUtils () | |
| Destructor. More... | |
| core::Img8u | createColorImage (core::Img32s &labelImage) |
| Creates a color image (e.g. for pointcloud coloring) from a given segmentation label image. More... | |
| core::Img8u | createROIMask (core::DataSegment< float, 4 > &xyzh, core::Img32f &depthImage, float xMin, float xMax, float yMin, float yMax, float zMin=-10000, float zMax=10000) |
| Creates the mask image for segmentation (including 3D ROI). More... | |
| core::Img8u | createMask (core::Img32f &depthImage) |
| Creates the mask image for segmentation. More... | |
| core::Img32s | stabelizeSegmentation (core::Img32s &labelImage) |
| Minimizes the label ID changes from frame to frame. The overlaps between the current and the previous label image are calculated and relabeled for the result. More... | |
| math::DynMatrix< bool > | calculateAdjacencyMatrix (core::DataSegment< float, 4 > &xyzh, core::Img32s &labelImage, core::Img8u &maskImage, int radius, float euclideanDistance, int numSurfaces) |
| Calculates the adjacency between segments. Use edgePointAssignmentAndAdjacencyMatrix(...) if edge point assignment is needed as well. More... | |
| void | edgePointAssignment (core::DataSegment< float, 4 > &xyzh, core::Img32s &labelImage, core::Img8u &maskImage, int radius, float euclideanDistance, int numSurfaces) |
| Assigns the edge points to the surfaces. Use edgePointAssignmentAndAdjacencyMatrix(...) if adjacency matrix is needed as well. More... | |
| math::DynMatrix< bool > | edgePointAssignmentAndAdjacencyMatrix (core::DataSegment< float, 4 > &xyzh, core::Img32s &labelImage, core::Img8u &maskImage, int radius, float euclideanDistance, int numSurfaces) |
| Calculates the adjacency between segments and assigns the edge points to the surfaces. More... | |
| std::vector< std::vector< int > > | extractSegments (core::Img32s &labelImage) |
| Extracts the segments from a label image. More... | |
| void | relabel (core::Img32s &labelImage, std::vector< std::vector< int > > &assignment, int maxOldLabel=0) |
| Relabels the label image. More... | |
Static Public Member Functions | |
| static bool | occlusionCheck (core::Img32f &depthImage, utils::Point p1, utils::Point p2, float distanceTolerance=3., float outlierTolerance=5.) |
| Checks if there is occlusion between two points (depth of all points on or in front of an augmented line). More... | |
| static std::vector< std::vector< int > > | createLabelVectors (core::Img32s &labelImage) |
| Creates the label vectors from a given label image. More... | |
Private Member Functions | |
| void | createColorImageCL (core::Img32s &labelImage, core::Img8u &colorImage) |
| void | createColorImageCPU (core::Img32s &labelImage, core::Img8u &colorImage) |
| std::vector< int > | calculateLabelReassignment (int countCur, int countLast, core::Channel32s &labelImageC, core::Channel32s &lastLabelImageC, utils::Size size) |
| math::DynMatrix< bool > | edgePointAssignmentAndAdjacencyMatrixCL (core::DataSegment< float, 4 > &xyzh, core::Img32s &labelImage, core::Img8u &maskImage, int radius, float euclideanDistance, int numSurfaces, bool pointAssignment) |
| math::DynMatrix< bool > | edgePointAssignmentAndAdjacencyMatrixCPU (core::DataSegment< float, 4 > &xyzh, core::Img32s &labelImage, core::Img8u &maskImage, int radius, float euclideanDistance, int numSurfaces, bool pointAssignment) |
Static Private Member Functions | |
| static float | dist3 (const Vec &a, const Vec &b) |
Private Attributes | |
| Data * | m_data |
| internal data type More... | |
Support class for segmentation algorithms.
This class provides supporting methods for segmentation algorithms.
Constructor.
Constructs an object of this class.
| mode | the selected mode: CPU, GPU or BEST (uses GPU if available) |
| icl::geom::SegmenterUtils::~SegmenterUtils | ( | ) |
Destructor.
| math::DynMatrix<bool> icl::geom::SegmenterUtils::calculateAdjacencyMatrix | ( | core::DataSegment< float, 4 > & | xyzh, |
| core::Img32s & | labelImage, | ||
| core::Img8u & | maskImage, | ||
| int | radius, | ||
| float | euclideanDistance, | ||
| int | numSurfaces | ||
| ) |
Calculates the adjacency between segments. Use edgePointAssignmentAndAdjacencyMatrix(...) if edge point assignment is needed as well.
| xyzh | the input pointcloud (point position) |
| labelImage | the input label image |
| maskImage | the input mask image |
| radius | in pixel (distance of surfaces/segments around separating edge) |
| euclideanDistance | the maximum euclidean distance between adjacent surfaces/segments |
| numSurfaces | the number of surfaces/segments in the label image |
|
private |
| core::Img8u icl::geom::SegmenterUtils::createColorImage | ( | core::Img32s & | labelImage | ) |
Creates a color image (e.g. for pointcloud coloring) from a given segmentation label image.
| labelImage | the input label image |
|
private |
|
private |
|
static |
Creates the label vectors from a given label image.
| labelImage | the input label image |
| core::Img8u icl::geom::SegmenterUtils::createMask | ( | core::Img32f & | depthImage | ) |
Creates the mask image for segmentation.
| depthImage | the input depth image |
| core::Img8u icl::geom::SegmenterUtils::createROIMask | ( | core::DataSegment< float, 4 > & | xyzh, |
| core::Img32f & | depthImage, | ||
| float | xMin, | ||
| float | xMax, | ||
| float | yMin, | ||
| float | yMax, | ||
| float | zMin = -10000, |
||
| float | zMax = 10000 |
||
| ) |
Creates the mask image for segmentation (including 3D ROI).
| xyzh | the input pointcloud (point position) |
| depthImage | the input depth image @xMin parameter for ROI (in mm for world coordinates) @xMax parameter for ROI (in mm for world coordinates) @yMin parameter for ROI (in mm for world coordinates) @yMax parameter for ROI (in mm for world coordinates) @zMin parameter for ROI (in mm for world coordinates) @zMax parameter for ROI (in mm for world coordinates) |
| void icl::geom::SegmenterUtils::edgePointAssignment | ( | core::DataSegment< float, 4 > & | xyzh, |
| core::Img32s & | labelImage, | ||
| core::Img8u & | maskImage, | ||
| int | radius, | ||
| float | euclideanDistance, | ||
| int | numSurfaces | ||
| ) |
Assigns the edge points to the surfaces. Use edgePointAssignmentAndAdjacencyMatrix(...) if adjacency matrix is needed as well.
| xyzh | the input pointcloud (point position) |
| labelImage | the input label image (changed by the method) |
| maskImage | the input mask image (changed by the method) |
| radius | in pixel (distance of surfaces/segments around separating edge) |
| euclideanDistance | the maximum euclidean distance between adjacent surfaces/segments |
| numSurfaces | the number of surfaces/segments in the label image |
| math::DynMatrix<bool> icl::geom::SegmenterUtils::edgePointAssignmentAndAdjacencyMatrix | ( | core::DataSegment< float, 4 > & | xyzh, |
| core::Img32s & | labelImage, | ||
| core::Img8u & | maskImage, | ||
| int | radius, | ||
| float | euclideanDistance, | ||
| int | numSurfaces | ||
| ) |
Calculates the adjacency between segments and assigns the edge points to the surfaces.
| xyzh | the input pointcloud (point position) |
| labelImage | the input label image (changed by the method) |
| maskImage | the input mask image (changed by the method) |
| radius | in pixel (distance of surfaces/segments around separating edge) |
| euclideanDistance | the maximum euclidean distance between adjacent surfaces/segments |
| numSurfaces | the number of surfaces/segments in the label image |
|
private |
|
private |
| std::vector<std::vector<int> > icl::geom::SegmenterUtils::extractSegments | ( | core::Img32s & | labelImage | ) |
Extracts the segments from a label image.
| labelImage | the input label image |
|
static |
Checks if there is occlusion between two points (depth of all points on or in front of an augmented line).
| depthImage | the input depth image |
| p1 | the first image point |
| p2 | the second image point |
| distanceTolerance | the distance tolerance in depthUnits |
| outlierTolerance | maximum number of outlier points in percent |
| void icl::geom::SegmenterUtils::relabel | ( | core::Img32s & | labelImage, |
| std::vector< std::vector< int > > & | assignment, | ||
| int | maxOldLabel = 0 |
||
| ) |
Relabels the label image.
| labelImage | the input/output label image |
| assignment | a vector of vectors with label ids. Each label from the inner id is replaced by the outer vector id. |
| maxOldLabel | the maximum id of the old labels (optional) |
| core::Img32s icl::geom::SegmenterUtils::stabelizeSegmentation | ( | core::Img32s & | labelImage | ) |
Minimizes the label ID changes from frame to frame. The overlaps between the current and the previous label image are calculated and relabeled for the result.
| labelImage | the input label image |
|
private |
internal data type
internal data pointer
1.8.15