ImageReader.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::armem_images
17  * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
18  * @date 2021
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
26 
27 #include <VisionX/libraries/armem/vision/images/core/aron/ImageDepth.aron.generated.h>
28 #include <VisionX/libraries/armem/vision/images/core/aron/ImageRGB.aron.generated.h>
30 #include <VisionX/libraries/armem/vision/camera/core/aron/CameraCalibration.aron.generated.h>
31 
32 #include <Calibration/StereoCalibration.h>
33 #include <Calibration/Calibration.h>
34 #include <VisionX/interface/components/Calibration.h>
35 #include <Image/ByteImage.h>
36 
38 {
39  namespace detail
40  {
42  {
43  public:
45 
46  RGBImageReader() = default;
47 
48  void getLatestRGBImages(const std::string& providerSegmentName, std::vector<cv::Mat>& ret);
49  std::vector<CByteImage*> getLatestRGBCByteImages(const std::string& providerSegmentName);
50 
51  protected:
52  std::string propertyPrefix() const final;
53  Properties defaultProperties() const final;
54 
55  private:
56  };
57 
58  class DepthImageReader : public armarx::armem::client::util::SimpleReaderBase
59  {
60  public:
62 
63  DepthImageReader() = default;
64 
65 
66  std::vector<cv::Mat> getLatestDepthImages(const std::string& providerSegmentName);
67 
68  protected:
69  std::string propertyPrefix() const final;
70  Properties defaultProperties() const final;
71 
72  private:
73  };
74 
75  class CameraCalibrationReader : public armarx::armem::client::util::SimpleReaderBase
76  {
77  public:
79 
80  CameraCalibrationReader() = default;
81 
82 
83  std::optional<visionx::StereoCalibration> getStereoCameraCalibration(const std::string& providerSegmentName);
84  //visionx::Calibration getMonoCameraCalibration(const std::string& providerSegmentName);
85 
86  protected:
87  std::string propertyPrefix() const final;
88  Properties defaultProperties() const final;
89 
90  private:
91  };
92  } // namespace detail
93 
95  {
96  public:
97  ImageReader() = default;
98 
101 
102  void getLatestRGBImages(const std::string& providerSegmentName, std::vector<cv::Mat>& ret);
103  std::vector<CByteImage*> getLatestRGBCByteImages(const std::string& providerSegmentName);
104  std::vector<cv::Mat> getLatestDepthImages(const std::string& providerSegmentName);
105  std::optional<visionx::StereoCalibration> getStereoCameraCalibration(const std::string& providerSegmentName);
106  //visionx::Calibration getMonoCameraCalibration(const std::string& providerSegmentName); //not yet supported
107 
108  private:
109  detail::RGBImageReader rgbReader;
110  detail::DepthImageReader depthReader;
111  detail::CameraCalibrationReader cameraCalibrationReader;
112  };
113 } // namespace visionx::armem_images::client
visionx::armem_images::client::detail::RGBImageReader::getLatestRGBCByteImages
std::vector< CByteImage * > getLatestRGBCByteImages(const std::string &providerSegmentName)
Definition: ImageReader.cpp:71
visionx::armem_images::client::detail::RGBImageReader::getLatestRGBImages
void getLatestRGBImages(const std::string &providerSegmentName, std::vector< cv::Mat > &ret)
Definition: ImageReader.cpp:49
armarx::aron::ret
ReaderT::InputType T & ret
Definition: rw.h:21
visionx::armem_images::client::detail::RGBImageReader::defaultProperties
Properties defaultProperties() const final
Definition: ImageReader.cpp:38
armarx::armem::client::util::SimpleReaderBase::registerPropertyDefinitions
void registerPropertyDefinitions(armarx::PropertyDefinitionsPtr &def)
Definition: SimpleReaderBase.cpp:14
armarx::armem
Definition: LegacyRobotStateMemoryAdapter.cpp:31
detail
Definition: OpenCVUtil.cpp:127
visionx::armem_images::client::detail::RGBImageReader::propertyPrefix
std::string propertyPrefix() const final
Definition: ImageReader.cpp:32
visionx::armem_images::client::ImageReader
Definition: ImageReader.h:94
visionx::armem_images::client::detail::RGBImageReader
Definition: ImageReader.h:41
armarx::armem::client::util::SimpleReaderBase::connect
virtual void connect(armarx::armem::client::MemoryNameSystem &mns)
Definition: SimpleReaderBase.cpp:30
armarx::armem::client::util::SimpleReaderBase::Properties
Definition: SimpleReaderBase.h:43
IceUtil::Handle< class PropertyDefinitionContainer >
visionx::armem_images::client::detail::CameraCalibrationReader
Definition: ImageReader.h:75
visionx::armem_images::client
Definition: ImageReader.cpp:29
visionx::armem_images::client::detail::DepthImageReader
Definition: ImageReader.h:58
armarx::armem::client::MemoryNameSystem
The memory name system (MNS) client.
Definition: MemoryNameSystem.h:69
armarx::armem::client::util::SimpleReaderBase::SimpleReaderBase
SimpleReaderBase()
Definition: SimpleReaderBase.cpp:9
constants.h
SimpleReaderBase.h
armarx::armem::client::util::SimpleReaderBase
Definition: SimpleReaderBase.h:38
visionx::armem_images::client::detail::RGBImageReader::RGBImageReader
RGBImageReader()=default
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28