RobotsIO
Loading...
Searching...
No Matches
SegmentationCamera.h
1/*
2 * Copyright (C) 2020 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_SEGMENTATIONCAMERA_H
9#define ROBOTSIO_SEGMENTATIONCAMERA_H
10
11#include <RobotsIO/Camera/Camera.h>
12#include <RobotsIO/Camera/CameraParameters.h>
13#include <RobotsIO/Utils/Transform.h>
14
15#include <SuperimposeMesh/SICAD.h>
16
17#include <Eigen/Dense>
18
19
20namespace RobotsIO {
21 namespace Camera {
22 class SegmentationCamera;
23 }
24}
25
26
27
29{
30public:
31 SegmentationCamera(const RobotsIO::Camera::CameraParameters& camera_parameters, const std::string& mesh_path, const double& threshold = 0.01);
32
34
35 void add_object();
36
40 std::pair<bool, cv::Mat> mask(const Eigen::MatrixXf& scene_depth, const Eigen::Transform<double, 3, Eigen::Affine> object_transform);
41
45 std::pair<bool, cv::Mat> mask(std::shared_ptr<RobotsIO::Camera::Camera> camera, std::shared_ptr<RobotsIO::Utils::Transform> object_transform);
46
47private:
51 std::pair<bool, cv::Mat> render_mask(const Eigen::MatrixXf& scene_depth, const Eigen::Transform<double, 3, Eigen::Affine> object_transform);
52
56 std::unique_ptr<SICAD> renderer_;
57
62
66 const double threshold_;
67
71 const std::string log_name_ = "SegmentationCamera";
72};
73
74#endif /* ROBOTSIO_SEGMENTATIONCAMERA_H */
std::pair< bool, cv::Mat > mask(std::shared_ptr< RobotsIO::Camera::Camera > camera, std::shared_ptr< RobotsIO::Utils::Transform > object_transform)
std::pair< bool, cv::Mat > mask(const Eigen::MatrixXf &scene_depth, const Eigen::Transform< double, 3, Eigen::Affine > object_transform)