SyB3R - Synthetic Benchmark for 3D Reconstruction
PointCloudEvaluation.h
1 #ifndef POINTCLOUDEVALUATION_H
2 #define POINTCLOUDEVALUATION_H
3 
4 #include <iostream>
5 #include <fstream>
6 
7 #include <Eigen/Dense>
8 #include <stdlib.h>
9 #include <vector>
10 
11 #include <pcl/point_cloud.h>
12 #include <pcl/octree/octree.h>
13 #include <pcl/registration/icp.h>
14 
15 #include <syb3r/data/Dataset.h>
16 #include <syb3r/data/Image.h>
17 #include <syb3r/data/Camera.h>
18 #include <syb3r/math/HelmertTransformation.h>
19 
20 namespace syb3r {
21 namespace analysis {
22 
24 {
25  public:
27 
34  PointCloudEvaluation(const std::vector<Eigen::Vector3f> &refPcld, const std::vector<bool>& objectOfInterest,
35  const std::vector<Eigen::Vector3f> &estPcld, const Eigen::Matrix4f &estToRefTrafo, float thresh);
36 
38  struct Statistics {
39  float min, max, avg, stddev;
40  unsigned numCorrect, numTotal;
41  };
42 
43  // access to computed performance
44  // sparse/dense point cloud estimation
45  inline const Statistics &getPCCorrectness() const { return m_cloudCorrectness; }
46  inline const Statistics &getPCCompleteness() const { return m_cloudCompleteness; }
47  // mesh might come later?
48 
50  inline const std::vector<float> &getPerPointCorrectness() const { return m_correctness; }
52  inline const std::vector<float> &getPerPointCompleteness() const { return m_completeness; }
54  inline const Eigen::Matrix4f &getRefinedEstToRefTrafo() const { return m_estToRefTransform; }
55 
57  float get95PercentPrecision() const;
59  float get95PercentCompleteness() const;
61  void createMatlabPlots(std::ostream &stream, float precCutoff, float complCutoff, float metricScale) const;
62 
63  protected:
65  void nnAnalysis(pcl::octree::OctreePointCloudSearch<pcl::PointXYZ>&, pcl::PointCloud<pcl::PointXYZ>::Ptr, float, Statistics&, const std::vector<bool>& objectOfInterest, std::vector<float> &distances, bool computeCompleteness);
67  void computeCorrectness(pcl::octree::OctreePointCloudSearch<pcl::PointXYZ>&, pcl::PointCloud<pcl::PointXYZ>::Ptr, float, const std::vector<bool>& objectOfInterest);
69  void computeCompleteness(pcl::octree::OctreePointCloudSearch<pcl::PointXYZ>&, pcl::PointCloud<pcl::PointXYZ>::Ptr, float, const std::vector<bool>& objectOfInterest);
70  // convert vector of eigen-points to pcl point cloud
71  void eigen2pcl(const std::vector<Eigen::Vector3f>&, pcl::PointCloud<pcl::PointXYZ>::Ptr);
72  // apply 3D homography to pcl point cloud
73  void transformPointCloud(pcl::PointCloud<pcl::PointXYZ>::Ptr, const Eigen::Matrix4f&);
74  static void transformPointCloud(std::vector<Eigen::Vector3f> &points, const Eigen::Matrix4f &transform);
75 
80 
81  std::vector<float> m_correctness;
82  std::vector<float> m_completeness;
83 
85  Eigen::Matrix4f m_estToRefTransform;
86 
87 };
88 
89 }
90 }
91 
92 #endif // POINTCLOUDEVALUATION_H
float get95PercentPrecision() const
returns precision value p such that 95% of the points have a precision larger than p ...
Definition: PointCloudEvaluation.cpp:184
Definition: CameraPathEvaluation.cpp:10
const std::vector< float > & getPerPointCorrectness() const
returns correctness per point, i.e. distance to closest point in reference point cloud ...
Definition: PointCloudEvaluation.h:50
void computeCompleteness(pcl::octree::OctreePointCloudSearch< pcl::PointXYZ > &, pcl::PointCloud< pcl::PointXYZ >::Ptr, float, const std::vector< bool > &objectOfInterest)
distance from each point in reference pc to closest point in estimated pc
Definition: PointCloudEvaluation.cpp:113
Statistics m_cloudCorrectness
statistics over correctness
Definition: PointCloudEvaluation.h:77
Eigen::Matrix4f m_estToRefTransform
4x4 transformation matrix from coordinate system of the estimate to the reference ...
Definition: PointCloudEvaluation.h:85
PointCloudEvaluation(const std::vector< Eigen::Vector3f > &refPcld, const std::vector< bool > &objectOfInterest, const std::vector< Eigen::Vector3f > &estPcld, const Eigen::Matrix4f &estToRefTrafo, float thresh)
computation of performance measures
Definition: PointCloudEvaluation.cpp:19
void nnAnalysis(pcl::octree::OctreePointCloudSearch< pcl::PointXYZ > &, pcl::PointCloud< pcl::PointXYZ >::Ptr, float, Statistics &, const std::vector< bool > &objectOfInterest, std::vector< float > &distances, bool computeCompleteness)
nearest neighbor analyis between two point clouds
Definition: PointCloudEvaluation.cpp:117
const std::vector< float > & getPerPointCompleteness() const
returns completeness per point, i.e. distance to closest point in estimated point cloud ...
Definition: PointCloudEvaluation.h:52
float get95PercentCompleteness() const
returns completeness value c such that 95% of the points have a completeness larger than c ...
Definition: PointCloudEvaluation.cpp:195
Statistics m_cloudCompleteness
statistics over completeness
Definition: PointCloudEvaluation.h:79
const Eigen::Matrix4f & getRefinedEstToRefTrafo() const
returns used transformation matrix from coordinate system of the estimate to the reference ...
Definition: PointCloudEvaluation.h:54
bundles several statistical values (minimal, maximal, average values as well as standard deviation...
Definition: PointCloudEvaluation.h:38
void createMatlabPlots(std::ostream &stream, float precCutoff, float complCutoff, float metricScale) const
creates a script to generate matlab plots summarizing the computed statistics
Definition: PointCloudEvaluation.cpp:206
Definition: PointCloudEvaluation.h:23
void computeCorrectness(pcl::octree::OctreePointCloudSearch< pcl::PointXYZ > &, pcl::PointCloud< pcl::PointXYZ >::Ptr, float, const std::vector< bool > &objectOfInterest)
distance from each point in estimated pc to closest point in reference pc
Definition: PointCloudEvaluation.cpp:108