1 /*M///////////////////////////////////////////////////////////////////////////////////////
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
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.
11 // For Open Source Computer Vision Library
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.
17 // Redistribution and use in source and binary forms, with or without modification,
18 // are permitted provided that the following conditions are met:
20 // * Redistribution's of source code must retain the above copyright notice,
21 // this list of conditions and the following disclaimer.
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.
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.
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.
43 #include "precomp.hpp"
47 Ptr<Feature2D> Feature2D::create( const String& feature2DType )
49 return Algorithm::create<Feature2D>("Feature2D." + feature2DType);
52 /////////////////////// AlgorithmInfo for various detector & descriptors ////////////////////////////
55 All the AlgorithmInfo-related stuff should be in the same file as initModule_features2d().
56 Otherwise, linker may throw away some seemingly unused stuff.
59 CV_INIT_ALGORITHM(BRISK, "Feature2D.BRISK",
60 obj.info()->addParam(obj, "thres", obj.threshold);
61 obj.info()->addParam(obj, "octaves", obj.octaves))
63 ///////////////////////////////////////////////////////////////////////////////////////////////////////////
65 CV_INIT_ALGORITHM(FastFeatureDetector, "Feature2D.FAST",
66 obj.info()->addParam(obj, "threshold", obj.threshold);
67 obj.info()->addParam(obj, "nonmaxSuppression", obj.nonmaxSuppression);
68 obj.info()->addParam(obj, "type", obj.type))
71 ///////////////////////////////////////////////////////////////////////////////////////////////////////////
73 CV_INIT_ALGORITHM(MSER, "Feature2D.MSER",
74 obj.info()->addParam(obj, "delta", obj.delta);
75 obj.info()->addParam(obj, "minArea", obj.minArea);
76 obj.info()->addParam(obj, "maxArea", obj.maxArea);
77 obj.info()->addParam(obj, "maxVariation", obj.maxVariation);
78 obj.info()->addParam(obj, "minDiversity", obj.minDiversity);
79 obj.info()->addParam(obj, "maxEvolution", obj.maxEvolution);
80 obj.info()->addParam(obj, "areaThreshold", obj.areaThreshold);
81 obj.info()->addParam(obj, "minMargin", obj.minMargin);
82 obj.info()->addParam(obj, "edgeBlurSize", obj.edgeBlurSize))
84 ///////////////////////////////////////////////////////////////////////////////////////////////////////////
86 CV_INIT_ALGORITHM(ORB, "Feature2D.ORB",
87 obj.info()->addParam(obj, "nFeatures", obj.nfeatures);
88 obj.info()->addParam(obj, "scaleFactor", obj.scaleFactor);
89 obj.info()->addParam(obj, "nLevels", obj.nlevels);
90 obj.info()->addParam(obj, "firstLevel", obj.firstLevel);
91 obj.info()->addParam(obj, "edgeThreshold", obj.edgeThreshold);
92 obj.info()->addParam(obj, "patchSize", obj.patchSize);
93 obj.info()->addParam(obj, "WTA_K", obj.WTA_K);
94 obj.info()->addParam(obj, "scoreType", obj.scoreType))
96 ///////////////////////////////////////////////////////////////////////////////////////////////////////////
98 CV_INIT_ALGORITHM(GFTTDetector, "Feature2D.GFTT",
99 obj.info()->addParam(obj, "nfeatures", obj.nfeatures);
100 obj.info()->addParam(obj, "qualityLevel", obj.qualityLevel);
101 obj.info()->addParam(obj, "minDistance", obj.minDistance);
102 obj.info()->addParam(obj, "useHarrisDetector", obj.useHarrisDetector);
103 obj.info()->addParam(obj, "k", obj.k))
105 ///////////////////////////////////////////////////////////////////////////////////////////////////////////
107 CV_INIT_ALGORITHM(KAZE, "Feature2D.KAZE",
108 obj.info()->addParam(obj, "upright", obj.upright);
109 obj.info()->addParam(obj, "extended", obj.extended);
110 obj.info()->addParam(obj, "threshold", obj.threshold);
111 obj.info()->addParam(obj, "octaves", obj.octaves);
112 obj.info()->addParam(obj, "sublevels", obj.sublevels);
113 obj.info()->addParam(obj, "diffusivity", obj.diffusivity))
115 ///////////////////////////////////////////////////////////////////////////////////////////////////////////
117 CV_INIT_ALGORITHM(AKAZE, "Feature2D.AKAZE",
118 obj.info()->addParam(obj, "descriptor", obj.descriptor);
119 obj.info()->addParam(obj, "descriptor_channels", obj.descriptor_channels);
120 obj.info()->addParam(obj, "descriptor_size", obj.descriptor_size);
121 obj.info()->addParam(obj, "threshold", obj.threshold);
122 obj.info()->addParam(obj, "octaves", obj.octaves);
123 obj.info()->addParam(obj, "sublevels", obj.sublevels);
124 obj.info()->addParam(obj, "diffusivity", obj.diffusivity))
126 ///////////////////////////////////////////////////////////////////////////////////////////////////////////
130 CV_INIT_ALGORITHM(SimpleBlobDetector, "Feature2D.SimpleBlob",
131 obj.info()->addParam(obj, "thresholdStep", obj.params.thresholdStep);
132 obj.info()->addParam(obj, "minThreshold", obj.params.minThreshold);
133 obj.info()->addParam(obj, "maxThreshold", obj.params.maxThreshold);
134 obj.info()->addParam_(obj, "minRepeatability", (sizeof(size_t) == sizeof(uint64))?Param::UINT64 : Param::UNSIGNED_INT, &obj.params.minRepeatability, false, 0, 0);
135 obj.info()->addParam(obj, "minDistBetweenBlobs", obj.params.minDistBetweenBlobs);
136 obj.info()->addParam(obj, "filterByColor", obj.params.filterByColor);
137 obj.info()->addParam(obj, "blobColor", obj.params.blobColor);
138 obj.info()->addParam(obj, "filterByArea", obj.params.filterByArea);
139 obj.info()->addParam(obj, "maxArea", obj.params.maxArea);
140 obj.info()->addParam(obj, "filterByCircularity", obj.params.filterByCircularity);
141 obj.info()->addParam(obj, "maxCircularity", obj.params.maxCircularity);
142 obj.info()->addParam(obj, "filterByInertia", obj.params.filterByInertia);
143 obj.info()->addParam(obj, "maxInertiaRatio", obj.params.maxInertiaRatio);
144 obj.info()->addParam(obj, "filterByConvexity", obj.params.filterByConvexity);
145 obj.info()->addParam(obj, "maxConvexity", obj.params.maxConvexity);
148 ///////////////////////////////////////////////////////////////////////////////////////////////////////////
150 class CV_EXPORTS HarrisDetector : public GFTTDetector
153 HarrisDetector( int maxCorners=1000, double qualityLevel=0.01, double minDistance=1,
154 int blockSize=3, bool useHarrisDetector=true, double k=0.04 );
155 AlgorithmInfo* info() const;
158 inline HarrisDetector::HarrisDetector( int _maxCorners, double _qualityLevel, double _minDistance,
159 int _blockSize, bool _useHarrisDetector, double _k )
160 : GFTTDetector( _maxCorners, _qualityLevel, _minDistance, _blockSize, _useHarrisDetector, _k ) {}
162 CV_INIT_ALGORITHM(HarrisDetector, "Feature2D.HARRIS",
163 obj.info()->addParam(obj, "nfeatures", obj.nfeatures);
164 obj.info()->addParam(obj, "qualityLevel", obj.qualityLevel);
165 obj.info()->addParam(obj, "minDistance", obj.minDistance);
166 obj.info()->addParam(obj, "useHarrisDetector", obj.useHarrisDetector);
167 obj.info()->addParam(obj, "k", obj.k))
169 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
171 CV_INIT_ALGORITHM(BFMatcher, "DescriptorMatcher.BFMatcher",
172 obj.info()->addParam(obj, "normType", obj.normType);
173 obj.info()->addParam(obj, "crossCheck", obj.crossCheck))
175 CV_INIT_ALGORITHM(FlannBasedMatcher, "DescriptorMatcher.FlannBasedMatcher",)
177 ///////////////////////////////////////////////////////////////////////////////////////////////////////////
179 bool cv::initModule_features2d(void)
182 all &= !BRISK_info_auto.name().empty();
183 all &= !FastFeatureDetector_info_auto.name().empty();
184 all &= !MSER_info_auto.name().empty();
185 all &= !ORB_info_auto.name().empty();
186 all &= !GFTTDetector_info_auto.name().empty();
187 all &= !KAZE_info_auto.name().empty();
188 all &= !AKAZE_info_auto.name().empty();
189 all &= !HarrisDetector_info_auto.name().empty();
190 all &= !BFMatcher_info_auto.name().empty();
191 all &= !FlannBasedMatcher_info_auto.name().empty();