hash.h
Go to the documentation of this file.
00001 #ifndef HASH_H
00002 #define HASH_H
00003 
00004 #include "opencv2/core/core.hpp"
00005 #include "opencv2/features2d/features2d.hpp"
00006 #include <Eigen/Eigen>
00007 #include <Eigen/Dense>
00008 
00009 using namespace std;
00010 using namespace cv;
00011 using namespace Eigen;
00012 
00013 namespace haloc
00014 {
00015 
00016 class Hash
00017 {
00018 
00019 public:
00020 
00021   // Class constructor
00022   Hash();
00023 
00024   struct Params
00025   {
00026     //Default constructor sets all values to defaults.
00027     Params();
00028 
00029     // Class parameters
00030     int num_proj;                   
00031 
00032     // Default values
00033     static const int              DEFAULT_NUM_PROJ = 2;
00034   };
00035 
00036   // Set the parameter struct
00037   void setParams(const Params& params);
00038 
00039   // Returns true if the class has been initialized
00040   bool isInitialized();
00041 
00042   // Return current parameters
00043   inline Params params() const { return params_; }
00044 
00045   // Initialize class
00046   void init(Mat desc);
00047 
00048   // Compute the hash
00049   vector<float> getHash(Mat desc);
00050 
00051   // Compute the distance between 2 hashes
00052   float match(vector<float> hash_1, vector<float> hash_2);
00053 
00054 private:
00055 
00056   // Init the random vectors for projections
00057   void initProjections(int desc_size);
00058 
00059   // Compute a random vector
00060   vector<float> compute_random_vector(uint seed, int size);
00061 
00062   // Make a vector unit
00063   vector<float> unit_vector(vector<float> x);
00064 
00065   // Properties
00066   Params params_;                           
00067   vector< vector<float> > r_;               
00068   int h_size_;                              
00069   bool initialized_;                        
00070 };
00071 
00072 } // namespace
00073 
00074 #endif // HASH_H


libhaloc
Author(s): Pep Lluis Negre
autogenerated on Thu Jun 6 2019 21:25:00