Image Component Library (ICL)
|
class for planar RANSAC estimation on poincloud data (xyzh). More...
#include <PlanarRansacEstimator.h>
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. More... | |
~PlanarRansacEstimator () | |
Destructor. More... | |
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). More... | |
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). More... | |
math::DynMatrix< Result > | 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). More... | |
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) More... | |
Static Public Member Functions | |
static void | calculateRandomModels (std::vector< Vec > &srcPoints, std::vector< Vec > &n0, std::vector< float > &dist, int passes) |
Creates random models (n and distance) for RANSAC. More... | |
static void | calculateRandomModels (core::DataSegment< float, 4 > &xyzh, std::vector< int > &srcPoints, std::vector< Vec > &n0, std::vector< float > &dist, int passes) |
Creates random models (n and distance) for RANSAC. More... | |
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 () |
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< Result > | 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) |
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) |
Static Private Member Functions | |
static void | calculateModel (Vec &fa, Vec &fb, Vec &rPoint, Vec &n0, float &dist) |
Private Attributes | |
Data * | m_data |
internal data type More... | |
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.
Constructor.
Constructs an object of this class.
mode | the selected mode: CPU, GPU or BEST (uses GPU if available) |
icl::geom::PlanarRansacEstimator::~PlanarRansacEstimator | ( | ) |
Destructor.
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).
xyzh | the input xyzh from the pointcloud |
srcIDs | vector of IDs (pointcloud position – for structured x+y*w) of the source surface (for model determination) |
dstIDs | vector of IDs of the destination surface (for matching) |
threshold | the maximal euclidean distance in mm |
passes | number of ransac passes |
subset | the subset of points for matching (2 means every second point) |
tolerance | number of points allowed not to be on one single side of the object for ON_ONE_SIDE |
optimization | the optimization criterion (ON_ONE_SIDE e.g. for cutfree adjacency test or MAX_ON e.g. for best fitting plane) |
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).
xyzh | the input xyzh from the pointcloud |
srcPoints | vector of pointcloud points of the source surface (for model determination) |
dstIDs | vector of pointcloud points of the destination surface (for matching) |
threshold | the maximal euclidean distance in mm |
passes | number of ransac passes |
subset | the subset of points for matching (2 means every second point) |
tolerance | number of points allowed not to be on one single side of the object for ON_ONE_SIDE |
optimization | the optimization criterion (ON_ONE_SIDE e.g. for cutfree adjacency test or MAX_ON e.g. for best fitting plane) |
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).
xyzh | the input xyzh from the pointcloud |
pointsIDs | vector (surfaces) of vector IDs (pointcloud position – for structured x+y*w) of the surfaces |
testMatrix | boolean matrix for surface pair testing (1 = test, 0 = dont test) |
threshold | the maximal euclidean distance in mm |
passes | number of ransac passes |
tolerance | number of points allowed not to be on one single side of the object for ON_ONE_SIDE |
optimization | the optimization criterion (ON_ONE_SIDE e.g. for cutfree adjacency test or MAX_ON e.g. for best fitting plane) |
labelImage | the labelImage with the point label |
|
staticprivate |
|
private |
|
private |
|
static |
Creates random models (n and distance) for RANSAC.
srcPoints | the input points |
n0 | the empty input n0 vector |
dist | the empty input distance vector |
passes | the number of passes |
|
static |
Creates random models (n and distance) for RANSAC.
xyzh | the input xyz pointcloud data |
srcPoints | the sourcePoint Ids |
n0 | the empty input n0 vector |
dist | the empty input distance vector |
passes | the number of passes |
|
private |
|
private |
|
private |
|
private |
|
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)
xyzh | the input xyzh from the pointcloud |
newMask | the mask (e.g. ROI) for the relabeling |
oldLabel | the original label image |
newLabel | the resulting label image with all points on the model |
desiredID | the id in the resulting label image |
srcID | the ID of the label image from the fitted surface |
threshold | the maximum euclidean distance for relabeling |
result | the result struct returned by apply (contains the model and the original surface ID) |
|
private |
|
private |
|
private |
internal data type
internal data pointer