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

class for planar RANSAC estimation on poincloud data (xyzh). More...

#include <PlanarRansacEstimator.h>

List of all members.

Classes

struct  Result

Public Types

enum  Mode { BEST, GPU, CPU }
enum  OptimizationCriterion { MAX_ON = 1, ON_ONE_SIDE = 2 }

Public Member Functions

 PlanarRansacEstimator (Mode mode=BEST)
 Constructor.
 ~PlanarRansacEstimator ()
 Destructor.
Result apply (core::DataSegment< float, 4 > &xyzh, std::vector< int > &srcIDs, std::vector< int > &dstIDs, float threshold, int passes, int subset, int tolerance, int optimization)
 Applies the planar RANSAC estimation on a destination region with a model from the src region (e.g. for best fitting plane src=dst).
Result apply (std::vector< Vec > &srcPoints, std::vector< Vec > &dstPoints, float threshold, int passes, int subset, int tolerance, int optimization)
 Applies the planar RANSAC estimation on a destination region with a model from the src region (e.g. for best fitting plane src=dst).
math::DynMatrix< Resultapply (core::DataSegment< float, 4 > &xyzh, std::vector< std::vector< int > > &pointIDs, math::DynMatrix< bool > &testMatrix, float threshold, int passes, int tolerance, int optimization, core::Img32s labelImage)
 Applies the planar RANSAC estimation on multiple pairs of surfaces (given by a boolean test matrix).
void relabel (core::DataSegment< float, 4 > &xyzh, core::Img8u &newMask, core::Img32s &oldLabel, core::Img32s &newLabel, int desiredID, int srcID, float threshold, Result &result)
 Create a label image of all points on the planar model (incl. the original surface)

Private Member Functions

void calculateMultiCL (core::DataSegment< float, 4 > &xyzh, core::Img32s labelImage, math::DynMatrix< bool > &testMatrix, float threshold, int passes, std::vector< Vec > &n0, std::vector< float > &dist, std::vector< int > &cAbove, std::vector< int > &cBelow, std::vector< int > &cOn, std::vector< int > &adjs, std::vector< int > &start, std::vector< int > &end)
void calculateMultiCPU (core::DataSegment< float, 4 > &xyzh, std::vector< std::vector< int > > &pointIDs, math::DynMatrix< bool > &testMatrix, float threshold, int passes, std::vector< std::vector< Vec > > &n0Pre, std::vector< std::vector< float > > &distPre, std::vector< int > &cAbove, std::vector< int > &cBelow, std::vector< int > &cOn, std::vector< int > &adjs, std::vector< int > &start, std::vector< int > &end)
void calculateSingleCL (std::vector< Vec > &dstPoints, float threshold, int passes, int subset, std::vector< Vec > &n0, std::vector< float > &dist, std::vector< int > &cAbove, std::vector< int > &cBelow, std::vector< int > &cOn)
void calculateSingleCPU (std::vector< Vec > &dstPoints, float threshold, int passes, int subset, std::vector< Vec > &n0, std::vector< float > &dist, std::vector< int > &cAbove, std::vector< int > &cBelow, std::vector< int > &cOn)
void initOpenCL ()
void calculateRandomModels (std::vector< Vec > &srcPoints, std::vector< Vec > &n0, std::vector< float > &dist, int passes)
void calculateRandomModels (core::DataSegment< float, 4 > &xyzh, std::vector< int > &srcPoints, std::vector< Vec > &n0, std::vector< float > &dist, int passes)
Result createResult (std::vector< Vec > &n0, std::vector< float > &dist, std::vector< int > &cAbove, std::vector< int > &cBelow, std::vector< int > &cOn, float threshold, int passes, int tolerance, int optimization, int numPoints)
math::DynMatrix< ResultcreateResultMatrix (math::DynMatrix< bool > &testMatrix, std::vector< int > &start, std::vector< int > &end, std::vector< int > &adjs, std::vector< int > &cAbove, std::vector< int > &cBelow, std::vector< int > &cOn, std::vector< std::vector< int > > &pointIDs, std::vector< std::vector< Vec > > &n0Pre, std::vector< std::vector< float > > &distPre, float threshold, int passes, int tolerance, int optimization)
void calculateModel (Vec &fa, Vec &fb, Vec &rPoint, Vec &n0, float &dist)
void relabelCL (core::DataSegment< float, 4 > &xyzh, core::Img8u &newMask, core::Img32s &oldLabel, core::Img32s &newLabel, int desiredID, int srcID, float threshold, Result &result, int w, int h)
void relabelCPU (core::DataSegment< float, 4 > &xyzh, core::Img8u &newMask, core::Img32s &oldLabel, core::Img32s &newLabel, int desiredID, int srcID, float threshold, Result &result, int w, int h)

