detector.cpp
Go to the documentation of this file.
00001 #include "outlet_pose_estimation/detector.h"
00002 
00003 namespace outlet_pose_estimation {
00004 
00005 Detector::Detector()
00006 {
00007 }
00008 
00009 bool Detector::loadTemplate(const std::string& filename)
00010 {
00011   return outlet_template_.load(filename.c_str());
00012 }
00013 
00014 bool Detector::detect(const cv::Mat& image, std::vector<cv::Point2f>& points) const
00015 {
00016   IplImage ipl = (IplImage)image;
00017 
00018   // Detect the outlet holes
00019   // Current code path does not depend on the camera parameters, so we leave them NULL.
00020   if (!outlet_template_.get_one_way_descriptor_base() ||
00021       !detect_outlet_tuple(&ipl, NULL, NULL, outlets_, outlet_template_, NULL, NULL))
00022     return false;
00023 
00024   // Retrieve the image coordinates of the holes
00025   std::vector<bool> is_detected;
00026   getImagePoints(outlets_, points, is_detected);
00027   return true;
00028 }
00029 
00030 void Detector::getDisplayImage(const cv::Mat& source,
00031                                const std::vector<cv::Point2f>& points,
00032                                bool success, cv::Mat& display) const
00033 {
00035   display = source.clone();
00036   if (success) {
00037     IplImage display_ipl = (IplImage)display;
00039     draw_outlets(&display_ipl, outlets_);
00040   }
00041 }
00042 
00043 } //namespace outlet_pose_estimation


outlet_pose_estimation
Author(s): Patrick Mihelich
autogenerated on Thu Aug 27 2015 14:29:52