FitKnownRectangleRotationMaxPoints Class Reference

Finds the rotation of a rectangle of known size at a given position that contains the most points from a point cloud. More...

#include <VisionX/libraries/PointCloudTools/FitKnownRectangleRotationMaxPoints.h>

Public Types

using PointT = pcl::PointXYZRGBA
 

Public Member Functions

Eigen::Matrix4f angleToPose (float angle)
 Get the global pose corresponding to a local rotation angle. More...
 
size_t countInliersOfAngle (float angle) const
 Count the inliers for a given local rotation angle. More...
 
pcl::PointIndicesPtr findInliersOfAngle (float angle) const
 Get the inliers for a given local rotation angle. More...
 
Eigen::Matrix4f fit ()
 Count the number of inliers per rotation step, and return the global pose corresponding to the rotation angle with the highest number of inliers. More...
 
Eigen::Matrix4f fit (const pcl::PointCloud< PointT > &cloud, Eigen::Vector3f normal, Eigen::Vector3f center)
 
 FitKnownRectangleRotationMaxPoints ()
 
float getBestAngle () const
 Get the best local rotation angle. More...
 
std::vector< size_t > getInlierCounts () const
 Get the inlier counts per step. More...
 
pcl::PointIndicesPtr getInliers () const
 Get the inliers of the best local rotation angle. More...
 
size_t getNumInliers () const
 Get the best local rotation angle. More...
 
size_t getNumSteps () const
 
Eigen::Vector2f getRectangleSize () const
 
void setInputCloud (const pcl::PointCloud< PointT > &cloud, Eigen::Vector3f normal, Eigen::Vector3f center)
 Set the input cloud and the rectangle's position and normal. More...
 
void setNumSteps (const size_t &value)
 Set the number of solution steps, i.e. the resolution of the solution space. More...
 
void setRectangleSize (const Eigen::Vector2f &value)
 Set the rectangle size. More...
 
template<typename Int >
float stepToAngle (Int step) const
 Get the local rotation angle of a solution step. More...
 

Public Attributes

pcl::PointCloud< pcl::PointXYZRGBA >::Ptr aligned {new pcl::PointCloud<pcl::PointXYZRGBA>}
 Transformed so center is at 0 and z = normal. More...
 
Eigen::Matrix4f alignedTransform = Eigen::Matrix4f::Identity()
 Transformation applied to get aligned. More...
 
float bestAngle = 0
 The best angle. More...
 
size_t bestStep = 0
 
std::vector< size_t > inlierCounts
 The inlier counts per step. More...
 
const float maxAngle = float(M_PI)
 
size_t numSteps = 180
 The number of steps (i.e. resolution of solution space). More...
 
Eigen::Vector2f rectangleSize = Eigen::Vector2f::Ones()
 The rectangle size. More...
 
pcl::PointCloud< pcl::PointXYZRGBA >::Ptr rotated {new pcl::PointCloud<pcl::PointXYZRGBA>}
 Buffer for point clouds rotated for inlier counting. More...
 

Detailed Description

Finds the rotation of a rectangle of known size at a given position that contains the most points from a point cloud.

Definition at line 23 of file FitKnownRectangleRotationMaxPoints.h.

Member Typedef Documentation

◆ PointT

using PointT = pcl::PointXYZRGBA

Definition at line 26 of file FitKnownRectangleRotationMaxPoints.h.

Constructor & Destructor Documentation

◆ FitKnownRectangleRotationMaxPoints()

Member Function Documentation

◆ angleToPose()

Eigen::Matrix4f angleToPose ( float  angle)

Get the global pose corresponding to a local rotation angle.

Definition at line 133 of file FitKnownRectangleRotationMaxPoints.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ countInliersOfAngle()

size_t countInliersOfAngle ( float  angle) const

Count the inliers for a given local rotation angle.

Definition at line 103 of file FitKnownRectangleRotationMaxPoints.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findInliersOfAngle()

pcl::PointIndicesPtr findInliersOfAngle ( float  angle) const

Get the inliers for a given local rotation angle.

Definition at line 115 of file FitKnownRectangleRotationMaxPoints.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fit() [1/2]

Eigen::Matrix4f fit ( )

Count the number of inliers per rotation step, and return the global pose corresponding to the rotation angle with the highest number of inliers.

The best rotation angle can be retrieved via getAngle(). The number of inliers per step retrieved via getInlierCounts().

Returns
The global pose of the fitted rectangle.

