Adds descriptors to train a descriptor collection. If the collection ``trainDescCollectionis`` is not empty, the new descriptors are added to existing train descriptors.
Trains a descriptor matcher (for example, the flann index). In all methods to match, the method ``train()`` is run every time before matching. Some descriptor matchers (for example, ``BruteForceMatcher``) have an empty implementation of this method. Other matchers really train their inner structures (for example, ``FlannBasedMatcher`` trains ``flann::Index`` ).
Finds the best match for each descriptor from a query set with train descriptors. Query descriptors are supposed to belong?? to keypoints detected on the same query image. In the first variant of this method, train descriptors are set as an input argument and are supposed to belong to keypoints detected on the same train image. In the second variant of the method, train descriptors collection that was set by ``addmethod`` is used. Optional mask (or masks) can be set to describe descriptors that can be matched. ``queryDescriptors[i]`` can be matched with ``trainDescriptors[j]`` only if ``mask.at<uchar>(i,j)`` is non-zero.??
Find the best match for each descriptor from a query set.
:param queryDescriptors:Query set of descriptors.
@ -174,45 +174,51 @@ DescriptorMatcher::match
:param masks:Set of masks. Each ``masks[i]`` specifies permissible matches between input query descriptors and stored train descriptors from the i-th image ``trainDescCollection[i]``.
In the first variant of this method, the train descriptors are passed as an input argument. In the second variant of the method, train descriptors collection that was set by ``DescriptorMatcher::add`` is used. Optional mask (or masks) can be passed to specify, which query and training descriptors can be matched. Namely, ``queryDescriptors[i]`` can be matched with ``trainDescriptors[j]`` only if ``mask.at<uchar>(i,j)`` is non-zero.
Finds the k best matches for each descriptor from a query set with train descriptors. Found k (or less if not possible) matches are returned in the distance increasing order. See the details about query and train descriptors in ??.
:param matches:Mathes. Each ``matches[i]`` is k or less matches for the same query descriptor.
:param k:Count of best matches found per each query descriptor (or less if it is not possible).
:param k:Count of best matches found per each query descriptor (or less if some query descriptor has less than k possible matches in total).
:param compactResult:Parameter that is used when the mask (or masks) is not empty. If ``compactResult`` is false, the ``matches`` vector has the same size as ``queryDescriptors`` rows. If ``compactResult`` is true, the ``matches`` vector does not contain matches for fully masked-out query descriptors.
These are extended variants of :cpp:func:`DescriptorMatcher::match` methods. They find several best matches for each query descriptor. The matches are returned in the distance increasing order. See :cpp:func:`DescriptorMatcher::match` for the details about query and train descriptors.
Finds the best matches for each query descriptor that has a distance smaller than the given threshold. Found matches are returned in the distance increasing order. See the details about query and train descriptors in ??.
:param maxDistance:Threshold for found match distances.
:param maxDistance:Threshold on the distance between matched descriptors.
For each query descriptor the methods find all the training descriptors such that the distance between the query descriptor and the training descriptor is equal or smaller than ``maxDistance``. Found matches are returned in the distance increasing order.
Now the following matcher types are supported: ``BruteForce`` (it uses ``L2`` ), ``BruteForce-L1`` ,``BruteForce-Hamming`` ,``BruteForce-HammingLUT`` , and ``FlannBased`` .
:param descriptorMatcherType:Descriptor matcher type. Now the following matcher types are supported:
* ``BruteForce`` (it uses ``L2`` ),
* ``BruteForce-L1``,
* ``BruteForce-Hamming``,
* ``BruteForce-HammingLUT``, and
* ``FlannBased``.
..index:: BruteForceMatcher
@ -256,7 +265,7 @@ Brute-force descriptor matcher. For each descriptor in the first set, this match
}
For efficiency, ``BruteForceMatcher`` is used as a template for the distance metric??. For float descriptors, ``L2<float>`` is a common choice. The following distances are supported: ::
For efficiency, ``BruteForceMatcher`` is used as a template, parameterized with the distance type. For float descriptors, ``L2<float>`` is a common choice. The following distances are supported: ::
Creates a feature detector of a given type with the default parameters (using the default constructor).??
Creates a feature detector by its name.
:param detectorType:Feature detector type.
@ -174,7 +174,7 @@ for example: ``"GridFAST"``, ``"PyramidSTAR"`` .
FastFeatureDetector
-------------------
..c:type:: FastFeatureDetector
..cpp:class:: FastFeatureDetector
Wrapping class for feature detection using the
:ref:`FAST` method ::
@ -196,7 +196,7 @@ Wrapping class for feature detection using the
GoodFeaturesToTrackDetector
---------------------------
..c:type:: GoodFeaturesToTrackDetector
..cpp:class:: GoodFeaturesToTrackDetector
Wrapping class for feature detection using the
:ref:`goodFeaturesToTrack` function ::
@ -239,7 +239,7 @@ Wrapping class for feature detection using the
MserFeatureDetector
-------------------
..c:type:: MserFeatureDetector
..cpp:class:: MserFeatureDetector
Wrapping class for feature detection using the
:ref:`MSER` class ::
@ -265,7 +265,7 @@ Wrapping class for feature detection using the
StarFeatureDetector
-------------------
..c:type:: StarFeatureDetector
..cpp:class:: StarFeatureDetector
Wrapping class for feature detection using the
:ref:`StarDetector` class ::
@ -289,7 +289,7 @@ Wrapping class for feature detection using the
SiftFeatureDetector
-------------------
..c:type:: SiftFeatureDetector
..cpp:class:: SiftFeatureDetector
Wrapping class for feature detection using the
:ref:`SIFT` class ::
@ -318,7 +318,7 @@ Wrapping class for feature detection using the
SurfFeatureDetector
-------------------
..c:type:: SurfFeatureDetector
..cpp:class:: SurfFeatureDetector
Wrapping class for feature detection using the
:ref:`SURF` class ::
@ -341,7 +341,7 @@ Wrapping class for feature detection using the
GridAdaptedFeatureDetector
--------------------------
..c:type:: GridAdaptedFeatureDetector
..cpp:class:: GridAdaptedFeatureDetector
Class adapting a detector to partition the source image into a grid and detect points in each cell ::
@ -371,7 +371,7 @@ Class adapting a detector to partition the source image into a grid and detect p
PyramidAdaptedFeatureDetector
-----------------------------
..c:type:: PyramidAdaptedFeatureDetector
..cpp:class:: PyramidAdaptedFeatureDetector
Class adapting a detector to detect points over multiple levels of a Gaussian pyramid. Consider using this class for detectors that are not inherently scaled. ::
@ -392,14 +392,14 @@ Class adapting a detector to detect points over multiple levels of a Gaussian py
DynamicAdaptedFeatureDetector
-----------------------------
..c:type:: DynamicAdaptedFeatureDetector
..cpp:class:: DynamicAdaptedFeatureDetector
Adaptively adjusting detector that iteratively detects features until the desired number is found ::
class DynamicAdaptedFeatureDetector: public FeatureDetector
..c:function:: DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector( const Ptr<AdjusterAdapter>\& adjaster, int min_features, int max_features, int max_iters )
..cpp:function:: DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector( const Ptr<AdjusterAdapter>& adjuster, int min_features, int max_features, int max_iters )
``DynamicAdaptedFeatureDetector`` constructor
The class constructor
:param adjaster::ref:`AdjusterAdapter` that detects features and adjusts parameters.??parameter formatting is broken here
:param adjuster::ref:`AdjusterAdapter` that detects features and adjusts parameters.
:param min_features:Minimum desired number of features.
Class providing an interface for adjusting parameters of a feature detector. This interface is used by :ref:`DynamicAdaptedFeatureDetector` . It is a wrapper for :ref:`FeatureDetector` that enables adjusting parameters after detection.?? ::
Class providing an interface for adjusting parameters of a feature detector. This interface is used by :ref:`DynamicAdaptedFeatureDetector` . It is a wrapper for :ref:`FeatureDetector` that enables adjusting parameters after feature detection. ::
class AdjusterAdapter: public FeatureDetector
{
@ -479,9 +478,9 @@ See
AdjusterAdapter::tooFew
---------------------------
..c:function:: virtual void tooFew(int min, int n_detected) = 0
..cpp:function:: void AdjusterAdapter::tooFew(int min, int n_detected)
Adjusts the detector parameters to detect more features.
Adjusts the detector parameters to detect more features.
:param min:Minimum desired number of features.
@ -499,7 +498,7 @@ Example: ::
AdjusterAdapter::tooMany
----------------------------
..c:function:: virtual void tooMany(int max, int n_detected) = 0
..cpp:function:: void AdjusterAdapter::tooMany(int max, int n_detected)
Adjusts the detector parameters to detect less features.
Class adapting a detector to detect points over multiple levels of a Gaussian pyramid. Consider using this class for detectors that are not inherently scaled. ::
class PyramidAdaptedFeatureDetector : public FeatureDetector
..c:function:: DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector( const Ptr<AdjusterAdapter>\& adjaster, int min_features, int max_features, int max_iters )
Provides the ``DynamicAdaptedFeatureDetector`` constructor.??
:param adjaster::ref:`AdjusterAdapter` that detects features and adjusts parameters.??formatting issue again
:param min_features:Minimum desired number of features.
:param max_features:Maximum desired number of features.
:param max_iters:Maximum number of times to try adjusting the feature detector parameters. For :ref:`FastAdjuster` , this number can be high, but with ``Star`` or ``Surf`` many iterations can be time-consuming. At each iteration the detector is rerun.
..index:: AdjusterAdapter
AdjusterAdapter
---------------
..c:type:: AdjusterAdapter
Class providing an interface for adjusting parameters of a feature detector. This interface is used by :ref:`DynamicAdaptedFeatureDetector` . It is a wrapper for :ref:`FeatureDetector` that enables adjusting parameters after detection. ::
class AdjusterAdapter: public FeatureDetector
{
public:
virtual ~AdjusterAdapter() {}
virtual void tooFew(int min, int n_detected) = 0;
virtual void tooMany(int max, int n_detected) = 0;
virtual bool good() const = 0;
};
See
:ref:`FastAdjuster`,
:ref:`StarAdjuster`,
:ref:`SurfAdjuster` for concrete implementations.
..index:: AdjusterAdapter::tooFew
AdjusterAdapter::tooFew
---------------------------
..c:function:: virtual void tooFew(int min, int n_detected) = 0
Adjusts the detector parameters to detect more features.
:param min:Minimum desired number of features.
:param n_detected:Number of features detected during the latest run.
Example: ::
void FastAdjuster::tooFew(int min, int n_detected)
{
thresh_--;
}
..index:: AdjusterAdapter::tooMany
AdjusterAdapter::tooMany
----------------------------
..c:function:: virtual void tooMany(int max, int n_detected) = 0
Adjusts the detector parameters to detect less features.
:param max:Maximum desired number of features.
:param n_detected:Number of features detected during the latest run.
Example: ::
void FastAdjuster::tooMany(int min, int n_detected)
{
thresh_++;
}
..index:: AdjusterAdapter::good
AdjusterAdapter::good
-------------------------
..c:function:: virtual bool good() const = 0
Are params maxed out or still valid?? Returns false if the parameters cannot be adjusted any more.
Example: ::
bool FastAdjuster::good() const
{
return (thresh > 1) && (thresh < 200);
}
..index:: FastAdjuster
FastAdjuster
------------
..c:type:: FastAdjuster
:ref:`AdjusterAdapter` for :ref:`FastFeatureDetector`. This class decrements or increments the threshhld by 1. ::
class FastAdjuster FastAdjuster: public AdjusterAdapter
@ -16,7 +16,7 @@ There are descriptors such as the One-way descriptor and Ferns that have the ``G
GenericDescriptorMatcher
------------------------
..c:type:: GenericDescriptorMatcher
..cpp:class:: GenericDescriptorMatcher
Abstract interface for extracting and matching a keypoint descriptor. There are also :ref:`DescriptorExtractor` and :ref:`DescriptorMatcher` for these purposes but their interfaces are intended for descriptors represented as vectors in a multidimensional space. ``GenericDescriptorMatcher`` is a more generic interface for descriptors. :ref:`DescriptorMatcher` and ``GenericDescriptorMatcher`` have two groups of match methods: for matching keypoints of an image with another image or with an image set. ::
@ -84,9 +84,9 @@ Abstract interface for extracting and matching a keypoint descriptor. There are
Adds images and their keypoints to a train collection (descriptors are supposed to be calculated here). If the train collection is not empty, a new image and its keypoints is added to existing data.??
Adds images and their keypoints to the training collection, stored in the class instance.
Classifies query keypoints under keypoints of a train image qiven as an input argument (first version of the method) or a train image collection (second version).??
:param trainKeypoints:Keypoints from the train image.
The method classify each keypoint from the query set. The first variant of method takes the training image and its keypoints as an input argument. The second variant uses the internally stored training collection, which can be built using ``GenericDescriptorMatcher::add`` method.
The methods do the following:
#.
They call ``GenericDescriptorMatcher::match`` method to find correspondence between the query set and the training set.
#.
``class_id`` field of each keypoint from the query set is set to ``class_id`` of the corresponding keypoint from the training set.
Finds the best match for query keypoints to the training set. In the first version of the method, a train image and keypoints detected on it are input arguments. In the second version, query keypoints are matched to a training collection set using ??. As in the mask can be set.??
:param masks:Set of masks. Each ``masks[i]`` specifies permissible matches between input query keypoints and stored train keypoints from the i-th image.
The methods find the best match for each query keypoint. In the first variant of the method, a train image and its keypoints are the input arguments. In the second variant, query keypoints are matched to the internally stored training collection, which can be built using ``GenericDescriptorMatcher::add`` method. Optional mask (or masks) can be passed to specify, which query and training descriptors can be matched. Namely, ``queryKeypoints[i]`` can be matched with ``trainKeypoints[j]`` only if ``mask.at<uchar>(i,j)`` is non-zero.
Finds the knn best matches for each keypoint from a query set with train keypoints. Found knn (or less if not possible) matches are returned in the distance increasing order. See details in ??.
Find the ``k`` best matches for each query keypoint.
The methods are extended variants of ``GenericDescriptorMatch::match``. The parameters are similar, and the the semantics is similar to ``DescriptorMatcher::knnMatch``, except that this class does not require explicitly computed keypoint descriptors.
Finds the best matches for each query keypoint that has a distance smaller than the given threshold. Found matches are returned in the distance increasing order. See details see in ??.
For each query keypoint, find the training keypoints not farther than the specified distance.
Returns the count of all descriptors stored in the training set.
@ -71,7 +71,7 @@ BOWTrainer::cluster
Clusters train descriptors. The vocabulary consists of cluster centers. So, this method returns the vocabulary. In the first variant of the method, train descriptors stored in the object are clustered. In the second variant, input descriptors are clustered.
..c:function:: Mat BOWTrainer::cluster( const Mat\& descriptors ) const
..c:function:: Mat BOWTrainer::cluster( const Mat& descriptors ) const
:param descriptors:Descriptors to cluster. Each row of the ``descriptors`` matrix is a descriptor. Descriptors are not added to the inner train descriptor set.
@ -81,7 +81,7 @@ BOWTrainer::cluster
BOWKMeansTrainer
----------------
..c:type:: BOWKMeansTrainer
..cpp:class:: BOWKMeansTrainer
:ref:`kmeans` -based class to train visual vocabulary using the *bag of visual words* approach ::
@ -111,13 +111,15 @@ arguments.
BOWImgDescriptorExtractor
-------------------------
..c:type:: BOWImgDescriptorExtractor
..cpp:class:: BOWImgDescriptorExtractor
Class to compute an image descriptor using the ''bag of visual words''. Such a computation consists of the following steps:
#. Compute descriptors for a given image and its keypoints set.
#. Find the nearest visual words from the vocabulary for each keypoint descriptor.
#. Image descriptor is a normalized histogram of vocabulary words encountered in the image. This means that the ``i`` -th bin of the histogram is a frequency of ``i`` -th word of the vocabulary in the given image.??this is not a step ::
#. Compute the bag-of-words image descriptor as is a normalized histogram of vocabulary words encountered in the image. The ``i``-th bin of the histogram is a frequency of ``i``-th word of the vocabulary in the given image.
Here is the class declaration ::
class BOWImgDescriptorExtractor
{
@ -144,9 +146,9 @@ Class to compute an image descriptor using the ''bag of visual words''. Such a c
@ -235,9 +235,7 @@ The function finds the most prominent corners in the image or in the specified i
:func:`cornerHarris` .
#.
Function performs a non-maximum?? suppression (the local maximums in
:math:`3\times 3` neighborhood
are retained).
Function performs a non-maximum suppression (the local maximums in *3 x 3* neighborhood are retained).
#.
The corners with the minimal eigenvalue less than
@ -247,10 +245,7 @@ The function finds the most prominent corners in the image or in the specified i
The remaining corners are sorted by the quality measure in the descending order.
#.
Function throws away each corner
:math:`pt_j` if there is a stronger corner
:math:`pt_i` (
:math:`i < j` ) so that the distance between them is less than ``minDistance`` .
Then the function throws away each corner for which there is a stronger corner at a distance less than ``maxDistance``.
The function can be used to initialize a point-based tracker of an object.
@ -278,7 +273,7 @@ HoughCircles
:param circles:Output vector of found circles. Each vector is encoded as a 3-element floating-point vector :math:`(x, y, radius)` .
:param method:desc required?? Currently, the only implemented method is ``CV_HOUGH_GRADIENT`` , which is basically *21HT* , described in Yuen90 .
:param method:The detection method to use. Currently, the only implemented method is ``CV_HOUGH_GRADIENT`` , which is basically *21HT* , described in [Yuen90].
:param dp:Inverse ratio of the accumulator resolution to the image resolution. For example, if ``dp=1`` , the accumulator has the same resolution as the input image. If ``dp=2`` , the accumulator has half as big width and height.
@ -286,7 +281,7 @@ HoughCircles
:param param1:The first method-specific parameter. In case of ``CV_HOUGH_GRADIENT`` , it is the higher threshold of the two passed to the :func:`Canny` edge detector (the lower one is twice smaller).
:param param2:The second method-specific parameter. In case of ``CV_HOUGH_GRADIENT`` , it is the accumulator threshold at the center of ?? detection stage. The smaller it is, the more false circles may be detected. Circles, corresponding to the larger accumulator values, will be returned first
:param param2:The second method-specific parameter. In case of ``CV_HOUGH_GRADIENT`` , it is the accumulator threshold for the circle centers at the detection stage. The smaller it is, the more false circles may be detected. Circles, corresponding to the larger accumulator values, will be returned first