processor.h
Go to the documentation of this file.
00001 
00012 #ifndef PROCESSOR_H_
00013 #define PROCESSOR_H_
00014 
00015 #include <opencv2/core/core.hpp>
00016 #include <opencv2/ml/ml.hpp>
00017 #include <pcl/point_cloud.h>
00018 #include <pcl/point_types.h>
00019 #include <ros/ros.h>
00020 #include <sensor_msgs/Image.h>
00021 #include <sensor_msgs/PointCloud2.h>
00022 #include <tf/transform_broadcaster.h>
00023 
00028 typedef struct
00029 {
00030   int c; 
00031   cv::RotatedRect rect; 
00032 } smoothing_point;
00033 
00038 #define RATIO_THRESHOLD 0.7
00039 
00043 #define MIN_AREA 1000
00044 
00048 #define MAX_AREA 7000
00049 
00054 #define SMOOTH_DIST_THRESH 5
00055 
00059 #define MAX_SMOOTHING_COUNT 20
00060 
00065 #define BLUR_KERNEL 5
00066 
00071 #define CANNY_MIN_THRESH 40
00072 
00076 #define CANNY_MAX_THRESH 120
00077 
00081 #define CANNY_KERNEL 3
00082 
00087 #define ERODE_ELEMENT_SIZE 5
00088 
00092 #define DILATE_ELEMENT_SIZE 3
00093 
00098 #define HOUGH_RHO 1
00099 
00103 #define HOUGH_THETA CV_PI/180.0
00104 
00108 #define HOUGH_THRESH 12
00109 
00113 #define HOUGH_MIN_LINE_LENGTH 8
00114 
00118 #define HOUGH_MAX_LINE_GAP 3
00119 
00124 #define REF_WIDTH 20
00125 
00129 #define REF_HEIGHT 28
00130 
00135 #define MAX_SIFT 20.0
00136 
00141 #define MAX_LINES 150.0
00142 
00146 #define MAX_AVG_LINE_LENGTH 25.0
00147 
00152 #define D 7
00153 
00158 #define COMPUTER 0
00159 
00163 #define NUM_COMPUTER 36
00164 
00168 #define TURTLE 1
00169 
00173 #define NUM_TURTLE 39
00174 
00178 #define ROBOT 2
00179 
00183 #define NUM_ROBOT 18
00184 
00188 #define BSG 3
00189 
00193 #define NUM_BSG 19
00194 
00198 #define PENS 4
00199 
00203 #define NUM_PENS 35
00204 
00208 #define COVERS 5
00209 
00213 #define NUM_COVERS 54
00214 
00218 #define OTHER 6
00219 
00223 #define NUM_OTHER 30
00224 
00229 #define OBJECT_FRAME "/computer_object_link"
00230 
00234 #define BASE_FRAME "/base_link"
00235 
00239 #define CLOUD_FRAME "/head_mount_kinect_rgb_optical_frame"
00240 
00244 #define GOAL_FRAME "/touch_goal"
00245 
00250 #define PADDING_X -0.2
00251 
00255 #define PADDING_Y -0.1
00256 
00260 #define PADDING_Z -0.1
00261 
00268 class processor
00269 {
00270 public:
00275   processor();
00276 
00280   ~processor();
00281 
00282 private:
00288   void feed_cback(const sensor_msgs::Image::ConstPtr& img);
00289 
00295   void cloud_cback(const sensor_msgs::PointCloud2::ConstPtr& pc);
00296 
00300   void train();
00301 
00305   void accuracy();
00306 
00314   std::vector<cv::RotatedRect> segment(cv::Mat const src);
00315 
00325   std::vector<cv::Mat> split_image(cv::Mat const src, std::vector<cv::RotatedRect> rectangles);
00326 
00334   std::vector<float> get_feature_vector(cv::Mat const src);
00335 
00341   void smooth(cv::RotatedRect r);
00342 
00343   ros::NodeHandle node; 
00345   ros::Subscriber feed, cloud; 
00347   cv::Mat erode_element, dilate_element; 
00349   std::vector<cv::Point> ref_contour; 
00351   cv::RNG random; 
00353   CvNormalBayesClassifier *bayes;
00354 
00355   bool capture; 
00356   int capture_count; 
00358   std::vector<smoothing_point> smoothing_points; 
00359   std::vector<int> non_matches; 
00361   int last_x, last_y; 
00362   tf::TransformBroadcaster tfb; 
00363   pcl::PointCloud<pcl::PointXYZ> latest_cloud; 
00364 };
00365 
00373 int main(int argc, char **argv);
00374 
00375 #endif


rail_cv_project
Author(s): Russell Toris, David Kent, Adrian‎ Boteanu
autogenerated on Sat Dec 28 2013 17:31:25