Definition at line 42 of file FitKnownRectangleRotationMaxPoints.cpp.

+ Here is the call graph for this function:

◆ fit() [2/2]

Eigen::Matrix4f fit ( const pcl::PointCloud< PointT > &  cloud,
Eigen::Vector3f  normal,
Eigen::Vector3f  center 
)

◆ getBestAngle()

float getBestAngle ( ) const

Get the best local rotation angle.

Definition at line 144 of file FitKnownRectangleRotationMaxPoints.cpp.

◆ getInlierCounts()

std::vector< size_t > getInlierCounts ( ) const

Get the inlier counts per step.

Definition at line 140 of file FitKnownRectangleRotationMaxPoints.cpp.

◆ getInliers()

pcl::PointIndicesPtr getInliers ( ) const
inline

Get the inliers of the best local rotation angle.

Definition at line 89 of file FitKnownRectangleRotationMaxPoints.h.

+ Here is the call graph for this function:

◆ getNumInliers()

size_t getNumInliers ( ) const
inline

Get the best local rotation angle.

Definition at line 84 of file FitKnownRectangleRotationMaxPoints.h.

◆ getNumSteps()

size_t getNumSteps ( ) const

Definition at line 25 of file FitKnownRectangleRotationMaxPoints.cpp.

◆ getRectangleSize()

Eigen::Vector2f getRectangleSize ( ) const

Definition at line 15 of file FitKnownRectangleRotationMaxPoints.cpp.

◆ setInputCloud()

void setInputCloud ( const pcl::PointCloud< PointT > &  cloud,
Eigen::Vector3f  normal,
Eigen::Vector3f  center 
)

Set the input cloud and the rectangle's position and normal.

Parameters
cloudThe input cloud.
normalThe rectangle normal.
centerThe rectangle center.

Definition at line 35 of file FitKnownRectangleRotationMaxPoints.cpp.

◆ setNumSteps()

void setNumSteps ( const size_t &  value)

Set the number of solution steps, i.e. the resolution of the solution space.

Definition at line 29 of file FitKnownRectangleRotationMaxPoints.cpp.

+ Here is the call graph for this function:

◆ setRectangleSize()

void setRectangleSize ( const Eigen::Vector2f &  value)

Set the rectangle size.

Definition at line 19 of file FitKnownRectangleRotationMaxPoints.cpp.

+ Here is the call graph for this function:

◆ stepToAngle()

float stepToAngle ( Int  step) const
inline

Get the local rotation angle of a solution step.

Definition at line 103 of file FitKnownRectangleRotationMaxPoints.h.

+ Here is the caller graph for this function:

Member Data Documentation

◆ aligned

pcl::PointCloud<pcl::PointXYZRGBA>::Ptr aligned {new pcl::PointCloud<pcl::PointXYZRGBA>}

Transformed so center is at 0 and z = normal.

Definition at line 138 of file FitKnownRectangleRotationMaxPoints.h.

◆ alignedTransform

Eigen::Matrix4f alignedTransform = Eigen::Matrix4f::Identity()

Transformation applied to get aligned.

Definition at line 140 of file FitKnownRectangleRotationMaxPoints.h.

◆ bestAngle

float bestAngle = 0

The best angle.

Definition at line 150 of file FitKnownRectangleRotationMaxPoints.h.

◆ bestStep

size_t bestStep = 0

Definition at line 148 of file FitKnownRectangleRotationMaxPoints.h.

◆ inlierCounts

std::vector<size_t> inlierCounts

The inlier counts per step.

Definition at line 152 of file FitKnownRectangleRotationMaxPoints.h.

◆ maxAngle

const float maxAngle = float(M_PI)

Definition at line 132 of file FitKnownRectangleRotationMaxPoints.h.

◆ numSteps

size_t numSteps = 180

The number of steps (i.e. resolution of solution space).

Definition at line 131 of file FitKnownRectangleRotationMaxPoints.h.

◆ rectangleSize

Eigen::Vector2f rectangleSize = Eigen::Vector2f::Ones()

The rectangle size.

Definition at line 128 of file FitKnownRectangleRotationMaxPoints.h.

◆ rotated

pcl::PointCloud<pcl::PointXYZRGBA>::Ptr rotated {new pcl::PointCloud<pcl::PointXYZRGBA>}
mutable

Buffer for point clouds rotated for inlier counting.

Definition at line 143 of file FitKnownRectangleRotationMaxPoints.h.


The documentation for this class was generated from the following files: