DGtal
0.6.devel
|
#include <SphericalAccumulator.h>
Public Types | |
typedef TVector | Vector |
typedef DGtal::int32_t | Quantity |
typedef DGtal::uint32_t | Size |
typedef std::vector< Quantity > ::const_iterator | ConstIterator |
typedef PointVector< 3, double > | RealVector |
Public Member Functions | |
BOOST_STATIC_ASSERT (Vector::dimension==3) | |
SphericalAccumulator (const Size aNphi) | |
~SphericalAccumulator () | |
void | addDirection (const Vector &aDir) |
void | binCoordinates (const Vector &aDir, Size &posPhi, Size &posTheta) const |
Quantity | count (const Size &posPhi, const Size &posTheta) const |
Vector | representativeDirection (const Size &posPhi, const Size &posTheta) const |
Vector | representativeDirection (ConstIterator &it) const |
Quantity | samples () const |
Quantity | binNumber () const |
void | maxCountBin (Size &posPhi, Size &posTheta) const |
void | clear () |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
std::string | className () const |
bool | isValidBin (const Size &posPhi, const Size &posTheta) const |
void | getBinGeometry (const Size &posPhi, const Size &posTheta, RealVector &a, RealVector &b, RealVector &c, RealVector &d) const |
ConstIterator | begin () const |
ConstIterator | end () const |
void | binCoordinates (ConstIterator &aDir, Size &posPhi, Size &posTheta) const |
Protected Member Functions | |
SphericalAccumulator () |
Private Member Functions | |
SphericalAccumulator (const SphericalAccumulator &other) | |
SphericalAccumulator & | operator= (const SphericalAccumulator &other) |
Private Attributes | |
Size | myNphi |
Size | myNtheta |
std::vector< Quantity > | myAccumulator |
std::vector< Vector > | myAccumulatorDir |
Quantity | myTotal |
Quantity | myBinNumber |
Size | myMaxBinPhi |
Size | myMaxBinTheta |
Aim: implements an accumulator (as histograms for 1D scalars) adapted to spherical point samples.
Description of template class 'SphericalAccumulator'
Spherical accumulator is decomposed into 2D bins (i,j) such that:
Compared to exact geodesic covering, such spherical accumulator bins do not have the exact same area. However, it allows fast conversion between directions and bin coordinates.
Such accumulator have been demonstrated in: Borrmann, D., Elseberg, J., & Lingemann, K. (2011). The 3D Hough Transform for plane detection in point clouds: A review and a new accumulator design. 3D Research, 02003. Retrieved from http://www.springerlink.com/index/N1W040850782VR85.pdf
Usage example:
Once the accumulator is filled up with directions, you can get the representative direction for each bin and the bin with maximal number of samples.
Furthermore, you can send the accumulator to a Viewer3D to see the bin geometry and values:
TVector | type used to represent directions. |
Definition at line 101 of file SphericalAccumulator.h.
typedef std::vector<Quantity>::const_iterator DGtal::SphericalAccumulator< TVector >::ConstIterator |
Type to iterate on bin values.
Definition at line 116 of file SphericalAccumulator.h.
typedef DGtal::int32_t DGtal::SphericalAccumulator< TVector >::Quantity |
Type to store the bin counts.
Definition at line 110 of file SphericalAccumulator.h.
typedef PointVector<3,double> DGtal::SphericalAccumulator< TVector >::RealVector |
Type to represent normalized vector (internal use).
Definition at line 119 of file SphericalAccumulator.h.
typedef DGtal::uint32_t DGtal::SphericalAccumulator< TVector >::Size |
Type to represent bin indexes.
Definition at line 113 of file SphericalAccumulator.h.
typedef TVector DGtal::SphericalAccumulator< TVector >::Vector |
Vector direction types.
Definition at line 107 of file SphericalAccumulator.h.
|
inline |
Constructs a spherical accumulator with aNphi slices along latitudes (phi spherial coordinate). The decomposition along the theta axis is also a function of aNphi.
aNphi | the number of slices in the longitude polar coordinates. |
Constructor.
Definition at line 46 of file SphericalAccumulator.ih.
References M_PI.
|
inline |
|
protected |
Constructor. Forbidden by default (protected to avoid g++ warnings).
|
private |
Copy constructor.
other | the object to clone. Forbidden by default. |
|
inline |
Add a new direction into the accumulator. The accumulator updates the bin coordinates with maximum count.
aDir | a direction |
Definition at line 123 of file SphericalAccumulator.ih.
|
inline |
Definition at line 296 of file SphericalAccumulator.h.
References DGtal::SphericalAccumulator< TVector >::myAccumulator.
Referenced by DGtal::Display3DFactory::draw().
|
inline |
Given a normalized direction, this method computes the bin coordinates.
aDir | a direction represented as a unit norm vector. |
posPhi | position according to the first direction. |
posTheta | position according to the second direction. |
Definition at line 83 of file SphericalAccumulator.ih.
References M_PI.
Referenced by DGtal::Display3DFactory::draw().
|
inline |
Given an iterator on the bin container, this method computes the bin coordinates.
aIt | an iterator to the bin container. |
posPhi | position according to the first direction. |
posTheta | position according to the second direction. |
Definition at line 193 of file SphericalAccumulator.ih.
|
inline |
Definition at line 216 of file SphericalAccumulator.h.
References DGtal::SphericalAccumulator< TVector >::myBinNumber.
DGtal::SphericalAccumulator< TVector >::BOOST_STATIC_ASSERT | ( | Vector::dimension | = =3 | ) |
|
inline |
Definition at line 251 of file SphericalAccumulator.h.
|
inline |
Clear the current accumulator.
Definition at line 271 of file SphericalAccumulator.ih.
|
inline |
Returns the current number of samples in the bin (posPhi,posTheta).
posPhi | position according to the first direction |
posTheta | position according to the second direction |
Definition at line 161 of file SphericalAccumulator.ih.
Referenced by DGtal::Display3DFactory::draw().
|
inline |
Definition at line 304 of file SphericalAccumulator.h.
References DGtal::SphericalAccumulator< TVector >::myAccumulator.
Referenced by DGtal::Display3DFactory::draw().
|
inline |
From the bin index(posPhi,posTheta), we compute the associated spherical quad (a,b,c,d) counterclockwise on the unit sphere.
posPhi | bin index along the first direction. |
posTheta | bin index along the second direction. |
a | vertex position. |
b | vertex position. |
c | vertex position. |
d | vertex position. |
Definition at line 220 of file SphericalAccumulator.ih.
References M_PI.
Referenced by DGtal::Display3DFactory::draw().
|
inline |
Checks the validity/consistency of the object.
Definition at line 309 of file SphericalAccumulator.ih.
|
inline |
Returns true if is bin (posPhi,posTheta) is valid.
posPhi | |
posTheta |
Definition at line 205 of file SphericalAccumulator.ih.
References M_PI.
Referenced by DGtal::Display3DFactory::draw().
|
inline |
Returns the coordinates of the bin containing the maximum number of samples.
posPhi | coordinate along the phi axis. |
posTheta | coordinate along the theta axis. |
Definition at line 152 of file SphericalAccumulator.ih.
|
private |
Assignment.
other | the object to copy. |
|
inline |
Returns the representative direction associated with the bin (posPhi,posTheta). If the bin does not contain any sample, a null vector is returned ( Vector::ZERO ).
Otherwise, it returns the (unnormalized) sum of directions added to the bin.
posPhi | position according to the first direction |
posTheta | position according to the second direction |
Definition at line 171 of file SphericalAccumulator.ih.
|
inline |
Get the representative direction of a bin specified by a ConstIterator.
it | the iterator on the bin to get the direction |
Definition at line 182 of file SphericalAccumulator.ih.
|
inline |
Definition at line 144 of file SphericalAccumulator.ih.
|
inline |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
Definition at line 295 of file SphericalAccumulator.ih.
|
private |
Accumulator container.
Definition at line 333 of file SphericalAccumulator.h.
Referenced by DGtal::SphericalAccumulator< TVector >::begin(), and DGtal::SphericalAccumulator< TVector >::end().
|
private |
Accumulator reprensentative directions.
Definition at line 336 of file SphericalAccumulator.h.
|
private |
Number of bins.
Definition at line 342 of file SphericalAccumulator.h.
Referenced by DGtal::SphericalAccumulator< TVector >::binNumber().
|
private |
Phi coordinate of the max bin.
Definition at line 345 of file SphericalAccumulator.h.
|
private |
Theta coordinate of the max bin.
Definition at line 348 of file SphericalAccumulator.h.
|
private |
Number of slices in the phi direction.
Definition at line 327 of file SphericalAccumulator.h.
|
private |
Number of bins in the theta direction.
Definition at line 330 of file SphericalAccumulator.h.
|
private |
Number of samples.
Definition at line 339 of file SphericalAccumulator.h.