1 //////////////////////////////////////////////////////////////////////////// 2 // File: SiftMatch.h 3 // Author: Changchang Wu 4 // Description : interface for the SiftMatchGL 5 //// 6 // Copyright (c) 2007 University of North Carolina at Chapel Hill 7 // All Rights Reserved 8 // 9 // Permission to use, copy, modify and distribute this software and its 10 // documentation for educational, research and non-profit purposes, without 11 // fee, and without a written agreement is hereby granted, provided that the 12 // above copyright notice and the following paragraph appear in all copies. 13 // 14 // The University of North Carolina at Chapel Hill make no representations 15 // about the suitability of this software for any purpose. It is provided 16 // 'as is' without express or implied warranty. 17 // 18 // Please send BUG REPORTS to ccwu@cs.unc.edu 19 // 20 //////////////////////////////////////////////////////////////////////////// 21 22 23 #ifndef GPU_SIFT_MATCH_H 24 #define GPU_SIFT_MATCH_H 25 class GLTexImage; 26 class ProgramGPU; 27 28 class SiftMatchGL:public SiftMatchGPU 29 { 30 typedef GLint ParameterGL; 31 private: 32 //tex storage 33 GLTexImage _texLoc[2]; 34 GLTexImage _texDes[2]; 35 GLTexImage _texDot; 36 GLTexImage _texMatch[2]; 37 38 //programs 39 ProgramGPU * s_multiply; 40 ProgramGPU * s_guided_mult; 41 ProgramGPU * s_col_max; 42 ProgramGPU * s_row_max; 43 44 //matching parameters 45 ParameterGL _param_multiply_tex1; 46 ParameterGL _param_multiply_tex2; 47 ParameterGL _param_multiply_size; 48 ParameterGL _param_rowmax_param; 49 ParameterGL _param_colmax_param; 50 51 ///guided matching 52 ParameterGL _param_guided_mult_tex1; 53 ParameterGL _param_guided_mult_tex2; 54 ParameterGL _param_guided_mult_texl1; 55 ParameterGL _param_guided_mult_texl2; 56 ParameterGL _param_guided_mult_h; 57 ParameterGL _param_guided_mult_f; 58 ParameterGL _param_guided_mult_param; 59 // 60 int _num_sift[2]; 61 int _id_sift[2]; 62 int _have_loc[2]; 63 64 //gpu parameter 65 int _sift_per_stripe; 66 int _sift_num_stripe; 67 int _sift_per_row; 68 int _pixel_per_sift; 69 int _initialized; 70 // 71 vector<float> sift_buffer; 72 private: 73 void AllocateSiftMatch(); 74 void LoadSiftMatchShadersGLSL(); 75 int GetBestMatch(int max_match, uint32_t match_buffer[][2], float distmax, float ratiomax, int mbm); 76 public: 77 SiftMatchGL(int max_sift, int use_glsl); 78 virtual ~SiftMatchGL(); 79 public: 80 bool Allocate(int max_sift, int mbm) override; 81 void InitSiftMatch(); 82 void SetMaxSift(int max_sift) override; 83 void SetDescriptors(int index, int num, const unsigned char * descriptor, int id = -1); 84 void SetDescriptors(int index, int num, const float * descriptor, int id = -1); 85 void SetFeautreLocation(int index, const float* locatoins, int gap); 86 int GetSiftMatch(int max_match, uint32_t match_buffer[][2], float distmax, float ratiomax, int mbm); 87 int GetGuidedSiftMatch(int max_match, uint32_t match_buffer[][2], float* H, float* F, 88 float distmax, float ratiomax, float hdistmax,float fdistmax, int mbm); 89 }; 90 91 92 #endif 93 94