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