Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef SIFT_GPU_FEATURE_DETECTOR_H
00019 #define SIFT_GPU_FEATURE_DETECTOR_H
00020
00021
00022 #include <opencv2/features2d/features2d.hpp>
00023 #include <opencv/cv.h>
00024 #include <SiftGPU/SiftGPU.h>
00025 #include <QMutex>
00026
00032 class SiftGPUWrapper {
00033 public:
00037 virtual ~SiftGPUWrapper();
00038
00049 void detect(const cv::Mat& image, cv::vector<cv::KeyPoint>& keypoints, std::vector<float>& descriptors, const cv::Mat& mask = cv::Mat()) const;
00050
00061 int match(const std::vector<float>& descriptors1, int num1, const std::vector<float>& descriptors2, int num2, std::vector<cv::DMatch>* matches);
00062
00066 static SiftGPUWrapper* getInstance();
00067 static void destroyInstance();
00068
00069 private:
00073 SiftGPUWrapper();
00074
00075 void initializeMatcher();
00076
00084 void cvMatToSiftGPU(const cv::Mat& image, unsigned char* siftImage) const;
00085
00094 void writePGM(FILE *fp, unsigned char* data, int width, int height);
00095
00096 static const int imageWidth = 640;
00097 static const int imageHeight = 480;
00098
00099 static SiftGPUWrapper* instance;
00100 SiftGPU* siftgpu;
00101 SiftMatchGPU *matcher;
00102 bool isMatcherInitialized;
00103 bool error;
00104 unsigned char* data;
00105 mutable QMutex gpu_mutex;
00106 };
00107
00108 #endif
00109