Private Attributes

Data * m_data
 internal data type

Detailed Description

class for planar RANSAC estimation on poincloud data (xyzh).

The PlanarRansacEstimator class does not minimize the error but simply counts the points with a distance smaller a given threshold. The smaller the threshold the preciser the model. Additionally, it is possible to assign all points on the plane to the initial surface.


Member Enumeration Documentation

Enumerator:
BEST 
GPU 
CPU 
Enumerator:
MAX_ON 
ON_ONE_SIDE 

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

Result icl::geom::PlanarRansacEstimator::apply ( core::DataSegment< float, 4 > &  xyzh,
std::vector< int > &  srcIDs,
std::vector< int > &  dstIDs,
float  threshold,
int  passes,
int  subset,
int  tolerance,
int  optimization 
)

Applies the planar RANSAC estimation on a destination region with a model from the src region (e.g. for best fitting plane src=dst).

Parameters:
xyzhthe input xyzh from the pointcloud
srcIDsvector of IDs (pointcloud position -- for structured x+y*w) of the source surface (for model determination)
dstIDsvector of IDs of the destination surface (for matching)
thresholdthe maximal euclidean distance in mm
passesnumber of ransac passes
subsetthe subset of points for matching (2 means every second point)
tolerancenumber of points allowed not to be on one single side of the object for ON_ONE_SIDE
optimizationthe optimization criterion (ON_ONE_SIDE e.g. for cutfree adjacency test or MAX_ON e.g. for best fitting plane)
Returns:
the Result struct.
Result icl::geom::PlanarRansacEstimator::apply ( std::vector< Vec > &  srcPoints,
std::vector< Vec > &  dstPoints,
float  threshold,
int  passes,
int  subset,
int  tolerance,
int  optimization 
)

Applies the planar RANSAC estimation on a destination region with a model from the src region (e.g. for best fitting plane src=dst).

Parameters:
xyzhthe input xyzh from the pointcloud
srcPointsvector of pointcloud points of the source surface (for model determination)
dstIDsvector of pointcloud points of the destination surface (for matching)
thresholdthe maximal euclidean distance in mm
passesnumber of ransac passes
subsetthe subset of points for matching (2 means every second point)
tolerancenumber of points allowed not to be on one single side of the object for ON_ONE_SIDE
optimizationthe optimization criterion (ON_ONE_SIDE e.g. for cutfree adjacency test or MAX_ON e.g. for best fitting plane)
Returns:
the Result struct.
math::DynMatrix<Result> icl::geom::PlanarRansacEstimator::apply ( core::DataSegment< float, 4 > &  xyzh,
std::vector< std::vector< int > > &  pointIDs,
math::DynMatrix< bool > &  testMatrix,
float  threshold,
int  passes,
int  tolerance,
int  optimization,
core::Img32s  labelImage 
)

Applies the planar RANSAC estimation on multiple pairs of surfaces (given by a boolean test matrix).

