00001 00024 #ifndef CCNY_RGBD_RGBD_FEATURE_VIEWER_H 00025 #define CCNY_RGBD_RGBD_FEATURE_VIEWER_H 00026 00027 #include <ros/ros.h> 00028 #include <sensor_msgs/PointCloud2.h> 00029 #include <visualization_msgs/Marker.h> 00030 #include <dynamic_reconfigure/server.h> 00031 #include <opencv2/imgproc/imgproc.hpp> 00032 #include <opencv2/highgui/highgui.hpp> 00033 #include <pcl_ros/point_cloud.h> 00034 #include <rgbdtools/rgbdtools.h> 00035 00036 #include "ccny_rgbd/types.h" 00037 #include "ccny_rgbd/util.h" 00038 #include "ccny_rgbd/FeatureDetectorConfig.h" 00039 #include "ccny_rgbd/GftDetectorConfig.h" 00040 #include "ccny_rgbd/StarDetectorConfig.h" 00041 #include "ccny_rgbd/SurfDetectorConfig.h" 00042 #include "ccny_rgbd/OrbDetectorConfig.h" 00043 00044 namespace ccny_rgbd { 00045 00049 class FeatureViewer 00050 { 00051 public: 00052 00057 FeatureViewer(const ros::NodeHandle& nh, 00058 const ros::NodeHandle& nh_private); 00059 00062 virtual ~FeatureViewer(); 00063 00064 private: 00065 00066 // **** ROS-related 00067 00068 ros::NodeHandle nh_; 00069 ros::NodeHandle nh_private_; 00070 00071 ros::Publisher cloud_publisher_; 00072 ros::Publisher covariances_publisher_; 00073 00074 FeatureDetectorConfigServer config_server_; 00075 00076 GftDetectorConfigServerPtr gft_config_server_; 00077 StarDetectorConfigServerPtr star_config_server_; 00078 SurfDetectorConfigServerPtr surf_config_server_; 00079 OrbDetectorConfigServerPtr orb_config_server_; 00080 00082 boost::shared_ptr<ImageTransport> rgb_it_; 00083 00085 boost::shared_ptr<ImageTransport> depth_it_; 00086 00088 boost::shared_ptr<RGBDSynchronizer3> sync_; 00089 00091 ImageSubFilter sub_rgb_; 00092 00094 ImageSubFilter sub_depth_; 00095 00097 CameraInfoSubFilter sub_info_; 00098 00099 // **** parameters 00100 00109 std::string detector_type_; 00110 00111 int queue_size_; 00112 00117 bool show_keypoints_; 00118 00123 bool publish_cloud_; 00124 00129 bool publish_covariances_; 00130 00131 // **** variables 00132 00133 boost::mutex mutex_; 00134 int frame_count_; 00135 00136 rgbdtools::FeatureDetectorPtr feature_detector_; 00137 00138 // **** private functions 00139 00146 void RGBDCallback(const ImageMsg::ConstPtr& rgb_msg, 00147 const ImageMsg::ConstPtr& depth_msg, 00148 const CameraInfoMsg::ConstPtr& info_msg); 00149 00152 void initParams(); 00153 00156 void resetDetector(); 00157 00162 void publishFeatureCloud(rgbdtools::RGBDFrame& frame); 00163 00168 void publishFeatureCovariances(rgbdtools::RGBDFrame& frame); 00169 00174 void showKeypointImage(rgbdtools::RGBDFrame& frame); 00175 00178 void reconfigCallback(FeatureDetectorConfig& config, uint32_t level); 00179 00182 void gftReconfigCallback(GftDetectorConfig& config, uint32_t level); 00183 00186 void starReconfigCallback(StarDetectorConfig& config, uint32_t level); 00187 00190 void surfReconfigCallback(SurfDetectorConfig& config, uint32_t level); 00191 00194 void orbReconfigCallback(OrbDetectorConfig& config, uint32_t level); 00195 }; 00196 00197 } // namespace ccny_rgbd 00198 00199 #endif // CCNY_RGBD_RGBD_FEATURE_VIEWER_H