Point Cloud Library (PCL) 1.15.1
Loading...
Searching...
No Matches
pcl::ExtractPolygonalPrismData< PointT > Class Template Reference

ExtractPolygonalPrismData uses a set of point indices that represent a planar model, and together with a given height, generates a 3D polygonal prism. More...

#include <pcl/segmentation/extract_polygonal_prism_data.h>

Inheritance diagram for pcl::ExtractPolygonalPrismData< PointT >:

Public Types

using PointCloud = pcl::PointCloud<PointT>
using PointCloudPtr = typename PointCloud::Ptr
using PointCloudConstPtr = typename PointCloud::ConstPtr
using PointIndicesPtr = PointIndices::Ptr
using PointIndicesConstPtr = PointIndices::ConstPtr
Public Types inherited from pcl::PCLBase< PointT >
using PointCloud = pcl::PointCloud<PointT>
using PointCloudPtr = typename PointCloud::Ptr
using PointCloudConstPtr = typename PointCloud::ConstPtr
using PointIndicesPtr = PointIndices::Ptr
using PointIndicesConstPtr = PointIndices::ConstPtr

Public Member Functions

 ExtractPolygonalPrismData ()=default
 Empty constructor.
void setInputPlanarHull (const PointCloudConstPtr &hull)
 Provide a pointer to the input planar hull dataset.
void setPolygons (const std::vector< pcl::Vertices > &polygons)
 Provide a vector of the concave polygons indices, as recieved from ConcaveHull::polygons.
PointCloudConstPtr getInputPlanarHull () const
 Get a pointer the input planar hull dataset.
void setHeightLimits (double height_min, double height_max)
 Set the height limits.
void getHeightLimits (double &height_min, double &height_max) const
 Get the height limits (min/max) as set by the user.
void setViewPoint (float vpx, float vpy, float vpz)
 Set the viewpoint.
void getViewPoint (float &vpx, float &vpy, float &vpz) const
 Get the viewpoint.
void segment (PointIndices &output)
 Cluster extraction in a PointCloud given by <setInputCloud (), setIndices ()>.
Public Member Functions inherited from pcl::PCLBase< PointT >
 PCLBase ()
 Empty constructor.
 PCLBase (const PCLBase &base)
 Copy constructor.
virtual ~PCLBase ()=default
 Destructor.
virtual void setInputCloud (const PointCloudConstPtr &cloud)
 Provide a pointer to the input dataset.
PointCloudConstPtr const getInputCloud () const
 Get a pointer to the input point cloud dataset.
virtual void setIndices (const IndicesPtr &indices)
 Provide a pointer to the vector of indices that represents the input data.
virtual void setIndices (const IndicesConstPtr &indices)
 Provide a pointer to the vector of indices that represents the input data.
virtual void setIndices (const PointIndicesConstPtr &indices)
 Provide a pointer to the vector of indices that represents the input data.
virtual void setIndices (std::size_t row_start, std::size_t col_start, std::size_t nb_rows, std::size_t nb_cols)
 Set the indices for the points laying within an interest region of the point cloud.
IndicesPtr getIndices ()
 Get a pointer to the vector of indices used.
IndicesConstPtr const getIndices () const
 Get a pointer to the vector of indices used.
const PointT & operator[] (std::size_t pos) const
 Override PointCloud operator[] to shorten code.

Protected Member Functions

virtual std::string getClassName () const
 Class getName method.
Protected Member Functions inherited from pcl::PCLBase< PointT >
bool initCompute ()
 This method should get called before starting the actual computation.
bool deinitCompute ()
 This method should get called after finishing the actual computation.

Protected Attributes

PointCloudConstPtr planar_hull_ {nullptr}
 A pointer to the input planar hull dataset.
std::vector< pcl::Verticespolygons_
 polygons indices vectors, as recieved from ConcaveHull
int min_pts_hull_ {3}
 The minimum number of points needed on the convex hull.
double height_limit_min_ {0.0}
 The minimum allowed height (distance to the model) a point will be considered from.
double height_limit_max_ {std::numeric_limits<float>::max()}
 The maximum allowed height (distance to the model) a point will be considered from.
float vpx_ {0.0f}
 Values describing the data acquisition viewpoint.
float vpy_ {0.0f}
float vpz_ {0.0f}
Protected Attributes inherited from pcl::PCLBase< PointT >
PointCloudConstPtr input_
 The input point cloud dataset.
IndicesPtr indices_
 A pointer to the vector of point indices to use.
bool use_indices_
 Set to true if point indices are used.
bool fake_indices_
 If no set of indices are given, we construct a set of fake indices that mimic the input PointCloud.

Detailed Description