Parameters:
xyzhthe input xyzh from the pointcloud
pointsIDsvector (surfaces) of vector IDs (pointcloud position -- for structured x+y*w) of the surfaces
testMatrixboolean matrix for surface pair testing (1 = test, 0 = dont test)
thresholdthe maximal euclidean distance in mm
passesnumber of ransac passes
tolerancenumber of points allowed not to be on one single side of the object for ON_ONE_SIDE
optimizationthe optimization criterion (ON_ONE_SIDE e.g. for cutfree adjacency test or MAX_ON e.g. for best fitting plane)
labelImagethe labelImage with the point label
Returns:
matrix of Result structs.
void icl::geom::PlanarRansacEstimator::calculateModel ( Vec fa,
Vec fb,
Vec rPoint,
Vec n0,
float &  dist 
) [private]
void icl::geom::PlanarRansacEstimator::calculateMultiCL ( core::DataSegment< float, 4 > &  xyzh,
core::Img32s  labelImage,
math::DynMatrix< bool > &  testMatrix,
float  threshold,
int  passes,
std::vector< Vec > &  n0,
std::vector< float > &  dist,
std::vector< int > &  cAbove,
std::vector< int > &  cBelow,
std::vector< int > &  cOn,
std::vector< int > &  adjs,
std::vector< int > &  start,
std::vector< int > &  end 
) [private]
void icl::geom::PlanarRansacEstimator::calculateMultiCPU ( core::DataSegment< float, 4 > &  xyzh,
std::vector< std::vector< int > > &  pointIDs,
math::DynMatrix< bool > &  testMatrix,
float  threshold,
int  passes,
std::vector< std::vector< Vec > > &  n0Pre,
std::vector< std::vector< float > > &  distPre,
std::vector< int > &  cAbove,
std::vector< int > &  cBelow,
std::vector< int > &  cOn,
std::vector< int > &  adjs,
std::vector< int > &  start,
std::vector< int > &  end 
) [private]
void icl::geom::PlanarRansacEstimator::calculateRandomModels ( std::vector< Vec > &  srcPoints,
std::vector< Vec > &  n0,
std::vector< float > &  dist,
int  passes 
) [private]
void icl::geom::PlanarRansacEstimator::calculateRandomModels ( core::DataSegment< float, 4 > &  xyzh,
std::vector< int > &  srcPoints,
std::vector< Vec > &  n0,
std::vector< float > &  dist,
int  passes 
) [private]
void icl::geom::PlanarRansacEstimator::calculateSingleCL ( std::vector< Vec > &  dstPoints,
float  threshold,
int  passes,
int  subset,
std::vector< Vec > &  n0,
std::vector< float > &  dist,
std::vector< int > &  cAbove,
std::vector< int > &  cBelow,
std::vector< int > &  cOn 
) [private]
void icl::geom::PlanarRansacEstimator::calculateSingleCPU ( std::vector< Vec > &  dstPoints,
float  threshold,
int  passes,
int  subset,
std::vector< Vec > &  n0,
std::vector< float > &  dist,
std::vector< int > &  cAbove,
std::vector< int > &  cBelow,
std::vector< int > &  cOn 
) [private]
Result icl::geom::PlanarRansacEstimator::createResult ( std::vector< Vec > &  n0,
std::vector< float > &  dist,
std::vector< int > &  cAbove,
std::vector< int > &  cBelow,
std::vector< int > &  cOn,
float  threshold,
int  passes,
int  tolerance,
int  optimization,
int  numPoints 
) [private]
math::DynMatrix<Result> icl::geom::PlanarRansacEstimator::createResultMatrix ( math::DynMatrix< bool > &  testMatrix,
std::vector< int > &  start,
std::vector< int > &  end,
std::vector< int > &  adjs,
std::vector< int > &  cAbove,
std::vector< int > &  cBelow,
std::vector< int > &  cOn,
std::vector< std::vector< int > > &  pointIDs,
std::vector< std::vector< Vec > > &  n0Pre,
std::vector< std::vector< float > > &  distPre,
float  threshold,
int  passes,
int  tolerance,
int  optimization 
) [private]
void icl::geom::PlanarRansacEstimator::relabel ( core::DataSegment< float, 4 > &  xyzh,
core::Img8u newMask,
core::Img32s oldLabel,
core::Img32s newLabel,
int  desiredID,
int  srcID,
float  threshold,
Result result 
)

Create a label image of all points on the planar model (incl. the original surface)

Parameters:
xyzhthe input xyzh from the pointcloud
newMaskthe mask (e.g. ROI) for the relabeling
oldLabelthe original label image
newLabelthe resulting label image with all points on the model
desiredIDthe id in the resulting label image
srcIDthe ID of the label image from the fitted surface
thresholdthe maximum euclidean distance for relabeling
resultthe result struct returned by apply (contains the model and the original surface ID)
void icl::geom::PlanarRansacEstimator::relabelCL ( core::DataSegment< float, 4 > &  xyzh,
core::Img8u newMask,
core::Img32s oldLabel,
core::Img32s newLabel,
int  desiredID,
int  srcID,
float  threshold,
Result result,
int  w,
int  h 
) [private]
void icl::geom::PlanarRansacEstimator::relabelCPU ( core::DataSegment< float, 4 > &  xyzh,
core::Img8u newMask,
core::Img32s oldLabel,
core::Img32s newLabel,
int  desiredID,
int  srcID,
float  threshold,
Result result,
int  w,
int  h 
) [private]

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