Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes

lssr::StannPointCloudManager< VertexT, NormalT > Class Template Reference

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>

Inheritance diagram for lssr::StannPointCloudManager< VertexT, NormalT >:
Inheritance graph
[legend]
Collaboration diagram for lssr::StannPointCloudManager< VertexT, NormalT >:
Collaboration graph
[legend]

List of all members.

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.

Detailed Description

template<typename VertexT, typename NormalT>
class lssr::StannPointCloudManager< VertexT, NormalT >

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.


Constructor & Destructor Documentation

template<typename VertexT, typename NormalT>
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.

Parameters:
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
template<typename VertexT, typename NormalT>
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.

Parameters:
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
template<typename VertexT, typename NormalT>
virtual lssr::StannPointCloudManager< VertexT, NormalT >::~StannPointCloudManager (  )  [inline, virtual]

Destructor.

Definition at line 100 of file StannPointCloudManager.hpp.


Member Function Documentation

template<typename VertexT, typename NormalT>
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.

Parameters:
dx,dy,dz The side lengths of the bounding box
Returns:
true if the given box has valid dimensions.
template<typename VertexT, typename NormalT>
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.

Parameters:
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
template<typename VertexT, typename NormalT>
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 >.

template<typename VertexT, typename NormalT>
float lssr::StannPointCloudManager< VertexT, NormalT >::distance ( VertexT  v,
Plane< VertexT, NormalT >  p 
) [private]

Returns the distance between vertex v and plane p.

template<typename VertexT, typename NormalT>
void lssr::StannPointCloudManager< VertexT, NormalT >::estimateSurfaceNormals (  )  [private]

Calculates initial point normals using a least squares fit to the m_kn nearest points.

template<typename VertexT, typename NormalT>
VertexT lssr::StannPointCloudManager< VertexT, NormalT >::fromID ( int  i  )  [private]

Returns a vertex representation of the given point in the point array.

Parameters:
i A id of a point in the current point set
Returns:
A vertex representation of the given point
template<typename VertexT, typename NormalT>
virtual BoundingBox<VertexT>& lssr::PointCloudManager< VertexT, NormalT >::getBoundingBox (  )  [virtual, inherited]

Returns the bounding box of the loaded point set.

template<typename VertexT, typename NormalT>
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.

Parameters:
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.

template<typename VertexT, typename NormalT>
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.

Parameters:
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.

template<typename VertexT, typename NormalT>
virtual size_t lssr::PointCloudManager< VertexT, NormalT >::getNumPoints (  )  [virtual, inherited]

Returns the number of managed points.

template<typename VertexT, typename NormalT>
virtual VertexT lssr::PointCloudManager< VertexT, NormalT >::getPoint ( size_t  index  )  [virtual, inherited]

Returns the points at index index} in the point array.

Parameters:
index 
Returns:
template<typename VertexT, typename NormalT>
void lssr::StannPointCloudManager< VertexT, NormalT >::init (  )  [private]

Helper function for constructors.

template<typename VertexT, typename NormalT>
void lssr::StannPointCloudManager< VertexT, NormalT >::interpolateSurfaceNormals (  )  [private]

Interpolate the initial normals with the m_ki neighbors.

template<typename VertexT, typename NormalT>
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.

Parameters:
p The query plane
id A list of point id's
k The number of points in the list
template<typename VertexT, typename NormalT>
virtual const VertexT lssr::PointCloudManager< VertexT, NormalT >::operator[] ( const size_t &  index  )  const [virtual, inherited]

Returns the point at the given index}.

template<typename VertexT, typename NormalT>
virtual void lssr::PointCloudManager< VertexT, NormalT >::readFromFile ( string  filename  )  [protected, virtual, inherited]

Tries to read point and normal information from the given file.

Parameters:
filename A file containing point cloud data.
template<typename VertexT, typename NormalT>
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.

Parameters:
filename The target file.

Here is the caller graph for this function:

template<typename VertexT, typename NormalT>
void lssr::StannPointCloudManager< VertexT, NormalT >::savePLY ( string  filename  )  [private]

Save points and normals to a binary PLY file.

Parameters:
filename The target file
template<typename VertexT, typename NormalT>
void lssr::StannPointCloudManager< VertexT, NormalT >::savePoints ( string  filename  )  [private]

Save points to a ascii file.

template<typename VertexT, typename NormalT>
void lssr::StannPointCloudManager< VertexT, NormalT >::savePointsAndNormals ( string  filename  )  [private]

Save points and normals to an ASCII file.


Member Data Documentation

template<typename VertexT, typename NormalT>
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.

template<typename VertexT, typename NormalT>
VertexT lssr::StannPointCloudManager< VertexT, NormalT >::m_centroid [private]

The centroid of the point set.

Definition at line 244 of file StannPointCloudManager.hpp.

template<typename VertexT, typename NormalT>
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.

template<typename VertexT, typename NormalT>
int lssr::StannPointCloudManager< VertexT, NormalT >::m_ki [private]

The number of neighbors used for normal interpolation.

Definition at line 238 of file StannPointCloudManager.hpp.

template<typename VertexT, typename NormalT>
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.

template<typename VertexT, typename NormalT>
float** lssr::PointCloudManager< VertexT, NormalT >::m_normals [protected, inherited]

The point normals.

Definition at line 89 of file PointCloudManager.hpp.

template<typename VertexT, typename NormalT>
size_t lssr::PointCloudManager< VertexT, NormalT >::m_numPoints [protected, inherited]

Definition at line 94 of file PointCloudManager.hpp.

template<typename VertexT, typename NormalT>
float** lssr::PointCloudManager< VertexT, NormalT >::m_points [protected, inherited]

The currently stored points.

Definition at line 86 of file PointCloudManager.hpp.

template<typename VertexT, typename NormalT>
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.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Defines