ocl.hpp
Go to the documentation of this file.
1 /*M///////////////////////////////////////////////////////////////////////////////////////
2 //
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 //
5 // By downloading, copying, installing or using the software you agree to this license.
6 // If you do not agree to this license, do not download, install,
7 // copy or use the software.
8 //
9 //
10 // License Agreement
11 // For Open Source Computer Vision Library
12 //
13 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
14 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
15 // Copyright (C) 2013, OpenCV Foundation, all rights reserved.
16 // Third party copyrights are property of their respective owners.
17 //
18 // Redistribution and use in source and binary forms, with or without modification,
19 // are permitted provided that the following conditions are met:
20 //
21 // * Redistribution's of source code must retain the above copyright notice,
22 // this list of conditions and the following disclaimer.
23 //
24 // * Redistribution's in binary form must reproduce the above copyright notice,
25 // this list of conditions and the following disclaimer in the documentation
26 // and/or other materials provided with the distribution.
27 //
28 // * The name of the copyright holders may not be used to endorse or promote products
29 // derived from this software without specific prior written permission.
30 //
31 // This software is provided by the copyright holders and contributors "as is" and
32 // any express or implied warranties, including, but not limited to, the implied
33 // warranties of merchantability and fitness for a particular purpose are disclaimed.
34 // In no event shall the Intel Corporation or contributors be liable for any direct,
35 // indirect, incidental, special, exemplary, or consequential damages
36 // (including, but not limited to, procurement of substitute goods or services;
37 // loss of use, data, or profits; or business interruption) however caused
38 // and on any theory of liability, whether in contract, strict liability,
39 // or tort (including negligence or otherwise) arising in any way out of
40 // the use of this software, even if advised of the possibility of such damage.
41 //
42 //M*/
43 
44 #ifndef __OPENCV_NONFREE_OCL_HPP__
45 #define __OPENCV_NONFREE_OCL_HPP__
46 
47 #include "opencv2/ocl/ocl.hpp"
48 
49 namespace cv
50 {
51  namespace ocl
52  {
55 
56  class CV_EXPORTS SURF_OCL : public cv::Feature2D
57  {
58  public:
60  {
61  X_ROW = 0,
68  ROWS_COUNT
69  };
70 
72  SURF_OCL();
74  explicit SURF_OCL(double _hessianThreshold, int _nOctaves = 4,
75  int _nOctaveLayers = 2, bool _extended = true, float _keypointsRatio = 0.01f, bool _upright = false);
76 
78  int descriptorSize() const;
79 
80  int descriptorType() const;
81 
83  void uploadKeypoints(const vector<cv::KeyPoint> &keypoints, oclMat &keypointsocl);
85  void downloadKeypoints(const oclMat &keypointsocl, vector<KeyPoint> &keypoints);
87  void downloadDescriptors(const oclMat &descriptorsocl, vector<float> &descriptors);
98  void operator()(const oclMat &img, const oclMat &mask, oclMat &keypoints);
101  void operator()(const oclMat &img, const oclMat &mask, oclMat &keypoints, oclMat &descriptors,
102  bool useProvidedKeypoints = false);
103  void operator()(const oclMat &img, const oclMat &mask, std::vector<KeyPoint> &keypoints);
104  void operator()(const oclMat &img, const oclMat &mask, std::vector<KeyPoint> &keypoints, oclMat &descriptors,
105  bool useProvidedKeypoints = false);
106  void operator()(const oclMat &img, const oclMat &mask, std::vector<KeyPoint> &keypoints, std::vector<float> &descriptors,
107  bool useProvidedKeypoints = false);
108 
110  void operator()(InputArray img, InputArray mask,
111  CV_OUT vector<KeyPoint>& keypoints) const;
113  void operator()(InputArray img, InputArray mask,
114  CV_OUT vector<KeyPoint>& keypoints,
116  bool useProvidedKeypoints=false) const;
117 
118  AlgorithmInfo* info() const;
119 
120  void releaseMemory();
121 
122  // SURF parameters
124  int nOctaves;
126  bool extended;
127  bool upright;
130  oclMat sum, mask1, maskSum, intBuffer;
131  oclMat det, trace;
133  protected:
134  void detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask) const;
135  void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors) const;
136  };
137  }
138 }
139 
140 #endif //__OPENCV_NONFREE_OCL_HPP__
int nOctaveLayers
Definition: ocl.hpp:125
KeypointLayout
Definition: ocl.hpp:59
Definition: ocl.hpp:63
oclMat maxPosBuffer
Definition: ocl.hpp:132
GLenum GLsizei GLenum GLenum const GLvoid * image
Definition: highgui_c.h:230
Definition: ocl.hpp:62
Proxy datatype for passing Mat's and vector<>'s as input parameters.
Definition: core.hpp:1312
GLint GLvoid * img
Definition: legacy.hpp:1150
Definition: ocl.hpp:65
Definition: ocl.hpp:66
oclMat sum
Definition: ocl.hpp:130
Definition: ocl.hpp:249
const CvArr CvSeq ** keypoints
Definition: compat.hpp:647
float keypointsRatio
max keypoints = min(keypointsRatio * img.size().area(), 65535)
Definition: ocl.hpp:129
Definition: features2d.hpp:249
Speeded up robust features, port from GPU module. /////////////////////////////// SURF //////////////...
Definition: ocl.hpp:56
The n-dimensional matrix class.
Definition: core.hpp:1688
const CvArr CvSeq CvSeq ** descriptors
Definition: compat.hpp:647
float hessianThreshold
Definition: ocl.hpp:123
Definition: core.hpp:4465
bool extended
Definition: ocl.hpp:126
bool upright
Definition: ocl.hpp:127
Definition: ocl.hpp:64
GLenum GLint GLuint mask
Definition: tracking.hpp:132
GLclampf f
int nOctaves
Definition: ocl.hpp:124
oclMat trace
Definition: ocl.hpp:131
Proxy datatype for passing Mat's and vector<>'s as input parameters.
Definition: core.hpp:1400
Definition: ocl.hpp:67