target.h
Go to the documentation of this file.
00001 
00010 #ifndef UCL_DRONE_TARGET_H
00011 #define UCL_DRONE_TARGET_H
00012 
00013 // #define DEBUG_TARGET // if defined a window with target matches is displayed
00014 
00015 // #define DEBUG_PROJECTION  // if defined print relative errors of projection for the target
00016 
00017 #include <ucl_drone/computer_vision/computer_vision.h>
00018 
00020 static const std::string TARGET_RELPATH = "/target/target_bottom.png";
00021 
00022 #ifdef DEBUG_TARGET
00023 static const std::string OPENCV_WINDOW = "Object matches";
00024 #endif
00025 
00030 class Target
00031 {
00032 private:
00033   cv::Mat image;                          
00034   std::vector< cv::KeyPoint > keypoints;  
00035   cv::Mat descriptors;                    
00036   std::vector< cv::Point2f > centerAndCorners;  
00037 
00038   cv::FlannBasedMatcher matcher;  
00039 
00040 
00041 public:
00043   Target();
00044 
00046   ~Target();
00047 
00049   bool init(const std::string relative_path);
00050 
00061   bool detect(cv::Mat cam_descriptors, std::vector< cv::KeyPoint >& cam_keypoints,
00062               std::vector< cv::DMatch >& good_matches, std::vector< int >& idxs_to_remove,
00063               std::vector< cv::Point2f >& target_coord
00064 #ifdef DEBUG_PROJECTION
00065               ,
00066               ucl_drone::Pose3D pose
00067 #endif
00068 #ifdef DEBUG_TARGET
00069               ,
00070               cv::Mat& image_cam
00071 #endif
00072               );
00073 
00076   void draw(cv::Mat cam_img, std::vector< cv::KeyPoint > cam_keypoints,
00077             std::vector< cv::DMatch > good_matches, cv::Mat& img_matches);
00078 
00080   void position(std::vector< cv::KeyPoint > cam_keypoints, std::vector< cv::DMatch > good_matches,
00081                 std::vector< cv::Point2f >& coord);
00082 };
00083 
00084 bool customLess(cv::DMatch a, cv::DMatch b);
00085 
00086 #endif /* UCL_DRONE_TARGET_DETECTION_H */


ucl_drone
Author(s): dronesinma
autogenerated on Sat Jun 8 2019 20:51:53