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. | |
~SegmenterUtils () | |
Destructor. | |
core::Img8u | createColorImage (core::Img32s &labelImage) |
Creates a color image (e.g. for pointcloud coloring) from a given segmentation label image. | |
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). | |
core::Img8u | createMask (core::Img32f &depthImage) |
Creates the mask image for segmentation. | |
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. | |
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. | |
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. | |
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. | |
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 |
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) |
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 |
std::vector<int> icl::geom::SegmenterUtils::calculateLabelReassignment | ( | int | countCur, |
int | countLast, | ||
core::Channel32s & | labelImageC, | ||
core::Channel32s & | lastLabelImageC, | ||
utils::Size | size | ||
) | [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 |
void icl::geom::SegmenterUtils::createColorImageCL | ( | core::Img32s & | labelImage, |
core::Img8u & | colorImage | ||
) | [private] |
void icl::geom::SegmenterUtils::createColorImageCPU | ( | core::Img32s & | labelImage, |
core::Img8u & | colorImage | ||
) | [private] |
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 parameter for ROI (in mm for world coordinates) parameter for ROI (in mm for world coordinates) parameter for ROI (in mm for world coordinates) parameter for ROI (in mm for world coordinates) parameter for ROI (in mm for world coordinates) parameter for ROI (in mm for world coordinates) |
static float icl::geom::SegmenterUtils::dist3 | ( | const Vec & | a, |
const Vec & | b | ||
) | [inline, static, private] |
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 |
math::DynMatrix<bool> icl::geom::SegmenterUtils::edgePointAssignmentAndAdjacencyMatrixCL | ( | core::DataSegment< float, 4 > & | xyzh, |
core::Img32s & | labelImage, | ||
core::Img8u & | maskImage, | ||
int | radius, | ||
float | euclideanDistance, | ||
int | numSurfaces, | ||
bool | pointAssignment | ||
) | [private] |
math::DynMatrix<bool> icl::geom::SegmenterUtils::edgePointAssignmentAndAdjacencyMatrixCPU | ( | core::DataSegment< float, 4 > & | xyzh, |
core::Img32s & | labelImage, | ||
core::Img8u & | maskImage, | ||
int | radius, | ||
float | euclideanDistance, | ||
int | numSurfaces, | ||
bool | pointAssignment | ||
) | [private] |
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 |
Data* icl::geom::SegmenterUtils::m_data [private] |
internal data type
internal data pointer