features2d.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 // Third party copyrights are property of their respective owners.
16 //
17 // Redistribution and use in source and binary forms, with or without modification,
18 // are permitted provided that the following conditions are met:
19 //
20 // * Redistribution's of source code must retain the above copyright notice,
21 // this list of conditions and the following disclaimer.
22 //
23 // * Redistribution's in binary form must reproduce the above copyright notice,
24 // this list of conditions and the following disclaimer in the documentation
25 // and/or other materials provided with the distribution.
26 //
27 // * The name of the copyright holders may not be used to endorse or promote products
28 // derived from this software without specific prior written permission.
29 //
30 // This software is provided by the copyright holders and contributors "as is" and
31 // any express or implied warranties, including, but not limited to, the implied
32 // warranties of merchantability and fitness for a particular purpose are disclaimed.
33 // In no event shall the Intel Corporation or contributors be liable for any direct,
34 // indirect, incidental, special, exemplary, or consequential damages
35 // (including, but not limited to, procurement of substitute goods or services;
36 // loss of use, data, or profits; or business interruption) however caused
37 // and on any theory of liability, whether in contract, strict liability,
38 // or tort (including negligence or otherwise) arising in any way out of
39 // the use of this software, even if advised of the possibility of such damage.
40 //
41 //M*/
42 
43 #ifndef __OPENCV_NONFREE_FEATURES_2D_HPP__
44 #define __OPENCV_NONFREE_FEATURES_2D_HPP__
45 
47 
48 #ifdef __cplusplus
49 
50 namespace cv
51 {
52 
58 class CV_EXPORTS_W SIFT : public Feature2D
59 {
60 public:
61  CV_WRAP explicit SIFT( int nfeatures=0, int nOctaveLayers=3,
62  double contrastThreshold=0.04, double edgeThreshold=10,
63  double sigma=1.6);
64 
66  CV_WRAP int descriptorSize() const;
67 
69  CV_WRAP int descriptorType() const;
70 
72  void operator()(InputArray img, InputArray mask,
73  vector<KeyPoint>& keypoints) const;
76  void operator()(InputArray img, InputArray mask,
77  vector<KeyPoint>& keypoints,
79  bool useProvidedKeypoints=false) const;
80 
81  AlgorithmInfo* info() const;
82 
83  void buildGaussianPyramid( const Mat& base, vector<Mat>& pyr, int nOctaves ) const;
84  void buildDoGPyramid( const vector<Mat>& pyr, vector<Mat>& dogpyr ) const;
85  void findScaleSpaceExtrema( const vector<Mat>& gauss_pyr, const vector<Mat>& dog_pyr,
86  vector<KeyPoint>& keypoints ) const;
87 
88 protected:
89  void detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;
90  void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const;
91 
92  CV_PROP_RW int nfeatures;
93  CV_PROP_RW int nOctaveLayers;
94  CV_PROP_RW double contrastThreshold;
95  CV_PROP_RW double edgeThreshold;
96  CV_PROP_RW double sigma;
97 };
98 
101 
107 class CV_EXPORTS_W SURF : public Feature2D
108 {
109 public:
111  CV_WRAP SURF();
113  explicit CV_WRAP SURF(double hessianThreshold,
114  int nOctaves=4, int nOctaveLayers=2,
115  bool extended=true, bool upright=false);
116 
118  CV_WRAP int descriptorSize() const;
119 
121  CV_WRAP int descriptorType() const;
122 
124  void operator()(InputArray img, InputArray mask,
125  CV_OUT vector<KeyPoint>& keypoints) const;
127  void operator()(InputArray img, InputArray mask,
128  CV_OUT vector<KeyPoint>& keypoints,
130  bool useProvidedKeypoints=false) const;
131 
132  AlgorithmInfo* info() const;
133 
134  CV_PROP_RW double hessianThreshold;
135  CV_PROP_RW int nOctaves;
136  CV_PROP_RW int nOctaveLayers;
137  CV_PROP_RW bool extended;
138  CV_PROP_RW bool upright;
139 
140 protected:
141 
142  void detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;
143  void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const;
144 };
145 
146 typedef SURF SurfFeatureDetector;
148 
149 } /* namespace cv */
150 
151 #endif /* __cplusplus */
152 
153 #endif
154 
155 /* End of file. */
CV_PROP_RW bool extended
Definition: features2d.hpp:137
SURF SurfDescriptorExtractor
Definition: features2d.hpp:147
CV_PROP_RW bool upright
Definition: features2d.hpp:138
CV_PROP_RW double sigma
Definition: features2d.hpp:96
SIFT SiftFeatureDetector
Definition: features2d.hpp:99
SIFT SiftDescriptorExtractor
Definition: features2d.hpp:100
GLenum GLsizei GLenum GLenum const GLvoid * image
Definition: highgui_c.h:230
Proxy datatype for passing Mat's and vector<>'s as input parameters.
Definition: core.hpp:1312
GLint GLvoid * img
Definition: legacy.hpp:1150
CV_PROP_RW int nfeatures
Definition: features2d.hpp:92
SIFT implementation.
Definition: features2d.hpp:58
const CvArr CvSeq ** keypoints
Definition: compat.hpp:647
SURF implementation.
Definition: features2d.hpp:107
Definition: features2d.hpp:249
The n-dimensional matrix class.
Definition: core.hpp:1688
const CvArr CvSeq CvSeq ** descriptors
Definition: compat.hpp:647
Definition: core.hpp:4465
CV_PROP_RW double hessianThreshold
Definition: features2d.hpp:134
SURF SurfFeatureDetector
Definition: features2d.hpp:146
CV_PROP_RW int nOctaveLayers
Definition: features2d.hpp:93
CV_PROP_RW int nOctaves
Definition: features2d.hpp:135
CV_PROP_RW double edgeThreshold
Definition: features2d.hpp:95
CV_PROP_RW int nOctaveLayers
Definition: features2d.hpp:136
GLenum GLint GLuint mask
Definition: tracking.hpp:132
CV_PROP_RW double contrastThreshold
Definition: features2d.hpp:94
Proxy datatype for passing Mat's and vector<>'s as input parameters.
Definition: core.hpp:1400