1#include <RobotsIO/Utils/FileToDepth.h>
2#include <RobotsIO/Utils/YarpImageOfMonoFloat.h>
3#include <RobotsIO/Utils/YarpBufferedPort.hpp>
7#include <opencv2/opencv.hpp>
8#include <opencv2/core/eigen.hpp>
10#include <yarp/cv/Cv.h>
11#include <yarp/os/Network.h>
12#include <yarp/sig/Image.h>
19using namespace RobotsIO::Utils;
20using namespace yarp::sig;
21using namespace yarp::os;
22using namespace std::chrono_literals;
25int main(
int argc,
char** argv)
28 if (!yarp.checkNetwork())
30 std::cout <<
"::main. Unable to find YARP." << std::endl;
37 Eigen::MatrixXf depth_eigen;
38 std::tie(valid_depth, depth_eigen) = file_to_depth(
"./depth.float");
40 std::cout <<
"depth image in" << std::endl;
43 cv::eigen2cv(depth_eigen, depth_image);
45 cv::Mat mask_image = cv::imread(
"./mask.png", cv::IMREAD_COLOR);
46 if (!mask_image.empty())
47 std::cout <<
"mask image in " << std::endl;
48 cv::cvtColor(mask_image, mask_image, cv::COLOR_BGR2GRAY);
52 YarpImageOfMonoFloat images;
53 images.image_mono = yarp::cv::fromCvMat<PixelMono>(mask_image);
54 images.image_float = yarp::cv::fromCvMat<PixelFloat>(depth_image);
56 port_out.send_data(images);
58 std::this_thread::sleep_for(1s);