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/interface/components/Calibration.h>
28 #include <VisionX/libraries/armem/vision/camera/core/aron/CameraCalibration.aron.generated.h>
29 #include <VisionX/libraries/armem/vision/images/core/aron/ImageDepth.aron.generated.h>
30 #include <VisionX/libraries/armem/vision/images/core/aron/ImageRGB.aron.generated.h>
32 
33 #include <Calibration/Calibration.h>
34 #include <Calibration/StereoCalibration.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,
49  std::vector<cv::Mat>& ret);
50  std::vector<CByteImage*>
51  getLatestRGBCByteImages(const std::string& providerSegmentName);
52 
53  protected:
54  std::string propertyPrefix() const final;
55  Properties defaultProperties() const final;
56 
57  private:
58  };
59 
60  class DepthImageReader : public armarx::armem::client::util::SimpleReaderBase
61  {
62  public:
64 
65  DepthImageReader() = default;
66 
67 
68  std::vector<cv::Mat> getLatestDepthImages(const std::string& providerSegmentName);
69 
70  protected:
71  std::string propertyPrefix() const final;
72  Properties defaultProperties() const final;
73 
74  private:
75  };
76 
77  class CameraCalibrationReader : public armarx::armem::client::util::SimpleReaderBase
78  {
79  public:
81 
82  CameraCalibrationReader() = default;
83 
84 
85  std::optional<visionx::StereoCalibration>
86  getStereoCameraCalibration(const std::string& providerSegmentName);
87  //visionx::Calibration getMonoCameraCalibration(const std::string& providerSegmentName);
88 
89  protected:
90  std::string propertyPrefix() const final;
91  Properties defaultProperties() const final;
92 
93  private:
94  };
95  } // namespace detail
96 
98  {
99  public:
100  ImageReader() = default;
101 
104 
105  void getLatestRGBImages(const std::string& providerSegmentName, std::vector<cv::Mat>& ret);
106  std::vector<CByteImage*> getLatestRGBCByteImages(const std::string& providerSegmentName);
107  std::vector<cv::Mat> getLatestDepthImages(const std::string& providerSegmentName);
108  std::optional<visionx::StereoCalibration>
109  getStereoCameraCalibration(const std::string& providerSegmentName);
110  //visionx::Calibration getMonoCameraCalibration(const std::string& providerSegmentName); //not yet supported
111 
112  private:
113  detail::RGBImageReader rgbReader;
114  detail::DepthImageReader depthReader;
115  detail::CameraCalibrationReader cameraCalibrationReader;
116  };
117 } // 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:48
armarx::aron::ret
ReaderT::InputType T & ret
Definition: rw.h:13
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:32
detail
Definition: OpenCVUtil.cpp:128
visionx::armem_images::client::detail::RGBImageReader::propertyPrefix
std::string propertyPrefix() const final
Definition: ImageReader.cpp:32
visionx::armem_images::client::ImageReader
Definition: ImageReader.h:97
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:77
visionx::armem_images::client
Definition: ImageReader.cpp:29
visionx::armem_images::client::detail::DepthImageReader
Definition: ImageReader.h:60
armarx::armem::client::MemoryNameSystem
The memory name system (MNS) client.
Definition: MemoryNameSystem.h:73
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:27