[10] | 1 | //=================================================================================== |
---|
| 2 | // Name : saliencyDetectionRudinac.h |
---|
| 3 | // Author : Joris van de Weem, joris.vdweem@gmail.com |
---|
| 4 | // Version : 1.0 |
---|
| 5 | // Copyright : Copyright (c) 2010 LGPL |
---|
| 6 | // Description : C++ implementation of "Maja Rudinac, Pieter P. Jonker. |
---|
| 7 | // "Saliency Detection and Object Localization in Indoor Environments". |
---|
| 8 | // ICPR'2010. pp.404~407 |
---|
| 9 | //=================================================================================== |
---|
| 10 | |
---|
| 11 | #ifndef _SALIENCYMAPRUDINAC_H_INCLUDED_ |
---|
| 12 | #define _SALIENCYMAPRUDINAC_H_INCLUDED_ |
---|
| 13 | |
---|
| 14 | // ROS |
---|
| 15 | #include <ros/ros.h> |
---|
| 16 | #include "image_transport/image_transport.h" |
---|
| 17 | #include <cv_bridge/cv_bridge.h> |
---|
| 18 | #include <sensor_msgs/image_encodings.h> |
---|
| 19 | #include <sensor_msgs/fill_image.h> |
---|
| 20 | #include <geometry_msgs/Point.h> |
---|
| 21 | |
---|
| 22 | // OpenCV |
---|
| 23 | #include "cv.h" |
---|
| 24 | #include "opencv2/highgui/highgui.hpp" |
---|
| 25 | |
---|
| 26 | using namespace cv; |
---|
| 27 | using namespace std; |
---|
| 28 | namespace enc = sensor_msgs::image_encodings; |
---|
| 29 | |
---|
| 30 | class saliencyMapRudinac |
---|
| 31 | { |
---|
| 32 | protected: |
---|
| 33 | ros::NodeHandle nh_; |
---|
| 34 | ros::Publisher point_pub_; |
---|
| 35 | image_transport::ImageTransport it_; |
---|
| 36 | image_transport::Subscriber image_sub_; |
---|
| 37 | image_transport::Publisher saliencymap_pub_; |
---|
| 38 | |
---|
| 39 | |
---|
| 40 | public: |
---|
| 41 | saliencyMapRudinac() : nh_("~"), it_(nh_) |
---|
| 42 | { |
---|
| 43 | image_sub_ = it_.subscribe("/rgbimage_in", 1, &saliencyMapRudinac::imageCB, this); |
---|
| 44 | saliencymap_pub_= it_.advertise("/saliency/image", 1); |
---|
| 45 | point_pub_ = nh_.advertise<geometry_msgs::Point>("/saliency/salientpoint", 1); |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | ~saliencyMapRudinac() |
---|
| 49 | { |
---|
| 50 | nh_.shutdown(); |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | void imageCB(const sensor_msgs::ImageConstPtr& msg_ptr); |
---|
| 54 | void calculateSaliencyMap(const Mat* src, Mat* dst); |
---|
| 55 | |
---|
| 56 | private: |
---|
| 57 | Mat r,g,b,RG,BY,I; |
---|
| 58 | void createChannels(const Mat* src); |
---|
| 59 | void createSaliencyMap(const Mat src, Mat* dst); |
---|
| 60 | }; |
---|
| 61 | #endif |
---|