color_histogram.h
Go to the documentation of this file.
1 // -*- mode: c++ -*-
2 /*********************************************************************
3  * Software License Agreement (BSD License)
4  *
5  * Copyright (c) 2014, JSK Lab
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/o2r other materials provided
17  * with the distribution.
18  * * Neither the name of the JSK Lab nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  *********************************************************************/
35 
36 #include <ros/ros.h>
37 #include <nodelet/nodelet.h>
38 #include <geometry_msgs/PolygonStamped.h>
39 #include <jsk_recognition_msgs/ColorHistogram.h>
41 #include <cv_bridge/cv_bridge.h>
48 #include <dynamic_reconfigure/server.h>
49 #include <jsk_perception/ColorHistogramConfig.h>
50 #include "opencv2/highgui/highgui.hpp"
51 #include "opencv2/imgproc/imgproc.hpp"
53 
54 namespace jsk_perception
55 {
57  {
58  public:
60  sensor_msgs::Image,
61  geometry_msgs::PolygonStamped > SyncPolicy;
62 
64  sensor_msgs::Image,
65  sensor_msgs::Image> MaskSyncPolicy;
66  typedef jsk_perception::ColorHistogramConfig Config;
67  ColorHistogram(): DiagnosticNodelet("ColorHistogram") {}
68  protected:
82  bool use_mask_;
83  boost::mutex mutex_;
84 
85  void configCallback(Config &new_config, uint32_t level);
86  virtual void onInit();
87  virtual void subscribe();
88  virtual void unsubscribe();
89  virtual void convertHistogramToMsg(
90  const cv::Mat& hist,
91  int size,
92  jsk_recognition_msgs::ColorHistogram& msg);
93  virtual void processBGR(const cv::Mat& bgr_image,
94  const std_msgs::Header& header);
95  virtual void processHSI(const cv::Mat& bgr_image,
96  const std_msgs::Header& header);
97  virtual void processBGR(const cv::Mat& bgr_image,
98  const cv::Mat& mask,
99  const std_msgs::Header& header);
100  virtual void processHSI(const cv::Mat& bgr_image,
101  const cv::Mat& mask,
102  const std_msgs::Header& header);
103  virtual void extract(
104  const sensor_msgs::Image::ConstPtr& image,
105  const geometry_msgs::PolygonStamped::ConstPtr& rectangle);
106  virtual void extractMask(
107  const sensor_msgs::Image::ConstPtr& image,
108  const sensor_msgs::Image::ConstPtr& mask_image);
109  private:
110 
111  };
112 }
image_transport::SubscriberFilter image_sub_
message_filters::sync_policies::ApproximateTime< sensor_msgs::Image, geometry_msgs::PolygonStamped > SyncPolicy
boost::shared_ptr< message_filters::Synchronizer< MaskSyncPolicy > > mask_sync_
boost::shared_ptr< message_filters::Synchronizer< SyncPolicy > > sync_
message_filters::Subscriber< geometry_msgs::PolygonStamped > rectangle_sub_
virtual void convertHistogramToMsg(const cv::Mat &hist, int size, jsk_recognition_msgs::ColorHistogram &msg)
DiagnosticNodelet(const std::string &name)
virtual void processBGR(const cv::Mat &bgr_image, const std_msgs::Header &header)
virtual void extract(const sensor_msgs::Image::ConstPtr &image, const geometry_msgs::PolygonStamped::ConstPtr &rectangle)
jsk_perception::ColorHistogramConfig Config
image_transport::SubscriberFilter image_mask_sub_
virtual void processHSI(const cv::Mat &bgr_image, const std_msgs::Header &header)
boost::shared_ptr< dynamic_reconfigure::Server< Config > > srv_
message_filters::sync_policies::ApproximateTime< sensor_msgs::Image, sensor_msgs::Image > MaskSyncPolicy
virtual void extractMask(const sensor_msgs::Image::ConstPtr &image, const sensor_msgs::Image::ConstPtr &mask_image)
boost::shared_ptr< image_transport::ImageTransport > it_
void configCallback(Config &new_config, uint32_t level)


jsk_perception
Author(s): Manabu Saito, Ryohei Ueda
autogenerated on Mon May 3 2021 03:03:27