StereoImagePointCloudProvider.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::StereoImagePointCloudProvider
19 * @author David Schiebener (schiebener at kit dot edu)
20 * @date 2015
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 <climits>
29#include <cmath>
30#include <mutex>
31#include <vector>
32
33#include <pcl/point_types.h>
34
37
40#include <VisionX/interface/components/PointCloudAndImageAndCalibrationProviderInterface.h>
41
42
43class CStereoCalibration;
44
45namespace visionx
46{
47
48 /**
49 * @class StereoImagePointCloudProviderPropertyDefinitions
50 * @brief
51 */
54 {
55 public:
58 {
60 "ImageProviderAdapterName",
61 "Armar3ImageProvider",
62 "Name of the stereo image provider for the camera images and the calibration");
64 "DownsamplingRate", 1, "Create a point only at every n-th pixel");
66 "SmoothDisparity",
67 true,
68 "Smooth the disparity image to filter out noise, but loose sharp edges");
69 }
70 };
71
72 /**
73 * @class StereoImagePointCloudProvider
74 * @ingroup VisionX-Components
75 * @brief A brief description
76 *
77 * Detailed Description
78 */
80 virtual public StereoImagePointCloudProviderInterface,
81 virtual public CapturingPointCloudProvider,
82 virtual public ImageProcessor,
83 virtual public ImageProvider
84 {
85 public:
86 /**
87 * @see armarx::ManagedIceObject::getDefaultName()
88 */
89 static std::string GetDefaultName();
90 std::string getDefaultName() const override;
91
92 MetaPointCloudFormatPtr getDefaultPointCloudFormat() override;
93
94 protected:
95 /**
96 * @see visionx::PointCloudProviderBase::onInitPointCloudProvider()
97 */
99
100 /**
101 * @see visionx::PointCloudProviderBase::onExitPointCloudProvider()
102 */
103 void onExitCapturingPointCloudProvider() override;
104
105 /**
106 * @see visionx::PointCloudProviderBase::onStartCapture()
107 */
108 void onStartCapture(float frameRate) override;
109
110 /**
111 * @see visionx::PointCloudProviderBase::onStopCapture()
112 */
113 void onStopCapture() override;
114
115 /**
116 * @see visionx::PointCloudProviderBase::doCapture()
117 */
118 bool doCapture() override;
119
120 // ImageProcessor functions
121 void onInitImageProcessor() override;
122 void onConnectImageProcessor() override;
123 void onExitImageProcessor() override;
124
125 void
126 process() override
127 {
128 }
129
130 /**
131 * @see visionx::CapturingImageProvider::onInitImageProvider()
132 */
133 void onInitImageProvider() override;
134
135 /**
136 * @see visionx::CapturingImageProvider::onExitImageProvider()
137 */
138 void
140 {
141 }
142
143 /**
144 * @see PropertyUser::createPropertyDefinitions()
145 */
147
148 // mixed inherited stuff
149 void onInitComponent() override;
150 void onConnectComponent() override;
151 void onDisconnectComponent() override;
152 void onExitComponent() override;
153
154 bool
155 getImagesAreUndistorted(const ::Ice::Current& c = Ice::emptyCurrent) override
156 {
157 return imagesAreUndistorted;
158 }
159
160 visionx::MonocularCalibration
161 getMonocularCalibration(const ::Ice::Current& c = Ice::emptyCurrent) override;
162
163 bool
164 hasSharedMemorySupport(const Ice::Current& c = Ice::emptyCurrent) override
165 {
166 return true;
167 }
168
169
170 private:
171 ImageProviderInterfacePrx imageProviderPrx;
172 std::string providerName;
173 CStereoCalibration* stereoCalibration;
174 CByteImage** cameraImages;
175 CByteImage** cameraImagesGrey;
176 CByteImage** resultImages;
177 CByteImage *disparityImage, *disparityImageRGB;
178 float frameRate;
179 int width, height;
180 bool imagesAreUndistorted;
181 int downsamplingRate;
182 bool smoothDisparity;
183
184 std::mutex captureLock;
185 };
186} // namespace visionx
constexpr T c
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...
The ImageProcessor class provides an interface for access to ImageProviders via Ice and shared memory...
ImageProvider abstract class defines a component which provide images via ice or shared memory.
bool hasSharedMemorySupport(const Ice::Current &c=Ice::emptyCurrent) override
void onConnectImageProcessor() override
Implement this method in the ImageProcessor in order execute parts when the component is fully initia...
void onDisconnectComponent() override
Hook for subclass.
void onExitImageProcessor() override
Exit the ImapeProcessor component.
void process() override
Process the vision component.
MetaPointCloudFormatPtr getDefaultPointCloudFormat() override
default point cloud format used to initialize shared memory
void onInitImageProcessor() override
Setup the vision component.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
visionx::MonocularCalibration getMonocularCalibration(const ::Ice::Current &c=Ice::emptyCurrent) override
std::string getDefaultName() const override
Retrieve default name of component.
bool getImagesAreUndistorted(const ::Ice::Current &c=Ice::emptyCurrent) override
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
ArmarX headers.