Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
icl::geom::SegmenterUtils Class Reference

Support class for segmentation algorithms. More...

#include <SegmenterUtils.h>

List of all members.

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

Detailed Description

Support class for segmentation algorithms.

This class provides supporting methods for segmentation algorithms.


Member Enumeration Documentation

Enumerator:
BEST 
GPU 
CPU 

Constructor & Destructor Documentation

Constructor.

Constructs an object of this class.

Parameters:
modethe selected mode: CPU, GPU or BEST (uses GPU if available)

Destructor.


Member Function Documentation

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.

Parameters:
xyzhthe input pointcloud (point position)
labelImagethe input label image
maskImagethe input mask image
radiusin pixel (distance of surfaces/segments around separating edge)
euclideanDistancethe maximum euclidean distance between adjacent surfaces/segments
numSurfacesthe number of surfaces/segments in the label image
Returns:
the adjacency matrix.
std::vector<int> icl::geom::SegmenterUtils::calculateLabelReassignment ( int  countCur,
int  countLast,
core::Channel32s &  labelImageC,
core::Channel32s &  lastLabelImageC,
utils::Size  size 
) [private]

Creates a color image (e.g. for pointcloud coloring) from a given segmentation label image.

Parameters:
labelImagethe input label image
Returns:
the output color 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]

Creates the mask image for segmentation.

Parameters:
depthImagethe input depth image
Returns:
the output mask 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).

Parameters:
xyzhthe input pointcloud (point position)
depthImagethe 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)
Returns:
the output mask image.
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.

Parameters:
xyzhthe input pointcloud (point position)
labelImagethe input label image (changed by the method)
maskImagethe input mask image (changed by the method)
radiusin pixel (distance of surfaces/segments around separating edge)
euclideanDistancethe maximum euclidean distance between adjacent surfaces/segments
numSurfacesthe 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.

Parameters:
xyzhthe input pointcloud (point position)
labelImagethe input label image (changed by the method)
maskImagethe input mask image (changed by the method)
radiusin pixel (distance of surfaces/segments around separating edge)
euclideanDistancethe maximum euclidean distance between adjacent surfaces/segments
numSurfacesthe number of surfaces/segments in the label image
Returns:
the adjacency matrix.
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]

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.

Parameters:
labelImagethe input label image
Returns:
the stabelized output label image.

Member Data Documentation

internal data type

internal data pointer


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines