root / rgbdslam / external / siftgpu / src / SiftGPU / PyramidGL.h @ 9240aaa3
History | View | Annotate | Download (3.75 KB)
1 | 9240aaa3 | Alex | ////////////////////////////////////////////////////////////////////////////
|
---|---|---|---|
2 | // File: PyramidGL.h
|
||
3 | // Author: Changchang Wu
|
||
4 | // Description : interface for the PyramdGL
|
||
5 | // class PyramidNaive and PyramidPacked are derived from PyramidGL
|
||
6 | //
|
||
7 | // Copyright (c) 2007 University of North Carolina at Chapel Hill
|
||
8 | // All Rights Reserved
|
||
9 | //
|
||
10 | // Permission to use, copy, modify and distribute this software and its
|
||
11 | // documentation for educational, research and non-profit purposes, without
|
||
12 | // fee, and without a written agreement is hereby granted, provided that the
|
||
13 | // above copyright notice and the following paragraph appear in all copies.
|
||
14 | //
|
||
15 | // The University of North Carolina at Chapel Hill make no representations
|
||
16 | // about the suitability of this software for any purpose. It is provided
|
||
17 | // 'as is' without express or implied warranty.
|
||
18 | //
|
||
19 | // Please send BUG REPORTS to ccwu@cs.unc.edu
|
||
20 | //
|
||
21 | ////////////////////////////////////////////////////////////////////////////
|
||
22 | |||
23 | |||
24 | |||
25 | #ifndef _PYRAMID_GL_H
|
||
26 | #define _PYRAMID_GL_H
|
||
27 | |||
28 | class GLTexImage; |
||
29 | class SiftParam; |
||
30 | class ProgramGPU; |
||
31 | class ShaderMan; |
||
32 | class GlobalUtil; |
||
33 | class SiftPyramid; |
||
34 | |||
35 | class PyramidGL:public SiftPyramid |
||
36 | { |
||
37 | protected:
|
||
38 | GLTexImage* _histoPyramidTex; |
||
39 | GLTexImage* _featureTex; |
||
40 | GLTexImage* _descriptorTex; |
||
41 | GLTexImage* _orientationTex; |
||
42 | public:
|
||
43 | void InitializeContext();
|
||
44 | void SetLevelFeatureNum(int idx, int num); |
||
45 | void GetTextureStorageSize(int num, int &fw, int& fh); |
||
46 | void GetAlignedStorageSize(int num, int align, int &fw, int &fh); |
||
47 | static void InterlaceDescriptorF2(int w, int h, float* buf, float* pd, int step); |
||
48 | static void NormalizeDescriptor(int num, float*pd); |
||
49 | virtual void DownloadKeypoints();
|
||
50 | virtual int ResizeFeatureStorage();
|
||
51 | ////////////////////////////
|
||
52 | virtual void DestroyPerLevelData();
|
||
53 | virtual void DestroySharedData();
|
||
54 | virtual void GetFeatureDescriptors();
|
||
55 | virtual void GenerateFeatureListTex();
|
||
56 | virtual void ReshapeFeatureListCPU();
|
||
57 | virtual void GenerateFeatureDisplayVBO();
|
||
58 | virtual void CleanUpAfterSIFT();
|
||
59 | virtual GLTexImage* GetBaseLevel(int octave, int dataName = DATA_GAUSSIAN)=0; |
||
60 | public:
|
||
61 | PyramidGL(SiftParam&sp); |
||
62 | virtual ~PyramidGL(); |
||
63 | }; |
||
64 | |||
65 | class PyramidNaive:public PyramidGL, public ShaderMan |
||
66 | { |
||
67 | protected:
|
||
68 | GLTexImage * _texPyramid; |
||
69 | GLTexImage * _auxPyramid; |
||
70 | public:
|
||
71 | void DestroyPyramidData();
|
||
72 | void GetSimplifiedOrientation();
|
||
73 | void GenerateFeatureListCPU();
|
||
74 | virtual void GetFeatureOrientations();
|
||
75 | virtual void GenerateFeatureList();
|
||
76 | void DetectKeypointsEX();
|
||
77 | void ComputeGradient();
|
||
78 | GLTexImage* GetLevelTexture(int octave, int level); |
||
79 | GLTexImage* GetBaseLevel(int octave, int dataName = DATA_GAUSSIAN); |
||
80 | GLTexImage* GetLevelTexture(int octave, int level, int dataName); |
||
81 | void BuildPyramid(GLTexInput * input);
|
||
82 | void InitPyramid(int w, int h, int ds); |
||
83 | void FitPyramid(int w, int h); |
||
84 | void ResizePyramid(int w, int h); |
||
85 | void FitHistogramPyramid();
|
||
86 | PyramidNaive(SiftParam & sp); |
||
87 | ~PyramidNaive(); |
||
88 | private:
|
||
89 | void GenerateFeatureList(int i, int j); |
||
90 | }; |
||
91 | |||
92 | |||
93 | class PyramidPacked:public PyramidGL, public ShaderMan |
||
94 | { |
||
95 | GLTexPacked * _allPyramid; |
||
96 | public:
|
||
97 | PyramidPacked(SiftParam& sp); |
||
98 | ~PyramidPacked(); |
||
99 | void DestroyPyramidData();
|
||
100 | void DetectKeypointsEX();
|
||
101 | void ComputeGradient();
|
||
102 | void BuildPyramid(GLTexInput * input);
|
||
103 | void InitPyramid(int w, int h, int ds); |
||
104 | void FitPyramid(int w, int h); |
||
105 | void ResizePyramid(int w, int h); |
||
106 | void FitHistogramPyramid();
|
||
107 | void GenerateFeatureListCPU();
|
||
108 | void GenerateFeatureList();
|
||
109 | void GetSimplifiedOrientation();
|
||
110 | void GetFeatureOrientations();
|
||
111 | GLTexImage* GetBaseLevel(int octave, int dataName = DATA_GAUSSIAN); |
||
112 | GLTexImage* GetLevelTexture(int octave, int level); |
||
113 | GLTexImage* GetLevelTexture(int octave, int level, int dataName); |
||
114 | virtual int IsUsingRectDescription(){return _existing_keypoints & SIFT_RECT_DESCRIPTION; } |
||
115 | private:
|
||
116 | void GenerateFeatureList(int i, int j); |
||
117 | }; |
||
118 | |||
119 | #endif |