30 #include <opencv2/core/core.hpp>
39 #include <sensor_msgs/Image.h>
45 const cv::Scalar
NO_MASK = cv::Scalar(-1, -1, -1);
65 const sensor_msgs::ImageConstPtr &base_image,
66 const sensor_msgs::ImageConstPtr &top_image);
105 priv.
param(
"mask_r", mask_r, -1.0);
106 priv.
param(
"mask_g", mask_g, -1.0);
107 priv.
param(
"mask_b", mask_b, -1.0);
110 if ((mask_r >= 0) && (mask_g >= 0) && (mask_b >= 0) &&
111 (mask_r <= 255) && (mask_g <= 255) && (mask_b <= 255))
117 ROS_ERROR(
"Mask color components must be in range [0,255]");
118 ROS_ERROR(
" Components were (%f, %f, %f)", mask_r, mask_g, mask_b);
140 const sensor_msgs::ImageConstPtr& base_image,
141 const sensor_msgs::ImageConstPtr& top_image)
151 base_image->encoding);
154 cv::Mat blended = cv::Mat::zeros(
155 cv_base_image->image.rows,
156 cv_base_image->image.cols,
157 cv_base_image->image.type());
166 cv_base_image->image,
175 cv_base_image->image,
181 cv_blended->image = blended;
182 cv_blended->encoding = cv_base_image->encoding;
183 cv_blended->header = cv_base_image->header;