RobotsIO
Loading...
Searching...
No Matches
TransformYarpPort.h
1/*
2 * Copyright (C) 2019 Istituto Italiano di Tecnologia (IIT)
3 *
4 * This software may be modified and distributed under the terms of the
5 * BSD 3-Clause license. See the accompanying LICENSE file for details.
6 */
7
8#ifndef ROBOTSIO_TRANSFORMYARPPORT_H
9#define ROBOTSIO_TRANSFORMYARPPORT_H
10
11#include <RobotsIO/Utils/Transform.h>
12#include <RobotsIO/Utils/YarpBufferedPort.hpp>
13#include <RobotsIO/Utils/YarpImageOfMonoFloat.h>
14
15#include <yarp/sig/Image.h>
16#include <yarp/sig/Vector.h>
17
18#include <Eigen/Dense>
19
20namespace RobotsIO {
21 namespace Utils {
22 class TransformYarpPort;
23 }
24}
25
27 public RobotsIO::Utils::YarpBufferedPort<yarp::sig::Vector>
28{
29public:
30 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
31
39 TransformYarpPort(const std::string& port_prefix, const bool& provide_rgb, const bool& provide_depth_segmentation);
40
41 virtual ~TransformYarpPort();
42
43 Eigen::Transform<double, 3, Eigen::Affine> transform() override;
44
45 Eigen::MatrixXd bounding_box() override;
46
47 bool freeze(const bool blocking = false) override;
48
49 int get_frames_between_iterations() const override;
50
51 void set_rgb_image(const cv::Mat& image) override;
52
53 void set_depth_segmentation_image(const Eigen::MatrixXf& depth, const cv::Mat& segmentation) override;
54
55 bool transform_received() override;
56
57private:
58 Eigen::Transform<double, 3, Eigen::Affine> transform_;
59
60 Eigen::MatrixXd bbox_points_;
61
63
65
66 const bool provide_rgb_;
67
68 const bool provide_depth_segmentation_;
69
70 cv::Mat cv_rgb_out_;
71 yarp::sig::ImageOf<yarp::sig::PixelRgb> yarp_rgb_out_;
72
73 cv::Mat cv_depth_out_;
74 cv::Mat cv_segmentation_out_;
75 RobotsIO::Utils::YarpImageOfMonoFloat yarp_depth_segmentation_out_;
76
77 bool transform_received_ = false;
78
79 const std::string log_name_ = "RobotsIO::Utils::TransformYarpPort";
80};
81
82#endif /* ROBOTSIO_TRANSFORMYARPPORT_H */
int get_frames_between_iterations() const override
Eigen::MatrixXd bounding_box() override
void set_rgb_image(const cv::Mat &image) override
void set_depth_segmentation_image(const Eigen::MatrixXf &depth, const cv::Mat &segmentation) override