ImageToArMem.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package VisionX::ArmarXObjects::SimpleEpisodicMemoryImageConnector
17  * @author Fabian Peller ( fabian dot peller-konrad at kit dot edu )
18  * @date 2020
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 #pragma once
23 
24 #include <mutex>
25 #include <string>
26 #include <vector>
27 
29 
30 // IVT
31 #include <Image/ByteImage.h>
32 
33 // Ice
34 #include <Ice/Current.h>
35 #include <IceUtil/Time.h>
36 
37 // ArmarX
38 #include <ArmarXCore/interface/observers/ObserverInterface.h>
39 
41 
43 #include <VisionX/interface/components/Calibration.h>
44 #include <VisionX/interface/components/PointCloudAndImageAndCalibrationProviderInterface.h>
47 #include <VisionX/libraries/armem/vision/images/core/aron/ImageDepth.aron.generated.h>
48 #include <VisionX/libraries/armem/vision/images/core/aron/ImageRGB.aron.generated.h>
49 
50 namespace visionx
51 {
53  {
54  public:
55  std::string getDefaultName() const override;
56 
57 
58  protected:
60 
61  // ImageProcessor interface
62  void onInitImageProcessor() override;
63  void onConnectImageProcessor() override;
64  void onDisconnectImageProcessor() override;
65  void onExitImageProcessor() override;
66 
67  void process() override;
68 
69 
70  private:
72 
73  visionx::ImageProviderInfo imageProviderInfo;
74  armarx::MetaInfoSizeBase::PointerType imageMetaInfo;
75 
76  // Image buffer
77  std::mutex inputImageMutex;
78  std::vector<CByteImage> inputImages;
79  std::vector<CByteImage*> inputImageBuffer;
80 
81 
82  // ArMem
83 
85 
86  struct Properties
87  {
89 
90  std::string imageProviderName = "ImageProvider";
91  std::string providerSegmentName = "(auto)";
92 
93  bool commitCameraCalib = true;
94 
95  bool clearProviderSegmentWhenExists = false;
96 
97  float maxFrequencyOfCommit = 15;
98  };
99 
100  Properties p;
101 
102  bool commitedCameraCalib = false;
103 
104  armarx::DateTime timeOfLastAcceptedImage = armarx::DateTime::Now();
105  };
106 
107 } // namespace visionx
visionx::ImageToArMem::onConnectImageProcessor
void onConnectImageProcessor() override
Implement this method in the ImageProcessor in order execute parts when the component is fully initia...
Definition: ImageToArMem.cpp:98
visionx::ImageToArMem::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: ImageToArMem.cpp:41
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
visionx::ImageToArMem::onDisconnectImageProcessor
void onDisconnectImageProcessor() override
Implement this method in the ImageProcessor in order execute parts when the component looses network ...
Definition: ImageToArMem.cpp:132
visionx::ImageProcessor
The ImageProcessor class provides an interface for access to ImageProviders via Ice and shared memory...
Definition: ImageProcessor.h:87
armarx::core::time::DateTime::Now
static DateTime Now()
Definition: DateTime.cpp:55
ImagesProperties.h
visionx::ImageToArMem::process
void process() override
Process the vision component.
Definition: ImageToArMem.cpp:142
visionx::ImageToArMem::onExitImageProcessor
void onExitImageProcessor() override
Exit the ImapeProcessor component.
Definition: ImageToArMem.cpp:137
visionx::ImageProviderInfo
Definition: ImageProcessor.h:466
armarx::armem::client::plugins::PluginUser
Adds the Memory Name System client component plugin.
Definition: PluginUser.h:29
ImageProcessor.h
visionx::ImageToArMem::onInitImageProcessor
void onInitImageProcessor() override
Setup the vision component.
Definition: ImageToArMem.cpp:79
plugins.h
Component.h
armarx::core::time::DateTime
Represents a point in time.
Definition: DateTime.h:24
visionx::ImageToArMem::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: ImageToArMem.cpp:47
IceUtil::Handle< class PropertyDefinitionContainer >
visionx::armem_images::ImagesProperties
Definition: ImagesProperties.h:14
IceInternal::ProxyHandle<::IceProxy::armarx::DebugObserverInterface >
visionx::armem_images::ImageToArMem
Allows to convert multiple CByteImages to Aron images and memory commits.
Definition: ImageToArMem.h:23
visionx::ImageToArMem
Definition: ImageToArMem.h:52
ImageToArMem.h