Commit f80c93aa authored by Elena Fedotova's avatar Elena Fedotova

Purpose: updated the feature2d chapter

parent 94760a5f
......@@ -162,19 +162,19 @@ DescriptorMatcher::match
.. cpp:function:: void DescriptorMatcher::match( const Mat& queryDescriptors, vector<DMatch>& matches, const vector<Mat>& masks=vector<Mat>() )
Find the best match for each descriptor from a query set.
Finds the best match for each descriptor from a query set.
:param queryDescriptors: Query set of descriptors.
:param trainDescriptors: Train set of descriptors. This set is not added to the train descriptors collection stored in the class object.
:param matches: Matches. If a query descriptor masked out in ``mask`` , no match is added for this descriptor. So, ``matches`` size may be smaller than the query descriptors count.
:param matches: Matches. If a query descriptor is masked out in ``mask`` , no match is added for this descriptor. So, ``matches`` size may be smaller than the query descriptors count.
:param mask: Mask specifying permissible matches between an input query and train matrices of descriptors.
: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.
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.
.. index:: DescriptorMatcher::knnMatch
......@@ -184,17 +184,17 @@ DescriptorMatcher::knnMatch
.. cpp:function:: void DescriptorMatcher::knnMatch( const Mat& queryDescriptors, vector<vector<DMatch> >& matches, int k, const vector<Mat>& masks=vector<Mat>(), bool compactResult=false )
Find the k best matches for each descriptor from a query set.
Finds the k best matches for each descriptor from a query set.
:param queryDescriptors, trainDescriptors, mask, masks: See :ref:`DescriptorMatcher::match` .
:param matches: Mathes. Each ``matches[i]`` is k or less matches for the same query descriptor.
:param matches: Matches. 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 some query descriptor has less than k possible matches in total).
:param k: Count of best matches found per each query descriptor or less if a 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.
These extended variants of :cpp:func:`DescriptorMatcher::match` methods 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.
.. index:: DescriptorMatcher::radiusMatch
......@@ -204,15 +204,15 @@ DescriptorMatcher::radiusMatch
.. cpp:function:: void DescriptorMatcher::radiusMatch( const Mat& queryDescriptors, vector<vector<DMatch> >& matches, float maxDistance, const vector<Mat>& masks=vector<Mat>(), bool compactResult=false )
For each query descriptor, find the training descriptors not farther than the specified distance.
For each query descriptor, finds the training descriptors not farther than the specified distance.
:param queryDescriptors, trainDescriptors, mask, masks: See :ref:`DescriptorMatcher::match` .
:param queryDescriptors, trainDescriptors, mask, masks: See :cpp:func:`DescriptorMatcher::match`.??look at the output - the 1st paarm is omitted
:param matches, compactResult: See :ref:`DescriptorMatcher::knnMatch` .
:param matches, compactResult: See :cpp:func:`DescriptorMatcher::knnMatch`.??look at the output - the 1st paarm is omitted
:param maxDistance: Threshold on the distance between matched descriptors.
:param maxDistance: Threshold for 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.
For each query descriptor, the methods find such training descriptors 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.
.. index:: DescriptorMatcher::clone
......@@ -235,11 +235,17 @@ DescriptorMatcher::create
Creates a descriptor matcher of a given type with the default parameters (using default constructor).
:param descriptorMatcherType: Descriptor matcher type. Now the following matcher types are supported:
* ``BruteForce`` (it uses ``L2`` ),
* ``BruteForce-L1``,
* ``BruteForce-Hamming``,
* ``BruteForce-HammingLUT``, and
* ``FlannBased``.
*
``BruteForce`` (it uses ``L2`` )
*
``BruteForce-L1``
*
``BruteForce-Hamming``
*
``BruteForce-HammingLUT``
*
``FlannBased``
.. index:: BruteForceMatcher
......@@ -249,7 +255,7 @@ BruteForceMatcher
-----------------
.. c:type:: BruteForceMatcher
Brute-force descriptor matcher. For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. This descriptor matcher supports masking permissible matches between descriptor sets. ::
Brute-force descriptor matcher. For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. This descriptor matcher supports masking permissible matches of descriptor sets. ::
template<class Distance>
class BruteForceMatcher : public DescriptorMatcher
......@@ -265,7 +271,7 @@ Brute-force descriptor matcher. For each descriptor in the first set, this match
}
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: ::
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: ::
template<typename T>
struct Accumulator
......@@ -335,7 +341,7 @@ FlannBasedMatcher
-----------------
.. c:type:: FlannBasedMatcher
Flann-based descriptor matcher. This matcher trains :ref:`flann::Index` on a train descriptor collection and calls its nearest search methods to find the best matches. So, this matcher may be faster in cases of matching a large train collection than the brute force matcher. ``FlannBasedMatcher`` does not support masking permissible matches between descriptor sets because :ref:`flann::Index` does not support this. ::
Flann-based descriptor matcher. This matcher trains :ref:`flann::Index` on a train descriptor collection and calls its nearest search methods to find the best matches. So, this matcher may be faster when matching a large train collection than the brute force matcher. ``FlannBasedMatcher`` does not support masking permissible matches of descriptor sets because :cpp:func:`flann::Index` does not support this. ::
class FlannBasedMatcher : public DescriptorMatcher
{
......
......@@ -413,7 +413,7 @@ panorama series.
with the help of ``AdjusterAdapter`` .
If the detected number of features is not large enough,
``AdjusterAdapter`` adjusts the detection parameters so that the next detection
results in bigger or smaller number of features. This is repeated until either the number of desired features are found
results in a bigger or smaller number of features. This is repeated until either the number of desired features are found
or the parameters are maxed out.
Adapters can be easily implemented for any detector via the
......@@ -439,7 +439,7 @@ DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector
----------------------------------------------------------------
.. cpp:function:: DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector( const Ptr<AdjusterAdapter>& adjuster, int min_features, int max_features, int max_iters )
The class constructor
Constructs the class.
:param adjuster: :ref:`AdjusterAdapter` that detects features and adjusts parameters.
......@@ -537,7 +537,7 @@ FastAdjuster
.. cpp:class:: FastAdjuster
:ref:`AdjusterAdapter` for :ref:`FastFeatureDetector`. This class decreases or increases the threshold value by 1 ::
:ref:`AdjusterAdapter` for :ref:`FastFeatureDetector`. This class decreases or increases the threshold value by 1. ::
class FastAdjuster FastAdjuster: public AdjusterAdapter
{
......@@ -553,7 +553,7 @@ StarAdjuster
.. cpp:class:: StarAdjuster
:ref:`AdjusterAdapter` for :ref:`StarFeatureDetector` . This class adjusts the ``responseThreshhold`` of ``StarFeatureDetector`` . ::
:ref:`AdjusterAdapter` for :ref:`StarFeatureDetector`. This class adjusts the ``responseThreshhold`` of ``StarFeatureDetector``. ::
class StarAdjuster: public AdjusterAdapter
{
......@@ -568,7 +568,7 @@ SurfAdjuster
.. cpp:class:: SurfAdjuster
:ref:`AdjusterAdapter` for :ref:`SurfFeatureDetector` . This class adjusts the ``hessianThreshold`` of ``SurfFeatureDetector`` . ::
:ref:`AdjusterAdapter` for :ref:`SurfFeatureDetector`. This class adjusts the ``hessianThreshold`` of ``SurfFeatureDetector``. ::
class SurfAdjuster: public SurfAdjuster
{
......
......@@ -7,10 +7,9 @@ Matchers of keypoint descriptors in OpenCV have wrappers with a common interface
between different algorithms solving the same problem. This section is devoted to matching descriptors
that cannot be represented as vectors in a multidimensional space. ``GenericDescriptorMatcher`` is a more generic interface for descriptors. It does not make any assumptions about descriptor representation.
Every descriptor with the
:ref:`DescriptorExtractor` interface has a wrapper with the ``GenericDescriptorMatcher`` interface (see
:ref:`VectorDescriptorMatcher` ).
There are descriptors such as the One-way descriptor and Ferns that have the ``GenericDescriptorMatcher`` interface implemented but do not support
:ref:`DescriptorExtractor` .
:cpp:class:`DescriptorExtractor` interface has a wrapper with the ``GenericDescriptorMatcher`` interface (see
:cpp:class:`VectorDescriptorMatcher` ).
There are descriptors such as the One-way descriptor and Ferns that have the ``GenericDescriptorMatcher`` interface implemented but do not support ``DescriptorExtractor``.
.. index:: GenericDescriptorMatcher
......@@ -86,7 +85,7 @@ GenericDescriptorMatcher::add
---------------------------------
.. cpp:function:: void GenericDescriptorMatcher::add( const vector<Mat>& images, vector<vector<KeyPoint> >& keypoints )
Adds images and their keypoints to the training collection, stored in the class instance.
Adds images and their keypoints to the training collection stored in the class instance.
:param images: Image collection.
......@@ -140,25 +139,25 @@ GenericDescriptorMatcher::classify
.. cpp:function:: void GenericDescriptorMatcher::classify( const Mat& queryImage, vector<KeyPoint>& queryKeypoints )
Classify keypoints from the query set.
Classify keypoints from a query set.
:param queryImage: Query image.
:param queryKeypoints: Keypoints from the query image.
:param queryKeypoints: Keypoints from a query image.
:param trainImage: Train image.
:param trainKeypoints: Keypoints from the train image.
:param trainKeypoints: Keypoints from a 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 method classifies each keypoint from a query set. The first variant of the method takes a train image and its keypoints as an input argument. The second variant uses the internally stored training collection that can be built using the ``GenericDescriptorMatcher::add`` method.
The methods do the following:
#.
They call ``GenericDescriptorMatcher::match`` method to find correspondence between the query set and the training set.
Call the ``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.
Sey the ``class_id`` field of each keypoint from the query set to ``class_id`` of the corresponding keypoint from the training set.
.. index:: GenericDescriptorMatcher::match
......@@ -184,7 +183,7 @@ GenericDescriptorMatcher::match
: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.
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 that 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.
.. index:: GenericDescriptorMatcher::knnMatch
......@@ -196,7 +195,7 @@ GenericDescriptorMatcher::knnMatch
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.
The methods are extended variants of ``GenericDescriptorMatch::match``. The parameters are similar, and the the semantics is similar to ``DescriptorMatcher::knnMatch``. But this class does not require explicitly computed keypoint descriptors.
.. index:: GenericDescriptorMatcher::radiusMatch
......@@ -208,7 +207,7 @@ GenericDescriptorMatcher::radiusMatch
For each query keypoint, find the training keypoints not farther than the specified distance.
The methods are similar to ``DescriptorMatcher::radiusMatch``, except that this class does not require explicitly computed keypoint descriptors.
The methods are similar to ``DescriptorMatcher::radiusM. But this class does not require explicitly computed keypoint descriptors.
.. index:: GenericDescriptorMatcher::read
......
......@@ -9,6 +9,7 @@ drawMatches
.. cpp:function:: void drawMatches( const Mat& img1, const vector<KeyPoint>& keypoints1, const Mat& img2, const vector<KeyPoint>& keypoints2, const vector<DMatch>& matches1to2, Mat& outImg, const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1), const vector<char>& matchesMask=vector<char>(), int flags=DrawMatchesFlags::DEFAULT )
.. cpp:function:: void drawMatches( const Mat& img1, const vector<KeyPoint>& keypoints1, const Mat& img2, const vector<KeyPoint>& keypoints2, const vector<vector<DMatch> >& matches1to2, Mat& outImg, const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1), const vector<vector<char>>& matchesMask= vector<vector<char> >(), int flags=DrawMatchesFlags::DEFAULT )
??Description??
:param img1: The first source image.
......
......@@ -210,9 +210,10 @@ Class for extracting Speeded Up Robust Features from an image ::
bool useProvidedKeypoints=false) const;
};
The class implements the Speeded Up Robust Features descriptor [Bay06].
The class implements the Speeded Up Robust Features descriptor
[Bay06].
There is a fast multi-scale Hessian keypoint detector that can be used to find keypoints
(which is the default option). But the descriptors can be also computed for the user-specified keypoints.
(default option). But the descriptors can be also computed for the user-specified keypoints.
The algorithm can be used for object tracking and localization, image stitching, and so on. See the ``find_obj.cpp`` demo in OpenCV samples directory.
.. index:: RandomizedTree
......@@ -301,7 +302,7 @@ RandomizedTree::train
.. c:function:: void train(std::vector<BaseKeypoint> const& base_set, RNG& rng, PatchGenerator& make_patch, int depth, int views, size_t reduced_num_dim, int num_quant_bits)
:param base_set: Vector of ``BaseKeypoint`` type. Contains image keypoints used for training.
:param base_set: Vector of the ``BaseKeypoint`` type. It contains image keypoints used for training.
:param rng: Random-number generator used for training.
......@@ -391,7 +392,7 @@ RTreeClassifier
---------------
.. cpp:class:: RTreeClassifier
Class containing ``RTreeClassifier`` . It represents the Calonder descriptor that was originally introduced by Michael Calonder. ::
Class containing ``RTreeClassifier``. It represents the Calonder descriptor that was originally introduced by Michael Calonder. ::
class CV_EXPORTS RTreeClassifier
{
......@@ -465,7 +466,7 @@ RTreeClassifier::train
.. c:function:: void train(vector<BaseKeypoint> const& base_set, RNG& rng, PatchGenerator& make_patch, int num_trees = RTreeClassifier::DEFAULT_TREES, int depth = DEFAULT_DEPTH, int views = DEFAULT_VIEWS, size_t reduced_num_dim = DEFAULT_REDUCED_NUM_DIM, int num_quant_bits = DEFAULT_NUM_QUANT_BITS, bool print_status = true)
:param base_set: Vector of ``BaseKeypoint`` type. It contains image keypoints used for training.
:param base_set: Vector of the ``BaseKeypoint`` type. It contains image keypoints used for training.
:param rng: Random-number generator used for training.
......@@ -505,7 +506,7 @@ RTreeClassifier::getSparseSignature
Returns a signature for an image patch similarly to ``getSignature`` but uses a threshold for removing all signature elements below the threshold so that the signature is compressed.
:param patch: Image patch to calculate the nsignature for.
:param patch: Image patch to calculate the signature for.
:param sig: Output signature (array dimension is ``reduced_num_dim)`` .
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment