Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
STARDetector.hpp
00001 /* $Id$ */
00002 
00003 #ifndef _FDETECT_STAR_DETECTOR_HPP_
00004 #define _FDETECT_STAR_DETECTOR_HPP_
00005 
00006 #include <vector>
00007 
00008 #include <cv.h>
00009 #include <cv.hpp>
00010 
00011 #include <boost/archive/text_oarchive.hpp>
00012 #include <boost/archive/text_iarchive.hpp>
00013 
00014 #include "fdetect/Detector.hpp"
00015 #include "fdetect/FloatDescriptor.hpp"
00016 #include "fdetect/RealDescriptor.hpp"
00017 
00018 namespace jafar {
00019   namespace fdetect {
00029     class STARDetector : public fdetect::Detector {
00030     private:
00032       cv::StarDetector cv_star;
00034       std::vector<cv::KeyPoint> cv_keypoints;
00036       std::vector<float> cv_descriptors;
00038       friend class boost::serialization::access;
00039       template<class Archive>
00040       void serialize(Archive & ar, const unsigned int /* file_version */){
00041         ar & cv_star.maxSize; 
00042         ar & cv_star.responseThreshold;
00043         ar & cv_star.lineThresholdProjected; 
00044         ar & cv_star.lineThresholdBinarized;
00045         ar & cv_star.suppressNonmaxSize;
00046       }
00047 
00048     public:
00063       STARDetector(int _maxSize, 
00064                    int _responseThreshold,
00065                    int _lineThresholdProjected,
00066                    int _lineThresholdBinarized,
00067                    int _suppressNonmaxSize) : 
00068         cv_star(_maxSize, _responseThreshold,
00069                 _lineThresholdProjected, _lineThresholdBinarized,
00070                 _suppressNonmaxSize) {};
00071       
00075       STARDetector() : cv_star() {};
00076 
00077       virtual fdetect::DetectionResult detectIn(jafar::image::Image const& image);
00078 
00079       void setMaxSize(int _maxSize); 
00080 
00081       void setResponseThreshold(int _responseThreshold);
00082 
00083       void setLineThresholdProjected(int _lineThresholdProjected);
00084 
00085       void setLineThresholdBinarized(int _lineThresholdBinarized);
00086 
00087       void setSuppressNonmaxSize(int _suppressNonmaxSize);
00088 
00089       int maxSize() const;
00090 
00091       int responseThreshold() const;
00092 
00093       int lineThresholdProjected() const;
00094 
00095       int lineThresholdBinarized() const;
00096 
00097       int suppressNonmaxSize() const;
00098 
00099     };
00100   }
00101 #ifndef SWIG
00102   namespace fdetect_v2 {
00112     template< typename InterestFeatureT >
00113     class STARDetectorT : public fdetect_v2::Detector< InterestFeatureT > {
00114     public:
00115       typedef InterestFeatureT InterestFeatureType;
00116       typedef fdetect_v2::DetectionResult<InterestFeatureT> DetectionResult;
00131       STARDetectorT(int _maxSize, 
00132                    int _responseThreshold,
00133                    int _lineThresholdProjected,
00134                    int _lineThresholdBinarized,
00135                    int _suppressNonmaxSize) : 
00136         cv_star(_maxSize, _responseThreshold,
00137                 _lineThresholdProjected, _lineThresholdBinarized,
00138                 _suppressNonmaxSize) {}      
00142       STARDetectorT() : cv_star() {};
00147       virtual DetectionResult detectIn(jafar::image::Image const& image) 
00148       {
00149         return detectIn(image, true);
00150       }
00156       DetectionResult detectIn(jafar::image::Image const& image, 
00157                                bool with_descriptors);
00161       void computeDescriptors(jafar::image::Image const& image, 
00162                               DetectionResult& dr); 
00163 
00164       void setMaxSize(int _maxSize); 
00165 
00166       void setResponseThreshold(int _responseThreshold);
00167 
00168       void setLineThresholdProjected(int _lineThresholdProjected);
00169 
00170       void setLineThresholdBinarized(int _lineThresholdBinarized);
00171 
00172       void setSuppressNonmaxSize(int _suppressNonmaxSize);
00173 
00174       int maxSize() const;
00175 
00176       int responseThreshold() const;
00177 
00178       int lineThresholdProjected() const;
00179 
00180       int lineThresholdBinarized() const;
00181 
00182       int suppressNonmaxSize() const;
00183 
00184     private:
00186       cv::StarDetector cv_star;
00188       friend class boost::serialization::access;
00189       template<class Archive>
00190       void serialize(Archive & ar, const unsigned int /* file_version */){
00191         ar & cv_star.maxSize; 
00192         ar & cv_star.responseThreshold;
00193         ar & cv_star.lineThresholdProjected; 
00194         ar & cv_star.lineThresholdBinarized;
00195         ar & cv_star.suppressNonmaxSize;
00196       }
00197     };
00199     typedef STARDetectorT<fdetect_v2::InterestFeature<fdetect_v2::FloatDescriptor> > STARDetector;
00200   }
00201 #endif
00202 }
00203 #include "fdetect/STARDetector.hxx"
00204 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:19 for Jafar by doxygen 1.7.6.1
LAAS-CNRS