YARP
Yet Another Robot Platform
RGBDRosConversionUtils.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
9 #ifndef RGBD_ROS_UTILS_H
10 #define RGBD_ROS_UTILS_H
11 
12 #include <iostream>
13 #include <cstring>
14 #include <mutex>
15 
16 #include <yarp/os/PeriodicThread.h>
17 #include <yarp/sig/all.h>
18 #include <yarp/sig/Matrix.h>
19 #include <yarp/os/Stamp.h>
20 #include <yarp/os/Property.h>
21 
22 #include <yarp/os/Node.h>
23 #include <yarp/os/Subscriber.h>
26 
28 
30 
31 namespace yarp {
32  namespace dev {
33  namespace RGBDRosConversionUtils {
34 
36  public yarp::os::Subscriber<yarp::rosmsg::sensor_msgs::Image>
37 {
38  protected:
41 
42  protected:
43  std::mutex m_port_mutex;
51 
52  public:
53  commonImageProcessor (std::string data_topic_name, std::string camera_info_topic_name);
54  virtual ~commonImageProcessor();
56  virtual void onRead(yarp::rosmsg::sensor_msgs::Image& v) override;
57 
58  public:
59  size_t getWidth() const;
60  size_t getHeight() const;
61  bool getFOV(double& horizontalFov, double& verticalFov) const;
62  bool getIntrinsicParam(yarp::os::Property& intrinsic) const;
63 
64  public:
67 };
68 
69 void deepCopyImages(const yarp::sig::FlexImage& src,
71  const std::string& frame_id,
72  const yarp::rosmsg::TickTime& timeStamp,
73  const unsigned int& seq);
74 
75 void deepCopyImages(const DepthImage& src,
77  const std::string& frame_id,
78  const yarp::rosmsg::TickTime& timeStamp,
79  const unsigned int& seq);
80 
82 
83 void shallowCopyImages(const DepthImage& src, DepthImage& dest);
84 
85 }
86 }
87 }
88 
89 #endif
yarp::dev::RGBDRosConversionUtils::commonImageProcessor::getHeight
size_t getHeight() const
Definition: RGBDRosConversionUtils.cpp:96
Subscriber.h
yarp::rosmsg::sensor_msgs::CameraInfo
Definition: CameraInfo.h:162
all.h
yarp::dev::RGBDRosConversionUtils::commonImageProcessor::m_cameradata_topic_name
std::string m_cameradata_topic_name
Definition: RGBDRosConversionUtils.h:45
Matrix.h
contains the definition of a Matrix type
yarp::dev::RGBDRosConversionUtils::commonImageProcessor::m_lastDepthImage
DepthImage m_lastDepthImage
Definition: RGBDRosConversionUtils.h:40
yarp::dev::RGBDRosConversionUtils::commonImageProcessor::m_lastCameraInfo
yarp::rosmsg::sensor_msgs::CameraInfo m_lastCameraInfo
Definition: RGBDRosConversionUtils.h:47
yarpRosHelper.h
yarp::rosmsg::sensor_msgs::Image
Definition: Image.h:57
yarp::sig::ImageOf< yarp::sig::PixelFloat >
yarp::rosmsg::TickTime
Definition: TickTime.h:30
yarp::dev::RGBDRosConversionUtils::commonImageProcessor::m_lastRGBImage
yarp::sig::FlexImage m_lastRGBImage
Definition: RGBDRosConversionUtils.h:39
yarp::dev::RGBDRosConversionUtils::commonImageProcessor::m_camerainfo_topic_name
std::string m_camerainfo_topic_name
Definition: RGBDRosConversionUtils.h:46
Property.h
yarp::dev::RGBDRosConversionUtils::commonImageProcessor::getWidth
size_t getWidth() const
Definition: RGBDRosConversionUtils.cpp:91
yarp::sig::FlexImage
Image class with user control of representation details.
Definition: Image.h:403
Stamp.h
yarp::dev::RGBDRosConversionUtils::deepCopyImages
void deepCopyImages(const yarp::sig::FlexImage &src, yarp::rosmsg::sensor_msgs::Image &dest, const std::string &frame_id, const yarp::rosmsg::TickTime &timeStamp, const unsigned int &seq)
Definition: RGBDRosConversionUtils.cpp:207
Node.h
CameraInfo.h
yarp::dev::RGBDRosConversionUtils::commonImageProcessor::onRead
virtual void onRead(yarp::rosmsg::sensor_msgs::Image &v) override
Definition: RGBDRosConversionUtils.cpp:101
DepthImage
yarp::sig::ImageOf< yarp::sig::PixelFloat > DepthImage
Definition: RGBDRosConversionUtils.h:29
yarp::dev::RGBDRosConversionUtils::commonImageProcessor::getLastDepthData
bool getLastDepthData(yarp::sig::ImageOf< yarp::sig::PixelFloat > &data, yarp::os::Stamp &stmp)
Definition: RGBDRosConversionUtils.cpp:72
yarp::dev::RGBDRosConversionUtils::commonImageProcessor::m_subscriber_camera_info
yarp::os::Subscriber< yarp::rosmsg::sensor_msgs::CameraInfo > m_subscriber_camera_info
Definition: RGBDRosConversionUtils.h:44
PeriodicThread.h
yarp::os::Stamp
An abstraction for a time stamp and/or sequence number.
Definition: Stamp.h:25
yarp::dev::RGBDRosConversionUtils::commonImageProcessor::m_lastStamp
yarp::os::Stamp m_lastStamp
Definition: RGBDRosConversionUtils.h:48
yarp::dev::RGBDRosConversionUtils::commonImageProcessor::m_port_mutex
std::mutex m_port_mutex
Definition: RGBDRosConversionUtils.h:43
yarp::dev::RGBDRosConversionUtils::commonImageProcessor::m_contains_depth_data
bool m_contains_depth_data
Definition: RGBDRosConversionUtils.h:50
yarp::dev::RGBDRosConversionUtils::commonImageProcessor::~commonImageProcessor
virtual ~commonImageProcessor()
Definition: RGBDRosConversionUtils.cpp:47
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::os::Subscriber
A port specialized for reading data of a constant type published on a topic.
Definition: Subscriber.h:26
yarp::dev::RGBDRosConversionUtils::commonImageProcessor::getFOV
bool getFOV(double &horizontalFov, double &verticalFov) const
Definition: RGBDRosConversionUtils.cpp:152
yarp::dev::RGBDRosConversionUtils::commonImageProcessor::m_contains_rgb_data
bool m_contains_rgb_data
Definition: RGBDRosConversionUtils.h:49
yarp::dev::RGBDRosConversionUtils::commonImageProcessor::getLastRGBData
bool getLastRGBData(yarp::sig::FlexImage &data, yarp::os::Stamp &stmp)
Definition: RGBDRosConversionUtils.cpp:53
Image.h
yarp::dev::RGBDRosConversionUtils::commonImageProcessor::getIntrinsicParam
bool getIntrinsicParam(yarp::os::Property &intrinsic) const
Definition: RGBDRosConversionUtils.cpp:165
yarp::dev::RGBDRosConversionUtils::shallowCopyImages
void shallowCopyImages(const yarp::sig::FlexImage &src, yarp::sig::FlexImage &dest)
Definition: RGBDRosConversionUtils.cpp:194
yarp::dev::RGBDRosConversionUtils::commonImageProcessor
Definition: RGBDRosConversionUtils.h:37
yarp::os::Property
A class for storing options and configuration information.
Definition: Property.h:37
yarp::dev::RGBDRosConversionUtils::commonImageProcessor::commonImageProcessor
commonImageProcessor(std::string data_topic_name, std::string camera_info_topic_name)
Definition: RGBDRosConversionUtils.cpp:32