前言:
录制了一个视频文件,想要将其发布到ROS的topic上,好让其他的节点去订阅。可以使用opencv的VideoCapture类。
VideoCapture的介绍请参考:
发布代码:
#include <ros/ros.h>
#include <image_transport/image_transport.h>
#include <sstream>
#include <iostream>
#include "opencv2/opencv.hpp"
#include <opencv2/highgui/highgui.hpp>
#include <cv_bridge/cv_bridge.h>
using namespace std;
using namespace cv;