Commit 0e3af357 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

put short descriptions right after the titles

parent d758cca9
......@@ -645,7 +645,7 @@ Finally, there are STL-style iterators that are smart enough to skip gaps betwee
The matrix iterators are random-access iterators, so they can be passed to any STL algorithm, including ``std::sort()`` .
.. _MatrixExpressions:
Matrix Expressions
------------------
......
......@@ -3,17 +3,12 @@ Clustering
.. highlight:: cpp
.. index:: kmeans
.. _kmeans:
kmeans
------
Finds centers of clusters and groups input samples around the clusters.
.. ocv:function:: double kmeans( InputArray samples, int clusterCount, InputOutputArray labels, TermCriteria termcrit, int attempts, int flags, OutputArray centers=noArray() )
Finds centers of clusters and groups input samples around the clusters.
:param samples: Floating-point matrix of input samples, one row per sample.
:param clusterCount: Number of clusters to split the set by.
......@@ -53,16 +48,14 @@ Basically, you can use only the core of the function, set the number of
attempts to 1, initialize labels each time using a custom algorithm, pass them with the
( ``flags`` = ``KMEANS_USE_INITIAL_LABELS`` ) flag, and then choose the best (most-compact) clustering.
.. index:: partition
partition
-------------
Splits an element set into equivalency classes.
.. ocv:function:: template<typename _Tp, class _EqPredicate> int
.. ocv:function:: partition( const vector<_Tp>& vec, vector<int>& labels, _EqPredicate predicate=_EqPredicate())
Splits an element set into equivalency classes.
:param vec: Set of elements stored as a vector.
:param labels: Output vector of labels. It contains as many elements as ``vec``. Each label ``labels[i]`` is a 0-based cluster index of ``vec[i]`` .
......
......@@ -26,13 +26,11 @@ If a drawn figure is partially or completely outside the image, the drawing func
.. note:: The functions do not support alpha-transparency when the target image is 4-channel. In this case, the ``color[3]`` is simply copied to the repainted pixels. Thus, if you want to paint semi-transparent shapes, you can paint them in a separate buffer and then blend it with the main image.
.. index:: circle
circle
----------
.. ocv:function:: void circle(Mat& img, Point center, int radius, const Scalar& color, int thickness=1, int lineType=8, int shift=0)
Draws a circle.
Draws a circle.
.. ocv:function:: void circle(Mat& img, Point center, int radius, const Scalar& color, int thickness=1, int lineType=8, int shift=0)
:param img: Image where the circle is drawn.
......@@ -50,16 +48,14 @@ circle
The function ``circle`` draws a simple or filled circle with a given center and radius.
.. index:: clipLine
clipLine
------------
Clips the line against the image rectangle.
.. ocv:function:: bool clipLine(Size imgSize, Point& pt1, Point& pt2)
.. ocv:function:: bool clipLine(Rect imgRect, Point& pt1, Point& pt2)
Clips the line against the image rectangle.
:param imgSize: Image size. The image rectangle is ``Rect(0, 0, imgSize.width, imgSize.height)`` .
:param imgSize: Image rectangle.?? why do you list the same para twice??
......@@ -71,16 +67,14 @@ clipLine
The functions ``clipLine`` calculate a part of the line segment that is entirely within the specified rectangle.
They return ``false`` if the line segment is completely outside the rectangle. Otherwise, they return ``true`` .
.. index:: ellipse
ellipse
-----------
Draws a simple or thick elliptic arc or fills an ellipse sector.
.. ocv:function:: void ellipse(Mat& img, Point center, Size axes, double angle, double startAngle, double endAngle, const Scalar& color, int thickness=1, int lineType=8, int shift=0)
.. ocv:function:: void ellipse(Mat& img, const RotatedRect& box, const Scalar& color, int thickness=1, int lineType=8)
Draws a simple or thick elliptic arc or fills an ellipse sector.
:param img: Image.
:param center: Center of the ellipse.
......@@ -113,13 +107,11 @@ A piecewise-linear curve is used to approximate the elliptic arc boundary. If yo
.. image:: pics/ellipse.png
.. index:: ellipse2Poly
ellipse2Poly
----------------
.. ocv:function:: void ellipse2Poly( Point center, Size axes, int angle, int startAngle, int endAngle, int delta, vector<Point>& pts )
Approximates an elliptic arc with a polyline.
Approximates an elliptic arc with a polyline.
.. ocv:function:: void ellipse2Poly( Point center, Size axes, int angle, int startAngle, int endAngle, int delta, vector<Point>& pts )
:param center: Center of the arc.
......@@ -138,13 +130,13 @@ ellipse2Poly
The function ``ellipse2Poly`` computes the vertices of a polyline that approximates the specified elliptic arc. It is used by
:ocv:func:`ellipse` .
.. index:: fillConvexPoly
fillConvexPoly
------------------
.. ocv:function:: void fillConvexPoly(Mat& img, const Point* pts, int npts, const Scalar& color, int lineType=8, int shift=0)
Fills a convex polygon.
Fills a convex polygon.
.. ocv:function:: void fillConvexPoly(Mat& img, const Point* pts, int npts, const Scalar& color, int lineType=8, int shift=0)
:param img: Image.
......@@ -162,13 +154,13 @@ The function ``fillConvexPoly`` draws a filled convex polygon.
This function is much faster than the function ``fillPoly`` . It can fill not only convex polygons but any monotonic polygon without self-intersections,
that is, a polygon whose contour intersects every horizontal line (scan line) twice at the most (though, its top-most and/or the bottom edge could be horizontal).
.. index:: fillPoly
fillPoly
------------
.. ocv:function:: void fillPoly(Mat& img, const Point** pts, const int* npts, int ncontours, const Scalar& color, int lineType=8, int shift=0, Point offset=Point() )
Fills the area bounded by one or more polygons.
Fills the area bounded by one or more polygons.
.. ocv:function:: void fillPoly(Mat& img, const Point** pts, const int* npts, int ncontours, const Scalar& color, int lineType=8, int shift=0, Point offset=Point() )
:param img: Image.
......@@ -187,13 +179,13 @@ fillPoly
The function ``fillPoly`` fills an area bounded by several polygonal contours. The function can fill complex areas, for example,
areas with holes, contours with self-intersections (some of thier parts), and so forth.
.. index:: getTextSize
getTextSize
---------------
.. ocv:function:: Size getTextSize(const string& text, int fontFace, double fontScale, int thickness, int* baseLine)
Calculates the width and height of a text string.
Calculates the width and height of a text string.
.. ocv:function:: Size getTextSize(const string& text, int fontFace, double fontScale, int thickness, int* baseLine)
:param text: Input text string.
......@@ -238,13 +230,13 @@ That is, the following code renders some text, the tight box surrounding it, and
putText(img, text, textOrg, fontFace, fontScale,
Scalar::all(255), thickness, 8);
.. index:: line
line
--------
.. ocv:function:: void line(Mat& img, Point pt1, Point pt2, const Scalar& color, int thickness=1, int lineType=8, int shift=0)
Draws a line segment connecting two points.
Draws a line segment connecting two points.
.. ocv:function:: void line(Mat& img, Point pt1, Point pt2, const Scalar& color, int thickness=1, int lineType=8, int shift=0)
:param img: Image.
......@@ -269,13 +261,10 @@ line
The function ``line`` draws the line segment between ``pt1`` and ``pt2`` points in the image. The line is clipped by the image boundaries. For non-antialiased lines with integer coordinates, the 8-connected or 4-connected Bresenham algorithm is used. Thick lines are drawn with rounding endings.
Antialiased lines are drawn using Gaussian filtering. To specify the line color, you may use the macro ``CV_RGB(r, g, b)`` .
.. index:: LineIterator
.. _LineIterator:
LineIterator
------------
.. c:type:: LineIterator
.. ocv:class:: LineIterator
Class for iterating pixels on a raster line. ::
......@@ -315,16 +304,16 @@ The number of pixels along the line is stored in ``LineIterator::count`` . ::
for(int i = 0; i < it.count; i++, ++it)
buf[i] = *(const Vec3b)*it;
.. index:: rectangle
rectangle
-------------
Draws a simple, thick, or filled up-right rectangle.
.. ocv:function:: void rectangle(Mat& img, Point pt1, Point pt2, const Scalar& color, int thickness=1, int lineType=8, int shift=0)
.. ocv:function:: void rectangle(Mat& img, Rect r, const Scalar& color, int thickness=1, int lineType=8, int shift=0)
Draws a simple, thick, or filled up-right rectangle.
:param img: Image.
:param pt1: Vertex of the rectangle.
......@@ -343,13 +332,13 @@ rectangle
The function ``rectangle`` draws a rectangle outline or a filled rectangle whose two opposite corners are ``pt1`` and ``pt2``, or ``r.tl()`` and ``r.br()-Point(1,1)``.
.. index:: polylines
polylines
-------------
.. ocv:function:: void polylines(Mat& img, const Point** pts, const int* npts, int ncontours, bool isClosed, const Scalar& color, int thickness=1, int lineType=8, int shift=0 )
Draws several polygonal curves.
Draws several polygonal curves.
.. ocv:function:: void polylines(Mat& img, const Point** pts, const int* npts, int ncontours, bool isClosed, const Scalar& color, int thickness=1, int lineType=8, int shift=0 )
:param img: Image.
......@@ -371,13 +360,13 @@ polylines
The function ``polylines`` draws one or more polygonal curves.
.. index:: putText
putText
-----------
.. ocv:function:: void putText( Mat& img, const string& text, Point org, int fontFace, double fontScale, Scalar color, int thickness=1, int lineType=8, bool bottomLeftOrigin=false )
Draws a text string.
Draws a text string.
.. ocv:function:: void putText( Mat& img, const string& text, Point org, int fontFace, double fontScale, Scalar color, int thickness=1, int lineType=8, bool bottomLeftOrigin=false )
:param img: Image.
......
This diff is collapsed.
......@@ -9,7 +9,7 @@ represented as vectors in a multidimensional space. All objects that implement t
descriptor extractors inherit the
:ocv:class:`DescriptorExtractor` interface.
.. index:: DescriptorExtractor
DescriptorExtractor
-------------------
......@@ -47,13 +47,13 @@ distances between descriptors. Therefore, a collection of
descriptors is represented as
:ocv:class:`Mat` , where each row is a keypoint descriptor.
.. index:: DescriptorExtractor::compute
DescriptorExtractor::compute
--------------------------------
.. ocv:function:: void DescriptorExtractor::compute( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const
Computes the descriptors for a set of keypoints detected in an image (first variant) or image set (second variant).
Computes the descriptors for a set of keypoints detected in an image (first variant) or image set (second variant).
.. ocv:function:: void DescriptorExtractor::compute( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const
:param image: Image.
......@@ -71,33 +71,33 @@ DescriptorExtractor::compute
:param descriptors: Descriptor collection. ``descriptors[i]`` are descriptors computed for a ``keypoints[i]`` set.
.. index:: DescriptorExtractor::read
DescriptorExtractor::read
-----------------------------
.. ocv:function:: void DescriptorExtractor::read( const FileNode& fn )
Reads the object of a descriptor extractor from a file node.
Reads the object of a descriptor extractor from a file node.
.. ocv:function:: void DescriptorExtractor::read( const FileNode& fn )
:param fn: File node from which the detector is read.
.. index:: DescriptorExtractor::write
DescriptorExtractor::write
------------------------------
.. ocv:function:: void DescriptorExtractor::write( FileStorage& fs ) const
Writes the object of a descriptor extractor to a file storage.
Writes the object of a descriptor extractor to a file storage.
.. ocv:function:: void DescriptorExtractor::write( FileStorage& fs ) const
:param fs: File storage where the detector is written.
.. index:: DescriptorExtractor::create
DescriptorExtractor::create
-------------------------------
.. ocv:function:: Ptr<DescriptorExtractor> DescriptorExtractor::create( const string& descriptorExtractorType )
Creates a descriptor extractor by name.
Creates a descriptor extractor by name.
.. ocv:function:: Ptr<DescriptorExtractor> DescriptorExtractor::create( const string& descriptorExtractorType )
:param descriptorExtractorType: Descriptor extractor type.
......@@ -112,9 +112,7 @@ A combined format is also supported: descriptor extractor adapter name ( ``"Oppo
:ocv:class:`OpponentColorDescriptorExtractor` ) + descriptor extractor name (see above),
for example: ``"OpponentSIFT"`` .
.. index:: SiftDescriptorExtractor
.. _SiftDescriptorExtractor:
SiftDescriptorExtractor
-----------------------
......@@ -144,9 +142,7 @@ Wrapping class for computing descriptors by using the
}
.. index:: SurfDescriptorExtractor
.. _SurfDescriptorExtractor:
SurfDescriptorExtractor
-----------------------
......@@ -170,9 +166,7 @@ Wrapping class for computing descriptors by using the
}
.. index:: OrbDescriptorExtractor
.. _OrbDescriptorExtractor:
OrbDescriptorExtractor
---------------------------
......@@ -196,7 +190,7 @@ Wrapping class for computing descriptors by using the
}
.. index:: CalonderDescriptorExtractor
CalonderDescriptorExtractor
---------------------------
......@@ -220,10 +214,6 @@ Wrapping class for computing descriptors by using the
}
.. index:: OpponentColorDescriptorExtractor
.. _OpponentColorDescriptorExtractor:
OpponentColorDescriptorExtractor
--------------------------------
.. ocv:class:: OpponentColorDescriptorExtractor
......@@ -248,9 +238,6 @@ them into a single color descriptor. ::
};
.. index:: BriefDescriptorExtractor
.. _BriefDescriptorExtractor:
BriefDescriptorExtractor
------------------------
......
......@@ -9,10 +9,6 @@ that are represented as vectors in a multidimensional space. All objects that im
descriptor matchers inherit the
:ocv:class:`DescriptorMatcher` interface.
.. index:: DMatch
.. _DMatch:
DMatch
------
.. ocv:class:: DMatch
......@@ -42,10 +38,6 @@ train descriptor index, train image index, and distance between descriptors. ::
};
.. index:: DescriptorMatcher
.. _DescriptorMatcher:
DescriptorMatcher
-----------------
.. ocv:class:: DescriptorMatcher
......@@ -104,66 +96,67 @@ with an image set. ::
};
.. index:: DescriptorMatcher::add
DescriptorMatcher::add
--------------------------
.. ocv:function:: void add( const vector<Mat>& descriptors )
Adds descriptors to train a descriptor collection. If the collection ``trainDescCollectionis`` is not empty, the new descriptors are added to existing train descriptors.
Adds descriptors to train a descriptor collection. If the collection ``trainDescCollectionis`` is not empty, the new descriptors are added to existing train descriptors.
.. ocv:function:: void DescriptorMatcher::add( const vector<Mat>& descriptors )
:param descriptors: Descriptors to add. Each ``descriptors[i]`` is a set of descriptors from the same train image.
.. index:: DescriptorMatcher::getTrainDescriptors
DescriptorMatcher::getTrainDescriptors
------------------------------------------
.. ocv:function:: const vector<Mat>& getTrainDescriptors() const
Returns a constant link to the train descriptor collection ``trainDescCollection`` .
.. ocv:function:: const vector<Mat>& DescriptorMatcher::getTrainDescriptors() const
Returns a constant link to the train descriptor collection ``trainDescCollection`` .
.. index:: DescriptorMatcher::clear
DescriptorMatcher::clear
----------------------------
Clears the train descriptor collection.
.. ocv:function:: void DescriptorMatcher::clear()
Clears the train descriptor collection.
.. index:: DescriptorMatcher::empty
DescriptorMatcher::empty
----------------------------
Returns true if there are no train descriptors in the collection.
.. ocv:function:: bool DescriptorMatcher::empty() const
Returns true if there are no train descriptors in the collection.
.. index:: DescriptorMatcher::isMaskSupported
DescriptorMatcher::isMaskSupported
--------------------------------------
Returns true if the descriptor matcher supports masking permissible matches.
.. ocv:function:: bool DescriptorMatcher::isMaskSupported()
Returns true if the descriptor matcher supports masking permissible matches.
.. index:: DescriptorMatcher::train
DescriptorMatcher::train
----------------------------
Trains a descriptor matcher
.. ocv:function:: void DescriptorMatcher::train()
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`` ).
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`` ).
.. index:: DescriptorMatcher::match
DescriptorMatcher::match
----------------------------
Finds the best match for each descriptor from a query set.
.. ocv:function:: void DescriptorMatcher::match( const Mat& queryDescriptors, const Mat& trainDescriptors, vector<DMatch>& matches, const Mat& mask=Mat() ) const
.. ocv:function:: void DescriptorMatcher::match( const Mat& queryDescriptors, vector<DMatch>& matches, const vector<Mat>& masks=vector<Mat>() )
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.
......@@ -176,16 +169,16 @@ DescriptorMatcher::match
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
DescriptorMatcher::knnMatch
-------------------------------
Finds the k best matches for each descriptor from a query set.
.. ocv:function:: void DescriptorMatcher::knnMatch( const Mat& queryDescriptors, const Mat& trainDescriptors, vector<vector<DMatch> >& matches, int k, const Mat& mask=Mat(), bool compactResult=false ) const
.. ocv:function:: void DescriptorMatcher::knnMatch( const Mat& queryDescriptors, vector<vector<DMatch> >& matches, int k, const vector<Mat>& masks=vector<Mat>(), bool compactResult=false )
Finds the k best matches 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.
......@@ -202,16 +195,16 @@ DescriptorMatcher::knnMatch
These extended variants of :ocv:func:`DescriptorMatcher::match` methods find several best matches for each query descriptor. The matches are returned in the distance increasing order. See :ocv:func:`DescriptorMatcher::match` for the details about query and train descriptors.
.. index:: DescriptorMatcher::radiusMatch
DescriptorMatcher::radiusMatch
----------------------------------
For each query descriptor, finds the training descriptors not farther than the specified distance.
.. ocv:function:: void DescriptorMatcher::radiusMatch( const Mat& queryDescriptors, const Mat& trainDescriptors, vector<vector<DMatch> >& matches, float maxDistance, const Mat& mask=Mat(), bool compactResult=false ) const
.. ocv: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, finds the training descriptors not farther than the specified distance.
: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.
......@@ -228,23 +221,23 @@ DescriptorMatcher::radiusMatch
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
DescriptorMatcher::clone
----------------------------
.. ocv:function:: Ptr<DescriptorMatcher> DescriptorMatcher::clone( bool emptyTrainData ) const
Clones the matcher.
Clones the matcher.
.. ocv:function:: Ptr<DescriptorMatcher> DescriptorMatcher::clone( bool emptyTrainData ) const
:param emptyTrainData: If ``emptyTrainData`` is false, the method creates a deep copy of the object, that is, copies both parameters and train data. If ``emptyTrainData`` is true, the method creates an object copy with the current parameters but with empty train data.
.. index:: DescriptorMatcher::create
DescriptorMatcher::create
-----------------------------
.. ocv:function:: Ptr<DescriptorMatcher> DescriptorMatcher::create( const string& descriptorMatcherType )
Creates a descriptor matcher of a given type with the default parameters (using default constructor).
Creates a descriptor matcher of a given type with the default parameters (using default constructor).
.. ocv:function:: Ptr<DescriptorMatcher> DescriptorMatcher::create( const string& descriptorMatcherType )
:param descriptorMatcherType: Descriptor matcher type. Now the following matcher types are supported:
......@@ -259,9 +252,9 @@ DescriptorMatcher::create
*
``FlannBased``
.. index:: BruteForceMatcher
.. _BruteForceMatcher:
BruteForceMatcher
-----------------
......@@ -345,9 +338,9 @@ For efficiency, ``BruteForceMatcher`` is used as a template parameterized with t
};
.. index:: FlannBasedMatcher
.. _FlannBasedMatcher:
FlannBasedMatcher
-----------------
......
......@@ -93,9 +93,9 @@ Abstract base class for 2D image feature detectors. ::
FeatureDetector::detect
---------------------------
.. ocv:function:: void FeatureDetector::detect( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const
Detects keypoints in an image (first variant) or image set (second variant).
Detects keypoints in an image (first variant) or image set (second variant).
.. ocv:function:: void FeatureDetector::detect( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const
:param image: Image.
......@@ -113,25 +113,25 @@ FeatureDetector::detect
FeatureDetector::read
-------------------------
.. ocv:function:: void FeatureDetector::read( const FileNode& fn )
Reads a feature detector object from a file node.
Reads a feature detector object from a file node.
.. ocv:function:: void FeatureDetector::read( const FileNode& fn )
:param fn: File node from which the detector is read.
FeatureDetector::write
--------------------------
.. ocv:function:: void FeatureDetector::write( FileStorage& fs ) const
Writes a feature detector object to a file storage.
Writes a feature detector object to a file storage.
.. ocv:function:: void FeatureDetector::write( FileStorage& fs ) const
:param fs: File storage where the detector is written.
FeatureDetector::create
---------------------------
.. ocv:function:: Ptr<FeatureDetector> FeatureDetector::create( const string& detectorType )
Creates a feature detector by its name.
Creates a feature detector by its name.
.. ocv:function:: Ptr<FeatureDetector> FeatureDetector::create( const string& detectorType )
:param detectorType: Feature detector type.
......@@ -457,12 +457,11 @@ Example of creating ``DynamicAdaptedFeatureDetector`` : ::
new FastAdjuster(20,true)));
DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector
----------------------------------------------------------------
.. ocv:function:: DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector( const Ptr<AdjusterAdapter>& adjuster, int min_features, int max_features, int max_iters )
The constructor
Constructs the class.
.. ocv:function:: DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector( const Ptr<AdjusterAdapter>& adjuster, int min_features, int max_features, int max_iters )
:param adjuster: :ocv:class:`AdjusterAdapter` that detects features and adjusts parameters.
......@@ -497,9 +496,9 @@ See
AdjusterAdapter::tooFew
---------------------------
.. ocv: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.
.. ocv:function:: void AdjusterAdapter::tooFew(int min, int n_detected)
:param min: Minimum desired number of features.
......@@ -514,9 +513,9 @@ Example: ::
AdjusterAdapter::tooMany
----------------------------
.. ocv:function:: void AdjusterAdapter::tooMany(int max, int n_detected)
Adjusts the detector parameters to detect less features.
Adjusts the detector parameters to detect less features.
.. ocv:function:: void AdjusterAdapter::tooMany(int max, int n_detected)
:param max: Maximum desired number of features.
......@@ -532,9 +531,9 @@ Example: ::
AdjusterAdapter::good
-------------------------
.. ocv:function:: bool AdjusterAdapter::good() const
Returns false if the detector parameters cannot be adjusted any more.
Returns false if the detector parameters cannot be adjusted any more.
.. ocv:function:: bool AdjusterAdapter::good() const
Example: ::
......@@ -545,6 +544,8 @@ Example: ::
AdjusterAdapter::create
-------------------------
Creates an adjuster adapter by name
.. ocv:function:: Ptr<AdjusterAdapter> AdjusterAdapter::create( const string& detectorType )
Creates an adjuster adapter by name ``detectorType``. The detector name is the same as in :ocv:func:`FeatureDetector::create`, but now supports ``"FAST"``, ``"STAR"``, and ``"SURF"`` only.
......
......@@ -11,7 +11,7 @@ Every descriptor with the
:ocv: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
GenericDescriptorMatcher
------------------------
......@@ -79,68 +79,69 @@ Abstract interface for extracting and matching a keypoint descriptor. There are
};
.. index:: GenericDescriptorMatcher::add
GenericDescriptorMatcher::add
---------------------------------
.. ocv: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.
.. ocv:function:: void GenericDescriptorMatcher::add( const vector<Mat>& images, vector<vector<KeyPoint> >& keypoints )
:param images: Image collection.
:param keypoints: Point collection. It is assumed that ``keypoints[i]`` are keypoints detected in the image ``images[i]`` .
.. index:: GenericDescriptorMatcher::getTrainImages
GenericDescriptorMatcher::getTrainImages
--------------------------------------------
Returns a train image collection.
.. ocv:function:: const vector<Mat>& GenericDescriptorMatcher::getTrainImages() const
Returns a train image collection.
.. index:: GenericDescriptorMatcher::getTrainKeypoints
GenericDescriptorMatcher::getTrainKeypoints
-----------------------------------------------
Returns a train keypoints collection.
.. ocv:function:: const vector<vector<KeyPoint> >& GenericDescriptorMatcher::getTrainKeypoints() const
Returns a train keypoints collection.
.. index:: GenericDescriptorMatcher::clear
GenericDescriptorMatcher::clear
-----------------------------------
Clears a train collection (images and keypoints).
.. ocv:function:: void GenericDescriptorMatcher::clear()
Clears a train collection (images and keypoints).
.. index:: GenericDescriptorMatcher::train
GenericDescriptorMatcher::train
-----------------------------------
Trains descriptor matcher
.. ocv:function:: void GenericDescriptorMatcher::train()
Trains an object, for example, a tree-based structure, to extract descriptors or to optimize descriptors matching.
Prepares descriptor matcher, for example, creates a tree-based structure, to extract descriptors or to optimize descriptors matching.
.. index:: GenericDescriptorMatcher::isMaskSupported
GenericDescriptorMatcher::isMaskSupported
---------------------------------------------
Returns ``true`` if a generic descriptor matcher supports masking permissible matches.
.. ocv:function:: void GenericDescriptorMatcher::isMaskSupported()
Returns ``true`` if a generic descriptor matcher supports masking permissible matches.
.. index:: GenericDescriptorMatcher::classify
GenericDescriptorMatcher::classify
--------------------------------------
Classifies keypoints from a query set.
.. ocv:function:: void GenericDescriptorMatcher::classify( const Mat& queryImage, vector<KeyPoint>& queryKeypoints, const Mat& trainImage, vector<KeyPoint>& trainKeypoints ) const
.. ocv:function:: void GenericDescriptorMatcher::classify( const Mat& queryImage, vector<KeyPoint>& queryKeypoints )
Classifies keypoints from a query set.
:param queryImage: Query image.
:param queryKeypoints: Keypoints from a query image.
......@@ -159,16 +160,16 @@ The methods do the following:
#.
Set 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
GenericDescriptorMatcher::match
-----------------------------------
Finds the best match in the training set for each keypoint from the query set.
.. ocv:function:: void GenericDescriptorMatcher::match( const Mat& queryImage, vector<KeyPoint>& queryKeypoints, const Mat& trainImage, vector<KeyPoint>& trainKeypoints, vector<DMatch>& matches, const Mat& mask=Mat() ) const
.. ocv:function:: void GenericDescriptorMatcher::match( const Mat& queryImage, vector<KeyPoint>& queryKeypoints, vector<DMatch>& matches, const vector<Mat>& masks=vector<Mat>() )
Finds the best match in the training set for each keypoint from the query set.
:param queryImage: Query image.
:param queryKeypoints: Keypoints detected in ``queryImage`` .
......@@ -185,61 +186,57 @@ GenericDescriptorMatcher::match
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 the ``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
GenericDescriptorMatcher::knnMatch
--------------------------------------
Finds the ``k`` best matches for each query keypoint.
.. ocv:function:: void GenericDescriptorMatcher::knnMatch( const Mat& queryImage, vector<KeyPoint>& queryKeypoints, const Mat& trainImage, vector<KeyPoint>& trainKeypoints, vector<vector<DMatch> >& matches, int k, const Mat& mask=Mat(), bool compactResult=false ) const
.. ocv:function:: void GenericDescriptorMatcher::knnMatch( const Mat& queryImage, vector<KeyPoint>& queryKeypoints, vector<vector<DMatch> >& matches, int k, const vector<Mat>& masks=vector<Mat>(), bool compactResult=false )
Finds 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``. But this class does not require explicitly computed keypoint descriptors.
.. index:: GenericDescriptorMatcher::radiusMatch
GenericDescriptorMatcher::radiusMatch
-----------------------------------------
For each query keypoint, finds the training keypoints not farther than the specified distance.
.. ocv:function:: void GenericDescriptorMatcher::radiusMatch( const Mat& queryImage, vector<KeyPoint>& queryKeypoints, const Mat& trainImage, vector<KeyPoint>& trainKeypoints, vector<vector<DMatch> >& matches, float maxDistance, const Mat& mask=Mat(), bool compactResult=false ) const
.. ocv:function:: void GenericDescriptorMatcher::radiusMatch( const Mat& queryImage, vector<KeyPoint>& queryKeypoints, vector<vector<DMatch> >& matches, float maxDistance, const vector<Mat>& masks=vector<Mat>(), bool compactResult=false )
For each query keypoint, finds the training keypoints not farther than the specified distance.
The methods are similar to ``DescriptorMatcher::radius``. But this class does not require explicitly computed keypoint descriptors.
.. index:: GenericDescriptorMatcher::read
GenericDescriptorMatcher::read
----------------------------------
Reads a matcher object from a file node.
.. ocv:function:: void GenericDescriptorMatcher::read( const FileNode& fn )
Reads a matcher object from a file node.
.. index:: GenericDescriptorMatcher::write
GenericDescriptorMatcher::write
-----------------------------------
.. ocv:function:: void GenericDescriptorMatcher::write( FileStorage& fs ) const
Writes a match object to a file storage.
Writes a match object to a file storage.
.. ocv:function:: void GenericDescriptorMatcher::write( FileStorage& fs ) const
.. index:: GenericDescriptorMatcher::clone
GenericDescriptorMatcher::clone
-----------------------------------
.. ocv:function:: Ptr<GenericDescriptorMatcher> GenericDescriptorMatcher::clone( bool emptyTrainData ) const
Clones the matcher.
Clones the matcher.
.. ocv:function:: Ptr<GenericDescriptorMatcher> GenericDescriptorMatcher::clone( bool emptyTrainData ) const
:param emptyTrainData: If ``emptyTrainData`` is false, the method creates a deep copy of the object, that is, copies
both parameters and train data. If ``emptyTrainData`` is true, the method creates an object copy with the current parameters
but with empty train data.
.. index:: OneWayDescriptorMatcher
.. _OneWayDescriptorMatcher:
OneWayDescriptorMatcher
-----------------------
......@@ -298,7 +295,7 @@ Wrapping class for computing, matching, and classifying descriptors using the
};
.. index:: FernDescriptorMatcher
FernDescriptorMatcher
---------------------
......@@ -355,9 +352,7 @@ Wrapping class for computing, matching, and classifying descriptors using the
};
.. index:: VectorDescriptorMatcher
.. _VectorDescriptorMatcher:
VectorDescriptorMatcher
-----------------------
......
Drawing Function of Keypoints and Matches
=========================================
.. index:: drawMatches
drawMatches
---------------
Draws the found matches of keypoints from two images.
.. ocv: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 )
.. ocv: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 )
Draws the found matches of keypoints from two images.
:param img1: First source image.
......@@ -59,13 +59,13 @@ This function draws matches of keypoints from two images in the output image. Ma
..
.. index:: drawKeypoints
drawKeypoints
-----------------
.. ocv:function:: void drawKeypoints( const Mat& image, const vector<KeyPoint>& keypoints, Mat& outImg, const Scalar& color=Scalar::all(-1), int flags=DrawMatchesFlags::DEFAULT )
Draws keypoints.
Draws keypoints.
.. ocv:function:: void drawKeypoints( const Mat& image, const vector<KeyPoint>& keypoints, Mat& outImg, const Scalar& color=Scalar::all(-1), int flags=DrawMatchesFlags::DEFAULT )
:param image: Source image.
......
......@@ -3,13 +3,13 @@ Feature Detection and Description
.. highlight:: cpp
.. index:: FAST
FAST
--------
.. ocv:function:: void FAST( const Mat& image, vector<KeyPoint>& keypoints, int threshold, bool nonmaxSupression=true )
Detects corners using the FAST algorithm
Detects corners using the FAST algorithm by E. Rosten (*Machine Learning for High-speed Corner Detection*, 2006).
.. ocv:function:: void FAST( const Mat& image, vector<KeyPoint>& keypoints, int threshold, bool nonmaxSupression=true )
:param image: Image where keypoints (corners) are detected.
......@@ -19,9 +19,8 @@ FAST
:param nonmaxSupression: If it is true, non-maximum supression is applied to detected corners (keypoints).
.. index:: MSER
Detects corners using the FAST algorithm by E. Rosten (*Machine Learning for High-speed Corner Detection*, 2006).
.. _MSER:
MSER
----
......@@ -48,9 +47,6 @@ Maximally stable extremal region extractor. ::
The class encapsulates all the parameters of the MSER extraction algorithm (see
http://en.wikipedia.org/wiki/Maximally_stable_extremal_regions). Also see http://opencv.willowgarage.com/wiki/documentation/cpp/features2d/MSER for usefull comments and parameters description.
.. index:: StarDetector
.. _StarDetector:
StarDetector
------------
......@@ -87,7 +83,7 @@ Class implementing the ``Star`` keypoint detector. ::
The class implements a modified version of the ``CenSurE`` keypoint detector described in
[Agrawal08].
.. index:: SIFT
SIFT
----
......@@ -175,7 +171,7 @@ Class for extracting keypoints and computing descriptors using the Scale Invaria
};
.. index:: SURF
SURF
----
......@@ -213,7 +209,7 @@ There is a fast multi-scale Hessian keypoint detector that can be used to find k
The algorithm can be used for object tracking and localization, image stitching, and so on. See the ``find_obj.cpp`` demo in the OpenCV samples directory.
.. index:: ORB
ORB
----
......@@ -269,7 +265,7 @@ Class for extracting ORB features and descriptors from an image. ::
The class implements ORB.
.. index:: RandomizedTree
RandomizedTree
......@@ -344,13 +340,13 @@ Class containing a base structure for ``RTreeClassifier``. ::
void estimateQuantPercForPosteriors(float perc[2]);
};
.. index:: RandomizedTree::train
RandomizedTree::train
-------------------------
.. ocv: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)
Trains a randomized tree using an input set of keypoints.
Trains a randomized tree using an input set of keypoints.
.. ocv: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)
.. ocv: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)
......@@ -368,37 +364,37 @@ RandomizedTree::train
:param num_quant_bits: Number of bits used for quantization.
.. index:: RandomizedTree::read
RandomizedTree::read
------------------------
Reads a pre-saved randomized tree from a file or stream.
.. ocv:function:: read(const char* file_name, int num_quant_bits)
.. ocv:function:: read(std::istream &is, int num_quant_bits)
Reads a pre-saved randomized tree from a file or stream.
:param file_name: Name of the file that contains randomized tree data.
:param is: Input stream associated with the file that contains randomized tree data.
:param num_quant_bits: Number of bits used for quantization.
.. index:: RandomizedTree::write
RandomizedTree::write
-------------------------
.. ocv:function:: void write(const char* file_name) const
Writes the current randomized tree to a file or stream.
Writes the current randomized tree to a file or stream.
.. ocv:function:: void write(const char* file_name) const
.. ocv:function:: void write(std::ostream \&os) const
.. ocv:function:: void write(std::ostream &os) const
:param file_name: Name of the file where randomized tree data is stored.
:param is: Output stream associated with the file where randomized tree data is stored.
.. index:: RandomizedTree::applyQuantization
RandomizedTree::applyQuantization
-------------------------------------
......@@ -408,9 +404,6 @@ RandomizedTree::applyQuantization
:param num_quant_bits: Number of bits used for quantization.
.. index:: RTreeNode
.. _RTreeNode:
RTreeNode
---------
......@@ -436,9 +429,7 @@ Class containing a base structure for ``RandomizedTree``. ::
}
};
.. index:: RTreeClassifier
.. _RTreeClassifier:
RTreeClassifier
---------------
......@@ -508,13 +499,13 @@ Class containing ``RTreeClassifier``. It represents the Calonder descriptor orig
bool keep_floats_;
};
.. index:: RTreeClassifier::train
RTreeClassifier::train
--------------------------
.. ocv:function:: void train(vector<BaseKeypoint> const& base_set, RNG& rng, 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)
Trains a randomized tree classifier using an input set of keypoints.
Trains a randomized tree classifier using an input set of keypoints.
.. ocv:function:: void train(vector<BaseKeypoint> const& base_set, RNG& rng, 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)
.. ocv: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)
......@@ -536,41 +527,41 @@ RTreeClassifier::train
:param print_status: Current status of training printed on the console.
.. index:: RTreeClassifier::getSignature
RTreeClassifier::getSignature
---------------------------------
.. ocv:function:: void getSignature(IplImage *patch, uchar *sig)
Returns a signature for an image patch.
Returns a signature for an image patch.
.. ocv:function:: void getSignature(IplImage *patch, uchar *sig)
.. ocv:function:: void getSignature(IplImage *patch, float *sig)
:param patch: Image patch to calculate the signature for.
:param sig: Output signature (array dimension is ``reduced_num_dim)`` .
.. index:: RTreeClassifier::getSparseSignature
RTreeClassifier::getSparseSignature
---------------------------------------
Returns a sparse signature for an image patch
.. ocv:function:: void getSparseSignature(IplImage *patch, float *sig, float thresh)
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 signature for.
:param sig: Output signature (array dimension is ``reduced_num_dim)`` .
:param thresh: Threshold used for compressing the signature.
.. index:: RTreeClassifier::countNonZeroElements
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.
RTreeClassifier::countNonZeroElements
-----------------------------------------
.. ocv:function:: static int countNonZeroElements(float *vec, int n, double tol=1e-10)
Returns the number of non-zero elements in an input array.
Returns the number of non-zero elements in an input array.
.. ocv:function:: static int countNonZeroElements(float *vec, int n, double tol=1e-10)
:param vec: Input vector containing float elements.
......@@ -578,13 +569,13 @@ RTreeClassifier::countNonZeroElements
:param tol: Threshold used for counting elements. All elements less than ``tol`` are considered as zero elements.
.. index:: RTreeClassifier::read
RTreeClassifier::read
-------------------------
.. ocv:function:: read(const char* file_name)
Reads a pre-saved ``RTreeClassifier`` from a file or stream.
Reads a pre-saved ``RTreeClassifier`` from a file or stream.
.. ocv:function:: read(const char* file_name)
.. ocv:function:: read(std::istream& is)
......@@ -592,13 +583,13 @@ RTreeClassifier::read
:param is: Input stream associated with the file that contains randomized tree data.
.. index:: RTreeClassifier::write
RTreeClassifier::write
--------------------------
.. ocv:function:: void write(const char* file_name) const
Writes the current ``RTreeClassifier`` to a file or stream.
Writes the current ``RTreeClassifier`` to a file or stream.
.. ocv:function:: void write(const char* file_name) const
.. ocv:function:: void write(std::ostream &os) const
......@@ -606,13 +597,13 @@ RTreeClassifier::write
:param os: Output stream associated with the file where randomized tree data is stored.
.. index:: RTreeClassifier::setQuantization
RTreeClassifier::setQuantization
------------------------------------
.. ocv:function:: void setQuantization(int num_quant_bits)
Applies quantization to the current randomized tree.
Applies quantization to the current randomized tree.
.. ocv:function:: void setQuantization(int num_quant_bits)
:param num_quant_bits: Number of bits used for quantization.
......
......@@ -34,42 +34,41 @@ Lixin Fan, Jutta Willamowski, Cedric Bray, 2004. ::
BOWTrainer::add
-------------------
.. ocv:function:: void BOWTrainer::add( const Mat& descriptors )
Adds descriptors to a training set.
Adds descriptors to a training set. The training set is clustered using ``clustermethod`` to construct the vocabulary.
.. ocv:function:: void BOWTrainer::add( const Mat& descriptors )
:param descriptors: Descriptors to add to a training set. Each row of the ``descriptors`` matrix is a descriptor.
The training set is clustered using ``clustermethod`` to construct the vocabulary.
BOWTrainer::getDescriptors
------------------------------
Returns a training set of descriptors.
.. ocv:function:: const vector<Mat>& BOWTrainer::getDescriptors() const
Returns a training set of descriptors.
.. index:: BOWTrainer::descripotorsCount
BOWTrainer::descripotorsCount
---------------------------------
Returns the count of all descriptors stored in the training set.
.. ocv:function:: const vector<Mat>& BOWTrainer::descripotorsCount() const
Returns the count of all descriptors stored in the training set.
.. index:: BOWTrainer::cluster
BOWTrainer::cluster
-----------------------
.. ocv:function:: Mat BOWTrainer::cluster() const
Clusters train descriptors.
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.
.. ocv:function:: Mat BOWTrainer::cluster() const
.. ocv: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.
.. index:: BOWKMeansTrainer
.. _BOWKMeansTrainer:
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.
BOWKMeansTrainer
----------------
......@@ -94,7 +93,9 @@ BOWKMeansTrainer
};
BOWKMeansTrainer::BOWKMeansTrainer
----------------
----------------------------------
The constructor.
.. ocv:function:: BOWKMeansTrainer::BOWKMeansTrainer( int clusterCount, const TermCriteria& termcrit=TermCriteria(), int attempts=3, int flags=KMEANS_PP_CENTERS );
See :ocv:func:`kmeans` function parameters.
......@@ -132,43 +133,43 @@ The class declaration is the following: ::
};
.. index:: BOWImgDescriptorExtractor::BOWImgDescriptorExtractor
BOWImgDescriptorExtractor::BOWImgDescriptorExtractor
--------------------------------------------------------
.. ocv:function:: BOWImgDescriptorExtractor::BOWImgDescriptorExtractor( const Ptr<DescriptorExtractor>& dextractor, const Ptr<DescriptorMatcher>& dmatcher )
The constructor.
Constructs a class.
.. ocv:function:: BOWImgDescriptorExtractor::BOWImgDescriptorExtractor( const Ptr<DescriptorExtractor>& dextractor, const Ptr<DescriptorMatcher>& dmatcher )
:param dextractor: Descriptor extractor that is used to compute descriptors for an input image and its keypoints.
:param dmatcher: Descriptor matcher that is used to find the nearest word of the trained vocabulary for each keypoint descriptor of the image.
.. index:: BOWImgDescriptorExtractor::setVocabulary
BOWImgDescriptorExtractor::setVocabulary
--------------------------------------------
.. ocv:function:: void BOWImgDescriptorExtractor::setVocabulary( const Mat& vocabulary )
Sets a visual vocabulary.
Sets a visual vocabulary.
.. ocv:function:: void BOWImgDescriptorExtractor::setVocabulary( const Mat& vocabulary )
:param vocabulary: Vocabulary (can be trained using the inheritor of :ocv:class:`BOWTrainer` ). Each row of the vocabulary is a visual word (cluster center).
.. index:: BOWImgDescriptorExtractor::getVocabulary
BOWImgDescriptorExtractor::getVocabulary
--------------------------------------------
Returns the set vocabulary.
.. ocv:function:: const Mat& BOWImgDescriptorExtractor::getVocabulary() const
Returns the set vocabulary.
.. index:: BOWImgDescriptorExtractor::compute
BOWImgDescriptorExtractor::compute
--------------------------------------
.. ocv:function:: void BOWImgDescriptorExtractor::compute( const Mat& image, vector<KeyPoint>& keypoints, Mat& imgDescriptor, vector<vector<int> >* pointIdxsOfClusters=0, Mat* descriptors=0 )
Computes an image descriptor using the set visual vocabulary.
Computes an image descriptor using the set visual vocabulary.
.. ocv:function:: void BOWImgDescriptorExtractor::compute( const Mat& image, vector<KeyPoint>& keypoints, Mat& imgDescriptor, vector<vector<int> >* pointIdxsOfClusters=0, Mat* descriptors=0 )
:param image: Image, for which the descriptor is computed.
......@@ -180,19 +181,19 @@ BOWImgDescriptorExtractor::compute
:param descriptors: Descriptors of the image keypoints that are returned if they are non-zero.
.. index:: BOWImgDescriptorExtractor::descriptorSize
BOWImgDescriptorExtractor::descriptorSize
---------------------------------------------
Returns an image discriptor size if the vocabulary is set. Otherwise, it returns 0.
.. ocv:function:: int BOWImgDescriptorExtractor::descriptorSize() const
Returns an image discriptor size if the vocabulary is set. Otherwise, it returns 0.
.. index:: BOWImgDescriptorExtractor::descriptorType
BOWImgDescriptorExtractor::descriptorType
---------------------------------------------
.. ocv:function:: int BOWImgDescriptorExtractor::descriptorType() const
Returns an image descriptor type.
Returns an image descriptor type.
.. ocv:function:: int BOWImgDescriptorExtractor::descriptorType() const
......@@ -56,15 +56,12 @@ The following code is an example used to generate the figure. ::
return 0;
}
.. index:: setWindowProperty
.. _setWindowProperty:
setWindowProperty
---------------------
.. ocv:function:: void setWindowProperty(const string& name, int prop_id, double prop_value)
Changes parameters of a window dynamically.
Changes parameters of a window dynamically.
.. ocv:function:: void setWindowProperty(const string& name, int prop_id, double prop_value)
:param name: Name of the window.
......@@ -92,13 +89,11 @@ setWindowProperty
The function ``setWindowProperty`` enables changing properties of a window.
.. index:: getWindowProperty
getWindowProperty
---------------------
.. ocv:function:: void getWindowProperty(const string& name, int prop_id)
Provides parameters of a window.
Provides parameters of a window.
.. ocv:function:: void getWindowProperty(const string& name, int prop_id)
:param name: Name of the window.
......@@ -116,15 +111,11 @@ See
The function ``getWindowProperty`` returns properties of a window.
.. index:: fontQt
.. _fontQt:
fontQt
----------
.. ocv:function:: CvFont fontQt(const string& nameFont, int pointSize = -1, Scalar color = Scalar::all(0), int weight = CV_FONT_NORMAL, int style = CV_STYLE_NORMAL, int spacing = 0)
Creates the font to draw a text on an image.
Creates the font to draw a text on an image.
.. ocv:function:: CvFont fontQt(const string& nameFont, int pointSize = -1, Scalar color = Scalar::all(0), int weight = CV_FONT_NORMAL, int style = CV_STYLE_NORMAL, int spacing = 0)
:param nameFont: Name of the font. The name should match the name of a system font (such as *Times*). If the font is not found, a default one is used.
......@@ -163,13 +154,12 @@ A basic usage of this function is the following: ::
CvFont font = fontQt(''Times'');
addText( img1, ``Hello World !'', Point(50,50), font);
.. index:: addText
addText
-----------
.. ocv:function:: void addText(const Mat& img, const string& text, Point location, CvFont *font)
Creates the font to draw a text on an image.
Creates the font to draw a text on an image.
.. ocv:function:: void addText(const Mat& img, const string& text, Point location, CvFont *font)
:param img: 8-bit 3-channel image where the text should be drawn.
......@@ -204,13 +194,12 @@ displayOverlay
The function ``displayOverlay`` displays useful information/tips on top of the window for a certain amount of time *delay*. The function does not modify the image, displayed in the window, that is, after the specified delay the original content of the window is restored.
.. index:: displayStatusBar
displayStatusBar
--------------------
.. ocv:function:: void displayStatusBar(const string& name, const string& text, int delay)
Displays a text on the window statusbar during the specified period of time.
Displays a text on the window statusbar during the specified period of time.
.. ocv:function:: void displayStatusBar(const string& name, const string& text, int delay)
:param name: Name of the window.
......@@ -222,15 +211,12 @@ The function ``displayOverlay`` displays useful information/tips on top of the w
*delay*
. This information is displayed on the window statubar (the window must be created with the ``CV_GUI_EXPANDED`` flags).
.. index:: createOpenGLCallback
createOpenGLCallback
------------------------
Creates a callback function called to draw OpenGL on top the the image display by ``windowname``.
.. ocv:function:: void createOpenGLCallback( const string& window_name, OpenGLCallback callbackOpenGL, void* userdata CV_DEFAULT(NULL), double angle CV_DEFAULT(-1), double zmin CV_DEFAULT(-1), double zmax CV_DEFAULT(-1)
Creates a callback function called to draw OpenGL on top the the image display by ``windowname``.
:param window_name: Name of the window.
:param callbackOpenGL: Pointer to the function to be called every frame. This function should be prototyped as ``void Foo(*void);`` .
......@@ -274,43 +260,35 @@ The function ``createOpenGLCallback`` can be used to draw 3D data on the window.
}
}
.. index:: saveWindowParameters
saveWindowParameters
------------------------
Saves parameters of the specified window.
.. ocv:function:: void saveWindowParameters(const string& name)
Saves parameters of the window ``windowname`` .
:param name: Name of the window.
The function ``saveWindowParameters`` saves size, location, flags, trackbars value, zoom and panning location of the window
``window_name`` .
.. index:: loadWindowParameters
loadWindowParameters
------------------------
Loads parameters of the specified window.
.. ocv:function:: void loadWindowParameters(const string& name)
Loads parameters of the window ``windowname`` .
:param name: Name of the window.
The function ``loadWindowParameters`` loads size, location, flags, trackbars value, zoom and panning location of the window
``window_name`` .
.. index:: createButton
createButton
----------------
Attaches a button to the control panel.
.. ocv:function:: createButton( const string& button_name CV_DEFAULT(NULL),ButtonCallback on_change CV_DEFAULT(NULL), void* userdata CV_DEFAULT(NULL), int button_type CV_DEFAULT(CV_PUSH_BUTTON), int initial_button_state CV_DEFAULT(0))
Attaches a button to the control panel.
:param button_name: Name of the button.
:param on_change: Pointer to the function to be called every time the button changes its state. This function should be prototyped as ``void Foo(int state,*void);`` . *state* is the current state of the button. It could be -1 for a push button, 0 or 1 for a check/radio box button.
......
......@@ -3,15 +3,11 @@ Reading and Writing Images and Video
.. highlight:: cpp
.. index:: imdecode
.. _imdecode:
imdecode
------------
.. ocv:function:: Mat imdecode( InputArray buf, int flags )
Reads an image from a buffer in memory.
Reads an image from a buffer in memory.
.. ocv:function:: Mat imdecode( InputArray buf, int flags )
:param buf: Input array of vector of bytes.
......@@ -23,15 +19,11 @@ If the buffer is too short or contains invalid data, the empty matrix is returne
See
:ref:`imread` for the list of supported formats and flags description.
.. index:: imencode
.. _imencode:
imencode
------------
.. ocv:function:: bool imencode( const string& ext, InputArray img, vector<uchar>& buf, const vector<int>& params=vector<int>())
Encode an image into a memory buffer.
Encode an image into a memory buffer.
.. ocv:function:: bool imencode( const string& ext, InputArray img, vector<uchar>& buf, const vector<int>& params=vector<int>())
:param ext: File extension that defines the output format.
......@@ -45,15 +37,11 @@ The function compresses the image and stores it in the memory buffer that is res
See
:ref:`imwrite` for the list of supported formats and flags description.
.. index:: imread
.. _imread:
imread
----------
.. ocv:function:: Mat imread( const string& filename, int flags=1 )
Loads an image from a file.
Loads an image from a file.
.. ocv:function:: Mat imread( const string& filename, int flags=1 )
:param filename: Name of file to be loaded.
......@@ -89,15 +77,11 @@ The function ``imread`` loads an image from the specified file and returns it. I
* On Linux*, BSD flavors and other Unix-like open-source operating systems, OpenCV looks for codecs supplied with an OS image. Install the relevant packages (do not forget the development files, for example, "libjpeg-dev", in Debian* and Ubuntu*) to get the codec support or turn on the ``OPENCV_BUILD_3RDPARTY_LIBS`` flag in CMake.
.. index:: imwrite
.. _imwrite:
imwrite
-----------
.. ocv:function:: bool imwrite( const string& filename, InputArray img, const vector<int>& params=vector<int>())
Saves an image to a specified file.
Saves an image to a specified file.
.. ocv:function:: bool imwrite( const string& filename, InputArray img, const vector<int>& params=vector<int>())
:param filename: Name of the file.
......@@ -116,13 +100,9 @@ The function ``imwrite`` saves the image to the specified file. The image format
:ref:`Mat::convertTo` , and
:ref:`cvtColor` to convert it before saving. Or, use the universal XML I/O functions to save the image to XML or YAML format.
.. index:: VideoCapture
.. _VideoCapture:
VideoCapture
------------
.. c:type:: VideoCapture
.. ocv:class:: VideoCapture
Class for video capturing from video files or cameras ::
......@@ -202,30 +182,25 @@ The class provides C++ video capturing API. Here is how the class can be used: :
}
.. index:: VideoCapture::VideoCapture
.. _VideoCapture::VideoCapture:
VideoCapture::VideoCapture
------------------------------
VideoCapture constructors.
.. ocv:function:: VideoCapture::VideoCapture()
.. ocv:function:: VideoCapture::VideoCapture(const string& filename)
.. ocv:function:: VideoCapture::VideoCapture(int device)
VideoCapture constructors.
:param filename: name of the opened video file
:param device: id of the opened video capturing device (i.e. a camera index).
.. index:: VideoCapture::get
.. _VideoCapture::get:
VideoCapture::get
---------------------
Returns the specified ``VideoCapture`` property
.. ocv:function:: double VideoCapture::get(int property_id)
:param property_id: Property identifier. It can be one of the following:
......@@ -271,15 +246,11 @@ VideoCapture::get
**Note**: When querying a property that is not supported by the backend used by the ``VideoCapture`` class, value 0 is returned.
.. index:: VideoCapture::set
.. _VideoCapture::set:
VideoCapture::set
---------------------
.. ocv:function:: bool VideoCapture::set(int property_id, double value)
Sets a property in the ``VideoCapture``.
Sets a property in the VideoCapture backend.
.. ocv:function:: bool VideoCapture::set(int property_id, double value)
:param property_id: Property identifier. It can be one of the following:
......@@ -323,15 +294,9 @@ VideoCapture::set
:param value: Value of the property.
.. index:: VideoWriter
.. _VideoWriter:
VideoWriter
-----------
.. c:type:: VideoWriter
.. ocv:class:: VideoWriter
Video writer class ::
......
......@@ -3,15 +3,11 @@ User Interface
.. highlight:: cpp
.. index:: createTrackbar
.. _createTrackbar:
createTrackbar
------------------
.. ocv:function:: int createTrackbar( const string& trackbarname, const string& winname, int* value, int count, TrackbarCallback onChange=0, void* userdata=0)
Creates a trackbar and attaches it to the specified window.
Creates a trackbar and attaches it to the specified window.
.. ocv:function:: int createTrackbar( const string& trackbarname, const string& winname, int* value, int count, TrackbarCallback onChange=0, void* userdata=0)
:param trackbarname: Name of the created trackbar.
......@@ -41,13 +37,11 @@ is NULL.
Clicking the label of each trackbar enables editing the trackbar values manually for a more accurate control of it.
.. index:: getTrackbarPos
getTrackbarPos
------------------
.. ocv:function:: int getTrackbarPos( const string& trackbarname, const string& winname )
Returns the trackbar position.
Returns the trackbar position.
.. ocv:function:: int getTrackbarPos( const string& trackbarname, const string& winname )
:param trackbarname: Name of the trackbar.
......@@ -61,15 +55,11 @@ Qt-specific details:
* **winname** Name of the window that is the parent of the trackbar. It can be NULL if the trackbar is attached to the control panel.
.. index:: imshow
.. _imshow:
imshow
----------
.. ocv:function:: void imshow( const string& winname, InputArray image )
Displays an image in the specified window.
Displays an image in the specified window.
.. ocv:function:: void imshow( const string& winname, InputArray image )
:param winname: Name of the window.
......@@ -86,15 +76,12 @@ The function ``imshow`` displays an image in the specified window. If the window
*
If the image is 32-bit floating-point, the pixel values are multiplied by 255. That is, the value range [0,1] is mapped to [0,255].
.. index:: namedWindow
.. _namedWindow:
namedWindow
---------------
.. ocv:function:: void namedWindow( const string& winname, int flags )
Creates a window.
Creates a window.
.. ocv:function:: void namedWindow( const string& winname, int flags )
:param name: Name of the window in the window caption that may be used as a window identifier.
......@@ -129,43 +116,31 @@ Qt-specific details:
..
.. index:: destroyWindow
.. _destroyWindow:
destroyWindow
-------------
.. ocv:function:: void destroyWindow( const string &winname )
Destroys a window.
Destroys a window.
.. ocv:function:: void destroyWindow( const string &winname )
:param winname: Name of the window to be destroyed.
The function ``destroyWindow`` destroys the window with the given name.
.. index:: destroyAllWindows
.. _destroyAllWindows:
destroyAllWindows
-----------------
.. ocv:function:: void destroyAllWindows()
Destroys all of the HighGUI windows.
Destroys all of the HighGUI windows.
.. ocv:function:: void destroyAllWindows()
The function ``destroyAllWindows`` destroys all of the opened HighGUI windows.
.. index:: setTrackbarPos
.. _setTrackbarPos:
setTrackbarPos
------------------
.. ocv:function:: void setTrackbarPos( const string& trackbarname, const string& winname, int pos )
Sets the trackbar position.
Sets the trackbar position.
.. ocv:function:: void setTrackbarPos( const string& trackbarname, const string& winname, int pos )
:param trackbarname: Name of the trackbar.
......@@ -181,15 +156,11 @@ Qt-specific details:
* **winname** Name of the window that is the parent of the trackbar. It can be NULL if the trackbar is attached to the control panel.
.. index:: waitKey
.. _waitKey:
waitKey
-----------
.. ocv:function:: int waitKey(int delay=0)
Waits for a pressed key.
Waits for a pressed key.
.. ocv:function:: int waitKey(int delay=0)
:param delay: Delay in milliseconds. 0 is the special value that means "forever".
......
......@@ -3,13 +3,13 @@ Feature Detection
.. highlight:: cpp
.. index:: Canny
Canny
---------
.. ocv:function:: void Canny( InputArray image, OutputArray edges, double threshold1, double threshold2, int apertureSize=3, bool L2gradient=false )
Finds edges in an image using the Canny algorithm.
Finds edges in an image using the Canny algorithm.
.. ocv:function:: void Canny( InputArray image, OutputArray edges, double threshold1, double threshold2, int apertureSize=3, bool L2gradient=false )
:param image: Single-channel 8-bit input image.
......@@ -26,15 +26,14 @@ Canny
The function finds edges in the input image ``image`` and marks them in the output map ``edges`` using the Canny algorithm. The smallest value between ``threshold1`` and ``threshold2`` is used for edge linking. The largest value is used to find initial segments of strong edges. See
http://en.wikipedia.org/wiki/Canny_edge_detector
.. index:: cornerEigenValsAndVecs
cornerEigenValsAndVecs
----------------------
Calculates eigenvalues and eigenvectors of image blocks for corner detection.
.. ocv:function:: void cornerEigenValsAndVecs( InputArray src, OutputArray dst, int blockSize, int apertureSize, int borderType=BORDER_DEFAULT )
Calculates eigenvalues and eigenvectors of image blocks for corner detection.
:param src: Input single-channel 8-bit or floating-point image.
:param dst: Image to store the results. It has the same size as ``src`` and the type ``CV_32FC(6)`` .
......@@ -73,15 +72,14 @@ See Also:
:ocv:func:`cornerHarris`,
:ocv:func:`preCornerDetect`
.. index:: cornerHarris
cornerHarris
------------
Harris edge detector.
.. ocv:function:: void cornerHarris( InputArray src, OutputArray dst, int blockSize, int apertureSize, double k, int borderType=BORDER_DEFAULT )
Harris edge detector.
:param src: Input single-channel 8-bit or floating-point image.
:param dst: Image to store the Harris detector responses. It has the type ``CV_32FC1`` and the same size as ``src`` .
......@@ -108,15 +106,14 @@ The function runs the Harris edge detector on the image. Similarly to
Corners in the image can be found as the local maxima of this response map.
.. index:: cornerMinEigenVal
cornerMinEigenVal
-----------------
Calculates the minimal eigenvalue of gradient matrices for corner detection.
.. ocv:function:: void cornerMinEigenVal( InputArray src, OutputArray dst, int blockSize, int apertureSize=3, int borderType=BORDER_DEFAULT )
Calculates the minimal eigenvalue of gradient matrices for corner detection.
:param src: Input single-channel 8-bit or floating-point image.
:param dst: Image to store the minimal eigenvalues. It has the type ``CV_32FC1`` and the same size as ``src`` .
......@@ -132,13 +129,13 @@ The function is similar to
:math:`\min(\lambda_1, \lambda_2)` in terms of the formulae in the
:ocv:func:`cornerEigenValsAndVecs` description.
.. index:: cornerSubPix
cornerSubPix
----------------
.. ocv:function:: void cornerSubPix( InputArray image, InputOutputArray corners, Size winSize, Size zeroZone, TermCriteria criteria )
Refines the corner locations.
Refines the corner locations.
.. ocv:function:: void cornerSubPix( InputArray image, InputOutputArray corners, Size winSize, Size zeroZone, TermCriteria criteria )
:param image: Input image.
......@@ -188,15 +185,14 @@ where the gradients are summed within a neighborhood ("search window") of
The algorithm sets the center of the neighborhood window at this new center
:math:`q` and then iterates until the center stays within a set threshold.
.. index:: goodFeaturesToTrack
goodFeaturesToTrack
-------------------
Determines strong corners on an image.
.. ocv:function:: void goodFeaturesToTrack( InputArray image, OutputArray corners, int maxCorners, double qualityLevel, double minDistance, InputArray mask=noArray(), int blockSize=3, bool useHarrisDetector=false, double k=0.04 )
Determines strong corners on an image.
:param image: Input 8-bit or floating-point 32-bit, single-channel image.
:param corners: Output vector of detected corners.
......@@ -246,15 +242,14 @@ See Also: :ocv:func:`cornerMinEigenVal`,
:ocv:func:`PlanarObjectDetector`,
:ocv:func:`OneWayDescriptor`
.. index:: HoughCircles
HoughCircles
------------
Finds circles in a grayscale image using the Hough transform.
.. ocv:function:: void HoughCircles( InputArray image, OutputArray circles, int method, double dp, double minDist, double param1=100, double param2=100, int minRadius=0, int maxRadius=0 )
Finds circles in a grayscale image using the Hough transform.
:param image: 8-bit, single-channel, grayscale input image.
:param circles: Output vector of found circles. Each vector is encoded as a 3-element floating-point vector :math:`(x, y, radius)` .
......@@ -312,15 +307,14 @@ See Also:
:ocv:func:`fitEllipse`,
:ocv:func:`minEnclosingCircle`
.. index:: HoughLines
HoughLines
----------
Finds lines in a binary image using the standard Hough transform.
.. ocv:function:: void HoughLines( InputArray image, OutputArray lines, double rho, double theta, int threshold, double srn=0, double stn=0 )
Finds lines in a binary image using the standard Hough transform.
:param image: 8-bit, single-channel binary source image. The image may be modified by the function.
:param lines: Output vector of lines. Each line is represented by a two-element vector :math:`(\rho, \theta)` . :math:`\rho` is the distance from the coordinate origin :math:`(0,0)` (top-left corner of the image). :math:`\theta` is the line rotation angle in radians ( :math:`0 \sim \textrm{vertical line}, \pi/2 \sim \textrm{horizontal line}` ).
......@@ -339,15 +333,14 @@ The function implements the standard or standard multi-scale Hough transform alg
:ocv:func:`HoughLinesP` for the code example. Also see http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm for a good explanation of Hough transform.
.. index:: HoughLinesP
HoughLinesP
-----------
Finds line segments in a binary image using the probabilistic Hough transform.
.. ocv:function:: void HoughLinesP( InputArray image, OutputArray lines, double rho, double theta, int threshold, double minLineLength=0, double maxLineGap=0 )
Finds line segments in a binary image using the probabilistic Hough transform.
:param image: 8-bit, single-channel binary source image. The image may be modified by the function.
:param lines: Output vector of lines. Each line is represented by a 4-element vector :math:`(x_1, y_1, x_2, y_2)` , where :math:`(x_1,y_1)` and :math:`(x_2, y_2)` are the ending points of each detected line segment.
......@@ -427,15 +420,14 @@ And this is the output of the above program in case of the probabilistic Hough t
.. image:: pics/houghp.png
.. index:: preCornerDetect
preCornerDetect
---------------
Calculates a feature map for corner detection.
.. ocv:function:: void preCornerDetect( InputArray src, OutputArray dst, int apertureSize, int borderType=BORDER_DEFAULT )
Calculates a feature map for corner detection.
:param src: Source single-channel 8-bit of floating-point image.
:param dst: Output image that has the type ``CV_32F`` and the same size as ``src`` .
......
This diff is collapsed.
......@@ -3,16 +3,16 @@ Histograms
.. highlight:: cpp
.. index:: calcHist
calcHist
------------
Calculates a histogram of a set of arrays.
.. ocv:function:: void calcHist( const Mat* arrays, int narrays, const int* channels, InputArray mask, OutputArray hist, int dims, const int* histSize, const float** ranges, bool uniform=true, bool accumulate=false )
.. ocv:function:: void calcHist( const Mat* arrays, int narrays, const int* channels, InputArray mask, SparseMat& hist, int dims, const int* histSize, const float** ranges, bool uniform=true, bool accumulate=false )
Calculates a histogram of a set of arrays.
:param arrays: Source arrays. They all should have the same depth, ``CV_8U`` or ``CV_32F`` , and the same size. Each of them can have an arbitrary number of channels.
:param narrays: Number of source arrays.
......@@ -95,16 +95,16 @@ input arrays at the same location. The sample below shows how to compute a 2D Hu
}
.. index:: calcBackProject
calcBackProject
-------------------
Calculates the back projection of a histogram.
.. ocv:function:: void calcBackProject( const Mat* arrays, int narrays, const int* channels, InputArray hist, OutputArray backProject, const float** ranges, double scale=1, bool uniform=true )
.. ocv:function:: void calcBackProject( const Mat* arrays, int narrays, const int* channels, const SparseMat& hist, OutputArray backProject, const float** ranges, double scale=1, bool uniform=true )
Calculates the back projection of a histogram.
:param arrays: Source arrays. They all should have the same depth, ``CV_8U`` or ``CV_32F`` , and the same size. Each of them can have an arbitrary number of channels.
:param narrays: Number of source arrays.
......@@ -138,17 +138,16 @@ This is an approximate algorithm of the
See Also:
:ocv:func:`calcHist`
.. index:: compareHist
compareHist
-----------
Compares two histograms.
.. ocv:function:: double compareHist( InputArray H1, InputArray H2, int method )
.. ocv:function:: double compareHist( const SparseMat& H1, const SparseMat& H2, int method )
Compares two histograms.
:param H1: The first compared histogram.
:param H2: The second compared histogram of the same size as ``H1`` .
......@@ -204,14 +203,13 @@ While the function works well with 1-, 2-, 3-dimensional dense histograms, it ma
:ocv:func:`EMD` function.
.. index:: EMD
EMD
------
.. ocv:function:: float EMD( InputArray signature1, InputArray signature2, int distType, InputArray cost=noArray(), float* lowerBound=0, OutputArray flow=noArray() )
Computes the "minimal work" distance between two weighted point configurations.
Computes the "minimal work" distance between two weighted point configurations.
.. ocv:function:: float EMD( InputArray signature1, InputArray signature2, int distType, InputArray cost=noArray(), float* lowerBound=0, OutputArray flow=noArray() )
:param signature1: The first signature, a :math:`\texttt{size1}\times \texttt{dims}+1` floating-point matrix. Each row stores the point weight followed by the point coordinates. The matrix is allowed to have a single column (weights only) if the user-defined cost matrix is used.
......@@ -228,13 +226,13 @@ EMD
The function computes the earth mover distance and/or a lower boundary of the distance between the two weighted point configurations. One of the applications described in :ref:`RubnerSept98` is multi-dimensional histogram comparison for image retrieval. EMD is a transportation problem that is solved using some modification of a simplex algorithm, thus the complexity is exponential in the worst case, though, on average it is much faster. In the case of a real metric the lower boundary can be calculated even faster (using linear-time algorithm) and it can be used to determine roughly whether the two signatures are far enough so that they cannot relate to the same object.
.. index:: equalizeHist
equalizeHist
----------------
.. ocv:function:: void equalizeHist( InputArray src, OutputArray dst )
Equalizes the histogram of a grayscale image.
Equalizes the histogram of a grayscale image.
.. ocv:function:: void equalizeHist( InputArray src, OutputArray dst )
:param src: Source 8-bit single channel image.
......
......@@ -3,15 +3,12 @@ Miscellaneous Image Transformations
.. highlight:: cpp
.. index:: adaptiveThreshold
.. _adaptiveThreshold:
adaptiveThreshold
---------------------
.. ocv:function:: void adaptiveThreshold( InputArray src, OutputArray dst, double maxValue, int adaptiveMethod, int thresholdType, int blockSize, double C )
Applies an adaptive threshold to an array.
Applies an adaptive threshold to an array.
.. ocv:function:: void adaptiveThreshold( InputArray src, OutputArray dst, double maxValue, int adaptiveMethod, int thresholdType, int blockSize, double C )
:param src: Source 8-bit single-channel image.
......@@ -64,15 +61,12 @@ See Also:
:ocv:func:`GaussianBlur`
.. index:: cvtColor
.. _cvtColor:
cvtColor
------------
.. ocv:function:: void cvtColor( InputArray src, OutputArray dst, int code, int dstCn=0 )
Converts an image from one color space to another.
Converts an image from one color space to another.
.. ocv:function:: void cvtColor( InputArray src, OutputArray dst, int code, int dstCn=0 )
:param src: Source image: 8-bit unsigned, 16-bit unsigned ( ``CV_16UC...`` ), or single-precision floating-point.
......@@ -399,18 +393,15 @@ The function can do the following transformations:
columns, respectively. For example, the above pattern has a very
popular "BG" type.
.. index:: distanceTransform
.. _distanceTransform:
distanceTransform
---------------------
Calculates the distance to the closest zero pixel for each pixel of the source image.
.. ocv:function:: void distanceTransform( InputArray src, OutputArray dst, int distanceType, int maskSize )
.. ocv:function:: void distanceTransform( InputArray src, OutputArray dst, OutputArray labels, int distanceType, int maskSize )
Calculates the distance to the closest zero pixel for each pixel of the source image.
:param src: 8-bit, single-channel (binary) source image.
:param dst: Output image with calculated distances. It is a 32-bit floating-point, single-channel image of the same size as ``src`` .
......@@ -467,18 +458,18 @@ In this mode, the complexity is still linear.
That is, the function provides a very fast way to compute the Voronoi diagram for a binary image.
Currently, the second variant can use only the approximate distance transform algorithm.
.. index:: floodFill
.. _floodFill:
floodFill
-------------
Fills a connected component with the given color.
.. ocv:function:: int floodFill( InputOutputArray image, Point seed, Scalar newVal, Rect* rect=0, Scalar loDiff=Scalar(), Scalar upDiff=Scalar(), int flags=4 )
.. ocv:function:: int floodFill( InputOutputArray image, InputOutputArray mask, Point seed, Scalar newVal, Rect* rect=0, Scalar loDiff=Scalar(), Scalar upDiff=Scalar(), int flags=4 )
Fills a connected component with the given color.
:param image: Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the function unless the ``FLOODFILL_MASK_ONLY`` flag is set in the second variant of the function. See the details below.
:param mask: (For the second function only) Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels taller. The function uses and updates the mask, so you take responsibility of initializing the ``mask`` content. Flood-filling cannot go across non-zero pixels in the mask. For example, an edge detector output can be used as a mask to stop filling at edges. It is possible to use the same mask in multiple calls to the function to make sure the filled area does not overlap.
......@@ -569,15 +560,15 @@ Use these functions to either mark a connected component with the specified colo
See Also:
:ocv:func:`findContours`
.. index:: inpaint
.. _inpaint:
inpaint
-----------
.. ocv:function:: void inpaint( InputArray src, InputArray inpaintMask, OutputArray dst, double inpaintRadius, int flags )
Restores the selected region in an image using the region neighborhood.
Restores the selected region in an image using the region neighborhood.
.. ocv:function:: void inpaint( InputArray src, InputArray inpaintMask, OutputArray dst, double inpaintRadius, int flags )
:param src: Input 8-bit 1-channel or 3-channel image.
......@@ -597,18 +588,18 @@ The function reconstructs the selected image area from the pixel near the area b
http://en.wikipedia.org/wiki/Inpainting
for more details.
.. index:: integral
integral
------------
Calculates the integral of an image.
.. ocv:function:: void integral( InputArray image, OutputArray sum, int sdepth=-1 )
.. ocv:function:: void integral( InputArray image, OutputArray sum, OutputArray sqsum, int sdepth=-1 )
.. ocv:function:: void integral( InputArray image, OutputArray sum, OutputArray sqsum, OutputArray tilted, int sdepth=-1 )
Calculates the integral of an image.
:param image: Source image as :math:`W \times H` , 8-bit or floating-point (32f or 64f).
:param sum: Integral image as :math:`(W+1)\times (H+1)` , 32-bit integer or floating-point (32f or 64f).
......@@ -645,15 +636,15 @@ As a practical example, the next figure shows the calculation of the integral of
.. image:: pics/integral.png
.. index:: threshold
.. _threshold:
threshold
-------------
.. ocv:function:: double threshold( InputArray src, OutputArray dst, double thresh, double maxVal, int thresholdType )
Applies a fixed-level threshold to each array element.
Applies a fixed-level threshold to each array element.
.. ocv:function:: double threshold( InputArray src, OutputArray dst, double thresh, double maxVal, int thresholdType )
:param src: Source array (single-channel, 8-bit of 32-bit floating point)
......@@ -718,13 +709,13 @@ See Also:
:ocv:func:`min`,
:ocv:func:`max`
.. index:: watershed
watershed
-------------
.. ocv:function:: void watershed( InputArray image, InputOutputArray markers )
Performs a marker-based image segmentation using the watershed algrorithm.
Performs a marker-based image segmentation using the watershed algrorithm.
.. ocv:function:: void watershed( InputArray image, InputOutputArray markers )
:param image: Input 8-bit 3-channel image.
......@@ -756,15 +747,14 @@ can be found in the OpenCV samples directory (see the ``watershed.cpp`` demo).
See Also:
:ocv:func:`findContours`
.. index:: grabCut
grabCut
-------
Runs the GrabCut algorithm.
.. ocv:function:: void grabCut(InputArray image, InputOutputArray mask, Rect rect, InputOutputArray bgdModel, InputOutputArray fgdModel, int iterCount, int mode )
Runs the GrabCut algorithm.
:param image: Input 8-bit 3-channel image.
:param mask: Input/output 8-bit single-channel mask. The mask is initialized by the function when ``mode`` is set to ``GC_INIT_WITH_RECT``. Its elements may have one of following values:
......
......@@ -3,13 +3,11 @@ Motion Analysis and Object Tracking
.. highlight:: cpp
.. index:: accumulate
accumulate
--------------
.. ocv:function:: void accumulate( InputArray src, InputOutputArray dst, InputArray mask=noArray() )
Adds an image to the accumulator.
Adds an image to the accumulator.
.. ocv:function:: void accumulate( InputArray src, InputOutputArray dst, InputArray mask=noArray() )
:param src: Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
......@@ -32,13 +30,13 @@ See Also:
:ocv:func:`accumulateProduct`,
:ocv:func:`accumulateWeighted`
.. index:: accumulateSquare
accumulateSquare
--------------------
.. ocv:function:: void accumulateSquare( InputArray src, InputOutputArray dst, InputArray mask=noArray() )
Adds the square of a source image to the accumulator.
Adds the square of a source image to the accumulator.
.. ocv:function:: void accumulateSquare( InputArray src, InputOutputArray dst, InputArray mask=noArray() )
:param src: Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
......@@ -59,13 +57,13 @@ See Also:
:ocv:func:`accumulateProduct`,
:ocv:func:`accumulateWeighted`
.. index:: accumulateProduct
accumulateProduct
---------------------
.. ocv:function:: void accumulateProduct( InputArray src1, InputArray src2, InputOutputArray dst, InputArray mask=noArray() )
Adds the per-element product of two input images to the accumulator.
Adds the per-element product of two input images to the accumulator.
.. ocv:function:: void accumulateProduct( InputArray src1, InputArray src2, InputOutputArray dst, InputArray mask=noArray() )
:param src1: The first input image, 1- or 3-channel, 8-bit or 32-bit floating point.
......@@ -88,13 +86,13 @@ See Also:
:ocv:func:`accumulateSquare`,
:ocv:func:`accumulateWeighted`
.. index:: accumulateWeighted
accumulateWeighted
----------------------
.. ocv:function:: void accumulateWeighted( InputArray src, InputOutputArray dst, double alpha, InputArray mask=noArray() )
Updates a running average.
Updates a running average.
.. ocv:function:: void accumulateWeighted( InputArray src, InputOutputArray dst, double alpha, InputArray mask=noArray() )
:param src: Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
......
......@@ -3,13 +3,11 @@ Object Detection
.. highlight:: cpp
.. index:: matchTemplate
matchTemplate
-----------------
.. ocv:function:: void matchTemplate( InputArray image, InputArray temp, OutputArray result, int method )
Compares a template against overlapped image regions.
Compares a template against overlapped image regions.
.. ocv:function:: void matchTemplate( InputArray image, InputArray temp, OutputArray result, int method )
:param image: Image where the search is running. It must be 8-bit or 32-bit floating-point.
......
......@@ -24,12 +24,14 @@ The boosted model is based on
:math:`K` -component vector. Each component encodes a feature relevant to the learning task at hand. The desired two-class output is encoded as -1 and +1.
Different variants of boosting are known as Discrete Adaboost, Real AdaBoost, LogitBoost, and Gentle AdaBoost
:ref:`[FHT98] <FHT98>` . All of them are very similar in their overall structure. Therefore, this chapter focuses only on the standard two-class Discrete AdaBoost algorithm as shown in the box below??. Initially the same weight is assigned to each sample (step 2). Then, a weak classifier
:ref:`[FHT98] <FHT98>` . All of them are very similar in their overall structure. Therefore, this chapter focuses only on the standard two-class Discrete AdaBoost algorithm, outlined below. Initially the same weight is assigned to each sample (step 2). Then, a weak classifier
:math:`f_{m(x)}` is trained on the weighted training data (step 3a). Its weighted training error and scaling factor
:math:`c_m` is computed (step 3b). The weights are increased for training samples that have been misclassified (step 3c). All weights are then normalized, and the process of finding the next weak classifier continues for another
:math:`M` -1 times. The final classifier
:math:`F(x)` is the sign of the weighted sum over the individual weak classifiers (step 4).
**Two-class Discrete AdaBoost Algorithm**
#.
Set
:math:`N` examples
......@@ -41,29 +43,17 @@ Different variants of boosting are known as Discrete Adaboost, Real AdaBoost, Lo
:math:`w_i = 1/N, i = 1,...,N` .
#.
Repeat for
:math:`m` =
:math:`1,2,...,M` :
Repeat for :math:`m = 1,2,...,M` :
#.
Fit the classifier
:math:`f_m(x) \in{-1,1}` , using weights
:math:`w_i` on the training data.
3.1. Fit the classifier :math:`f_m(x) \in{-1,1}`, using weights :math:`w_i` on the training data.
#.
Compute
:math:`err_m = E_w [1_{(y =\neq f_m(x))}], c_m = log((1 - err_m)/err_m)` .
3.2. Compute :math:`err_m = E_w [1_{(y \neq f_m(x))}], c_m = log((1 - err_m)/err_m)` .
3.3. Set :math:`w_i \Leftarrow w_i exp[c_m 1_{(y_i \neq f_m(x_i))}], i = 1,2,...,N,` and renormalize so that :math:`\Sigma i w_i = 1` .
#.
Set
:math:`w_i \Leftarrow w_i exp[c_m 1_{(y_i \neq f_m(x_i))}], i = 1,2,...,N,` and renormalize so that
:math:`\Sigma i w_i = 1` .
#.
Output the classifier sign
:math:`[\Sigma m = 1M c_m f_m(x)]` .
#. Classify new samples *x* using the formula: :math:`\sign (\Sigma m = 1M c_m f_m(x))` .
Two-class Discrete AdaBoost Algorithm: Training (steps 1 to 3) and Evaluation (step 4)??you need to revise this section. what is this? a title for the image that is missing?
.. note:: Similar to the classical boosting methods, the current implementation supports two-class classifiers only. For M
:math:`>` two classes, there is the **AdaBoost.MH** algorithm (described in :ref:`[FHT98] <FHT98>` ) that reduces the problem to the two-class problem, yet with a much larger training set.
......@@ -93,6 +83,8 @@ All parameters are public. You can initialize them by a constructor and then ove
CvBoostParams::CvBoostParams
----------------------------
The constructors.
.. ocv:function:: CvBoostParams::CvBoostParams()
.. ocv:function:: CvBoostParams::CvBoostParams( int boost_type, int weak_count, double weight_trim_rate, int max_depth, bool use_surrogates, const float* priors )
......@@ -120,10 +112,6 @@ Also there is one parameter that you can set directly.
* **CvBoost::MISCLASS** Default option for discrete AdaBoost.
* **CvBoost::SQERR** Least-square error; only option available for LogitBoost and gentle AdaBoost.
.. index:: CvBoostTree
.. _CvBoostTree:
CvBoostTree
-----------
.. ocv:class:: CvBoostTree
......@@ -168,25 +156,25 @@ Boosted tree classifier derived from :ocv:class:`CvStatModel`.
CvBoost::train
--------------
.. ocv:function:: bool CvBoost::train( const Mat& _train_data, int _tflag, const Mat& _responses, const Mat& _var_idx=Mat(), const Mat& _sample_idx=Mat(), const Mat& _var_type=Mat(), const Mat& _missing_mask=Mat(), CvBoostParams params=CvBoostParams(), bool update=false )
Trains a boosted tree classifier.
Trains a boosted tree classifier.
.. ocv:function:: bool CvBoost::train( const Mat& _train_data, int _tflag, const Mat& _responses, const Mat& _var_idx=Mat(), const Mat& _sample_idx=Mat(), const Mat& _var_type=Mat(), const Mat& _missing_mask=Mat(), CvBoostParams params=CvBoostParams(), bool update=false )
The train method follows the common template. The last parameter ``update`` specifies whether the classifier needs to be updated (the new weak tree classifiers added to the existing ensemble) or the classifier needs to be rebuilt from scratch. The responses must be categorical, which means that boosted trees cannot be built for regression, and there should be two classes.
CvBoost::predict
----------------
.. ocv:function:: float CvBoost::predict( const Mat& sample, const Mat& missing=Mat(), const Range& slice=Range::all(), bool rawMode=false, bool returnSum=false ) const
Predicts a response for an input sample.
Predicts a response for an input sample.
.. ocv:function:: float CvBoost::predict( const Mat& sample, const Mat& missing=Mat(), const Range& slice=Range::all(), bool rawMode=false, bool returnSum=false ) const
The method ``CvBoost::predict`` runs the sample through the trees in the ensemble and returns the output class label based on the weighted voting.
CvBoost::prune
--------------
.. ocv:function:: void CvBoost::prune( CvSlice slice )
Removes the specified weak classifiers.
Removes the specified weak classifiers.
.. ocv:function:: void CvBoost::prune( CvSlice slice )
The method removes the specified weak classifiers from the sequence.
......@@ -195,30 +183,32 @@ The method removes the specified weak classifiers from the sequence.
CvBoost::calc_error
-------------------
.. ocv:function:: float CvBoost::calc_error( CvMLData* _data, int type , std::vector<float> *resp = 0 )
Returns error of the boosted tree classifier.
Returns error of the boosted tree classifier.
.. ocv:function:: float CvBoost::calc_error( CvMLData* _data, int type , std::vector<float> *resp = 0 )
The method is identical to :ocv:func:`CvDTree::calc_error` but uses the boosted tree classifier as predictor.
CvBoost::get_weak_predictors
----------------------------
Returns the sequence of weak tree classifiers.
.. ocv:function:: CvSeq* CvBoost::get_weak_predictors()
Returns the sequence of weak tree classifiers.
The method returns the sequence of weak classifiers. Each element of the sequence is a pointer to the ``CvBoostTree`` class or to some of its derivatives.
CvBoost::get_params
-------------------
.. ocv:function:: const CvBoostParams& CvBoost::get_params() const
Returns current parameters of the boosted tree classifier.
Returns current parameters of the boosted tree classifier.
.. ocv:function:: const CvBoostParams& CvBoost::get_params() const
CvBoost::get_data
-----------------
Returns used train data of the boosted tree classifier.
.. ocv:function:: const CvDTreeTrainData* CvBoost::get_data() const
Returns used train data of the boosted tree classifier.
......@@ -138,14 +138,14 @@ Decision tree training data and shared data for tree ensembles. ::
CvDTreeParams
-------------
.. c:type:: CvDTreeParams
Decision tree training parameters.
.. ocv:class:: CvDTreeParams
The structure contains all the decision tree training parameters. You can initialize it by default constructor and then override any parameters directly before training, or the structure may be fully initialized using the advanced variant of the constructor.
CvDTreeParams::CvDTreeParams
----------------------------
The constructors.
.. ocv:function:: CvDTreeParams::CvDTreeParams()
.. ocv:function:: CvDTreeParams::CvDTreeParams( int max_depth, int min_sample_count, float regression_accuracy, bool use_surrogates, int max_categories, int cv_folds, bool use_1se_rule, bool truncate_pruned_tree, const float* priors )
......@@ -182,9 +182,7 @@ CvDTreeTrainData
----------------
.. ocv:class:: CvDTreeTrainData
Decision tree training data and shared data for tree ensembles.
The structure is mostly used internally for storing both standalone trees and tree ensembles efficiently. Basically, it contains the following types of information:
Decision tree training data and shared data for tree ensembles. The structure is mostly used internally for storing both standalone trees and tree ensembles efficiently. Basically, it contains the following types of information:
#. Training parameters, an instance of :ocv:class:`CvDTreeParams`.
......@@ -209,13 +207,13 @@ CvDTree
-------
.. ocv:class:: CvDTree
Decision tree.
The class implements a decision tree predictor as described in the beginning of this section.
The class implements a decision tree as described in the beginning of this section.
CvDTree::train
--------------
Trains a decision tree.
.. ocv:function:: bool CvDTree::train( const Mat& train_data, int tflag, const Mat& responses, const Mat& var_idx=Mat(), const Mat& sample_idx=Mat(), const Mat& var_type=Mat(), const Mat& missing_mask=Mat(), CvDTreeParams params=CvDTreeParams() )
.. ocv:function:: bool CvDTree::train( const CvMat* trainData, int tflag, const CvMat* responses, const CvMat* varIdx=0, const CvMat* sampleIdx=0, const CvMat* varType=0, const CvMat* missingDataMask=0, CvDTreeParams params=CvDTreeParams() )
......@@ -224,8 +222,6 @@ CvDTree::train
.. ocv:function:: bool CvDTree::train( CvDTreeTrainData* trainData, const CvMat* subsampleIdx )
Trains a decision tree.
There are four ``train`` methods in :ocv:class:`CvDTree`:
* The **first two** methods follow the generic ``CvStatModel::train`` conventions. It is the most complete form. Both data layouts (``tflag=CV_ROW_SAMPLE`` and ``tflag=CV_COL_SAMPLE``) are supported, as well as sample and variable subsets, missing measurements, arbitrary combinations of input and output variable types, and so on. The last parameter contains all of the necessary training parameters (see the :ref:`CvDTreeParams` description).
......@@ -238,12 +234,12 @@ There are four ``train`` methods in :ocv:class:`CvDTree`:
CvDTree::predict
----------------
Returns the leaf node of a decision tree corresponding to the input vector.
.. ocv:function:: CvDTreeNode* CvDTree::predict( const Mat& sample, const Mat& missing_data_mask=Mat(), bool raw_mode=false ) const
.. ocv:function:: CvDTreeNode* CvDTree::predict( const CvMat* sample, const CvMat* missingDataMask=0, bool preprocessedInput=false ) const
Returns the leaf node of a decision tree corresponding to the input vector.
:param sample: Sample for prediction.
:param missing_data: Optional input missing measurement mask.
......@@ -256,9 +252,9 @@ The method traverses the decision tree and returns the reached leaf node as outp
CvDTree::calc_error
-------------------
.. ocv:function:: float CvDTree::calc_error( CvMLData* trainData, int type, std::vector<float> *resp = 0 )
Returns error of the decision tree.
Returns error of the decision tree.
.. ocv:function:: float CvDTree::calc_error( CvMLData* trainData, int type, std::vector<float> *resp = 0 )
:param data: Data for the decision tree.
......@@ -275,33 +271,33 @@ The method calculates error of the decision tree. In case of classification it i
CvDTree::getVarImportance
-------------------------
Returns the variable importance array.
.. ocv:function:: Mat CvDTree::getVarImportance()
.. ocv:function:: const CvMat* CvDTree::get_var_importance()
Returns the variable importance array.
CvDTree::get_root
-----------------
.. ocv:function:: const CvDTreeNode* CvDTree::get_root() const
Returns the root of the decision tree.
Returns the root of the decision tree.
.. ocv:function:: const CvDTreeNode* CvDTree::get_root() const
CvDTree::get_pruned_tree_idx
----------------------------
.. ocv:function:: int CvDTree::get_pruned_tree_idx() const
Returns the ``CvDTree::pruned_tree_idx`` parameter.
Returns the ``CvDTree::pruned_tree_idx`` parameter.
.. ocv:function:: int CvDTree::get_pruned_tree_idx() const
The parameter ``DTree::pruned_tree_idx`` is used to prune a decision tree. See the ``CvDTreeNode::Tn`` parameter.
CvDTree::get_data
-----------------
.. ocv:function:: const CvDTreeTrainData* CvDTree::get_data() const
Returns used train data of the decision tree.
Returns used train data of the decision tree.
.. ocv:function:: const CvDTreeTrainData* CvDTree::get_data() const
Example: building a tree for classifying mushrooms. See the ``mushroom.cpp`` sample that demonstrates how to build and use the
decision tree.
......
This diff is collapsed.
This diff is collapsed.
......@@ -7,10 +7,6 @@ The algorithm caches all training samples and predicts the response for a new sa
**K**
) of the nearest neighbors of the sample using voting, calculating weighted sum, and so on. The method is sometimes referred to as "learning by example" because for prediction it looks for the feature vector with a known response that is closest to the given vector.
.. index:: CvKNearest
.. _CvKNearest:
CvKNearest
----------
.. ocv:class:: CvKNearest
......@@ -45,15 +41,11 @@ K-Nearest Neighbors model. ::
};
.. index:: CvKNearest::train
.. _CvKNearest::train:
CvKNearest::train
-----------------
.. ocv:function:: bool CvKNearest::train( const Mat& _train_data, const Mat& _responses, const Mat& _sample_idx=Mat(), bool is_regression=false, int _max_k=32, bool _update_base=false )
Trains the model.
Trains the model.
.. ocv:function:: bool CvKNearest::train( const Mat& _train_data, const Mat& _responses, const Mat& _sample_idx=Mat(), bool is_regression=false, int _max_k=32, bool _update_base=false )
The method trains the K-Nearest model. It follows the conventions of the generic ``train`` approach with the following limitations:
......@@ -67,15 +59,11 @@ The parameter ``_max_k`` specifies the number of maximum neighbors that may be p
The parameter ``_update_base`` specifies whether the model is trained from scratch
( ``_update_base=false`` ), or it is updated using the new training data ( ``_update_base=true`` ). In the latter case, the parameter ``_max_k`` must not be larger than the original value.
.. index:: CvKNearest::find_nearest
.. _CvKNearest::find_nearest:
CvKNearest::find_nearest
------------------------
.. ocv:function:: float CvKNearest::find_nearest( const Mat& _samples, int k, Mat* results=0, const float** neighbors=0, Mat* neighbor_responses=0, Mat* dist=0 ) const
Finds the neighbors for input vectors.
Finds the neighbors for input vectors.
.. ocv:function:: float CvKNearest::find_nearest( const Mat& _samples, int k, Mat* results=0, const float** neighbors=0, Mat* neighbor_responses=0, Mat* dist=0 ) const
For each input vector (a row of the matrix ``_samples`` ), the method finds the
:math:`\texttt{k} \le
......
This diff is collapsed.
......@@ -100,9 +100,6 @@ References:
*
M. Riedmiller and H. Braun, *A Direct Adaptive Method for Faster Backpropagation Learning: The RPROP Algorithm*, Proc. ICNN, San Francisco (1993).
.. index:: CvANN_MLP_TrainParams
.. _CvANN_MLP_TrainParams:
CvANN_MLP_TrainParams
---------------------
......@@ -133,10 +130,6 @@ Parameters of the MLP training algorithm. ::
The structure has a default constructor that initializes parameters for the ``RPROP`` algorithm. There is also a more advanced constructor to customize the parameters and/or choose the back-propagation algorithm. Finally, the individual parameters can be adjusted after the structure is created.
.. index:: CvANN_MLP
.. _CvANN_MLP:
CvANN_MLP
---------
.. ocv:class:: CvANN_MLP
......@@ -224,15 +217,11 @@ MLP model. ::
Unlike many other models in ML that are constructed and trained at once, in the MLP model these steps are separated. First, a network with the specified topology is created using the non-default constructor or the method ``create`` . All the weights are set to zeros. Then, the network is trained using a set of input and output vectors. The training procedure can be repeated more than once, that is, the weights can be adjusted based on the new training data.
.. index:: CvANN_MLP::create
.. _CvANN_MLP::create:
CvANN_MLP::create
-----------------
.. ocv:function:: void CvANN_MLP::create( const Mat& _layer_sizes, int _activ_func=SIGMOID_SYM, double _f_param1=0, double _f_param2=0 )
Constructs MLP with the specified topology.
Constructs MLP with the specified topology.
.. ocv:function:: void CvANN_MLP::create( const Mat& _layer_sizes, int _activ_func=SIGMOID_SYM, double _f_param1=0, double _f_param2=0 )
:param _layer_sizes: Integer vector specifying the number of neurons in each layer including the input and output layers.
......@@ -242,15 +231,11 @@ CvANN_MLP::create
The method creates an MLP network with the specified topology and assigns the same activation function to all the neurons.
.. index:: CvANN_MLP::train
.. _CvANN_MLP::train:
CvANN_MLP::train
----------------
.. ocv:function:: int CvANN_MLP::train( const Mat& _inputs, const Mat& _outputs, const Mat& _sample_weights, const Mat& _sample_idx=Mat(), CvANN_MLP_TrainParams _params = CvANN_MLP_TrainParams(), int flags=0 )
Trains/updates MLP.
Trains/updates MLP.
.. ocv:function:: int CvANN_MLP::train( const Mat& _inputs, const Mat& _outputs, const Mat& _sample_weights, const Mat& _sample_idx=Mat(), CvANN_MLP_TrainParams _params = CvANN_MLP_TrainParams(), int flags=0 )
:param _inputs: Floating-point matrix of input vectors, one vector per row.
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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