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.
 
size_t countInliersOfAngle (float angle) const
 Count the inliers for a given local rotation angle.
 
pcl::PointIndicesPtr findInliersOfAngle (float angle) const
 Get the inliers for a given local rotation angle.
 
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.
 
Eigen::Matrix4f fit (const pcl::PointCloud< PointT > &cloud, Eigen::Vector3f normal, Eigen::Vector3f center)
 
 FitKnownRectangleRotationMaxPoints ()
 
float getBestAngle () const
 Get the best local rotation angle.
 
std::vector< size_t > getInlierCounts () const
 Get the inlier counts per step.
 
pcl::PointIndicesPtr getInliers () const
 Get the inliers of the best local rotation angle.
 
size_t getNumInliers () const
 Get the best local rotation angle.
 
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.
 
void setNumSteps (const size_t &value)
 Set the number of solution steps, i.e. the resolution of the solution space.
 
void setRectangleSize (const Eigen::Vector2f &value)
 Set the rectangle size.
 
template<typename Int>
float stepToAngle (Int step) const
 Get the local rotation angle of a solution step.
 

Public Attributes

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

Detailed Description

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

Member Typedef Documentation

◆ PointT

using PointT = pcl::PointXYZRGBA

Constructor & Destructor Documentation

◆ FitKnownRectangleRotationMaxPoints()

Member Function Documentation

◆ angleToPose()

Eigen::Matrix4f angleToPose ( float angle)

Get the global pose corresponding to a local rotation angle.

◆ countInliersOfAngle()

size_t countInliersOfAngle ( float angle) const

Count the inliers for a given local rotation angle.

◆ findInliersOfAngle()

pcl::PointIndicesPtr findInliersOfAngle ( float angle) const

Get the inliers for a given local rotation angle.

◆ 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.

◆ 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.

◆ getInlierCounts()

std::vector< size_t > getInlierCounts ( ) const

Get the inlier counts per step.

◆ getInliers()

pcl::PointIndicesPtr getInliers ( ) const
inline

Get the inliers of the best local rotation angle.

◆ getNumInliers()

size_t getNumInliers ( ) const
inline

Get the best local rotation angle.

◆ getNumSteps()

size_t getNumSteps ( ) const

◆ getRectangleSize()

Eigen::Vector2f getRectangleSize ( ) const

◆ 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.

◆ setNumSteps()

void setNumSteps ( const size_t & value)

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

◆ setRectangleSize()

void setRectangleSize ( const Eigen::Vector2f & value)

Set the rectangle size.

◆ stepToAngle()

template<typename Int>
float stepToAngle ( Int step) const
inline

Get the local rotation angle of a solution step.

Member Data Documentation

◆ aligned

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

Transformed so center is at 0 and z = normal.

◆ alignedTransform

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

Transformation applied to get aligned.

◆ bestAngle

float bestAngle = 0

The best angle.

◆ bestStep

size_t bestStep = 0

◆ inlierCounts

std::vector<size_t> inlierCounts

The inlier counts per step.

◆ maxAngle

const float maxAngle = float(M_PI)

◆ numSteps

size_t numSteps = 180

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

◆ rectangleSize

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

The rectangle size.

◆ rotated

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

Buffer for point clouds rotated for inlier counting.


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