ScoreComputer.h
Go to the documentation of this file.
1 #ifndef SCORECOMPUTER_HEADER
2 #define SCORECOMPUTER_HEADER
3 #include <GfxTL/NullClass.h>
4 #ifndef _USE_MATH_DEFINES
5 #define _USE_MATH_DEFINES
6 #endif
7 #include <cmath>
8 #include "PointCloud.h"
9 
10 inline float weigh(const float d, const float eps)
11 {
12  return std::exp(-d * d / (2.f / 9.f * eps * eps)); // gaussian weighting eps / 3 == sigma
13  // return 1.f - (d / eps) * (d / eps); // anti-quadratic weighting
14  // return 1.f - d / eps; // linear weighting
15  //return d * d; // SSE
16 }
17 
18 template< class BaseT >
20  : public BaseT
21 {
22 public:
23  template< class ShapeT >
24  static void Score(const ShapeT& shape, const PointCloud& pc, float epsilon,
25  float normalThresh, MiscLib::Vector< size_t >::const_iterator begin,
27  std::pair< size_t, float >* score,
29  {
30  Vec3f n;
31  size_t size = end - begin;
32  for (size_t iter = 0; iter < size; ++iter)
33  {
34  float d = shape.DistanceAndNormal(pc[begin[iter]].pos, &n);
35  float nd = n.dot(pc[begin[iter]].normal);
36  if (d < epsilon && abs(nd) > normalThresh)
37  {
38  ++score->first;
39  score->second += weigh(d, epsilon);
40  }
41  }
42  }
43 };
44 
45 #endif
weigh
float weigh(const float d, const float eps)
Definition: ScoreComputer.h:10
Vec3f
Definition: basic.h:16
LocalScoreComputer
Definition: ScoreComputer.h:19
MiscLib::Vector
Definition: Vector.h:19
armarx::abs
std::vector< T > abs(const std::vector< T > &v)
Definition: VectorHelpers.h:253
pcl::graph::indices
pcl::PointIndices::Ptr indices(const PCG &g)
Retrieve the indices of the points of the point cloud stored in a point cloud graph that actually bel...
Definition: point_cloud_graph.h:737
LocalScoreComputer::Score
static void Score(const ShapeT &shape, const PointCloud &pc, float epsilon, float normalThresh, MiscLib::Vector< size_t >::const_iterator begin, MiscLib::Vector< size_t >::const_iterator end, std::pair< size_t, float > *score, MiscLib::Vector< size_t > *indices=NULL)
Definition: ScoreComputer.h:24
PointCloud
Definition: PointCloud.h:69
Vec3f::dot
float dot(const Vec3f &v) const
Definition: basic.h:92
NullClass.h
PointCloud.h
pc
Introduction Thank you for taking interest in our work and downloading this software This library implements the algorithm described in the paper R R R Klein Efficient RANSAC for Point Cloud Shape in Computer Graphics Blackwell June If you use this software you should cite the aforementioned paper in any resulting publication Please send comments or bug reports to Ruwen Roland BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY OR CONSEQUENTIAL WHETHER IN STRICT OR EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE Example usage This section shows how to use the library to detect the shapes in a point cloud PointCloud pc
Definition: ReadMe.txt:68