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 std::string getDefaultName() const override;
79
80
81 std::string getReferenceFrame(const ::Ice::Current& = ::Ice::emptyCurrent) override;
82 visionx::StereoCalibration
83 getStereoCalibration(const ::Ice::Current& = ::Ice::emptyCurrent) override;
84 bool getImagesAreUndistorted(const ::Ice::Current& = ::Ice::emptyCurrent) override;
85
86 // Interface:
87 void startCapture(::Ice::Float framesPerSecond,
88 const ::Ice::Current& current = ::Ice::emptyCurrent) override;
89
90 void stopCapture(const ::Ice::Current& current = ::Ice::emptyCurrent) override;
91
92 protected:
93 void
99
100 void
106
107 void
113
114 void
120
121 void onInitImageProcessor() override;
122 void onConnectImageProcessor() override;
123
124 void
126 {
127 }
128
129 void
131 {
132 }
133
134 void
136 {
137 }
138
139 void
141 {
142 }
143
144 void process() override;
145
146 void createRemoteGuiTab();
147 void RemoteGui_update() override;
148
149 StereoCalibrationInterfacePrx getStereoCalibrationProvider();
150
151
152 public:
153 // ImagePassThroughInterface interface
154
155
156 private:
157 struct Properties
158 {
159
160 std::string referenceFrame = "DepthCamera";
161 std::string agentName = "Armar6";
162 std::string imageProviderName = "ImageProvider";
163
164 std::size_t cameraIndex = 0;
165
166 // "Vector of distortion coefficients (k1,k2,p1,p2 [,k3 [,k4,k5,k6], [s1,s2,s3,s4]]) of 4, 5, 8 or 12 elements"
167 std::vector<float> extraDistortionCoeffs;
168 };
169
170 Properties p;
171
172 struct RemoteGuiTab : armarx::RemoteGui::Client::Tab
173 {
175 };
176
177 RemoteGuiTab tab;
178
179
180 armarx::DateTime m_timestamp_last_image;
181 CByteImage** cameraImages;
182 cv::Mat cameraMatrix, distortionCoeffs;
183
184 // armarx::DateTime m_timestamp_last_result;
185
186
187 // template <typename T>
188 // using rw_plugin = armarx::armem::client::plugins::ReaderWriterPlugin<T>;
189
190 // template <typename T>
191 // using obs_ptr = std::experimental::observer_ptr<T>;
192
193 // obs_ptr<rw_plugin<armarx::armem::robot_state::VirtualRobotReader>>
194 // virtualRobotReaderPlugin = nullptr;
195
196 // VirtualRobot::RobotPtr robot;
197 // VirtualRobot::RobotNodePtr referenceNode;
198 };
199
200} // 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
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
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.