Skip to content

Commit

Permalink
Add ImageConstPtr to ros-cv-bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
raultapia committed Jul 4, 2024
1 parent ef0229a commit c60d252
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions include/rush/ros-cv-bridge.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,26 @@ inline cv::Mat ros2cv(const sensor_msgs::Image &ros) {
return (cv_ptr->image);
}

/**
* @brief Converts a ROS Image message to an OpenCV Mat.
* @param ros The input ROS Image message.
* @param cv The output OpenCV Mat.
* @note This function is provided for convenience when working with ImageConstPtr.
*/
inline void ros2cv(const sensor_msgs::ImageConstPtr &ros, cv::Mat &cv) {
ros2cv(*ros);
}

/**
* @brief Converts a ROS Image message to an OpenCV Mat.
* @param ros The input ROS Image message.
* @return The output OpenCV Mat.
* @note This function is provided for convenience when working with ImageConstPtr.
*/
inline cv::Mat ros2cv(const sensor_msgs::ImageConstPtr &ros) {
return ros2cv(*ros);
}

/**
* @brief This class extends ros::Publisher to directly publish OpenCV matrices.
*/
Expand Down

0 comments on commit c60d252

Please sign in to comment.