KinectV1PointCloudProvider.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package VisionX::ArmarXObjects::KinectV1PointCloudProvider
19  * @author Christoph Pohl (christoph dot pohl at kit dot edu)
20  * @date 2019
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 #pragma once
26 
27 
32 
33 #include <VisionX/interface/components/RGBDImageProvider.h>
34 
35 
36 #include <pcl/common/transforms.h>
37 #include <pcl/point_cloud.h>
38 #include <pcl/point_types.h>
39 
40 #include <Eigen/Geometry>
41 
42 #include <libfreenect.hpp>
43 #include "KinectV1Device.hpp"
44 
45 
46 //#include <Image/IplImageAdaptor.h>
47 
48 namespace visionx
49 {
50 
51 
52  /**
53  * @class KinectV1PointCloudProviderPropertyDefinitions
54  * @brief
55  */
58  {
59  public:
62  {
63  defineOptionalProperty<std::string>("ReferenceFrameName", "DepthCamera", "Optional reference frame name.");
64  }
65  };
66 
67  /**
68  * @class KinectV1PointCloudProvider
69  * @ingroup VisionX-Components
70  * @brief A brief description
71  *
72  * Detailed Description
73  */
75  virtual public RGBDPointCloudProviderInterface,
76  virtual public CapturingPointCloudProvider,
77  virtual public ImageProvider
78  {
79  public:
80  /**
81  * @see armarx::ManagedIceObject::getDefaultName()
82  */
83 
84  std::string getDefaultName() const override
85  {
86  return "KinectV1PointCloudProvider";
87  }
88 
89  protected:
90  /**
91  * @see visionx::PointCloudProviderBase::onInitPointCloudProvider()
92  */
93  void onInitCapturingPointCloudProvider() override;
94 
95  /**
96  * @see visionx::PointCloudProviderBase::onExitPointCloudProvider()
97  */
98  void onExitCapturingPointCloudProvider() override;
99 
100  /**
101  * @see visionx::PointCloudProviderBase::onStartCapture()
102  */
103  void onStartCapture(float frameRate) override;
104 
105  /**
106  * @see visionx::PointCloudProviderBase::onStopCapture()
107  */
108  void onStopCapture() override;
109 
110  /**
111  * @see visionx::PointCloudProviderBase::doCapture()
112  */
113  bool doCapture() override;
114 
115  /**
116  * @see visionx::CapturingImageProvider::onInitImageProvider()
117  */
118  void onInitImageProvider() override;
119 
120  /**
121  * @see visionx::CapturingImageProvider::onExitImageProvider()
122  */
123  void onExitImageProvider() override {}
124 
125  bool hasSharedMemorySupport(const Ice::Current& c = Ice::emptyCurrent) override
126  {
127  return true;
128  }
129 
130  /**
131  * @see PropertyUser::createPropertyDefinitions()
132  */
134 
135  // mixed inherited stuff
136  void onInitComponent() override;
137 
138  void onConnectComponent() override;
139 
140  void onDisconnectComponent() override;
141 
142  void onExitComponent() override;
143 
144  StereoCalibration getStereoCalibration(const Ice::Current& c = Ice::emptyCurrent) override;
145 
146  bool getImagesAreUndistorted(const ::Ice::Current& c = Ice::emptyCurrent) override
147  {
148  return false;
149  }
150 
151 
152  std::string getReferenceFrame(const Ice::Current& c = Ice::emptyCurrent) override
153  {
154  return getProperty<std::string>("ReferenceFrameName");
155  };
156 
157  private:
158  typedef pcl::PointXYZRGBA PointT;
159 
160  Freenect::Freenect freenect_;
161  KinectV1Device* device_;
162 
163  CByteImage** rgbImages_;
164  int width_, height_, size_;
165  StereoCalibration calibration;
166  float cx_, cy_, fx_, fy_;
167 
168  };
169 }
CapturingPointCloudProvider.h
visionx::KinectV1PointCloudProvider::onExitComponent
void onExitComponent() override
Definition: KinectV1PointCloudProvider.cpp:70
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
visionx::KinectV1PointCloudProvider::onExitCapturingPointCloudProvider
void onExitCapturingPointCloudProvider() override
Definition: KinectV1PointCloudProvider.cpp:112
visionx::KinectV1PointCloudProvider::onInitComponent
void onInitComponent() override
Definition: KinectV1PointCloudProvider.cpp:43
visionx::KinectV1PointCloudProvider::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: KinectV1PointCloudProvider.cpp:61
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
visionx::KinectV1PointCloudProvider::onInitCapturingPointCloudProvider
void onInitCapturingPointCloudProvider() override
Definition: KinectV1PointCloudProvider.cpp:80
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
KinectV1Device
Definition: KinectV1Device.hpp:14
visionx::KinectV1PointCloudProvider::getDefaultName
std::string getDefaultName() const override
Definition: KinectV1PointCloudProvider.h:84
visionx::KinectV1PointCloudProvider
A brief description.
Definition: KinectV1PointCloudProvider.h:74
visionx::KinectV1PointCloudProvider::hasSharedMemorySupport
bool hasSharedMemorySupport(const Ice::Current &c=Ice::emptyCurrent) override
Definition: KinectV1PointCloudProvider.h:125
visionx::KinectV1PointCloudProvider::onStopCapture
void onStopCapture() override
Definition: KinectV1PointCloudProvider.cpp:102
KinectV1Device.hpp
visionx::CapturingPointCloudProvider::frameRate
float frameRate
Required frame rate.
Definition: CapturingPointCloudProvider.h:214
ImageProcessor.h
visionx::KinectV1PointCloudProvider::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: KinectV1PointCloudProvider.cpp:184
visionx::CapturingPointCloudProviderPropertyDefinitions
Definition: CapturingPointCloudProvider.h:38
visionx::KinectV1PointCloudProvider::onExitImageProvider
void onExitImageProvider() override
Definition: KinectV1PointCloudProvider.h:123
Component.h
visionx::CapturingPointCloudProvider
The CapturingPointCloudProvider provides a callback function to trigger the capturing of point clouds...
Definition: CapturingPointCloudProvider.h:56
visionx::ImageProvider
ImageProvider abstract class defines a component which provide images via ice or shared memory.
Definition: ImageProvider.h:66
visionx::KinectV1PointCloudProviderPropertyDefinitions
Definition: KinectV1PointCloudProvider.h:56
visionx::KinectV1PointCloudProvider::onStartCapture
void onStartCapture(float frameRate) override
Definition: KinectV1PointCloudProvider.cpp:95
visionx::KinectV1PointCloudProvider::getReferenceFrame
std::string getReferenceFrame(const Ice::Current &c=Ice::emptyCurrent) override
Definition: KinectV1PointCloudProvider.h:152
IceUtil::Handle< class PropertyDefinitionContainer >
visionx::KinectV1PointCloudProviderPropertyDefinitions::KinectV1PointCloudProviderPropertyDefinitions
KinectV1PointCloudProviderPropertyDefinitions(std::string prefix)
Definition: KinectV1PointCloudProvider.h:60
visionx::KinectV1PointCloudProvider::getStereoCalibration
StereoCalibration getStereoCalibration(const Ice::Current &c=Ice::emptyCurrent) override
Definition: KinectV1PointCloudProvider.cpp:189
visionx::KinectV1PointCloudProvider::onInitImageProvider
void onInitImageProvider() override
Definition: KinectV1PointCloudProvider.cpp:124
visionx::KinectV1PointCloudProvider::onConnectComponent
void onConnectComponent() override
Definition: KinectV1PointCloudProvider.cpp:52
ArmarXDataPath.h
visionx::KinectV1PointCloudProvider::doCapture
bool doCapture() override
Definition: KinectV1PointCloudProvider.cpp:142
visionx::KinectV1PointCloudProvider::getImagesAreUndistorted
bool getImagesAreUndistorted(const ::Ice::Current &c=Ice::emptyCurrent) override
Definition: KinectV1PointCloudProvider.h:146
visionx::PointT
pcl::PointXYZRGBA PointT
Definition: MaskRCNNPointCloudObjectLocalizer.h:79