1 #ifndef _IMAGE_TRANSPORTER_
2 #define _IMAGE_TRANSPORTER_
4 #include <opencv2/core/core.hpp>
5 #include <cv_bridge/cv_bridge.h>
6 #include <image_transport/image_transport.h>
14 ImagePubliserData(
const image_transport::Publisher& publisher,
const std::string& topic_name,
const ros::Time& last_hit)
17 topic_name(topic_name),
18 last_hit(last_hit) {};
19 image_transport::Publisher publisher;
20 std::string topic_name;
28 bool publish(std::string topic_name,
double throttle_period, cv::Mat& image,
bool bgr_order =
false);
31 std::string getEncoding(cv::Mat& input,
bool bgr_order);
32 bool throttle(
int index,
double throttle_period);
34 ros::NodeHandlePtr nh;
35 std::vector<std::unique_ptr<ImagePubliserData>> imagePublishers;
36 std::unique_ptr<image_transport::ImageTransport> transport;
37 cv_bridge::CvImage outputImage;
38 sensor_msgs::ImagePtr msg;
40 std::mutex main_pub_mutex;
46 #endif //_IMAGE_TRANSPORTER_