Inshaping: include/Normal.h Source File

Inshaping

Inshaping  0.1
Normal.h
Go to the documentation of this file.
1 #pragma once
2 #include<iostream>
3 #include<pcl/visualization/pcl_visualizer.h>
4 #include<pcl/search/kdtree.h>
5 #include<pcl/features/normal_3d.h>
6 #include <pcl/kdtree/kdtree_flann.h>
7 
8 namespace Inshape
9 {
12  class NormalEstimationPlus : public pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal>
13  {
14 
15  private:
16  int coherence;
17 
18  class WArc
19  {
20  public:
22  {
23  pcl::PointNormal* p;
24  int index;
25 
26  //return a copy of
27  Eigen::Vector3f normalCopy()
28  {
29  return p->getNormalVector3fMap();
30  }
31 
32  void invertNormal()
33  {
34  p->normal_x = -p->normal_x;
35  p->normal_y = -p->normal_y;
36  p->normal_z = -p->normal_z;
37  }
38  };
39 
40  WArc(pcl::PointNormal& _s, int is, pcl::PointNormal& _t, int it) :src({ &_s, is }), trg({ &_t,it }), w(0)
41  {
42  w = fabs(src.normalCopy().dot(trg.normalCopy()));
43  }
44 
45  PointerAndIdx src;
46  PointerAndIdx trg;
47  float w;
48  bool operator< (const WArc &a) const { return w < a.w; }
49  };
50 
51 
52  public:
53  NormalEstimationPlus() :pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal>(), coherence(8) {}
54 
55  //����һ���Բ��� void setCoherence(int _coherence)// { coherence = _coherence; } //����һ���Բ��� int getCoherence() { return coherence; } pcl::PointCloud<pcl::PointNormal>::Ptr getCoherencyPointNormals(); static void AddNeighboursToHeap(pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals, int index, int K, pcl::search::KdTree<pcl::PointNormal>::Ptr &tree, std::vector<WArc> &heap, std::shared_ptr<bool>& visited); static void coherencyPass(pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals, int coherence = 8); }; /*@}*/ }
56  void setCoherence(int _coherence)//
57  {
58  coherence = _coherence;
59  }
60 
61  //����һ���Բ��� int getCoherence() { return coherence; } pcl::PointCloud<pcl::PointNormal>::Ptr getCoherencyPointNormals(); static void AddNeighboursToHeap(pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals, int index, int K, pcl::search::KdTree<pcl::PointNormal>::Ptr &tree, std::vector<WArc> &heap, std::shared_ptr<bool>& visited); static void coherencyPass(pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals, int coherence = 8); }; /*@}*/ }
63  {
64  return coherence;
65  }
66 
67  pcl::PointCloud<pcl::PointNormal>::Ptr getCoherencyPointNormals();
68 
69  static void AddNeighboursToHeap(pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals, int index, int K, pcl::search::KdTree<pcl::PointNormal>::Ptr &tree, std::vector<WArc> &heap, std::shared_ptr<bool>& visited);
70 
71  static void coherencyPass(pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals, int coherence = 8);
72 
73  };
75 }
Eigen::Vector3f normalCopy()
Definition: Normal.h:27
Definition: AfterProcess.h:9
pcl::PointCloud< pcl::PointNormal >::Ptr getCoherencyPointNormals()
static void coherencyPass(pcl::PointCloud< pcl::PointNormal >::Ptr cloud_with_normals, int coherence=8)
NormalEstimationPlus()
Definition: Normal.h:53
void setCoherence(int _coherence)
Definition: Normal.h:56
int getCoherence()
Definition: Normal.h:62
Definition: Normal.h:12
pcl::PointNormal * p
Definition: Normal.h:23
static void AddNeighboursToHeap(pcl::PointCloud< pcl::PointNormal >::Ptr cloud_with_normals, int index, int K, pcl::search::KdTree< pcl::PointNormal >::Ptr &tree, std::vector< WArc > &heap, std::shared_ptr< bool > &visited)
Generated by   doxygen 1.8.14