kinect2_registration.cpp
Go to the documentation of this file.
1 
20 
21 #ifdef DEPTH_REG_CPU
22 #include "depth_registration_cpu.h"
23 #endif
24 
25 #ifdef DEPTH_REG_OPENCL
27 #endif
28 
30 {
31 }
32 
34 {
35 }
36 
37 bool DepthRegistration::init(const cv::Mat &cameraMatrixRegistered, const cv::Size &sizeRegistered, const cv::Mat &cameraMatrixDepth, const cv::Size &sizeDepth,
38  const cv::Mat &distortionDepth, const cv::Mat &rotation, const cv::Mat &translation,
39  const float zNear, const float zFar, const int deviceId)
40 {
41  this->cameraMatrixRegistered = cameraMatrixRegistered;
42  this->cameraMatrixDepth = cameraMatrixDepth;
43  this->rotation = rotation;
44  this->translation = translation;
45  this->sizeRegistered = sizeRegistered;
46  this->sizeDepth = sizeDepth;
47  this->zNear = zNear;
48  this->zFar = zFar;
49 
50  cv::initUndistortRectifyMap(cameraMatrixDepth, distortionDepth, cv::Mat(), cameraMatrixRegistered, sizeRegistered, CV_32FC1, mapX, mapY);
51 
52  return init(deviceId);
53 }
54 
56 {
57  if(method == DEFAULT)
58  {
59 #ifdef DEPTH_REG_OPENCL
60  method = OPENCL;
61 #elif defined DEPTH_REG_CPU
62  method = CPU;
63 #endif
64  }
65 
66  switch(method)
67  {
68  case DEFAULT:
69  OUT_ERROR("No default registration method available!");
70  break;
71  case CPU:
72 #ifdef DEPTH_REG_CPU
73  OUT_INFO("Using CPU registration method!");
74  return new DepthRegistrationCPU();
75 #else
76  OUT_ERROR("CPU registration method not available!");
77  break;
78 #endif
79  case OPENCL:
80 #ifdef DEPTH_REG_OPENCL
81  OUT_INFO("Using OpenCL registration method!");
82  return new DepthRegistrationOpenCL();
83 #else
84  OUT_ERROR("OpenCL registration method not available!");
85  break;
86 #endif
87  }
88  return NULL;
89 }
90 
91 
92 const std::string getFunctionName(const std::string &name)
93 {
94  size_t end = name.rfind('(');
95  if(end == std::string::npos)
96  {
97  end = name.size();
98  }
99  size_t begin = 1 + name.rfind(' ', end);
100  return name.substr(begin, end - begin);
101 }
const std::string getFunctionName(const std::string &name)
#define OUT_ERROR(msg)
#define OUT_INFO(msg)
static DepthRegistration * New(Method method=DEFAULT)
virtual bool init(const int deviceId)=0


kinect2_registration
Author(s):
autogenerated on Wed Jan 3 2018 03:48:04