Debian Codegraph @

src/thirdparty/SiftGPU/SiftMatch.h

raw
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 [email protected]
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 int _loc_ncomp[2];
64 ProgramGPU* s_guided_mult_ray;
65 int _param_guided_mult_ray_tex1, _param_guided_mult_ray_tex2;
66 int _param_guided_mult_ray_texl1, _param_guided_mult_ray_texl2;
67 int _param_guided_mult_ray_e, _param_guided_mult_ray_param;
68
69 //gpu parameter
70 int _sift_per_stripe;
71 int _sift_num_stripe;
72 int _sift_per_row;
73 int _pixel_per_sift;
74 int _initialized;
75 //
76 vector<float> sift_buffer;
77 private:
78 void AllocateSiftMatch();
79 void LoadSiftMatchShadersGLSL();
80 int GetBestMatch(int max_match, uint32_t match_buffer[][2], float distmax, float ratiomax, int mbm);
81 public:
82 SiftMatchGL(int max_sift, int use_glsl);
83 virtual ~SiftMatchGL();
84 public:
85 bool Allocate(int max_sift, int mbm) override;
86 void InitSiftMatch();
87 void SetMaxSift(int max_sift) override;
88 void SetDescriptors(int index, int num, const unsigned char * descriptor, int id = -1);
89 void SetDescriptors(int index, int num, const float * descriptor, int id = -1);
90 void SetFeatureLocation(int index, const float* locations, int gap, int ncomp);
91 int GetSiftMatch(int max_match, uint32_t match_buffer[][2], float distmax, float ratiomax, int mbm);
92 int GetGuidedSiftMatch(int max_match, uint32_t match_buffer[][2], float* H, float* F,
93 float distmax, float ratiomax, float hdistmax,float fdistmax, int mbm,
94 int use_h, int use_f);
95 };
96
97
98 #endif
99