00001 #ifndef CUDASIFT_H 00002 #define CUDASIFT_H 00003 00004 #include "cudaImage.h" 00005 00006 typedef struct { 00007 float xpos; 00008 float ypos; 00009 float scale; 00010 float sharpness; 00011 float edgeness; 00012 float orientation; 00013 float score; 00014 float ambiguity; 00015 int match; 00016 float match_xpos; 00017 float match_ypos; 00018 float match_error; 00019 float empty[4]; 00020 float data[128]; 00021 } SiftPoint; 00022 00023 typedef struct { 00024 int numPts; // Number of available Sift points 00025 int maxPts; // Number of allocated Sift points 00026 SiftPoint *h_data; // Host (CPU) data 00027 SiftPoint *d_data; // Device (GPU) data 00028 } SiftData; 00029 00030 void InitCuda(int argc, char **argv); 00031 00032 void ExtractSift(SiftData *siftData, CudaImage *img, int numLayers, 00033 int numOctaves, double initBlur, float thresh, float subsampling = 1.0f); 00034 void ExtractSiftOctave(SiftData *siftData, CudaImage *img, int numLayers, 00035 double initBlur, float thresh = 0.02f, float subsampling = 1.0f); 00036 00037 void InitSiftData(SiftData *data, int num = 1024, bool host = false, 00038 bool dev = true); 00039 void FreeSiftData(SiftData *data); 00040 void PrintSiftData(SiftData *data); 00041 double MatchSiftData(SiftData *data1, SiftData *data2); 00042 double FindHomography(SiftData *data, float *homography, int *numMatches, 00043 int numLoops = 1000, float minScore = 0.85f, float maxAmbiguity = 0.95f, 00044 float thresh = 5.0f); 00045 00046 double LowPass5(CudaImage *res, CudaImage *data, float variance); 00047 double ScaleDown(CudaImage *res, CudaImage *data, float variance); 00048 double Subtract(CudaImage *res, CudaImage *dataA, CudaImage *dataB); 00049 double MultiplyAdd(CudaImage *res, CudaImage *data, float constA, 00050 float constB); 00051 double FindMinMax(CudaImage *img, float *minval, float *maxval); 00052 00053 #endif