ImagePassThrough.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::Component
19 * @author Rainer Kartmann (rainer dot kartmann at kit dot edu)
20 * @date 2020
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
25#pragma once
26
27#include <experimental/memory>
28#include <mutex>
29
30#include <VirtualRobot/VirtualRobot.h>
31
33
35
40
43#include <VisionX/interface/components/Calibration.h>
44#include <VisionX/interface/components/ImagePassThroughInterface.h>
45
46
47// forward declarations
48class CByteImage;
49
50namespace visionx
51{
57
58 /**
59 * ImagePassThrough uses CTexturedRecognition of IVTRecognition in order to recognize and localize objects.
60 * The object data is read from PriorKnowledge and CommonStorage via MemoryX.
61 * The object localization is invoked automatically by the working memory if the object has been requested there.
62 */
64 virtual public visionx::ImagePassThroughInterface,
65 virtual public ImageProcessor,
66 virtual public ImageProvider,
69 virtual public visionx::StereoCalibrationCaptureProviderInterface
70 {
71 public:
73
74 /// @see PropertyUser::createPropertyDefinitions()
76
77 /// @see Component::getDefaultName()
78 static std::string GetDefaultName();
79 std::string getDefaultName() const override;
80
81
82 std::string getReferenceFrame(const ::Ice::Current& = ::Ice::emptyCurrent) override;
83 visionx::StereoCalibration
84 getStereoCalibration(const ::Ice::Current& = ::Ice::emptyCurrent) override;
85 bool getImagesAreUndistorted(const ::Ice::Current& = ::Ice::emptyCurrent) override;
86
87 // Interface:
88 void startCapture(::Ice::Float framesPerSecond,
89 const ::Ice::Current& current = ::Ice::emptyCurrent) override;
90
91 void stopCapture(const ::Ice::Current& current = ::Ice::emptyCurrent) override;
92
93 protected:
94 void
100
101 void
107
108 void
114
115 void
121
122 void onInitImageProcessor() override;
123 void onConnectImageProcessor() override;
124
125 void
127 {
128 }
129
130 void
132 {
133 }
134
135 void
137 {
138 }
139
140 void
142 {
143 }
144
145 void process() override;
146
147 void createRemoteGuiTab();
148 void RemoteGui_update() override;
149
150 StereoCalibrationInterfacePrx getStereoCalibrationProvider();
151
152
153 public:
154 // ImagePassThroughInterface interface
155
156
157 private:
158 struct Properties
159 {
160
161 std::string referenceFrame = "DepthCamera";
162 std::string agentName = "Armar6";
163 std::string imageProviderName = "ImageProvider";
164
165 std::size_t cameraIndex = 0;
166
167 // "Vector of distortion coefficients (k1,k2,p1,p2 [,k3 [,k4,k5,k6], [s1,s2,s3,s4]]) of 4, 5, 8 or 12 elements"
168 std::vector<float> extraDistortionCoeffs;
169 };
170
171 Properties p;
172
173 struct RemoteGuiTab : armarx::RemoteGui::Client::Tab
174 {
176 };
177
178 RemoteGuiTab tab;
179
180
181 armarx::DateTime m_timestamp_last_image;
182 CByteImage** cameraImages;
183 cv::Mat cameraMatrix, distortionCoeffs;
184
185 // armarx::DateTime m_timestamp_last_result;
186
187
188 // template <typename T>
189 // using rw_plugin = armarx::armem::client::plugins::ReaderWriterPlugin<T>;
190
191 // template <typename T>
192 // using obs_ptr = std::experimental::observer_ptr<T>;
193
194 // obs_ptr<rw_plugin<armarx::armem::robot_state::VirtualRobotReader>>
195 // virtualRobotReaderPlugin = nullptr;
196
197 // VirtualRobot::RobotPtr robot;
198 // VirtualRobot::RobotNodePtr referenceNode;
199 };
200
201} // namespace visionx
Provides a ready-to-use ArViz client arviz as member variable.
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
void startCapture(::Ice::Float framesPerSecond, const ::Ice::Current &current=::Ice::emptyCurrent) override
void onConnectImageProcessor() override
Implement this method in the ImageProcessor in order execute parts when the component is fully initia...
std::string getReferenceFrame(const ::Ice::Current &=::Ice::emptyCurrent) override
void onExitImageProcessor() override
Exit the ImapeProcessor component.
void stopCapture(const ::Ice::Current &current=::Ice::emptyCurrent) override
StereoCalibrationInterfacePrx getStereoCalibrationProvider()
visionx::StereoCalibration getStereoCalibration(const ::Ice::Current &=::Ice::emptyCurrent) override
void onExitComponent() final
Hook for subclass.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void process() override
Process the vision component.
void onConnectComponent() final
Pure virtual hook for the subclass.
void onInitImageProcessor() override
Setup the vision component.
bool getImagesAreUndistorted(const ::Ice::Current &=::Ice::emptyCurrent) override
static std::string GetDefaultName()
void onDisconnectImageProcessor() override
Implement this method in the ImageProcessor in order execute parts when the component looses network ...
void onInitImageProvider() override
This is called when the Component::onInitComponent() is called.
void onDisconnectComponent() final
Hook for subclass.
void onExitImageProvider() override
This is called when the Component::onExitComponent() setup is called.
std::string getDefaultName() const override
Retrieve default name of component.
void onInitComponent() final
Pure virtual hook for the subclass.
ImageProcessorPropertyDefinitions(std::string prefix)
The ImageProcessor class provides an interface for access to ImageProviders via Ice and shared memory...
void onInitComponent() override
void onDisconnectComponent() override
void onConnectComponent() override
void onExitComponent() override
ImageProvider abstract class defines a component which provide images via ice or shared memory.
void onInitComponent() override
void onDisconnectComponent() override
Hook for subclass.
void onConnectComponent() override
void onExitComponent() override
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
ArmarX headers.