RUSH
Reusable Utilities in Single Headers is a collection of header-only utilities for C++
Loading...
Searching...
No Matches
ros-cv-bridge.hpp File Reference

This library provides an easier-to-use ROS-OpenCV bridge. More...

#include <cv_bridge/cv_bridge.h>
#include <opencv2/core/hal/interface.h>
#include <opencv2/core/mat.hpp>
#include <opencv2/core/mat.inl.hpp>
#include <ros/publisher.h>
#include <ros/time.h>
#include <sensor_msgs/Image.h>
#include <sensor_msgs/image_encodings.h>
#include <std_msgs/Header.h>
#include <string>

Go to the source code of this file.

Classes

class  rush::roscv::Encoding
 
class  rush::roscv::Publisher
 This class extends ros::Publisher to directly publish OpenCV matrices. More...
 

Functions

void rush::roscv::cv2ros (const cv::Mat &cv, sensor_msgs::Image &ros, const std_msgs::Header &header=std_msgs::Header())
 Converts an OpenCV Mat to a ROS Image message.
 
sensor_msgs::ImagePtr rush::roscv::cv2ros (const cv::Mat &cv, const std_msgs::Header &header=std_msgs::Header())
 Converts an OpenCV Mat to a ROS Image message.
 
void rush::roscv::ros2cv (const sensor_msgs::Image &ros, cv::Mat &cv)
 Converts a ROS Image message to an OpenCV Mat.
 
cv::Mat & rush::roscv::ros2cv (const sensor_msgs::Image &ros)
 Converts a ROS Image message to an OpenCV Mat.
 
void rush::roscv::ros2cv (const sensor_msgs::ImageConstPtr &ros, cv::Mat &cv)
 Converts a ROS Image message to an OpenCV Mat.
 
cv::Mat & rush::roscv::ros2cv (const sensor_msgs::ImageConstPtr &ros)
 Converts a ROS Image message to an OpenCV Mat.
 

Detailed Description

This library provides an easier-to-use ROS-OpenCV bridge.

Author
Raul Tapia (raultapia.com)
See also
https://github.com/raultapia/rush

Function Documentation

◆ cv2ros() [1/2]

sensor_msgs::ImagePtr rush::roscv::cv2ros ( const cv::Mat & cv,
const std_msgs::Header & header = std_msgs::Header() )
inline

Converts an OpenCV Mat to a ROS Image message.

Parameters
cvThe input OpenCV Mat.
headerThe header for the ROS Image message.
Returns
The output ROS Image message.

◆ cv2ros() [2/2]

void rush::roscv::cv2ros ( const cv::Mat & cv,
sensor_msgs::Image & ros,
const std_msgs::Header & header = std_msgs::Header() )
inline

Converts an OpenCV Mat to a ROS Image message.

Parameters
cvThe input OpenCV Mat.
rosThe output ROS Image message.
headerThe header for the ROS Image message.

◆ ros2cv() [1/4]

cv::Mat & rush::roscv::ros2cv ( const sensor_msgs::Image & ros)
inline

Converts a ROS Image message to an OpenCV Mat.

Parameters
rosThe input ROS Image message.
Returns
The output OpenCV Mat.

◆ ros2cv() [2/4]

void rush::roscv::ros2cv ( const sensor_msgs::Image & ros,
cv::Mat & cv )
inline

Converts a ROS Image message to an OpenCV Mat.

Parameters
rosThe input ROS Image message.
cvThe output OpenCV Mat.

◆ ros2cv() [3/4]

cv::Mat & rush::roscv::ros2cv ( const sensor_msgs::ImageConstPtr & ros)
inline

Converts a ROS Image message to an OpenCV Mat.

Parameters
rosThe input ROS Image message.
Returns
The output OpenCV Mat.
Note
This function is provided for convenience when working with ImageConstPtr.

◆ ros2cv() [4/4]

void rush::roscv::ros2cv ( const sensor_msgs::ImageConstPtr & ros,
cv::Mat & cv )
inline

Converts a ROS Image message to an OpenCV Mat.

Parameters
rosThe input ROS Image message.
cvThe output OpenCV Mat.
Note
This function is provided for convenience when working with ImageConstPtr.