00001 #ifndef __ONV_FEATURETRACK_H
00002 #define __ONV_FEATURETRACK_H
00003 #include <GL/gl.h>
00004 #include <GL/glext.h>
00005 #include <GL/glu.h>
00006 #include <stdio.h>
00007 #include <assert.h>
00008 #include <Cg/cgGL.h>
00009 #include "fv.h"
00010 #include "float_pbuffer_lnx.h"
00011
00057 class featureTrack {
00058 private :
00059 GLuint fb[10],depth_rb;
00060 GLuint inputfb, testTex;
00061
00062
00063 GLuint occlusionQueries;
00064 GLuint pixelCount, gaussian16x16tex;
00065 GLuint orientationfb, orientationQuadTex[5], orientationSumTex;
00066 GLuint orientationTex, orientationfb2;
00067 GLuint featureCoordsLUTTex;
00068
00069 GLuint featurefb, featureTex[16];
00070 float *featureCoordsBuf, *featureCoordsTex;
00071 unsigned char *stencilbuf;
00072 float *orientationsBuf;
00073 GLuint featureWorkBufs[4], featureWorkTex[16];
00074
00075
00076 CGcontext cgContext;
00077 CGprogram undistortProgram, gaussianderivXProgram, magdirProgram,
00078 gaussianderivYProgram,
00079 cannysearchProgram, dxdyProgram, gaussianXProgram, gaussianYProgram,
00080 derandomProgram, decideProgram, basicProgram;
00081
00082
00083 CGprogram passredProgram, orientationProgram, featureProgram, sum4texProgram;
00084
00085 CGprofile cgProfile;
00086 CFPBuffer fpbuffer, procbuffer;
00087
00088 int numCorners;
00089 float featureBuf0[16*640*4];
00090
00091
00092 float cannythresh[4] ;
00093 float derandomthresh[4];
00094 float cornerthresh[4];
00095
00096
00097 unsigned char rbbuf[640*480*4];
00098
00099 int Width;
00100 int Height;
00101 float depth;
00102
00103 static GLenum errCode;
00104 const GLubyte *errString;
00105
00106 void reshape(int,int);
00107 void drawQuadTex();
00108 void drawQuadFBT();
00109 void makeLUT(unsigned char *f);
00110 CGprogram load_cgprogram(CGprofile prof, char *name);
00111 void init_cg();
00112 void locateFeatures( GLuint texIn );
00113 void makeLookupTexture();
00114 void calcOrientations();
00115 void calcFeatures();
00116 Scene *createScene( int num, float *coords, float *orients, float *buf );
00117 void render_redirect(GLuint texIn);
00118
00119 public :
00120 GLuint tex[10];
00121
00122
00123
00124 featureTrack(int width,
00125 int height);
00126
00129 Scene *getScene( GLuint texIn )
00130 {
00131 render_redirect( texIn );
00132 return createScene( numCorners, featureCoordsBuf,
00133 orientationsBuf, featureBuf0);
00134 }
00136 int width() { return Width; }
00138 int height() { return Height; }
00139 };
00140
00141 #endif