Point Cloud Library (PCL)
1.14.1-dev
|
Extract obstacle borders from range images, meaning positions where there is a transition from foreground to background. More...
#include <pcl/features/range_image_border_extractor.h>
Classes | |
struct | LocalSurface |
Stores some information extracted from the neighborhood of a point. More... | |
struct | Parameters |
Parameters used in this class. More... | |
struct | ShadowBorderIndices |
Stores the indices of the shadow border corresponding to obstacle borders. More... | |
Public Member Functions | |
RangeImageBorderExtractor (const RangeImage *range_image=nullptr) | |
Constructor. More... | |
~RangeImageBorderExtractor () override | |
Destructor. More... | |
void | setRangeImage (const RangeImage *range_image) |
Provide a pointer to the range image. More... | |
void | clearData () |
Erase all data calculated for the current range image. More... | |
float * | getAnglesImageForBorderDirections () |
Get the 2D directions in the range image from the border directions - probably mainly useful for visualization. More... | |
float * | getAnglesImageForSurfaceChangeDirections () |
Get the 2D directions in the range image from the surface change directions - probably mainly useful for visualization. More... | |
void | compute (PointCloudOut &output) |
Overwrite the compute function of the base class. More... | |
Parameters & | getParameters () |
bool | hasRangeImage () const |
const RangeImage & | getRangeImage () const |
float * | getBorderScoresLeft () |
float * | getBorderScoresRight () |
float * | getBorderScoresTop () |
float * | getBorderScoresBottom () |
LocalSurface ** | getSurfaceStructure () |
PointCloudOut & | getBorderDescriptions () |
ShadowBorderIndices ** | getShadowBorderInformations () |
Eigen::Vector3f ** | getBorderDirections () |
float * | getSurfaceChangeScores () |
Eigen::Vector3f * | getSurfaceChangeDirections () |
Public Member Functions inherited from pcl::Feature< PointWithRange, BorderDescription > | |
Feature () | |
Empty constructor. More... | |
void | setSearchSurface (const PointCloudInConstPtr &cloud) |
Provide a pointer to a dataset to add additional information to estimate the features for every point in the input dataset. More... | |
PointCloudInConstPtr | getSearchSurface () const |
Get a pointer to the surface point cloud dataset. More... | |
void | setSearchMethod (const KdTreePtr &tree) |
Provide a pointer to the search object. More... | |
KdTreePtr | getSearchMethod () const |
Get a pointer to the search method used. More... | |
double | getSearchParameter () const |
Get the internal search parameter. More... | |
void | setKSearch (int k) |
Set the number of k nearest neighbors to use for the feature estimation. More... | |
int | getKSearch () const |
get the number of k nearest neighbors used for the feature estimation. More... | |
void | setRadiusSearch (double radius) |
Set the sphere radius that is to be used for determining the nearest neighbors used for the feature estimation. More... | |
double | getRadiusSearch () const |
Get the sphere radius used for determining the neighbors. More... | |
void | compute (PointCloudOut &output) |
Base method for feature estimation for all points given in <setInputCloud (), setIndices ()> using the surface in setSearchSurface () and the spatial locator in setSearchMethod () More... | |
Public Member Functions inherited from pcl::PCLBase< PointT > | |
PCLBase () | |
Empty constructor. More... | |
PCLBase (const PCLBase &base) | |
Copy constructor. More... | |
virtual | ~PCLBase ()=default |
Destructor. More... | |
virtual void | setInputCloud (const PointCloudConstPtr &cloud) |
Provide a pointer to the input dataset. More... | |
PointCloudConstPtr const | getInputCloud () const |
Get a pointer to the input point cloud dataset. More... | |
virtual void | setIndices (const IndicesPtr &indices) |
Provide a pointer to the vector of indices that represents the input data. More... | |
virtual void | setIndices (const IndicesConstPtr &indices) |
Provide a pointer to the vector of indices that represents the input data. More... | |
virtual void | setIndices (const PointIndicesConstPtr &indices) |
Provide a pointer to the vector of indices that represents the input data. More... | |
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. More... | |
IndicesPtr | getIndices () |
Get a pointer to the vector of indices used. More... | |
IndicesConstPtr const | getIndices () const |
Get a pointer to the vector of indices used. More... | |
const PointT & | operator[] (std::size_t pos) const |
Override PointCloud operator[] to shorten code. More... | |
Static Public Member Functions | |
static float | getObstacleBorderAngle (const BorderTraits &border_traits) |
Take the information from BorderTraits to calculate the local direction of the border. More... | |
Protected Member Functions | |
float | getNeighborDistanceChangeScore (const LocalSurface &local_surface, int x, int y, int offset_x, int offset_y, int pixel_radius=1) const |
Calculate a border score based on how distant the neighbor is, compared to the closest neighbors /param local_surface /param x /param y /param offset_x /param offset_y /param pixel_radius (defaults to 1) /return the resulting border score. More... | |
float | getNormalBasedBorderScore (const LocalSurface &local_surface, int x, int y, int offset_x, int offset_y) const |
Calculate a border score based on how much the neighbor is away from the local surface plane. More... | |
bool | changeScoreAccordingToShadowBorderValue (int x, int y, int offset_x, int offset_y, float *border_scores, float *border_scores_other_direction, int &shadow_border_idx) const |
Find the best corresponding shadow border and lower score according to the shadow borders value. More... | |
float | updatedScoreAccordingToNeighborValues (int x, int y, const float *border_scores) const |
Returns a new score for the given pixel that is >= the original value, based on the neighbors values. More... | |
float * | updatedScoresAccordingToNeighborValues (const float *border_scores) const |
For all pixels, returns a new score that is >= the original value, based on the neighbors values. More... | |
void | updateScoresAccordingToNeighborValues () |
Replace all border score values with updates according to updatedScoreAccordingToNeighborValues. More... | |
bool | checkPotentialBorder (int x, int y, int offset_x, int offset_y, float *border_scores_left, float *border_scores_right, int &shadow_border_idx) const |
Check if a potential border point has a corresponding shadow border. More... | |
bool | checkIfMaximum (int x, int y, int offset_x, int offset_y, float *border_scores, int shadow_border_idx) const |
Check if a potential border point is a maximum regarding the border score. More... | |
void | findAndEvaluateShadowBorders () |
Find the best corresponding shadow border and lower score according to the shadow borders value. More... | |
void | extractLocalSurfaceStructure () |
Extract local plane information in every point (see getSurfaceStructure ()) More... | |
void | extractBorderScoreImages () |
Get images representing the probability that the corresponding pixels are borders in that direction (see getBorderScores... More... | |
void | classifyBorders () |
Classify the pixels in the range image according to the different classes defined below in enum BorderClass. More... | |
void | calculateBorderDirection (int x, int y) |
Calculate the 3D direction of the border just using the border traits at this position (facing away from the obstacle) More... | |
void | calculateBorderDirections () |
Call calculateBorderDirection for every point and average the result over parameters_.pixel_radius_border_direction. More... | |
bool | get3dDirection (const BorderDescription &border_description, Eigen::Vector3f &direction, const LocalSurface *local_surface=nullptr) |
Calculate a 3d direction from a border point by projecting the direction in the range image - returns false if direction could not be calculated. More... | |
bool | calculateMainPrincipalCurvature (int x, int y, int radius, float &magnitude, Eigen::Vector3f &main_direction) const |
Calculate the main principal curvature (the largest eigenvalue and corresponding eigenvector for the normals in the area) in the given point. More... | |
void | calculateSurfaceChanges () |
Uses either the border or principal curvature to define a score how much the surface changes in a point (1 for a border) and what the main direction of that change is. More... | |
void | blurSurfaceChanges () |
Apply a blur to the surface change images. More... | |
void | computeFeature (PointCloudOut &output) override |
Implementation of abstract derived function. More... | |
Protected Member Functions inherited from pcl::Feature< PointWithRange, BorderDescription > | |
const std::string & | getClassName () const |
Get a string representation of the name of this class. More... | |
virtual bool | initCompute () |
This method should get called before starting the actual computation. More... | |
virtual bool | deinitCompute () |
This method should get called after ending the actual computation. More... | |
int | searchForNeighbors (std::size_t index, double parameter, pcl::Indices &indices, std::vector< float > &distances) const |
Search for k-nearest neighbors using the spatial locator from setSearchmethod, and the given surface from setSearchSurface. More... | |
int | searchForNeighbors (const PointCloudIn &cloud, std::size_t index, double parameter, pcl::Indices &indices, std::vector< float > &distances) const |
Search for k-nearest neighbors using the spatial locator from setSearchmethod, and the given surface from setSearchSurface. More... | |
Protected Member Functions inherited from pcl::PCLBase< PointT > | |
bool | initCompute () |
This method should get called before starting the actual computation. More... | |
bool | deinitCompute () |
This method should get called after finishing the actual computation. More... | |
Protected Attributes | |
Parameters | parameters_ |
const RangeImage * | range_image_ |
int | range_image_size_during_extraction_ {0} |
std::vector< float > | border_scores_left_ |
std::vector< float > | border_scores_right_ |
std::vector< float > | border_scores_top_ |
std::vector< float > | border_scores_bottom_ |
LocalSurface ** | surface_structure_ {nullptr} |
PointCloudOut * | border_descriptions_ {nullptr} |
ShadowBorderIndices ** | shadow_border_informations_ {nullptr} |
Eigen::Vector3f ** | border_directions_ {nullptr} |
float * | surface_change_scores_ {nullptr} |
Eigen::Vector3f * | surface_change_directions_ {nullptr} |
Protected Attributes inherited from pcl::Feature< PointWithRange, BorderDescription > | |
std::string | feature_name_ |
The feature name. More... | |
SearchMethodSurface | search_method_surface_ |
The search method template for points. More... | |
PointCloudInConstPtr | surface_ |
An input point cloud describing the surface that is to be used for nearest neighbors estimation. More... | |
KdTreePtr | tree_ |
A pointer to the spatial search object. More... | |
double | search_parameter_ |
The actual search parameter (from either search_radius_ or k_). More... | |
double | search_radius_ |
The nearest neighbors search radius for each point. More... | |
int | k_ |
The number of K nearest neighbors to use for each point. More... | |
bool | fake_surface_ |
If no surface is given, we use the input PointCloud as the surface. More... | |
Protected Attributes inherited from pcl::PCLBase< PointT > | |
PointCloudConstPtr | input_ |
The input point cloud dataset. More... | |
IndicesPtr | indices_ |
A pointer to the vector of point indices to use. More... | |
bool | use_indices_ |
Set to true if point indices are used. More... | |
bool | fake_indices_ |
If no set of indices are given, we construct a set of fake indices that mimic the input PointCloud. More... | |
Extract obstacle borders from range images, meaning positions where there is a transition from foreground to background.
Definition at line 55 of file range_image_border_extractor.h.
Definition at line 61 of file range_image_border_extractor.h.
using pcl::RangeImageBorderExtractor::ConstPtr = shared_ptr<const RangeImageBorderExtractor> |
Definition at line 59 of file range_image_border_extractor.h.
using pcl::RangeImageBorderExtractor::Ptr = shared_ptr<RangeImageBorderExtractor> |
Definition at line 58 of file range_image_border_extractor.h.
pcl::RangeImageBorderExtractor::RangeImageBorderExtractor | ( | const RangeImage * | range_image = nullptr | ) |
Constructor.
|
override |
Destructor.
|
protected |
Apply a blur to the surface change images.
|
inlineprotected |
Calculate the 3D direction of the border just using the border traits at this position (facing away from the obstacle)
x | the x-coordinate of the input position |
y | the y-coordinate of the input position |
Definition at line 162 of file range_image_border_extractor.hpp.
References border_directions_, pcl::BORDER_TRAIT__OBSTACLE_BORDER, get3dDirection(), range_image_, surface_structure_, pcl::BorderDescription::traits, and pcl::PointCloud< PointT >::width.
|
protected |
Call calculateBorderDirection for every point and average the result over parameters_.pixel_radius_border_direction.
|
inlineprotected |
Calculate the main principal curvature (the largest eigenvalue and corresponding eigenvector for the normals in the area) in the given point.
x | the x-coordinate of the input point |
y | the y-coordinate of the input point |
radius | the pixel radius that is used to find neighboring points |
magnitude | the resulting magnitude |
main_direction | the resulting direction |
Definition at line 312 of file range_image_border_extractor.hpp.
References pcl::VectorAverage< real, dimension >::add(), pcl::BORDER_TRAIT__SHADOW_BORDER, pcl::BORDER_TRAIT__VEIL_POINT, pcl::VectorAverage< real, dimension >::doPCA(), pcl::VectorAverage< real, dimension >::getNoOfSamples(), pcl::RangeImage::isValid(), pcl::RangeImageBorderExtractor::LocalSurface::normal_no_jumps, range_image_, surface_structure_, and pcl::PointCloud< PointT >::width.
|
protected |
Uses either the border or principal curvature to define a score how much the surface changes in a point (1 for a border) and what the main direction of that change is.
|
inlineprotected |
Find the best corresponding shadow border and lower score according to the shadow borders value.
x | |
y | |
offset_x | |
offset_y | |
border_scores | |
border_scores_other_direction | |
shadow_border_idx |
Definition at line 180 of file range_image_border_extractor.hpp.
References pcl::RangeImage::isInImage(), pcl::RangeImage::isMaxRange(), pcl::RangeImageBorderExtractor::Parameters::minimum_border_probability, parameters_, pcl::RangeImageBorderExtractor::Parameters::pixel_radius_borders, range_image_, and pcl::PointCloud< PointT >::width.
|
inlineprotected |
Check if a potential border point is a maximum regarding the border score.
x | the x-coordinate of the input point |
y | the y-coordinate of the input point |
offset_x | |
offset_y | |
border_scores | |
shadow_border_idx |
Definition at line 289 of file range_image_border_extractor.hpp.
References pcl::RangeImage::isInImage(), parameters_, pcl::RangeImageBorderExtractor::Parameters::pixel_radius_borders, range_image_, and pcl::PointCloud< PointT >::width.
|
inlineprotected |
Check if a potential border point has a corresponding shadow border.
x | the x-coordinate of the input point |
y | the y-coordinate of the input point |
offset_x | |
offset_y | |
border_scores_left | |
border_scores_right | |
shadow_border_idx |
Definition at line 258 of file range_image_border_extractor.hpp.
References pcl::RangeImage::isInImage(), pcl::RangeImageBorderExtractor::Parameters::minimum_border_probability, parameters_, pcl::RangeImageBorderExtractor::Parameters::pixel_radius_borders, range_image_, and pcl::PointCloud< PointT >::width.
|
protected |
Classify the pixels in the range image according to the different classes defined below in enum BorderClass.
minImpactAngle (in radians) defines how flat the angle at which a surface was seen can be.
void pcl::RangeImageBorderExtractor::clearData | ( | ) |
Erase all data calculated for the current range image.
void pcl::RangeImageBorderExtractor::compute | ( | PointCloudOut & | output | ) |
Overwrite the compute function of the base class.
|
overrideprotectedvirtual |
Implementation of abstract derived function.
Implements pcl::Feature< PointWithRange, BorderDescription >.
|
protected |
Get images representing the probability that the corresponding pixels are borders in that direction (see getBorderScores...
())
|
protected |
Extract local plane information in every point (see getSurfaceStructure ())
|
protected |
Find the best corresponding shadow border and lower score according to the shadow borders value.
|
inlineprotected |
Calculate a 3d direction from a border point by projecting the direction in the range image - returns false if direction could not be calculated.
border_description | |
direction | |
local_surface |
Definition at line 120 of file range_image_border_extractor.hpp.
References pcl::BORDER_TRAIT__OBSTACLE_BORDER_BOTTOM, pcl::BORDER_TRAIT__OBSTACLE_BORDER_LEFT, pcl::BORDER_TRAIT__OBSTACLE_BORDER_RIGHT, pcl::BORDER_TRAIT__OBSTACLE_BORDER_TOP, pcl::RangeImage::calculate3DPoint(), pcl::RangeImage::getPoint(), pcl::RangeImage::getSensorPos(), pcl::RangeImageBorderExtractor::LocalSurface::neighborhood_mean_no_jumps, pcl::RangeImageBorderExtractor::LocalSurface::normal_no_jumps, pcl::_PointWithRange::range, range_image_, pcl::BorderDescription::traits, pcl::BorderDescription::x, and pcl::BorderDescription::y.
Referenced by calculateBorderDirection().
float* pcl::RangeImageBorderExtractor::getAnglesImageForBorderDirections | ( | ) |
Get the 2D directions in the range image from the border directions - probably mainly useful for visualization.
float* pcl::RangeImageBorderExtractor::getAnglesImageForSurfaceChangeDirections | ( | ) |
Get the 2D directions in the range image from the surface change directions - probably mainly useful for visualization.
|
inline |
Definition at line 163 of file range_image_border_extractor.h.
|
inline |
Definition at line 169 of file range_image_border_extractor.h.
|
inline |
Definition at line 157 of file range_image_border_extractor.h.
|
inline |
Definition at line 148 of file range_image_border_extractor.h.
|
inline |
Definition at line 151 of file range_image_border_extractor.h.
|
inline |
Definition at line 154 of file range_image_border_extractor.h.
|
inlineprotected |
Calculate a border score based on how distant the neighbor is, compared to the closest neighbors /param local_surface /param x /param y /param offset_x /param offset_y /param pixel_radius (defaults to 1) /return the resulting border score.
Definition at line 70 of file range_image_border_extractor.hpp.
References pcl::RangeImage::get1dPointAverage(), pcl::RangeImage::getPoint(), pcl::RangeImageBorderExtractor::LocalSurface::max_neighbor_distance_squared, pcl::_PointWithRange::range, range_image_, and pcl::squaredEuclideanDistance().
|
inlineprotected |
Calculate a border score based on how much the neighbor is away from the local surface plane.
local_surface | |
x | |
y | |
offset_x | |
offset_y |
|
inlinestatic |
Take the information from BorderTraits to calculate the local direction of the border.
border_traits | contains the information needed to calculate the border angle |
Definition at line 45 of file range_image_border_extractor.hpp.
References pcl::BORDER_TRAIT__OBSTACLE_BORDER_BOTTOM, pcl::BORDER_TRAIT__OBSTACLE_BORDER_LEFT, pcl::BORDER_TRAIT__OBSTACLE_BORDER_RIGHT, and pcl::BORDER_TRAIT__OBSTACLE_BORDER_TOP.
|
inline |
Definition at line 139 of file range_image_border_extractor.h.
|
inline |
Definition at line 145 of file range_image_border_extractor.h.
|
inline |
Definition at line 166 of file range_image_border_extractor.h.
|
inline |
Definition at line 175 of file range_image_border_extractor.h.
|
inline |
Definition at line 172 of file range_image_border_extractor.h.
|
inline |
Definition at line 160 of file range_image_border_extractor.h.
|
inline |
Definition at line 142 of file range_image_border_extractor.h.
void pcl::RangeImageBorderExtractor::setRangeImage | ( | const RangeImage * | range_image | ) |
Provide a pointer to the range image.
range_image | a pointer to the range_image |
|
inlineprotected |
Returns a new score for the given pixel that is >= the original value, based on the neighbors values.
x | the x-coordinate of the input pixel |
y | the y-coordinate of the input pixel |
border_scores | the input border scores |
Definition at line 226 of file range_image_border_extractor.hpp.
References pcl::RangeImage::isInImage(), pcl::RangeImageBorderExtractor::Parameters::minimum_border_probability, parameters_, range_image_, and pcl::PointCloud< PointT >::width.
|
protected |
For all pixels, returns a new score that is >= the original value, based on the neighbors values.
border_scores | the input border scores |
|
protected |
Replace all border score values with updates according to updatedScoreAccordingToNeighborValues.
|
protected |
Definition at line 186 of file range_image_border_extractor.h.
|
protected |
Definition at line 188 of file range_image_border_extractor.h.
Referenced by calculateBorderDirection().
|
protected |
Definition at line 184 of file range_image_border_extractor.h.
|
protected |
Definition at line 183 of file range_image_border_extractor.h.
|
protected |
Definition at line 183 of file range_image_border_extractor.h.
|
protected |
Definition at line 184 of file range_image_border_extractor.h.
|
protected |
Definition at line 180 of file range_image_border_extractor.h.
Referenced by changeScoreAccordingToShadowBorderValue(), checkIfMaximum(), checkPotentialBorder(), and updatedScoreAccordingToNeighborValues().
|
protected |
Definition at line 181 of file range_image_border_extractor.h.
Referenced by calculateBorderDirection(), calculateMainPrincipalCurvature(), changeScoreAccordingToShadowBorderValue(), checkIfMaximum(), checkPotentialBorder(), get3dDirection(), getNeighborDistanceChangeScore(), and updatedScoreAccordingToNeighborValues().
|
protected |
Definition at line 182 of file range_image_border_extractor.h.
|
protected |
Definition at line 187 of file range_image_border_extractor.h.
|
protected |
Definition at line 191 of file range_image_border_extractor.h.
|
protected |
Definition at line 190 of file range_image_border_extractor.h.
|
protected |
Definition at line 185 of file range_image_border_extractor.h.
Referenced by calculateBorderDirection(), and calculateMainPrincipalCurvature().