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
28#include <Eigen/Geometry>
29
30#include <pcl/common/transforms.h>
31#include <pcl/point_cloud.h>
32#include <pcl/point_types.h>
33
36
39#include <VisionX/interface/components/RGBDImageProvider.h>
40
41#include "KinectV1Device.hpp"
42#include <libfreenect.hpp>
43
44//#include <Image/IplImageAdaptor.h>
45
46namespace visionx
47{
48
49
50 /**
51 * @class KinectV1PointCloudProviderPropertyDefinitions
52 * @brief
53 */
65
66 /**
67 * @class KinectV1PointCloudProvider
68 * @ingroup VisionX-Components
69 * @brief A brief description
70 *
71 * Detailed Description
72 */
74 virtual public RGBDPointCloudProviderInterface,
75 virtual public CapturingPointCloudProvider,
76 virtual public ImageProvider
77 {
78 public:
79 /**
80 * @see armarx::ManagedIceObject::getDefaultName()
81 */
82
83 std::string
84 getDefaultName() const override
85 {
86 return "KinectV1PointCloudProvider";
87 }
88
89 protected:
90 /**
91 * @see visionx::PointCloudProviderBase::onInitPointCloudProvider()
92 */
94
95 /**
96 * @see visionx::PointCloudProviderBase::onExitPointCloudProvider()
97 */
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
125 {
126 }
127
128 bool
129 hasSharedMemorySupport(const Ice::Current& c = Ice::emptyCurrent) override
130 {
131 return true;
132 }
133
134 /**
135 * @see PropertyUser::createPropertyDefinitions()
136 */
138
139 // mixed inherited stuff
140 void onInitComponent() override;
141
142 void onConnectComponent() override;
143
144 void onDisconnectComponent() override;
145
146 void onExitComponent() override;
147
148 StereoCalibration getStereoCalibration(const Ice::Current& c = Ice::emptyCurrent) override;
149
150 bool
151 getImagesAreUndistorted(const ::Ice::Current& c = Ice::emptyCurrent) override
152 {
153 return false;
154 }
155
156 std::string
157 getReferenceFrame(const Ice::Current& c = Ice::emptyCurrent) override
158 {
159 return getProperty<std::string>("ReferenceFrameName");
160 };
161
162 private:
163 typedef pcl::PointXYZRGBA PointT;
164
165 Freenect::Freenect freenect_;
166 KinectV1Device* device_;
167
168 CByteImage** rgbImages_;
169 int width_, height_, size_;
170 StereoCalibration calibration;
171 float cx_, cy_, fx_, fy_;
172 };
173} // namespace visionx
constexpr T c
Property< PropertyType > getProperty(const std::string &name)
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
The CapturingPointCloudProvider provides a callback function to trigger the capturing of point clouds...
ImageProvider abstract class defines a component which provide images via ice or shared memory.
std::string getReferenceFrame(const Ice::Current &c=Ice::emptyCurrent) override
bool hasSharedMemorySupport(const Ice::Current &c=Ice::emptyCurrent) override
void onInitComponent() override
Pure virtual hook for the subclass.
void onDisconnectComponent() override
Hook for subclass.
void onConnectComponent() override
Pure virtual hook for the subclass.
StereoCalibration getStereoCalibration(const Ice::Current &c=Ice::emptyCurrent) override
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void onExitComponent() override
Hook for subclass.
bool getImagesAreUndistorted(const ::Ice::Current &c=Ice::emptyCurrent) override
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
ArmarX headers.