DisparityConverter.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <deque>
4 
5 #include "depthai/depthai.hpp"
6 
7 #ifdef IS_ROS2
8  #include "rclcpp/rclcpp.hpp"
9  #include "sensor_msgs/image_encodings.hpp"
10  #include "stereo_msgs/msg/disparity_image.hpp"
11 
12 #else
13  #include <ros/ros.h>
14 
15  #include <boost/make_shared.hpp>
16 
18  #include "stereo_msgs/DisparityImage.h"
19 
20 #endif
21 
22 namespace dai {
23 
24 namespace ros {
25 
26 #ifdef IS_ROS2
27 namespace DisparityMsgs = stereo_msgs::msg;
28 using DisparityImagePtr = DisparityMsgs::DisparityImage::SharedPtr;
29 #else
30 namespace DisparityMsgs = stereo_msgs;
31 using DisparityImagePtr = DisparityMsgs::DisparityImage::Ptr;
32 #endif
33 using TimePoint = std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration>;
34 
36  public:
37  DisparityConverter(const std::string frameName, float focalLength, float baseline = 7.5, float minDepth = 80, float maxDepth = 1100);
38 
39  void toRosMsg(std::shared_ptr<dai::ImgFrame> inData, std::deque<DisparityMsgs::DisparityImage>& outImageMsg);
40  DisparityImagePtr toRosMsgPtr(std::shared_ptr<dai::ImgFrame> inData);
41 
42  // void toDaiMsg(const DisparityMsgs::DisparityImage& inMsg, dai::ImgFrame& outData);
43 
44  private:
45  const std::string _frameName = "";
46  const float _focalLength = 882.2, _baseline = 7.5, _minDepth = 80, _maxDepth;
47 };
48 
49 } // namespace ros
50 
51 namespace rosBridge = ros;
52 
53 } // namespace dai
std::chrono::time_point< std::chrono::steady_clock, std::chrono::steady_clock::duration > TimePoint
DisparityImagePtr toRosMsgPtr(std::shared_ptr< dai::ImgFrame > inData)
void toRosMsg(std::shared_ptr< dai::ImgFrame > inData, std::deque< DisparityMsgs::DisparityImage > &outImageMsg)
DisparityConverter(const std::string frameName, float focalLength, float baseline=7.5, float minDepth=80, float maxDepth=1100)
DisparityMsgs::DisparityImage::Ptr DisparityImagePtr


depthai_bridge
Author(s): Sachin Guruswamy
autogenerated on Tue May 10 2022 03:01:27