template<typename PointT>
class pcl::ExtractPolygonalPrismData< PointT >

ExtractPolygonalPrismData uses a set of point indices that represent a planar model, and together with a given height, generates a 3D polygonal prism.

The polygonal prism is then used to segment all points lying inside it.

An example of its usage is to extract the data lying within a set of 3D boundaries (e.g., objects supported by a plane).

Example usage:

double z_min = 0., z_max = 0.05; // we want the points above the plane, no farther than 5 cm from the surface
// hull.setDimension (2); // not necessarily needed, but we need to check the dimensionality of the output
hull.setInputCloud (cloud);
hull.reconstruct (hull_points);
if (hull.getDimension () == 2)
{
prism.setInputCloud (point_cloud);
prism.setInputPlanarHull (hull_points);
prism.setHeightLimits (z_min, z_max);
prism.segment (cloud_indices);
}
else
PCL_ERROR ("The input cloud does not represent a planar surface.\n");
ConvexHull using libqhull library.
Definition convex_hull.h:73
int getDimension() const
Returns the dimensionality (2 or 3) of the calculated hull.
void reconstruct(PointCloud &points, std::vector< pcl::Vertices > &polygons)
Compute a convex hull for all points given.
ExtractPolygonalPrismData uses a set of point indices that represent a planar model,...
void setHeightLimits(double height_min, double height_max)
Set the height limits.
void setInputPlanarHull(const PointCloudConstPtr &hull)
Provide a pointer to the input planar hull dataset.
void segment(PointIndices &output)
Cluster extraction in a PointCloud given by <setInputCloud (), setIndices ()>.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Provide a pointer to the input dataset.
Definition pcl_base.hpp:65
PointCloud represents the base class in PCL for storing collections of 3D points.
shared_ptr< PointCloud< PointT > > Ptr
Author
Radu Bogdan Rusu

Definition at line 103 of file extract_polygonal_prism_data.h.

Member Typedef Documentation

◆ PointCloud

template<typename PointT>
using pcl::ExtractPolygonalPrismData< PointT >::PointCloud = pcl::PointCloud<PointT>

Definition at line 111 of file extract_polygonal_prism_data.h.

◆ PointCloudConstPtr

template<typename PointT>
using pcl::ExtractPolygonalPrismData< PointT >::PointCloudConstPtr = typename PointCloud::ConstPtr

Definition at line 113 of file extract_polygonal_prism_data.h.

◆ PointCloudPtr

template<typename PointT>
using pcl::ExtractPolygonalPrismData< PointT >::PointCloudPtr = typename PointCloud::Ptr

Definition at line 112 of file extract_polygonal_prism_data.h.

◆ PointIndicesConstPtr

template<typename PointT>
using pcl::ExtractPolygonalPrismData< PointT >::PointIndicesConstPtr = PointIndices::ConstPtr

Definition at line 116 of file extract_polygonal_prism_data.h.

◆ PointIndicesPtr

template<typename PointT>
using pcl::ExtractPolygonalPrismData< PointT >::PointIndicesPtr = PointIndices::Ptr

Definition at line 115 of file extract_polygonal_prism_data.h.

Constructor & Destructor Documentation

◆ ExtractPolygonalPrismData()

template<typename PointT>
pcl::ExtractPolygonalPrismData< PointT >::ExtractPolygonalPrismData ( )
default

Empty constructor.

Member Function Documentation

◆ getClassName()

template<typename PointT>
virtual std::string pcl::ExtractPolygonalPrismData< PointT >::getClassName ( ) const
inlineprotectedvirtual

Class getName method.

Definition at line 220 of file extract_polygonal_prism_data.h.

Referenced by segment().

◆ getHeightLimits()

template<typename PointT>
void pcl::ExtractPolygonalPrismData< PointT >::getHeightLimits ( double & height_min,
double & height_max ) const
inline

Get the height limits (min/max) as set by the user.

The default values are 0, std::numeric_limits<float>::max().

Parameters
[out]height_minthe resultant min height limit
[out]height_maxthe resultant max height limit

Definition at line 161 of file extract_polygonal_prism_data.h.

References height_limit_max_, and height_limit_min_.

◆ getInputPlanarHull()

template<typename PointT>
PointCloudConstPtr pcl::ExtractPolygonalPrismData< PointT >::getInputPlanarHull ( ) const
inline

Get a pointer the input planar hull dataset.

Definition at line 140 of file extract_polygonal_prism_data.h.

References planar_hull_.

◆ getViewPoint()

template<typename PointT>
void pcl::ExtractPolygonalPrismData< PointT >::getViewPoint ( float & vpx,
float & vpy,
float & vpz ) const
inline

