00001
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #ifndef ASRL_GPU_SURF_DETECTOR
00045 #define ASRL_GPU_SURF_DETECTOR
00046
00047 #include <vector>
00048 #include <opencv/cxtypes.h>
00049 #include <opencv/cxcore.h>
00050 #include <opencv/cv.h>
00051 #include <opencv/cv.hpp>
00052
00053 #ifdef WIN32
00054 # ifdef gpusurf_EXPORTS
00055 # define GPUSURF_API __declspec(dllexport)
00056 # else
00057
00058 # define GPUSURF_API
00059 # endif
00060 #else
00061 # define GPUSURF_API
00062 #endif
00063
00064 namespace asrl {
00065
00066
00067 class GpuSurfDetectorInternal;
00068
00076 struct GpuSurfConfiguration {
00077
00082 GpuSurfConfiguration() :
00083 threshold(0.1f),
00084 nOctaves(4),
00085 nIntervals(4),
00086 initialScale(2.f),
00087 l1(3.f/1.5f),
00088 l2(5.f/1.5f),
00089 l3(3.f/1.5f),
00090 l4(1.f/1.5f),
00091 edgeScale(0.81f),
00092 initialStep(1),
00093 targetFeatures(1000),
00094 detector_threads_x(8),
00095 detector_threads_y(8),
00096 nonmax_threads_x(8),
00097 nonmax_threads_y(8)
00098 {
00099
00100 }
00101
00103 float threshold;
00105 int nOctaves;
00107 int nIntervals;
00109 float initialScale;
00110
00112 float l1;
00114 float l2;
00116 float l3;
00118 float l4;
00120 float edgeScale;
00122 int initialStep;
00125 int targetFeatures;
00127 int detector_threads_x;
00129 int detector_threads_y;
00131 int nonmax_threads_x;
00133 int nonmax_threads_y;
00134
00135 };
00136
00205 class GpuSurfDetector
00206 {
00207 public:
00208
00215 GPUSURF_API GpuSurfDetector(GpuSurfConfiguration config = GpuSurfConfiguration());
00216
00221 GPUSURF_API virtual ~GpuSurfDetector();
00222
00230 GPUSURF_API void buildIntegralImage(cv::Mat & image);
00231
00236 GPUSURF_API void detectKeypoints();
00237
00242 GPUSURF_API void findOrientation();
00243
00249 GPUSURF_API void findOrientationFast();
00250
00255 GPUSURF_API void computeDescriptors();
00256
00261 GPUSURF_API void computeUprightDescriptors();
00262
00268 GPUSURF_API void getKeypoints(std::vector<cv::KeyPoint> & outKeypoints);
00269
00276 GPUSURF_API void getDescriptors(std::vector<float> & outDescriptors);
00277
00283 GPUSURF_API int descriptorSize();
00284
00285
00291 GPUSURF_API void setKeypoints(std::vector<cv::KeyPoint> const & inKeypoints);
00292
00298 GPUSURF_API void saveIntegralImage(std::string const & basename);
00299 private:
00303 GpuSurfDetector(const GpuSurfDetector & rhs);
00307 GpuSurfDetector & operator=(const GpuSurfDetector & rhs);
00309 GpuSurfDetectorInternal * m_implementation;
00310 };
00311
00312 }
00313
00314
00315 #endif // ASRL_GPU_SURF_DETECTOR