-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathpcl_ssa_hierarchical.h
131 lines (97 loc) · 4.13 KB
/
pcl_ssa_hierarchical.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#ifndef __PCL_SSA_HIERARCHICAL__
#define __PCL_SSA_HIERARCHICAL__
#include <vector>
#include <Eigen/Core>
#include <Eigen/Geometry>
#include "pcl/point_types.h"
#include "pcl/point_cloud.h"
#include "pcl/io/pcd_io.h"
#include "pcl/common/transforms.h"
#include "pcl/filters/filter.h"
#include "pcl/filters/voxel_grid.h"
#include "ssa/core/ssa_graph_3d.h"
#include "ssa/sensor_models/rgbd_sensor_model.h"
#include "ssa/core/parameter.h"
#include "g2o/stuff/string_tools.h"
#include "pcl_g2o_math_conversion.h"
// #warning "pcl_ssa_hierarchical included"
// Forward declarations
namespace pcl {
class RangeImage;
}
namespace g2o{
class EdgeSE3PointXYZCov;
class EdgePointXYZCovPointXYZCov;
}
namespace ssa{
template <typename PointCloudType>
class PCLSSAHierarchicalT {
typedef Eigen::Matrix<double, 6, 1> Vector6d;
typedef typename PointCloudType::Ptr PointCloudPtr;
public:
PCLSSAHierarchicalT ();
~PCLSSAHierarchicalT ();
enum Sensor{KINECT, LMS};
/** \brief sets the input point cloud vector from wich the ssa graph will be constructed
Make shure that each cloud has a properly set sensor_origin_ and sensor_orientation_
*/
void
setInput (std::vector< PointCloudType >* clouds);
/** \brief sets the type of sensor from which the data are measured */
void
setSensor (Sensor sensor);
/** \brief sets the number of hierarchy levels */
void
setLevels (int levels);
/** \brief sets the resolution of one hierarchy level.
Note level 0 is the lowest level with the highest resolution.
*/
void
setResolution (int level, double resolution);
inline
SparseSurfaceAdjustmentParams&
params () { return params_; };
/** \brief constructs ssa graph and optimizes the system. */
void
optimize (PointCloudType& result);
/** \brief constructs ssa graph. This will be called from optimize. */
void
constructGraph (SparseSurfaceAdjustmentGraph3D& graph);
/** \brief inserts cloud into ssa graph. */
int
insertCloud(SparseSurfaceAdjustmentGraph3D& graph, PointCloudType& cloud);
int addCloudToGraph(SparseSurfaceAdjustmentGraph3D& graph, typename PointCloudType::Ptr cloud);
private:
std::vector< PointCloudType >* input_clouds_;
Sensor sensor_;
int levels_;
std::map<int, double> resolution_;
SparseSurfaceAdjustmentParams params_;
public:
/** Returns pcl pointcloud for landmark edges vector.*/
static PointCloudType landmarksToPointCloud(std::vector<ssa::EdgeSE3PointXYZCov* >& landmarksFromVertex);
/** Returns pcl pointcloud for landmark edges vector.*/
static PointCloudType landmarksToPointCloud(Observation<VertexPointXYZCov>& pointVertices);
/** get pose information from cloud */
static Eigen::Affine3f getPose(PointCloudType& cloud);
static Eigen::Affine3f getPose(PointCloudPtr& cloudPtr);
/** create pose vertex for Affine3f pose */
static g2o::VertexSE3* createVertexSE3(Eigen::Affine3f pose);
/** create pose vertex for cloud with valid sensor origin and orientation */
static g2o::VertexSE3* createVertexSE3(PointCloudType& cloud);
static g2o::VertexSE3* createVertexSE3(PointCloudPtr& cloud);
/** RGB pcl to uint conversion*/
static void pclRGBToRGB(float& rgb, uint& r, uint& g, uint& b);
static void pclRGBToRGB(float& rgb, unsigned char& r, unsigned char& g, unsigned char& b);
static void RGBToPclRGB(float& rgb, uint& r, uint& g, uint& b);
static void RGBToPclRGB(float& rgb, unsigned char& r, unsigned char& g, unsigned char& b);
static void RGBToPclRGB(uint32_t& rgb, unsigned char& r, unsigned char& g, unsigned char& b);
inline double getMaxDistance(){return _maxDistanceForNormalCalulation;}
inline void setMaxDistance(double value){_maxDistanceForNormalCalulation = value;}
void rgbToHsv(Eigen::Vector3i rgb, Eigen::Vector3i& hsv);
protected:
double _maxDistanceForNormalCalulation;
};
#include "pcl_ssa_hierarchical.hpp"
}
#endif