SurfSet.h
Go to the documentation of this file.
00001 
00028 #ifndef __D_SURF_SET__
00029 #define __D_SURF_SET__
00030 
00031 #include <opencv/cv.h>
00032 #include <opencv/highgui.h>
00033 #include <vector>
00034 #include <string>
00035 
00036 namespace DVision {
00037 
00038 class Matches;
00039 
00040 class SurfSet 
00041 {
00042 public:
00043         std::vector<cv::KeyPoint> keys;
00044         std::vector<float> descriptors;
00045         std::vector<int> laplacians;
00046         
00047 public:
00048 
00049         SurfSet(): m_index(NULL) {}
00050         virtual ~SurfSet(){ delete m_index; }
00051 
00060         void Extract(const cv::Mat &image, 
00061                 double hessianTh = 400.0, bool extended = false);
00062 
00070   void Compute(const cv::Mat &image,
00071     const std::vector<cv::KeyPoint> &keypoints, bool extended = false);
00072   
00078   inline int GetDescriptorLength() const 
00079   {
00080     if(!keys.empty()) return descriptors.size() / keys.size();
00081     else return 0;
00082   }  
00083 
00087   inline unsigned int size() const
00088   {
00089     return keys.size();
00090   }
00091   
00102         void CalculateCorrespondences(const SurfSet &B,
00103                 std::vector<int> &A_corr, std::vector<int> &B_corr,
00104                 std::vector<double> *distances = NULL,
00105                 bool remove_duplicates = true, 
00106                 double max_ratio = 0.6) const;
00107 
00118   void CalculateFastCorrespondences(const SurfSet &B,
00119                 std::vector<int> &A_corr, std::vector<int> &B_corr,
00120                 std::vector<double> *distances = NULL,
00121                 bool remove_duplicates = true, 
00122                 double max_ratio = 0.6);
00123 
00129   void RecalculateApproximationTree();
00130 
00135   void Save(const std::string &filename) const;
00136 
00141   void Load(const std::string &filename);
00142 
00151         void SaveCustom(const std::string &filename) const;
00152         
00157         void LoadCustom(const std::string &filename);
00158 
00163    int getPointOctave(const CvSURFPoint& kpt, const CvSURFParams& params);
00164 
00165 protected:
00166   friend class Matches;
00167   
00173   void save(cv::FileStorage &fs, int idx) const;
00174   
00180   void load(cv::FileStorage &fs, int idx);
00181 
00182 protected:
00183 
00190         double calculateSqDistance(std::vector<float>::const_iterator ita, 
00191                 std::vector<float>::const_iterator itb, const int L) const;
00192 
00202         void calculateCorrespondencesNaive(const SurfSet &B,
00203                 std::vector<int> &A_corr, std::vector<int> &B_corr,
00204                 std::vector<double> *distances,
00205                 bool remove_duplicates, double max_ratio) const;
00206 
00216         void calculateCorrespondencesApproximate(const SurfSet &B,
00217                 std::vector<int> &A_corr, std::vector<int> &B_corr,
00218                 std::vector<double> *distances,
00219                 bool remove_duplicates, double max_ratio);
00220                 
00228   int getPointOctave(const CvSURFPoint& kpt, const CvSURFParams& params) const;
00229 
00230 protected:
00231   
00232   cv::flann::Index *m_index;
00233 
00234 };
00235 
00236 }
00237 
00238 #endif
00239 


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:33:07