A point cloud manager class that uses the STANN nearest neighbor search library to handle the data. This class calculates robust surface normals for the given point set as described in the SSRR2010 paper. More...
#include <StannPointCloudManager.hpp>
Public Member Functions | |
StannPointCloudManager (float **points, NormalT *normals, size_t n, const int &kn=10, const int &ki=10, const int &kd=10) | |
Creates a new instance using the given coordinate array. The point data is supposed to be stored as a sequence of n tripels that contain the point coordinates. | |
StannPointCloudManager (string filename, const int &kn=10, const int &ki=10, const int &kd=10) | |
Trys to read the given file to create a new StannPointCloudManager instance. | |
virtual | ~StannPointCloudManager () |
Destructor. | |
virtual void | getkClosestVertices (const VertexT &v, const size_t &k, vector< VertexT > &nb) |
Returns the k closest neighbor vertices to a given queryy point. | |
virtual void | getkClosestNormals (const VertexT &n, const size_t &k, vector< NormalT > &nb) |
Return the k closest neighbor normals to a given query point. | |
void | save (string filename) |
Saves currently present data to a file. | |
virtual float | distance (VertexT v) |
Returns the distance of vertex v from the nearest tangent plane. | |
virtual BoundingBox< VertexT > & | getBoundingBox () |
Returns the bounding box of the loaded point set. | |
virtual VertexT | getPoint (size_t index) |
Returns the points at index index} in the point array. | |
virtual size_t | getNumPoints () |
Returns the number of managed points. | |
virtual const VertexT | operator[] (const size_t &index) const |
Returns the point at the given index}. | |
Protected Member Functions | |
virtual void | readFromFile (string filename) |
Tries to read point and normal information from the given file. | |
Protected Attributes | |
float ** | m_points |
The currently stored points. | |
float ** | m_normals |
The point normals. | |
BoundingBox< VertexT > | m_boundingBox |
The bounding box of the point set. | |
size_t | m_numPoints |
Private Member Functions | |
void | init () |
Helper function for constructors. | |
void | savePLY (string filename) |
Save points and normals to a binary PLY file. | |
void | savePointsAndNormals (string filename) |
Save points and normals to an ASCII file. | |
void | savePoints (string filename) |
Save points to a ascii file. | |
void | estimateSurfaceNormals () |
Calculates initial point normals using a least squares fit to the m_kn nearest points. | |
void | interpolateSurfaceNormals () |
Interpolate the initial normals with the m_ki neighbors. | |
bool | boundingBoxOK (const float &dx, const float &dy, const float &dz) |
Checks if the bounding box of a point set is "well formed", i.e. no dimension is significantly larger than the other. | |
float | meanDistance (const Plane< VertexT, NormalT > &p, const vector< unsigned long > &id, const int &k) |
Returns the mean distance of the given point set from the given plane. | |
VertexT | fromID (int i) |
Returns a vertex representation of the given point in the point array. | |
float | distance (VertexT v, Plane< VertexT, NormalT > p) |
Returns the distance between vertex v and plane p. | |
Plane< VertexT, NormalT > | calcPlane (const VertexT &queryPoint, const int &k, const vector< unsigned long > &id) |
Calculates a tangent plane for the query point using the provided k-neighborhood. | |
Private Attributes | |
sfcnn< float *, 3, float > | m_pointTree |
STANN tree to manage the data points. | |
int | m_kn |
The number of neighbors used for initial normal estimation. | |
int | m_ki |
The number of neighbors used for normal interpolation. | |
int | m_kd |
The number of tangent planes used for distance determination. | |
VertexT | m_centroid |
The centroid of the point set. |
A point cloud manager class that uses the STANN nearest neighbor search library to handle the data. This class calculates robust surface normals for the given point set as described in the SSRR2010 paper.
Definition at line 59 of file StannPointCloudManager.hpp.
lssr::StannPointCloudManager< VertexT, NormalT >::StannPointCloudManager | ( | float ** | points, | |
NormalT * | normals, | |||
size_t | n, | |||
const int & | kn = 10 , |
|||
const int & | ki = 10 , |
|||
const int & | kd = 10 | |||
) |
Creates a new instance using the given coordinate array. The point data is supposed to be stored as a sequence of n tripels that contain the point coordinates.
points | An array of point coordinates | |
normals | A normal array. If a null pointer is passed, normals are automatically calculated. | |
n | The number of points in the data set | |
kn | The number of neighbor points used for normal estimation | |
ki | The number of neighbor points used for normal interpolation | |
kd | The number of neighbor points used for distance value calculation |
lssr::StannPointCloudManager< VertexT, NormalT >::StannPointCloudManager | ( | string | filename, | |
const int & | kn = 10 , |
|||
const int & | ki = 10 , |
|||
const int & | kd = 10 | |||
) |
Trys to read the given file to create a new StannPointCloudManager instance.
The | file to read from | |
kn | The number of neighbor points used for normal estimation | |
ki | The number of neighbor points used for normal interpolation | |
kd | The number of neighbor points used for distance value calculation |
virtual lssr::StannPointCloudManager< VertexT, NormalT >::~StannPointCloudManager | ( | ) | [inline, virtual] |
Destructor.
Definition at line 100 of file StannPointCloudManager.hpp.
bool lssr::StannPointCloudManager< VertexT, NormalT >::boundingBoxOK | ( | const float & | dx, | |
const float & | dy, | |||
const float & | dz | |||
) | [private] |
Checks if the bounding box of a point set is "well formed", i.e. no dimension is significantly larger than the other.
This method is needed to achieve a better quality of the initial normal estimation in sparse scans. Details are described in the SRR2010 paper.
dx,dy,dz | The side lengths of the bounding box |
Plane<VertexT, NormalT> lssr::StannPointCloudManager< VertexT, NormalT >::calcPlane | ( | const VertexT & | queryPoint, | |
const int & | k, | |||
const vector< unsigned long > & | id | |||
) | [private] |
Calculates a tangent plane for the query point using the provided k-neighborhood.
queryPoint | The point fpr which the tangent plane is created | |
k | The size of the used k-neighborhood | |
id | The positions of the neighborhood points in m_points |
virtual float lssr::StannPointCloudManager< VertexT, NormalT >::distance | ( | VertexT | v | ) | [virtual] |
Returns the distance of vertex v from the nearest tangent plane.
Implements lssr::PointCloudManager< VertexT, NormalT >.
float lssr::StannPointCloudManager< VertexT, NormalT >::distance | ( | VertexT | v, | |
Plane< VertexT, NormalT > | p | |||
) | [private] |
Returns the distance between vertex v and plane p.
void lssr::StannPointCloudManager< VertexT, NormalT >::estimateSurfaceNormals | ( | ) | [private] |
Calculates initial point normals using a least squares fit to the m_kn nearest points.
VertexT lssr::StannPointCloudManager< VertexT, NormalT >::fromID | ( | int | i | ) | [private] |
Returns a vertex representation of the given point in the point array.
i | A id of a point in the current point set |
virtual BoundingBox<VertexT>& lssr::PointCloudManager< VertexT, NormalT >::getBoundingBox | ( | ) | [virtual, inherited] |
Returns the bounding box of the loaded point set.
virtual void lssr::StannPointCloudManager< VertexT, NormalT >::getkClosestNormals | ( | const VertexT & | n, | |
const size_t & | k, | |||
vector< NormalT > & | nb | |||
) | [inline, virtual] |
Return the k closest neighbor normals to a given query point.
n | A query vertex | |
k | The (max) number of returned closest points to v | |
nb | A vector containing the determined closest normals |
TODO: Implement method
Implements lssr::PointCloudManager< VertexT, NormalT >.
Definition at line 122 of file StannPointCloudManager.hpp.
virtual void lssr::StannPointCloudManager< VertexT, NormalT >::getkClosestVertices | ( | const VertexT & | v, | |
const size_t & | k, | |||
vector< VertexT > & | nb | |||
) | [inline, virtual] |
Returns the k closest neighbor vertices to a given queryy point.
v | A query vertex | |
k | The (max) number of returned closest points to v | |
nb | A vector containing the determined closest points |
TODO: Implement method
Implements lssr::PointCloudManager< VertexT, NormalT >.
Definition at line 109 of file StannPointCloudManager.hpp.
virtual size_t lssr::PointCloudManager< VertexT, NormalT >::getNumPoints | ( | ) | [virtual, inherited] |
Returns the number of managed points.
virtual VertexT lssr::PointCloudManager< VertexT, NormalT >::getPoint | ( | size_t | index | ) | [virtual, inherited] |
Returns the points at index index} in the point array.
index |
void lssr::StannPointCloudManager< VertexT, NormalT >::init | ( | ) | [private] |
Helper function for constructors.
void lssr::StannPointCloudManager< VertexT, NormalT >::interpolateSurfaceNormals | ( | ) | [private] |
Interpolate the initial normals with the m_ki neighbors.
float lssr::StannPointCloudManager< VertexT, NormalT >::meanDistance | ( | const Plane< VertexT, NormalT > & | p, | |
const vector< unsigned long > & | id, | |||
const int & | k | |||
) | [private] |
Returns the mean distance of the given point set from the given plane.
p | The query plane | |
id | A list of point id's | |
k | The number of points in the list |
virtual const VertexT lssr::PointCloudManager< VertexT, NormalT >::operator[] | ( | const size_t & | index | ) | const [virtual, inherited] |
Returns the point at the given index}.
virtual void lssr::PointCloudManager< VertexT, NormalT >::readFromFile | ( | string | filename | ) | [protected, virtual, inherited] |
Tries to read point and normal information from the given file.
filename | A file containing point cloud data. |
void lssr::StannPointCloudManager< VertexT, NormalT >::save | ( | string | filename | ) |
Saves currently present data to a file.
Which data is saved depends on the file extension. Extensions .xyz, .pts and .3d will produce ASCII files that contain point cloud data only. Files with extension .nor will additionally contain normal defintions. Extension .ply will produce a binary .ply file with point and normal information.
filename | The target file. |
void lssr::StannPointCloudManager< VertexT, NormalT >::savePLY | ( | string | filename | ) | [private] |
Save points and normals to a binary PLY file.
filename | The target file |
void lssr::StannPointCloudManager< VertexT, NormalT >::savePoints | ( | string | filename | ) | [private] |
Save points to a ascii file.
void lssr::StannPointCloudManager< VertexT, NormalT >::savePointsAndNormals | ( | string | filename | ) | [private] |
Save points and normals to an ASCII file.
BoundingBox<VertexT> lssr::PointCloudManager< VertexT, NormalT >::m_boundingBox [protected, inherited] |
The bounding box of the point set.
Definition at line 92 of file PointCloudManager.hpp.
VertexT lssr::StannPointCloudManager< VertexT, NormalT >::m_centroid [private] |
The centroid of the point set.
Definition at line 244 of file StannPointCloudManager.hpp.
int lssr::StannPointCloudManager< VertexT, NormalT >::m_kd [private] |
The number of tangent planes used for distance determination.
Definition at line 241 of file StannPointCloudManager.hpp.
int lssr::StannPointCloudManager< VertexT, NormalT >::m_ki [private] |
The number of neighbors used for normal interpolation.
Definition at line 238 of file StannPointCloudManager.hpp.
int lssr::StannPointCloudManager< VertexT, NormalT >::m_kn [private] |
The number of neighbors used for initial normal estimation.
Definition at line 235 of file StannPointCloudManager.hpp.
float** lssr::PointCloudManager< VertexT, NormalT >::m_normals [protected, inherited] |
The point normals.
Definition at line 89 of file PointCloudManager.hpp.
size_t lssr::PointCloudManager< VertexT, NormalT >::m_numPoints [protected, inherited] |
Definition at line 94 of file PointCloudManager.hpp.
float** lssr::PointCloudManager< VertexT, NormalT >::m_points [protected, inherited] |
The currently stored points.
Definition at line 86 of file PointCloudManager.hpp.
sfcnn< float*, 3, float> lssr::StannPointCloudManager< VertexT, NormalT >::m_pointTree [private] |
STANN tree to manage the data points.
Definition at line 232 of file StannPointCloudManager.hpp.