ArMarkerLocalizer.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 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 // VisionX
29 #include <VisionX/interface/components/ArMarkerLocalizerInterface.h>
30 
32 
34 
35 // ArUco
36 #include <aruco/aruco.h>
37 
38 #include <mutex>
39 
40 
41 // forward declarations
42 class CByteImage;
43 
44 namespace visionx
45 {
48  {
49  public:
51  };
52 
53 
54  /**
55  * ArMarkerLocalizer uses CTexturedRecognition of IVTRecognition in order to recognize and localize objects.
56  * The object data is read from PriorKnowledge and CommonStorage via MemoryX.
57  * The object localization is invoked automatically by the working memory if the object has been requested there.
58  */
60  virtual public ArMarkerLocalizerInterface,
61  virtual public ImageProcessor,
62  virtual public armarx::ArVizComponentPluginUser,
64  {
65  public:
66 
67  /// @see PropertyUser::createPropertyDefinitions()
69 
70  /// @see Component::getDefaultName()
71  std::string getDefaultName() const override;
72 
73 
74  public:
75  // ArMarkerLocalizerInterface interface
76  visionx::ArMarkerLocalizationResultList LocalizeAllMarkersNow(const Ice::Current&) override;
77  visionx::ArMarkerLocalizationResultList GetLatestLocalizationResult(const Ice::Current&) override;
78 
79 
80  protected:
81 
82  void onInitImageProcessor() override;
83  void onConnectImageProcessor() override;
84  void onDisconnectImageProcessor() override {}
85  void onExitImageProcessor() override {}
86 
87 
88  void process() override;
89 
90 
91  void createRemoteGuiTab();
92  void RemoteGui_update() override;
93 
94 
95  private:
96 
97 
98  IceUtil::Time startingTime;
99  aruco::CameraParameters arucoCameraParameters;
100  aruco::MarkerDetector markerDetector;
101  std::atomic<float> markerSize;
102  std::map<std::string, int> markerIDs;
103  std::map<std::string, float> markerSizes;
104 
105  CByteImage** cameraImages;
106 
107  std::string imageProviderName;
108  bool gotAnyImages = false;
109 
110  visionx::ArMarkerLocalizationResultList lastLocalizationResult;
111  std::mutex resultMutex;
112 
113  visionx::ArMarkerLocalizationResultList localizeAllMarkersInternal();
114 
115 
116  bool visuEnabled = false;
117 
118 
119  struct RemoteGuiTab : armarx::RemoteGui::Client::Tab
120  {
122  };
123  RemoteGuiTab tab;
124 
125  };
126 
127 }
128 
visionx::ArMarkerLocalizerPropertyDefinitions::ArMarkerLocalizerPropertyDefinitions
ArMarkerLocalizerPropertyDefinitions(std::string prefix)
Definition: ArMarkerLocalizer.cpp:52
ArVizComponentPlugin.h
visionx::ArMarkerLocalizer::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: ArMarkerLocalizer.cpp:61
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
visionx::ImageProcessor
The ImageProcessor class provides an interface for access to ImageProviders via Ice and shared memory...
Definition: ImageProcessor.h:87
visionx::ArMarkerLocalizer::getDefaultName
std::string getDefaultName() const override
Definition: ArMarkerLocalizer.cpp:70
visionx::ArMarkerLocalizer::onExitImageProcessor
void onExitImageProcessor() override
Exit the ImapeProcessor component.
Definition: ArMarkerLocalizer.h:85
armarx::RemoteGui::Client::Tab
Definition: Tab.h:15
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
visionx::ArMarkerLocalizer::RemoteGui_update
void RemoteGui_update() override
Definition: ArMarkerLocalizer.cpp:273
visionx::ArMarkerLocalizer::GetLatestLocalizationResult
visionx::ArMarkerLocalizationResultList GetLatestLocalizationResult(const Ice::Current &) override
Definition: ArMarkerLocalizer.cpp:244
visionx::ArMarkerLocalizer::process
void process() override
Process the vision component.
Definition: ArMarkerLocalizer.cpp:135
LightweightRemoteGuiComponentPlugin.h
ObjectLocalizerProcessor.h
visionx::ArMarkerLocalizer::onConnectImageProcessor
void onConnectImageProcessor() override
Implement this method in the ImageProcessor in order execute parts when the component is fully initia...
Definition: ArMarkerLocalizer.cpp:83
visionx::ArMarkerLocalizer
ArMarkerLocalizer uses CTexturedRecognition of IVTRecognition in order to recognize and localize obje...
Definition: ArMarkerLocalizer.h:59
armarx::ArVizComponentPluginUser
Provides a ready-to-use ArViz client arviz as member variable.
Definition: ArVizComponentPlugin.h:36
visionx::ArMarkerLocalizerPropertyDefinitions
Definition: ArMarkerLocalizer.h:46
visionx::ArMarkerLocalizer::onInitImageProcessor
void onInitImageProcessor() override
Setup the vision component.
Definition: ArMarkerLocalizer.cpp:77
visionx::ArMarkerLocalizer::onDisconnectImageProcessor
void onDisconnectImageProcessor() override
Implement this method in the ImageProcessor in order execute parts when the component looses network ...
Definition: ArMarkerLocalizer.h:84
armarx::LightweightRemoteGuiComponentPluginUser
Definition: LightweightRemoteGuiComponentPlugin.h:73
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
visionx::ArMarkerLocalizer::LocalizeAllMarkersNow
visionx::ArMarkerLocalizationResultList LocalizeAllMarkersNow(const Ice::Current &) override
Definition: ArMarkerLocalizer.cpp:233
visionx::ArMarkerLocalizer::createRemoteGuiTab
void createRemoteGuiTab()
Definition: ArMarkerLocalizer.cpp:254
IceUtil::Handle< class PropertyDefinitionContainer >
visionx::ImageProcessorPropertyDefinitions
Definition: ImageProcessor.h:61
armarx::RemoteGui::Client::FloatSpinBox
Definition: Widgets.h:93