Get the viewpoint.

Definition at line 182 of file extract_polygonal_prism_data.h.

References vpx_, vpy_, and vpz_.

◆ segment()

◆ setHeightLimits()

template<typename PointT>
void pcl::ExtractPolygonalPrismData< PointT >::setHeightLimits ( double height_min,
double height_max )
inline

Set the height limits.

All points having distances to the model outside this interval will be discarded.

Parameters
[in]height_minthe minimum allowed distance to the plane model value
[in]height_maxthe maximum allowed distance to the plane model value

Definition at line 149 of file extract_polygonal_prism_data.h.

References height_limit_max_, and height_limit_min_.

◆ setInputPlanarHull()

template<typename PointT>
void pcl::ExtractPolygonalPrismData< PointT >::setInputPlanarHull ( const PointCloudConstPtr & hull)
inline

Provide a pointer to the input planar hull dataset.

Note
Please see the example in the class description for how to obtain this.
Parameters
[in]hullthe input planar hull dataset

Definition at line 126 of file extract_polygonal_prism_data.h.

References planar_hull_.

◆ setPolygons()

template<typename PointT>
void pcl::ExtractPolygonalPrismData< PointT >::setPolygons ( const std::vector< pcl::Vertices > & polygons)
inline

Provide a vector of the concave polygons indices, as recieved from ConcaveHull::polygons.

Note
This is only needed when using ConcaveHull that has more than one polygon.
Parameters
[in]polygons- see ConcaveHull::polygons

Definition at line 133 of file extract_polygonal_prism_data.h.

References polygons_.

◆ setViewPoint()

template<typename PointT>
void pcl::ExtractPolygonalPrismData< PointT >::setViewPoint ( float vpx,
float vpy,
float vpz )
inline

Set the viewpoint.

Parameters
[in]vpxthe X coordinate of the viewpoint
[in]vpythe Y coordinate of the viewpoint
[in]vpzthe Z coordinate of the viewpoint

Definition at line 173 of file extract_polygonal_prism_data.h.

References vpx_, vpy_, and vpz_.

Member Data Documentation

◆ height_limit_max_

template<typename PointT>
double pcl::ExtractPolygonalPrismData< PointT >::height_limit_max_ {std::numeric_limits<float>::max()}
protected

The maximum allowed height (distance to the model) a point will be considered from.

Definition at line 213 of file extract_polygonal_prism_data.h.

Referenced by getHeightLimits(), segment(), and setHeightLimits().

◆ height_limit_min_

template<typename PointT>
double pcl::ExtractPolygonalPrismData< PointT >::height_limit_min_ {0.0}
protected

The minimum allowed height (distance to the model) a point will be considered from.

Definition at line 208 of file extract_polygonal_prism_data.h.

Referenced by getHeightLimits(), and setHeightLimits().

◆ min_pts_hull_

template<typename PointT>
int pcl::ExtractPolygonalPrismData< PointT >::min_pts_hull_ {3}
protected

The minimum number of points needed on the convex hull.

Definition at line 203 of file extract_polygonal_prism_data.h.

Referenced by segment().

◆ planar_hull_

template<typename PointT>
PointCloudConstPtr pcl::ExtractPolygonalPrismData< PointT >::planar_hull_ {nullptr}
protected

A pointer to the input planar hull dataset.

Definition at line 197 of file extract_polygonal_prism_data.h.

Referenced by getInputPlanarHull(), segment(), and setInputPlanarHull().

◆ polygons_

template<typename PointT>
std::vector<pcl::Vertices> pcl::ExtractPolygonalPrismData< PointT >::polygons_
protected

polygons indices vectors, as recieved from ConcaveHull

Definition at line 200 of file extract_polygonal_prism_data.h.

Referenced by segment(), and setPolygons().

◆ vpx_

template<typename PointT>
float pcl::ExtractPolygonalPrismData< PointT >::vpx_ {0.0f}
protected

Values describing the data acquisition viewpoint.

Default: 0,0,0.

Definition at line 216 of file extract_polygonal_prism_data.h.

Referenced by getViewPoint(), segment(), and setViewPoint().

◆ vpy_

template<typename PointT>
float pcl::ExtractPolygonalPrismData< PointT >::vpy_ {0.0f}
protected

Definition at line 216 of file extract_polygonal_prism_data.h.

Referenced by getViewPoint(), segment(), and setViewPoint().

◆ vpz_

template<typename PointT>
float pcl::ExtractPolygonalPrismData< PointT >::vpz_ {0.0f}
protected

Definition at line 216 of file extract_polygonal_prism_data.h.

Referenced by getViewPoint(), segment(), and setViewPoint().


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