38 #include <boost/assign.hpp> 42 #include <opencv2/opencv.hpp> 48 DiagnosticNodelet::onInit();
49 pub_h_ = advertise<sensor_msgs::Image>(*
pnh_,
"output/hue", 1);
50 pub_s_ = advertise<sensor_msgs::Image>(*
pnh_,
"output/saturation", 1);
51 pub_v_ = advertise<sensor_msgs::Image>(*
pnh_,
"output/value", 1);
68 const sensor_msgs::Image::ConstPtr& image_msg)
71 image_msg, image_msg->encoding);
72 cv::Mat image = cv_ptr->image;
74 std::vector<cv::Mat> hsv_planes;
76 cv::cvtColor(image, hsv_image, CV_BGR2HSV);
79 cv::cvtColor(image, hsv_image, CV_RGB2HSV);
84 cv::cvtColor(image, tmp_image, CV_BGRA2BGR);
85 cv::cvtColor(tmp_image, hsv_image, CV_BGR2HSV);
90 cv::cvtColor(image, tmp_image, CV_RGBA2BGR);
91 cv::cvtColor(tmp_image, hsv_image, CV_BGR2HSV);
94 NODELET_ERROR(
"unsupported format to HSV: %s", image_msg->encoding.c_str());
97 cv::split(hsv_image, hsv_planes);
98 cv::Mat hue = hsv_planes[0];
99 cv::Mat saturation = hsv_planes[1];
100 cv::Mat value = hsv_planes[2];
#define NODELET_ERROR(...)
void publish(const boost::shared_ptr< M > &message) const
virtual void unsubscribe()
std::vector< std::string > V_string
CvImagePtr toCvCopy(const sensor_msgs::ImageConstPtr &source, const std::string &encoding=std::string())
PLUGINLIB_EXPORT_CLASS(jsk_perception::HSVDecomposer, nodelet::Nodelet)
virtual void decompose(const sensor_msgs::Image::ConstPtr &image_msg)
sensor_msgs::ImagePtr toImageMsg() const