s \vecthree{u}{v}{1} = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1} \begin{bmatrix} r_{11} & r_{12} & r_{13} & t_1 \\ r_{21} & r_{22} & r_{23} & t_2 \\ r_{31} & r_{32} & r_{33} & t_3 \end{bmatrix} \begin{bmatrix} X \\ Y \\ Z \\ 1 \end{bmatrix}
s \vecthree{u}{v}{1} = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}
\begin{bmatrix}
r_{11} & r_{12} & r_{13} & t_1 \\
r_{21} & r_{22} & r_{23} & t_2 \\
r_{31} & r_{32} & r_{33} & t_3
\end{bmatrix}
\begin{bmatrix}
X \\
Y \\
Z \\
1
\end{bmatrix}
Where
:math:`(X, Y, Z)` are the coordinates of a 3D point in the world
@ -45,7 +57,13 @@ to the following (when
..math::
\begin{array}{l} \vecthree{x}{y}{z} = R \vecthree{X}{Y}{Z} + t \\ x' = x/z \\ y' = y/z \\ u = f_x*x' + c_x \\ v = f_y*y' + c_y \end{array}
\begin{array}{l}
\vecthree{x}{y}{z} = R \vecthree{X}{Y}{Z} + t \\
x' = x/z \\
y' = y/z \\
u = f_x*x' + c_x \\
v = f_y*y' + c_y
\end{array}
Real lenses usually have some distortion, mostly
radial distortion and slight tangential distortion. So, the above model
@ -207,7 +225,7 @@ cv::composeRT
:param tvec3:The output translation vector of the superposition
:param d??d??:The optional output derivatives of ``rvec3`` or ``tvec3`` w.r.t. ``rvec?`` or ``tvec?``
:param d*d*:The optional output derivatives of ``rvec3`` or ``tvec3`` w.r.t. ``rvec?`` or ``tvec?``
The functions compute:
@ -1192,7 +1210,7 @@ The matrices, together with ``R1`` and ``R2`` , can then be passed to
Below is the screenshot from ``stereo_calib.cpp`` sample. Some red horizontal lines, as you can see, pass through the corresponding image regions, i.e. the images are well rectified (which is what most stereo correspondence algorithms rely on). The green rectangles are ``roi1`` and ``roi2`` - indeed, their interior are all valid pixels.
@ -455,16 +455,14 @@ Template class for short numerical vectors ::
typedef Vec<double, 3> Vec3d;
typedef Vec<double, 4> Vec4d;
typedef Vec<double, 6> Vec6d;
.. ``Vec`` is a partial case of ``Matx`` . It is possible to convert ``Vec<T,2>`` to/from ``Point_``,``Vec<T,3>`` to/from ``Point3_`` , and ``Vec<T,4>`` to
:ref:`CvScalar` or
:ref:`Scalar` . The elements of ``Vec`` are accessed using ``operator[]`` . All the expected vector operations are implemented too:
``Vec`` is a partial case of ``Matx`` . It is possible to convert ``Vec<T,2>`` to/from ``Point_``,``Vec<T,3>`` to/from ``Point3_`` , and ``Vec<T,4>`` to :ref:`CvScalar` or :ref:`Scalar`. The elements of ``Vec`` are accessed using ``operator[]``. All the expected vector operations are implemented too:
*
:math:`\texttt{v1} = \texttt{v2} \pm \texttt{v3}`, :math:`\texttt{v1} = \texttt{v2} * \alpha`, :math:`\texttt{v1} = \alpha * \texttt{v2}` (plus the corresponding augmenting operations; note that these operations apply
The class ``Vec`` is commonly used to describe pixel types of multi-channel arrays, see ``Mat_`` description.
@ -742,10 +740,7 @@ There are many different ways to create ``Mat`` object. Here are the some popula
..
Thanks to the additional ``datastart`` and ``dataend`` members, it is possible to
compute the relative sub-array position in the main
*"container"*
array using ``locateROI()`` :
Thanks to the additional ``datastart`` and ``dataend`` members, it is possible to compute the relative sub-array position in the main *"container"* array using ``locateROI()``:
::
@ -792,17 +787,9 @@ There are many different ways to create ``Mat`` object. Here are the some popula
..
partial yet very common cases of this "user-allocated data" case are conversions
from
:ref:`CvMat` and
:ref:`IplImage` to ``Mat`` . For this purpose there are special constructors
taking pointers to ``CvMat`` or ``IplImage`` and the optional
flag indicating whether to copy the data or not.
partial yet very common cases of this "user-allocated data" case are conversions from :ref:`CvMat` and :ref:`IplImage` to ``Mat``. For this purpose there are special constructors taking pointers to ``CvMat`` or ``IplImage`` and the optional flag indicating whether to copy the data or not.
Backward conversion from ``Mat`` to ``CvMat`` or ``IplImage`` is provided via cast operators ``Mat::operator CvMat() const`` an ``Mat::operator IplImage()`` .
The operators do
*not*
copy the data.
Backward conversion from ``Mat`` to ``CvMat`` or ``IplImage`` is provided via cast operators ``Mat::operator CvMat() const`` an ``Mat::operator IplImage()``. The operators do *not* copy the data.
::
@ -915,11 +902,11 @@ for a scalar ( ``Scalar`` ),
:math:`A.t() \sim A^t` *
matrix inversion and pseudo-inversion, solving linear systems and least-squares problems:
The result of comparison is 8-bit single channel mask, which elements are set to 255
(if the particular element or pair of elements satisfy the condition) and 0 otherwise.
:math:`A\gtreqqless B,\;A \ne B,\;A \gtreqqless \alpha,\;A \ne \alpha`. The result of comparison is 8-bit single channel mask, which elements are set to 255 (if the particular element or pair of elements satisfy the condition) and 0 otherwise.
*
bitwise logical operations: ``A & B, A & s, A | B, A | s, A textasciicircum B, A textasciicircum s, ~ A`` *
matrix constructors and operators that extract sub-matrices (see
:ref:`Mat` description).
matrix initializers ( ``eye(), zeros(), ones()`` ), matrix comma-separated initializers, matrix constructors and operators that extract sub-matrices (see :ref:`Mat` description).
*
verb
"Mat_<destination_type>()" constructors to cast the result to the proper type.
``Mat_<destination_type>()`` constructors to cast the result to the proper type.
Note, however, that comma-separated initializers and probably some other operations may require additional explicit ``Mat()`` or
verb
"Mat_<T>()" constuctor calls to resolve possible ambiguity.
Note, however, that comma-separated initializers and probably some other operations may require additional explicit ``Mat()`` or ``Mat_<T>()`` constuctor calls to resolve possible ambiguity.
Below is the formal description of the ``Mat`` methods.
@ -2410,8 +2392,8 @@ Template sparse n-dimensional array class derived from
SparseMatIterator_<_Tp> end();
SparseMatConstIterator_<_Tp> end() const;
};
..``SparseMat_``isa thin wrapper on top of
:ref:`SparseMat` , made in the same way as ``Mat_`` .
``SparseMat_`` is a thin wrapper on top of :ref:`SparseMat` , made in the same way as ``Mat_`` .
It simplifies notation of some operations, and that's it. ::
The array ``frame`` is automatically allocated by ``>>`` operator, since the video frame resolution and bit-depth is known to the video capturing module. The array ``edges`` is automatically allocated by ``cvtColor`` function. It will have the same size and the bit-depth as the input array, and the number of channels will be 1, because we passed the color conversion code ``CV_BGR2GRAY`` (that means color to grayscale conversion). Note that ``frame`` and ``edges`` will be allocated only once during the first execution of the loop body, since all the next video frames will have the same resolution (unless user somehow changes the video resolution, in this case the arrays will be automatically reallocated).
@ -112,7 +112,6 @@ The macro ``CV_Error_`` can be used to construct the error message on-fly to inc
CV_Error_(CV_StsOutOfRange,
("the matrix element (
i, j, mtx.at<float>(i,j)))
..
..index:: Exception
@ -145,7 +144,6 @@ The exception class passed to error ::
// the source file line where the error happened
int line;
};
..
The class ``Exception`` encapsulates all or almost all the necessary information about the error happened in the program. The exception is usually constructed and thrown implicitly, via ``CV_Error`` and ``CV_Error_`` macros, see
:func:`error` .
@ -241,7 +239,6 @@ That is, the following code computes the execution time in seconds. ::
double t = (double)getTickCount();
// do something ...
t = ((double)getTickCount() - t)/getTickFrequency();
Add descriptors to train descriptor collection. If collection trainDescCollectionis not empty
the new descriptors are added to existing train descriptors.
Add descriptors to train descriptor collection. If collection trainDescCollectionis not empty the new descriptors are added to existing train descriptors.
:param descriptors:Descriptors to add. Each ``descriptors[i]`` is a set of descriptors
from the same (one) train image.
@ -119,7 +118,7 @@ the new descriptors are added to existing train descriptors.
Returns constant link to the train descriptor collection (i.e. trainDescCollection).
@ -154,23 +153,15 @@ DescriptorMatcher::train
----------------------------
..c:function:: void DescriptorMatcher::train()
Train descriptor matcher (e.g. train flann index). In all methods to match the method train()
is run every time before matching. Some descriptor matchers (e.g. BruteForceMatcher) have empty
implementation of this method, other matchers realy train their inner structures (e.g. FlannBasedMatcher
trains flann::Index)
Train descriptor matcher (e.g. train flann index). In all methods to match the method train() is run every time before matching. Some descriptor matchers (e.g. BruteForceMatcher) have empty implementation of this method, other matchers realy train their inner structures (e.g. FlannBasedMatcher trains flann::Index)
Find the best match for each descriptor from a query set with train descriptors.
Supposed that the query descriptors are of keypoints detected on the same query image.
In first variant of this method train descriptors are set as input argument and
supposed that they are of keypoints detected on the same train image. In second variant
of the method train descriptors collection that was set using addmethod is used.
Optional mask (or masks) can be set to describe which descriptors can be matched. queryDescriptors[i]can be matched with trainDescriptors[j]only if mask.at<uchar>(i,j)is non-zero.
Find the best match for each descriptor from a query set with train descriptors. Supposed that the query descriptors are of keypoints detected on the same query image. In first variant of this method train descriptors are set as input argument and supposed that they are of keypoints detected on the same train image. In second variant of the method train descriptors collection that was set using addmethod is used. Optional mask (or masks) can be set to describe which descriptors can be matched. queryDescriptors[i] can be matched with trainDescriptors[j] only if mask.at<uchar>(i,j)is non-zero.
Find the k best matches for each descriptor from a query set with train descriptors.
Found k (or less if not possible) matches are returned in distance increasing order.
Details about query and train descriptors see in .
Find the k best matches for each descriptor from a query set with train descriptors. Found k (or less if not possible) matches are returned in distance increasing order. Details about query and train descriptors see in .
Find the best matches for each query descriptor which have distance less than given threshold.
Found matches are returned in distance increasing order. Details about query and train
descriptors see in .
Find the best matches for each query descriptor which have distance less than given threshold. Found matches are returned in distance increasing order. Details about query and train descriptors see in.
Brute-force descriptor matcher. For each descriptor in the first set, this matcher finds the closest
descriptor in the second set by trying each one. This descriptor matcher supports masking
permissible matches between descriptor sets. ::
Brute-force descriptor matcher. For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. This descriptor matcher supports masking permissible matches between descriptor sets. ::
template<class Distance>
class BruteForceMatcher : public DescriptorMatcher
@ -277,10 +261,9 @@ permissible matches between descriptor sets. ::
protected:
...
}
..
For efficiency, BruteForceMatcher is templated on the distance metric.
For float descriptors, a common choice would be ``L2<float>``. Class of supported distances are: ::
For efficiency, BruteForceMatcher is templated on the distance metric. For float descriptors, a common choice would be ``L2<float>``. Class of supported distances are: ::
template<typename T>
struct Accumulator
@ -340,7 +323,7 @@ For float descriptors, a common choice would be ``L2<float>`` . Class of support
int size ) const;
...
};
..
..index:: FlannBasedMatcher
@ -350,14 +333,7 @@ FlannBasedMatcher
-----------------
..c:type:: FlannBasedMatcher
Flann based descriptor matcher. This matcher trains
:func:`flann::Index` on
train descriptor collection and calls it's nearest search methods to find best matches.
So this matcher may be faster in cases of matching to large train collection than
brute force matcher. ``FlannBasedMatcher`` does not support masking permissible
matches between descriptor sets, because
:func:`flann::Index` does not
support this. ::
Flann based descriptor matcher. This matcher trains :func:`flann::Index` on train descriptor collection and calls it's nearest search methods to find best matches. So this matcher may be faster in cases of matching to large train collection than brute force matcher. ``FlannBasedMatcher`` does not support masking permissible matches between descriptor sets, because :func:`flann::Index` does not support this. ::
class FlannBasedMatcher : public DescriptorMatcher
..c:function:: DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector( const Ptr<AdjusterAdapter>\& adjaster, int min_features, int max_features, int max_iters )
DynamicAdaptedFeatureDetector constructor.
:param adjaster:An :func:`AdjusterAdapter` that will do the detection and parameter
adjustment
:param min_features:This minimum desired number features.
:param max_features:The maximum desired number of features.
:param max_iters:The maximum number of times to try to adjust the feature detector parameters. For the :func:`FastAdjuster` this number can be high,
but with Star or Surf, many iterations can get time consuming. At each iteration the detector is rerun, so keep this in mind when choosing this value.
..index:: AdjusterAdapter
AdjusterAdapter
---------------
..c:type:: AdjusterAdapter
A feature detector parameter adjuster interface, this is used by the :func:`DynamicAdaptedFeatureDetector` and is a wrapper for :func:`FeatureDetecto` r that allow them to be adjusted after a detection. ::
class AdjusterAdapter: public FeatureDetector
{
public:
virtual ~AdjusterAdapter() {}
virtual void tooFew(int min, int n_detected) = 0;
virtual void tooMany(int max, int n_detected) = 0;
virtual bool good() const = 0;
};
See
:func:`FastAdjuster`,:func:`StarAdjuster`,:func:`SurfAdjuster` for concrete implementations.
..index:: AdjusterAdapter::tooFew
AdjusterAdapter::tooFew
---------------------------
..c:function:: virtual void tooFew(int min, int n_detected) = 0
Too few features were detected so, adjust the detector parameters accordingly - so that the next detection detects more features.
:param min:This minimum desired number features.
:param n_detected:The actual number detected last run.
An example implementation of this is ::
void FastAdjuster::tooFew(int min, int n_detected)
{
thresh_--;
}
..index:: AdjusterAdapter::tooMany
AdjusterAdapter::tooMany
----------------------------
..c:function:: virtual void tooMany(int max, int n_detected) = 0
Too many features were detected so, adjust the detector parameters accordingly - so that the next detection detects less features.
:param max:This maximum desired number features.
:param n_detected:The actual number detected last run.
An example implementation of this is ::
void FastAdjuster::tooMany(int min, int n_detected)
{
thresh_++;
}
..index:: AdjusterAdapter::good
AdjusterAdapter::good
-------------------------
..c:function:: virtual bool good() const = 0
Are params maxed out or still valid? Returns false if the parameters can't be adjusted any more. An example implementation of this is ::
bool FastAdjuster::good() const
{
return (thresh_ > 1) && (thresh_ < 200);
}
..index:: FastAdjuster
FastAdjuster
------------
..c:type:: FastAdjuster
:func:`AdjusterAdapter` for the :func:`FastFeatureDetector`. This will basically decrement or increment the threshhold by 1 ::
class FastAdjuster FastAdjuster: public AdjusterAdapter
A feature detector parameter adjuster interface, this is used by the
:func:`DynamicAdaptedFeatureDetector` and is a wrapper for
:func:`FeatureDetecto` r that allow them to be adjusted after a detection.
A feature detector parameter adjuster interface, this is used by the :func:`DynamicAdaptedFeatureDetector` and is a wrapper for :func:`FeatureDetecto` r that allow them to be adjusted after a detection. ::
class AdjusterAdapter: public FeatureDetector
{
public:
virtual ~AdjusterAdapter() {}
virtual void tooFew(int min, int n_detected) = 0;
virtual void tooMany(int max, int n_detected) = 0;
virtual bool good() const = 0;
};
See
:func:`FastAdjuster`,:func:`StarAdjuster`,:func:`SurfAdjuster` for concrete implementations. ::
class AdjusterAdapter: public FeatureDetector
{
public:
virtual ~AdjusterAdapter() {}
virtual void tooFew(int min, int n_detected) = 0;
virtual void tooMany(int max, int n_detected) = 0;
virtual bool good() const = 0;
};
..
:func:`FastAdjuster`,:func:`StarAdjuster`,:func:`SurfAdjuster` for concrete implementations.
..index:: AdjusterAdapter::tooFew
@ -489,8 +963,7 @@ AdjusterAdapter::tooFew
---------------------------
..c:function:: virtual void tooFew(int min, int n_detected) = 0
Too few features were detected so, adjust the detector parameters accordingly - so that the next
detection detects more features.
Too few features were detected so, adjust the detector parameters accordingly - so that the next detection detects more features.
:param min:This minimum desired number features.
@ -502,7 +975,7 @@ An example implementation of this is ::
{
thresh_--;
}
..
..index:: AdjusterAdapter::tooMany
@ -510,8 +983,7 @@ AdjusterAdapter::tooMany
----------------------------
..c:function:: virtual void tooMany(int max, int n_detected) = 0
Too many features were detected so, adjust the detector parameters accordingly - so that the next
detection detects less features.
Too many features were detected so, adjust the detector parameters accordingly - so that the next detection detects less features.
:param max:This maximum desired number features.
@ -523,7 +995,7 @@ An example implementation of this is ::
{
thresh_++;
}
..
..index:: AdjusterAdapter::good
@ -531,28 +1003,22 @@ AdjusterAdapter::good
-------------------------
..c:function:: virtual bool good() const = 0
Are params maxed out or still valid? Returns false if the parameters can't be adjusted any more.
An example implementation of this is ::
Are params maxed out or still valid? Returns false if the parameters can't be adjusted any more. An example implementation of this is ::
bool FastAdjuster::good() const
{
return (thresh_ > 1) && (thresh_ < 200);
}
..
..index:: FastAdjuster
.._FastAdjuster:
..index:: FastAdjuster
FastAdjuster
------------
..c:type:: FastAdjuster
An
:func:`AdjusterAdapter` for the
:func:`FastFeatureDetector` . This will basically decrement or increment the
threshhold by 1 ::
:func:`AdjusterAdapter` for the :func:`FastFeatureDetector`. This will basically decrement or increment the threshhold by 1 ::
class FastAdjuster FastAdjuster: public AdjusterAdapter
Adds images and keypoints from them to the train collection (descriptors are supposed to be calculated here).
If train collection is not empty new image and keypoints from them will be added to
existing data.
Adds images and keypoints from them to the train collection (descriptors are supposed to be calculated here). If train collection is not empty new image and keypoints from them will be added to existing data.
Classifies query keypoints under keypoints of one train image qiven as input argument
(first version of the method) or train image collection that set using (second version).
Classifies query keypoints under keypoints of one train image qiven as input argument (first version of the method) or train image collection that set using (second version).
Find best match for query keypoints to the training set. In first version of method
one train image and keypoints detected on it - are input arguments. In second version
query keypoints are matched to training collectin that set using . As in the mask can be set.
Find best match for query keypoints to the training set. In first version of method one train image and keypoints detected on it - are input arguments. In second version query keypoints are matched to training collectin that set using . As in the mask can be set.
Find the knn best matches for each keypoint from a query set with train keypoints.
Found knn (or less if not possible) matches are returned in distance increasing order.
Details see in and .
Find the knn best matches for each keypoint from a query set with train keypoints. Found knn (or less if not possible) matches are returned in distance increasing order. Details see in and.
Find the best matches for each query keypoint which have distance less than given threshold.
Found matches are returned in distance increasing order. Details see in and .
Find the best matches for each query keypoint which have distance less than given threshold. Found matches are returned in distance increasing order. Details see in and .
@ -24,45 +23,43 @@ Match is a line connecting two keypoints (circles).
:param matches:Matches from first image to second one, i.e. ``keypoints1[i]`` has corresponding point ``keypoints2[matches[i]]`` .
:param outImg:Output image. Its content depends on ``flags`` value
what is drawn in output image. See below possible ``flags`` bit values.
:param outImg:Output image. Its content depends on ``flags`` value what is drawn in output image. See below possible ``flags`` bit values.
:param matchColor:Color of matches (lines and connected keypoints).
If ``matchColor==Scalar::all(-1)`` color will be generated randomly.
:param matchColor:Color of matches (lines and connected keypoints). If ``matchColor==Scalar::all(-1)`` color will be generated randomly.
:param singlePointColor:Color of single keypoints (circles), i.e. keypoints not having the matches.
If ``singlePointColor==Scalar::all(-1)`` color will be generated randomly.
:param singlePointColor:Color of single keypoints (circles), i.e. keypoints not having the matches. If ``singlePointColor==Scalar::all(-1)`` color will be generated randomly.
:param matchesMask:Mask determining which matches will be drawn. If mask is empty all matches will be drawn.
:param flags:Each bit of ``flags`` sets some feature of drawing.
Possible ``flags`` bit values is defined by ``DrawMatchesFlags`` , see below. ::
struct DrawMatchesFlags
{
enum{ DEFAULT = 0, // Output image matrix will be created (Mat::create),
// i.e. existing memory of output image may be reused.
// Two source image, matches and single keypoints
// will be drawn.
// For each keypoint only the center point will be
// drawn (without the circle around keypoint with
// keypoint size and orientation).
DRAW_OVER_OUTIMG = 1, // Output image matrix will not be
// created (Mat::create). Matches will be drawn
// on existing content of output image.
NOT_DRAW_SINGLE_POINTS = 2, // Single keypoints will not be drawn.
DRAW_RICH_KEYPOINTS = 4 // For each keypoint the circle around
// keypoint with keypoint size and orientation will
// be drawn.
:param flags:Each bit of ``flags`` sets some feature of drawing. Possible ``flags`` bit values is defined by ``DrawMatchesFlags`` ::
struct DrawMatchesFlags
{
enum{ DEFAULT = 0, // Output image matrix will be created (Mat::create),
// i.e. existing memory of output image may be reused.
// Two source image, matches and single keypoints
// will be drawn.
// For each keypoint only the center point will be
// drawn (without the circle around keypoint with
// keypoint size and orientation).
DRAW_OVER_OUTIMG = 1, // Output image matrix will not be
// created (Mat::create). Matches will be drawn
// on existing content of output image.
NOT_DRAW_SINGLE_POINTS = 2, // Single keypoints will not be drawn.
DRAW_RICH_KEYPOINTS = 4 // For each keypoint the circle around
// keypoint with keypoint size and orientation will
:param outImg:Output image. Its content depends on ``flags`` value
what is drawn in output image. See possible ``flags`` bit values.
:param color:Color of keypoints
:param outImg:Output image. Its content depends on ``flags`` value what is drawn in output image. See possible ``flags`` bit values.
.
:param color:Color of keypoints.
:param flags:Each bit of ``flags`` sets some feature of drawing.
Possible ``flags`` bit values is defined by ``DrawMatchesFlags`` ,
see above in :func:`drawMatches` .
:param flags:Each bit of ``flags`` sets some feature of drawing. Possible ``flags`` bit values is defined by ``DrawMatchesFlags``, see above in :func:`drawMatches` .
Add descriptors to training set. The training set will be clustered using clustermethod to construct vocabulary.
@ -70,14 +70,11 @@ BOWTrainer::cluster
-----------------------
..c:function:: Mat BOWTrainer::cluster() const
Cluster train descriptors. Vocabulary consists from cluster centers. So this method
returns vocabulary. In first method variant the stored in object train descriptors will be
clustered, in second variant -- input descriptors will be clustered.
Cluster train descriptors. Vocabulary consists from cluster centers. So this method returns vocabulary. In first method variant the stored in object train descriptors will be clustered, in second variant -- input descriptors will be clustered.
..c:function:: Mat BOWTrainer::cluster( const Mat\& descriptors ) const
:param descriptors:Descriptors to cluster. Each row of ``descriptors`` matrix is a one descriptor. Descriptors will not be added
to the inner train descriptor set.
:param descriptors:Descriptors to cluster. Each row of ``descriptors`` matrix is a one descriptor. Descriptors will not be added to the inner train descriptor set.
..index:: BOWKMeansTrainer
@ -103,7 +100,7 @@ BOWKMeansTrainer
protected:
...
};
..
To gain an understanding of constructor parameters see
:func:`kmeans` function
@ -117,35 +114,32 @@ BOWImgDescriptorExtractor
-------------------------
..c:type:: BOWImgDescriptorExtractor
Class to compute image descriptor using ''bad of visual words''. In few,
such computing consists from the following steps:
1. Compute descriptors for given image and it's keypoints set,
\
2. Find nearest visual words from vocabulary for each keypoint descriptor,
\
3. Image descriptor is a normalized histogram of vocabulary words encountered in the image. I.e.
``i`` -bin of the histogram is a frequency of ``i`` -word of vocabulary in the given image. ::
Class to compute image descriptor using ''bad of visual words''. In few, such computing consists from the following steps:
#. Compute descriptors for given image and it's keypoints set
#. Find nearest visual words from vocabulary for each keypoint descriptor,
#. Image descriptor is a normalized histogram of vocabulary words encountered in the image. I.e. ``i`` -bin of the histogram is a frequency of ``i`` -word of vocabulary in the given image. ::
:param imgDescriptor:This is output, i.e. computed image descriptor.
:param pointIdxsOfClusters:Indices of keypoints which belong to the cluster, i.e. ``pointIdxsOfClusters[i]`` is keypoint indices which belong
to the ``i-`` cluster (word of vocabulary) (returned if it is not 0.)
:param pointIdxsOfClusters:Indices of keypoints which belong to the cluster, i.e. ``pointIdxsOfClusters[i]`` is keypoint indices which belong to the ``i-`` cluster (word of vocabulary) (returned if it is not 0.)
:param descriptors:Descriptors of the image keypoints (returned if it is not 0.)
@ -45,11 +45,11 @@ This class computes the disparity map using block matching algorithm. The class
:math:`>` 0). If ``avergeTexThreshold = 0`` low textureness filtering is disabled, otherwise disparity is set to 0 in each point ``(x, y)`` where for left image
:math:`\sum HorizontalGradiensInWindow(x, y, winSize) < (winSize \cdot winSize) \cdot avergeTexThreshold` i.e. input left image is low textured.
..c:function:: StereoBeliefPropagation::StereoBeliefPropagation( int ndisp = DEFAULT_NDISP, int iters = DEFAULT_ITERS, int levels = DEFAULT_LEVELS, int msg_type = CV_32F)
This is a simple lightweight class that encapsulate pitched memory on GPU. It is intended to pass to nvcc-compiled code, i.e. CUDA kernels. So it is used internally by OpenCV and by users writes own device code. Its members can be called both from host and from device code. ::
@ -21,7 +21,7 @@ This is a simple lightweight class that encapsulate pitched memory on GPU. It is
DevMem2D_(int rows_, int cols_, T *data_, size_t step_);
DevMem2D_(int rows, int cols, T *data, size_t step);
template <typename U>
explicit DevMem2D_(const DevMem2D_<U>& d);
@ -37,15 +37,15 @@ This is a simple lightweight class that encapsulate pitched memory on GPU. It is
};
..index:: gpu::PtrStep_
..index:: gpu::PtrStep\_
.._gpu::PtrStep_:
..gpu::PtrStep\_:
gpu::PtrStep_
-------------
..c:type:: gpu::PtrStep_
gpu::PtrStep\_
--------------
..c:type:: gpu::PtrStep\_
This is structure is similar to DevMem2D_but contains only pointer and row step. Width and height fields are excluded due to performance reasons. The structure is for internal use or for users who write own device code. ::
This is structure is similar to DevMem2D\_but contains only pointer and row step. Width and height fields are excluded due to performance reasons. The structure is for internal use or for users who write own device code. ::
template<typename T> struct PtrStep_
{
@ -64,13 +64,13 @@ This is structure is similar to DevMem2D_but contains only pointer and row step.
};
..index:: gpu::PtrElemStrp_
..index:: gpu::PtrElemStrp\_
.._gpu::PtrElemStrp_:
..gpu::PtrElemStrp\_:
gpu::PtrElemStrp_
-----------------
..c:type:: gpu::PtrElemStrp_
gpu::PtrElemStrp\_
------------------
..c:type:: gpu::PtrElemStrp\_
This is structure is similar to DevMem2D_but contains only pointer and row step in elements. Width and height fields are excluded due to performance reasons. This class is can only be constructed if sizeof(T) is a multiple of 256. The structure is for internal use or for users who write own device code. ::
@ -84,7 +84,7 @@ This is structure is similar to DevMem2D_but contains only pointer and row step
..index:: gpu::GpuMat
.._gpu::GpuMat:
..gpu::GpuMat:
gpu::GpuMat
-----------
@ -136,9 +136,8 @@ Is it a bad practice to leave static or global GpuMat variables allocated, i.e.
See also:
:func:`Mat`
..index:: gpu::CudaMem
.._gpu::CudaMem:
..index:: gpu::CudaMem
gpu::CudaMem
------------
@ -187,18 +186,18 @@ Please note that allocation size of such memory types is usually limited. For mo
..index:: gpu::CudaMem::createMatHeader
cv::gpu::CudaMem::createMatHeader
gpu::CudaMem::createMatHeader
---------------------------------
:func:`Mat`
..c:function:: Mat CudaMem::createMatHeader() const
..c:function:: CudaMem::operator Mat() const
..cpp:function:: Mat CudaMem::createMatHeader() const
..cpp:function:: CudaMem::operator Mat() const
Creates header without reference counting to CudaMem data.
@ -168,34 +168,30 @@ Brute-force descriptor matcher. For each descriptor in the first set, this match
};
The class ``BruteForceMatcher_GPU`` has the similar interface to class
. It has two groups of match methods: for matching descriptors of one image with other image or with image set. Also all functions have alternative: save results to GPU memory or to CPU memory.
``Distance`` template parameter is kept for CPU/GPU interfaces similarity. ``BruteForceMatcher_GPU`` supports only ``L1<float>`` and ``L2<float>`` distance types.
The class ``BruteForceMatcher_GPU`` has the similar interface to class. It has two groups of match methods: for matching descriptors of one image with other image or with image set. Also all functions have alternative: save results to GPU memory or to CPU memory. ``Distance`` template parameter is kept for CPU/GPU interfaces similarity. ``BruteForceMatcher_GPU`` supports only ``L1<float>`` and ``L2<float>`` distance types.
:param maskCollection:``GpuMat`` containing set of masks. It can be obtained from ``std::vector<GpuMat>`` by . Or it can contain user defined mask set. It must be empty matrix or one row matrix, each element is a ``PtrStep`` that points to one mask.
Finds the k best matches for each descriptor from a query set with train descriptors. Found k (or less if not possible) matches are returned in distance increasing order.
Finds the k best matches for each descriptor from a query set with train descriptors. Found k (or less if not possible) matches are returned in distance increasing order. Results will be stored to GPU memory.
Downloads trainIdxand distancematrices obtained via to CPU vector with . If compactResultis true matchesvector will not contain matches for fully masked out query descriptors.
Finds the best matches for each query descriptor which have distance less than given threshold. Found matches are returned in distance increasing order.
Downloads trainIdx, nMatchesand distancematrices obtained via to CPU vector with . If compactResultis true matchesvector will not contain matches for fully masked out query descriptors.
@ -130,15 +122,11 @@ By using ``FilterEngine_GPU`` instead of functions you can avoid unnecessary mem
**Please note:**
The GPU filters doesn't support the in-place mode.
See also:,,,,,,,,,,
..index:: cv::gpu::createFilter2D_GPU
..index:: gpu::createFilter2D_GPU
.._cv::gpu::createFilter2D_GPU:
cv::gpu::createFilter2D_GPU
gpu::createFilter2D_GPU
---------------------------
..c:function:: Ptr<FilterEngine_GPU> createFilter2D_GPU( const Ptr<BaseFilter_GPU>\& filter2D, int srcType, int dstType)
..c:function:: Ptr<FilterEngine_GPU> createFilter2D_GPU( const Ptr<BaseFilter_GPU>& filter2D, int srcType, int dstType)
Creates non-separable filter engine with the specified filter.
@ -150,13 +138,11 @@ cv::gpu::createFilter2D_GPU
Usually this function is used inside high-level functions, like,.
..index:: cv::gpu::createSeparableFilter_GPU
.._cv::gpu::createSeparableFilter_GPU:
..index:: gpu::createSeparableFilter_GPU
cv::gpu::createSeparableFilter_GPU
gpu::createSeparableFilter_GPU
----------------------------------
..c:function:: Ptr<FilterEngine_GPU> createSeparableFilter_GPU( const Ptr<BaseRowFilter_GPU>\& rowFilter, const Ptr<BaseColumnFilter_GPU>\& columnFilter, int srcType, int bufType, int dstType)
..c:function:: Ptr<FilterEngine_GPU> createSeparableFilter_GPU( const Ptr<BaseRowFilter_GPU>& rowFilter, const Ptr<BaseColumnFilter_GPU>& columnFilter, int srcType, int bufType, int dstType)
Creates separable filter engine with the specified filters.
There are two version of algorithm: NPP and OpenCV. NPP calls when ``dstType == CV_8UC1`` or ``dstType == CV_8UC4`` and ``bufType == dstType`` , otherwise calls OpenCV version. NPP supports only ``BORDER_CONSTANT`` border type and doesn't check indices outside image. OpenCV version supports only ``CV_32F`` buffer depth and ``BORDER_REFLECT101``,``BORDER_REPLICATE`` and ``BORDER_CONSTANT`` border types and checks indices outside image.
See also:,:func:`createSeparableLinearFilter` .
..index::cv::gpu::createSeparableLinearFilter_GPU
..index:: gpu::createSeparableLinearFilter_GPU
.._cv::gpu::createSeparableLinearFilter_GPU:
cv::gpu::createSeparableLinearFilter_GPU
gpu::createSeparableLinearFilter_GPU
----------------------------------------
..c:function:: Ptr<FilterEngine_GPU> createSeparableLinearFilter_GPU(int srcType, int dstType, const Mat\& rowKernel, const Mat\& columnKernel, const Point\& anchor = Point(-1,-1), int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
..c:function:: Ptr<FilterEngine_GPU> createSeparableLinearFilter_GPU(int srcType, int dstType, const Mat& rowKernel, const Mat& columnKernel, const Point& anchor = Point(-1,-1), int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
Creates the separable linear filter engine.
@ -546,9 +515,9 @@ See also:,,
..index:: gpu::sepFilter2D
cv::gpu::sepFilter2D
gpu::sepFilter2D
--------------------
..c:function:: void sepFilter2D(const GpuMat\& src, GpuMat\& dst, int ddepth, const Mat\& kernelX, const Mat\& kernelY, Point anchor = Point(-1,-1), int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
..c:function:: void gpu::sepFilter2D(const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernelX, const Mat& kernelY, Point anchor = Point(-1,-1), int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
Applies separable 2D linear filter to the image.
@ -566,11 +535,9 @@ cv::gpu::sepFilter2D
See also:,:func:`sepFilter2D` .
..index:: cv::gpu::createDerivFilter_GPU
.._cv::gpu::createDerivFilter_GPU:
..index:: gpu::createDerivFilter_GPU
cv::gpu::createDerivFilter_GPU
gpu::createDerivFilter_GPU
------------------------------
..c:function:: Ptr<FilterEngine_GPU> createDerivFilter_GPU(int srcType, int dstType, int dx, int dy, int ksize, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
@ -592,9 +559,9 @@ See also:,:func:`createDerivFilter` .
..index:: gpu::Sobel
cv::gpu::Sobel
gpu::Sobel
--------------
..c:function:: void Sobel(const GpuMat\& src, GpuMat\& dst, int ddepth, int dx, int dy, int ksize = 3, double scale = 1, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
..c:function:: void gpu::Sobel(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, int ksize = 3, double scale = 1, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
Applies generalized Sobel operator to the image.
@ -618,9 +585,9 @@ See also:,:func:`Sobel` .
..index:: gpu::Scharr
cv::gpu::Scharr
gpu::Scharr
---------------
..c:function:: void Scharr(const GpuMat\& src, GpuMat\& dst, int ddepth, int dx, int dy, double scale = 1, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
..c:function:: void gpu::Scharr(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, double scale = 1, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
Calculates the first x- or y- image derivative using Scharr operator.
@ -636,14 +603,11 @@ cv::gpu::Scharr
:param scale:Optional scale factor for the computed derivative values (by default, no scaling is applied, see :func:`getDerivKernels` ).
:param rowBorderType, columnBorderType:Pixel extrapolation method, see :func:`borderInterpolate`
See also:,:func:`Scharr` .
..index:: cv::gpu::createGaussianFilter_GPU
:param rowBorderType, columnBorderType:Pixel extrapolation method, see :func:`borderInterpolate` See also:,:func:`Scharr` .
.._cv::gpu::createGaussianFilter_GPU:
..index:: gpu::createGaussianFilter_GPU
cv::gpu::createGaussianFilter_GPU
gpu::createGaussianFilter_GPU
---------------------------------
..c:function:: Ptr<FilterEngine_GPU> createGaussianFilter_GPU(int type, Size ksize, double sigmaX, double sigmaY = 0, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
@ -663,9 +627,9 @@ See also:,:func:`createGaussianFilter` .
Performs a forward or inverse discrete Fourier transform (1D or 2D) of floating point matrix. Can handle real matrices (CV32FC1) and complex matrices in the interleaved format (CV32FC2).
Computes a proximity map for a raster template and an image where the template is searched for.
@ -325,8 +325,7 @@ cv::gpu::matchTemplate
:param templ:Template image. Must have the same size and type as ``image`` .
:param result:Map containing comparison results ( ``CV_32FC1`` ). If ``image`` is :math:`W \times H` and
``templ`` is :math:`w \times h` then ``result`` must be :math:`(W-w+1) \times (H-h+1)` .
:param result:Map containing comparison results ( ``CV_32FC1`` ). If ``image`` is :math:`W \times H` and ``templ`` is :math:`w \times h` then ``result`` must be :math:`(W-w+1) \times (H-h+1)` .
:param method:Specifies the way which the template must be compared with the image.
:param src:The source 8-bit or floating-point, 1-channel or 3-channel image
:param dst:The destination image; will have the same size and the same type as ``src``
:param d:The diameter of each pixel neighborhood, that is used during filtering. If it is non-positive, it's computed from ``sigmaSpace``
:param sigmaColor:Filter sigma in the color space. Larger value of the parameter means that farther colors within the pixel neighborhood (see ``sigmaSpace`` ) will be mixed together, resulting in larger areas of semi-equal color
:param sigmaSpace:Filter sigma in the coordinate space. Larger value of the parameter means that farther pixels will influence each other (as long as their colors are close enough; see ``sigmaColor`` ). Then ``d>0`` , it specifies the neighborhood size regardless of ``sigmaSpace`` , otherwise ``d`` is proportional to ``sigmaSpace``
The function applies bilateral filtering to the input image, as described in
:param dst:The destination image; will have the same size and the same type as ``src``
:param ksize:The smoothing kernel size
:param anchor:The anchor point. The default value ``Point(-1,-1)`` means that the anchor is at the kernel center
@ -404,9 +408,11 @@ borderInterpolate
Computes source location of extrapolated pixel
:param p:0-based coordinate of the extrapolated pixel along one of the axes, likely <0 or >= ``len``
:param len:length of the array along the corresponding axis
:param borderType:the border type, one of the ``BORDER_*`` , except for ``BORDER_TRANSPARENT`` and ``BORDER_ISOLATED`` . When ``borderType==BORDER_CONSTANT`` the function always returns -1, regardless of ``p`` and ``len``
The function computes and returns the coordinate of the donor pixel, corresponding to the specified extrapolated pixel when using the specified extrapolation border mode. For example, if we use ``BORDER_WRAP`` mode in the horizontal direction, ``BORDER_REFLECT_101`` in the vertical direction and want to compute value of the "virtual" pixel ``Point(-5, 100)`` in a floating-point image ``img`` , it will be ::
float val = img.at<float>(borderInterpolate(100, img.rows, BORDER_REFLECT_101),
@ -419,6 +425,7 @@ Normally, the function is not called directly; it is used inside
See also:
:func:`FilterEngine`,:func:`copyMakeBorder`
..index:: boxFilter
boxFilter
@ -430,6 +437,7 @@ boxFilter
:param src:The source image
:param dst:The destination image; will have the same size and the same type as ``src``
:param ksize:The smoothing kernel size
:param anchor:The anchor point. The default value ``Point(-1,-1)`` means that the anchor is at the kernel center
@ -486,10 +494,13 @@ copyMakeBorder
:param src:The source image
:param dst:The destination image; will have the same type as ``src`` and the size ``Size(src.cols+left+right, src.rows+top+bottom)``
:param top, bottom, left, right:Specify how much pixels in each direction from the source image rectangle one needs to extrapolate, e.g. ``top=1, bottom=1, left=1, right=1`` mean that 1 pixel-wide border needs to be built
:param borderType:The border type; see :func:`borderInterpolate`
:param value:The border value if ``borderType==BORDER_CONSTANT``
The function copies the source image into the middle of the destination image. The areas to the left, to the right, above and below the copied source image will be filled with extrapolated pixels. This is not what
:func:`FilterEngine` or based on it filtering functions do (they extrapolate pixels on-fly), but what other more complex functions, including your own, may do to simplify image boundary handling.
@ -527,14 +538,19 @@ createBoxFilter
:param srcType:The source image type
:param sumType:The intermediate horizontal sum type; must have as many channels as ``srcType``
:param dstType:The destination image type; must have as many channels as ``srcType``
:param ksize:The aperture size
:param anchor:The anchor position with the kernel; negative values mean that the anchor is at the kernel center
:param normalize:Whether the sums are normalized or not; see :func:`boxFilter`
:param scale:Another way to specify normalization in lower-level ``getColumnSumFilter``
:param borderType:Which border type to use; see :func:`borderInterpolate`
The function is a convenience function that retrieves horizontal sum primitive filter with
:func:`getRowSumFilter` , vertical sum filter with
:func:`getColumnSumFilter` , constructs new
@ -558,14 +574,16 @@ createDerivFilter
:param srcType:The source image type
:param dstType:The destination image type; must have as many channels as ``srcType``
:param dx:The derivative order in respect with x
:param dy:The derivative order in respect with y
:param ksize:The aperture size; see :func:`getDerivKernels`
:param borderType:Which border type to use; see :func:`borderInterpolate`
The function
:func:`createDerivFilter` is a small convenience function that retrieves linear filter coefficients for computing image derivatives using
The function :func:`createDerivFilter` is a small convenience function that retrieves linear filter coefficients for computing image derivatives using
:func:`getDerivKernels` and then creates a separable linear filter with
:func:`createSeparableLinearFilter` . The function is used by
:func:`Sobel` and
@ -585,11 +603,14 @@ createGaussianFilter
:param type:The source and the destination image type
:param ksize:The aperture size; see :func:`getGaussianKernel`
:param sigmaX:The Gaussian sigma in the horizontal direction; see :func:`getGaussianKernel`
:param sigmaY:The Gaussian sigma in the vertical direction; if 0, then :math:`\texttt{sigmaY}\leftarrow\texttt{sigmaX}`
:param borderType:Which border type to use; see :func:`borderInterpolate`
The function
:func:`createGaussianFilter` computes Gaussian kernel coefficients and then returns separable linear filter for that kernel. The function is used by
The function :func:`createGaussianFilter` computes Gaussian kernel coefficients and then returns separable linear filter for that kernel. The function is used by
:func:`GaussianBlur` . Note that while the function takes just one data type, both for input and output, you can pass by this limitation by calling
:func:`getGaussianKernel` and then
:func:`createSeparableFilter` directly.
@ -610,6 +631,7 @@ createLinearFilter
:param srcType:The source image type
:param dstType:The destination image type; must have as many channels as ``srcType``
:param kernel:The 2D array of filter coefficients
:param anchor:The anchor point within the kernel; special value ``Point(-1,-1)`` means that the anchor is at the kernel center
@ -620,6 +642,7 @@ createLinearFilter
the parameter specifies the number of the fractional bits
:param rowBorderType, columnBorderType:The pixel extrapolation methods in the horizontal and the vertical directions; see :func:`borderInterpolate`
:param borderValue:Used in case of constant border
The function returns pointer to 2D linear filter for the specified kernel, the source array type and the destination array type. The function is a higher-level function that calls ``getLinearFilter`` and passes the retrieved 2D filter to
@ -644,6 +667,7 @@ createMorphologyFilter
Creates engine for non-separable morphological operations
:param op:The morphology operation id, ``MORPH_ERODE`` or ``MORPH_DILATE``
:param type:The input/output image type
:param element:The 2D 8-bit structuring element for the morphological operation. Non-zero elements indicate the pixels that belong to the element
@ -653,6 +677,7 @@ createMorphologyFilter
:param anchor:The anchor position within the structuring element; negative values mean that the anchor is at the center
:param rowBorderType, columnBorderType:The pixel extrapolation methods in the horizontal and the vertical directions; see :func:`borderInterpolate`
:param borderValue:The border value in case of a constant border. The default value, \ ``morphologyDefaultBorderValue`` , has the special meaning. It is transformed :math:`+\inf` for the erosion and to :math:`-\inf` for the dilation, which means that the minimum (maximum) is effectively computed only over the pixels that are inside the image.
The functions construct primitive morphological filtering operations or a filter engine based on them. Normally it's enough to use
@ -678,7 +703,9 @@ createSeparableLinearFilter
:param srcType:The source array type
:param dstType:The destination image type; must have as many channels as ``srcType``
:param bufType:The inermediate buffer type; must have as many channels as ``srcType``
:param rowKernel:The coefficients for filtering each row
:param columnKernel:The coefficients for filtering each column
@ -691,6 +718,7 @@ createSeparableLinearFilter
the parameter specifies the number of the fractional bits
:param rowBorderType, columnBorderType:The pixel extrapolation methods in the horizontal and the vertical directions; see :func:`borderInterpolate`
:param borderValue:Used in case of a constant border
:param symmetryType:The type of each of the row and column kernel; see :func:`getKernelType` .
@ -714,6 +742,7 @@ dilate
:param src:The source image
:param dst:The destination image. It will have the same size and the same type as ``src``
:param element:The structuring element used for dilation. If ``element=Mat()`` , a :math:`3\times 3` rectangular structuring element is used
:param anchor:Position of the anchor within the element. The default value :math:`(-1, -1)` means that the anchor is at the element center
@ -721,7 +750,9 @@ dilate
:param iterations:The number of times dilation is applied
:param borderType:The pixel extrapolation method; see :func:`borderInterpolate`
:param borderValue:The border value in case of a constant border. The default value has a special meaning, see :func:`createMorphologyFilter`
The function dilates the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the maximum is taken:
..math::
@ -743,6 +774,7 @@ erode
:param src:The source image
:param dst:The destination image. It will have the same size and the same type as ``src``
:param element:The structuring element used for dilation. If ``element=Mat()`` , a :math:`3\times 3` rectangular structuring element is used
:param anchor:Position of the anchor within the element. The default value :math:`(-1, -1)` means that the anchor is at the element center
@ -750,7 +782,9 @@ erode
:param iterations:The number of times erosion is applied
:param borderType:The pixel extrapolation method; see :func:`borderInterpolate`
:param borderValue:The border value in case of a constant border. The default value has a special meaning, see :func:`createMorphoogyFilter`
The function erodes the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the minimum is taken:
..math::
@ -761,6 +795,7 @@ The function supports the in-place mode. Erosion can be applied several ( ``iter
:param dst:The destination image. It will have the same size and the same number of channels as ``src``
:param ddepth:The desired depth of the destination image. If it is negative, it will be the same as ``src.depth()``
:param kernel:Convolution kernel (or rather a correlation kernel), a single-channel floating point matrix. If you want to apply different kernels to different channels, split the image into separate color planes using :func:`split` and process them individually
:param anchor:The anchor of the kernel that indicates the relative position of a filtered point within the kernel. The anchor should lie within the kernel. The special default value (-1,-1) means that the anchor is at the kernel center
:param delta:The optional value added to the filtered pixels before storing them in ``dst``
:param borderType:The pixel extrapolation method; see :func:`borderInterpolate`
The function applies an arbitrary linear filter to the image. In-place operation is supported. When the aperture is partially outside the image, the function interpolates outlier pixel values according to the specified border mode.
The function does actually computes correlation, not the convolution:
:param dst:The destination image; will have the same size and the same type as ``src``
:param ksize:The Gaussian kernel size; ``ksize.width`` and ``ksize.height`` can differ, but they both must be positive and odd. Or, they can be zero's, then they are computed from ``sigma*``
:param sigmaX, sigmaY:The Gaussian kernel standard deviations in X and Y direction. If ``sigmaY`` is zero, it is set to be equal to ``sigmaX`` . If they are both zeros, they are computed from ``ksize.width`` and ``ksize.height`` , respectively, see :func:`getGaussianKernel` . To fully control the result regardless of possible future modification of all this semantics, it is recommended to specify all of ``ksize`` , ``sigmaX`` and ``sigmaY``
:param borderType:The pixel extrapolation method; see :func:`borderInterpolate`
The function convolves the source image with the specified Gaussian kernel. In-place filtering is supported.
See also:
@ -824,7 +868,9 @@ getDerivKernels
Returns filter coefficients for computing spatial image derivatives
:param kx:The output matrix of row filter coefficients; will have type ``ktype``
:param ky:The output matrix of column filter coefficients; will have type ``ktype``
:param dx:The derivative order in respect with x
:param dy:The derivative order in respect with y
@ -834,6 +880,7 @@ getDerivKernels
:param normalize:Indicates, whether to normalize (scale down) the filter coefficients or not. In theory the coefficients should have the denominator :math:`=2^{ksize*2-dx-dy-2}` . If you are going to filter floating-point images, you will likely want to use the normalized kernels. But if you compute derivatives of a 8-bit image, store the results in 16-bit image and wish to preserve all the fractional bits, you may want to set ``normalize=false`` .
:param ktype:The type of filter coefficients. It can be ``CV_32f`` or ``CV_64F``
The function computes and returns the filter coefficients for spatial image derivatives. When ``ksize=CV_SCHARR`` , the Scharr
:math:`3 \times 3` kernels are generated, see
:func:`Scharr` . Otherwise, Sobel kernels are generated, see
@ -853,6 +900,7 @@ getGaussianKernel
:param sigma:The Gaussian standard deviation. If it is non-positive, it is computed from ``ksize`` as \ ``sigma = 0.3*(ksize/2 - 1) + 0.8``
:param ktype:The type of filter coefficients. It can be ``CV_32f`` or ``CV_64F``
The function computes and returns the
:math:`\texttt{ksize} \times 1` matrix of Gaussian filter coefficients:
@ -893,6 +941,7 @@ The function analyzes the kernel coefficients and returns the corresponding kern
* **KERNEL_SMOOTH** All the kernel elements are non-negative and sum to 1. E.g. the Gaussian kernel is both smooth kernel and symmetrical, so the function will return ``KERNEL_SMOOTH | KERNEL_SYMMETRICAL``
* **KERNEL_INTEGER** Al the kernel coefficients are integer numbers. This flag can be combined with ``KERNEL_SYMMETRICAL`` or ``KERNEL_ASYMMETRICAL``
..index:: getStructuringElement
getStructuringElement
@ -903,15 +952,15 @@ getStructuringElement
:param shape:The element shape, one of:
* ``MORPH_RECT`` - rectangular structuring element
* ``MORPH_RECT`` - rectangular structuring element
..math::
E_{ij}=1
* ``MORPH_ELLIPSE`` - elliptic structuring element, i.e. a filled ellipse inscribed into the rectangle
:param src:The source 1-, 3- or 4-channel image. When ``ksize`` is 3 or 5, the image depth should be ``CV_8U`` , ``CV_16U`` or ``CV_32F`` . For larger aperture sizes it can only be ``CV_8U``
:param dst:The destination array; will have the same size and the same type as ``src``
:param ksize:The aperture linear size. It must be odd and more than 1, i.e. 3, 5, 7 ...
The function smoothes image using the median filter with
@ -953,6 +1004,7 @@ morphologyEx
:param src:Source image
:param dst:Destination image. It will have the same size and the same type as ``src``
:param element:Structuring element
:param op:Type of morphological operation, one of the following:
@ -970,7 +1022,9 @@ morphologyEx
:param iterations:Number of times erosion and dilation are applied
:param borderType:The pixel extrapolation method; see :func:`borderInterpolate`
:param borderValue:The border value in case of a constant border. The default value has a special meaning, see :func:`createMorphoogyFilter`
The function can perform advanced morphological transformations using erosion and dilation as basic operations.
Opening:
@ -1018,6 +1072,7 @@ Laplacian
:param src:Source image
:param dst:Destination image; will have the same size and the same number of channels as ``src``
:param ddepth:The desired depth of the destination image
:param ksize:The aperture size used to compute the second-derivative filters, see :func:`getDerivKernels` . It must be positive and odd
@ -1025,7 +1080,9 @@ Laplacian
:param scale:The optional scale factor for the computed Laplacian values (by default, no scaling is applied, see :func:`getDerivKernels` )
:param delta:The optional delta value, added to the results prior to storing them in ``dst``
:param borderType:The pixel extrapolation method, see :func:`borderInterpolate`
The function calculates the Laplacian of the source image by adding up the second x and y derivatives calculated using the Sobel operator:
..math::
@ -1052,6 +1109,7 @@ pyrDown
:param src:The source image
:param dst:The destination image. It will have the specified size and the same type as ``src``
:param dstsize:Size of the destination image. By default it is computed as ``Size((src.cols+1)/2, (src.rows+1)/2)`` . But in any case the following conditions should be satisfied:
..math::
@ -1078,6 +1136,7 @@ pyrUp
:param src:The source image
:param dst:The destination image. It will have the specified size and the same type as ``src``
:param dstsize:Size of the destination image. By default it is computed as ``Size(src.cols*2, (src.rows*2)`` . But in any case the following conditions should be satisfied:
..math::
@ -1099,6 +1158,7 @@ sepFilter2D
:param src:The source image
:param dst:The destination image; will have the same size and the same number of channels as ``src``
:param ddepth:The destination image depth
:param rowKernel:The coefficients for filtering each row
@ -1110,6 +1170,7 @@ sepFilter2D
:param delta:The value added to the filtered results before storing them
:param borderType:The pixel extrapolation method; see :func:`borderInterpolate`
The function applies a separable linear filter to the image. That is, first, every row of ``src`` is filtered with 1D kernel ``rowKernel`` . Then, every column of the result is filtered with 1D kernel ``columnKernel`` and the final result shifted by ``delta`` is stored in ``dst`` .
See also:
@ -1126,6 +1187,7 @@ Sobel
:param src:The source image
:param dst:The destination image; will have the same size and the same number of channels as ``src``
:param ddepth:The destination image depth
:param xorder:Order of the derivative x
@ -1137,7 +1199,9 @@ Sobel
:param scale:The optional scale factor for the computed derivative values (by default, no scaling is applied, see :func:`getDerivKernels` )
:param delta:The optional delta value, added to the results prior to storing them in ``dst``
:param borderType:The pixel extrapolation method, see :func:`borderInterpolate`
In all cases except 1, an
:math:`\texttt{ksize} \times
\texttt{ksize}` separable kernel will be used to calculate the
@ -1192,6 +1256,7 @@ Scharr
:param src:The source image
:param dst:The destination image; will have the same size and the same number of channels as ``src``
:param ddepth:The destination image depth
:param xorder:Order of the derivative x
@ -1201,7 +1266,9 @@ Scharr
:param scale:The optional scale factor for the computed derivative values (by default, no scaling is applied, see :func:`getDerivKernels` )
:param delta:The optional delta value, added to the results prior to storing them in ``dst``
:param borderType:The pixel extrapolation method, see :func:`borderInterpolate`
The function computes the first x- or y- spatial image derivative using Scharr operator. The call
Other numerous fields of ``CvDTreeNode`` are used internally at the training stage.
@ -154,7 +154,7 @@ Decision tree training parameters. ::
bool _use_1se_rule, bool _truncate_pruned_tree,
const float* _priors );
};
..
The structure contains all the decision tree training parameters. There is a default constructor that initializes all the parameters with the default values tuned for standalone classification tree. Any of the parameters can be overridden then, or the structure may be fully initialized using the advanced variant of the constructor.
@ -260,7 +260,7 @@ Decision tree training data and shared data for tree ensembles. ::
CvRNG rng;
};
..
This structure is mostly used internally for storing both standalone trees and tree ensembles efficiently. Basically, it contains 3 types of information:
@ -124,7 +124,7 @@ Parameters of the EM algorithm. ::
const CvMat** covs;
CvTermCriteria term_crit;
};
..
The structure has 2 constructors, the default one represents a rough rule-of-thumb, with another one it is possible to override a variety of parameters, from a single number of mixtures (the only essential problem-dependent parameter), to the initial values for the mixture parameters.
@ -186,7 +186,7 @@ EM model. ::
CvMat* inv_eigen_values;
CvMat** cov_rotate_mats;
};
..
..index:: CvEM::train
@ -311,5 +311,5 @@ Example: Clustering random samples of multi-Gaussian distribution using EM ::
The structure has default constructor that initializes parameters for ``RPROP`` algorithm. There is also more advanced constructor to customize the parameters and/or choose backpropagation algorithm. Finally, the individual parameters can be adjusted after the structure is created.
@ -212,7 +212,7 @@ MLP model. ::
CvRNG rng;
};
..
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 the set of input and output vectors. The training procedure can be repeated more than once, i.e. the weights can be adjusted based on the new training data.
@ -76,7 +76,7 @@ Training Parameters of Random Trees. ::
int _nactive_vars, int max_tree_count,
float forest_accuracy, int termcrit_type );
};
..
The set of training parameters for the forest is the superset of the training parameters for a single tree. However, Random trees do not need all the functionality/features of decision trees, most noticeably, the trees are not pruned, so the cross-validation parameters are not used.
@ -128,7 +128,7 @@ Random Trees. ::
int nclasses;
...
};
..
..index:: CvRTrees::train
@ -295,5 +295,5 @@ Example: Prediction of mushroom goodness using random trees classifier ::
In this declaration some methods are commented off. Actually, these are methods for which there is no unified API (with the exception of the default constructor), however, there are many similarities in the syntax and semantics that are briefly described below in this section, as if they are a part of the base class.
@ -85,7 +85,7 @@ The destructor of the base class is declared as virtual, so it is safe to write
model = new CvDTree(... /* Decision tree params */);
...
delete model;
..
Normally, the destructor of each derived class does nothing, but in this instance it calls the overridden method ``clear()`` that deallocates all the memory.
* **OPTFLOW_USE_INITIAL_FLOW** use initial estimations stored in ``nextPts`` . If the flag is not set, then initially :math:`\texttt{nextPts}\leftarrow\texttt{prevPts}`
The function implements the sparse iterative version of the Lucas-Kanade optical flow in pyramids, see
Bouguet00
.
@ -86,6 +87,7 @@ updateMotionHistory
:param timestamp:Current time in milliseconds or other units
:param duration:Maximal duration of the motion track in the same units as ``timestamp``
The function updates the motion history image as following:
..math::
@ -145,11 +147,15 @@ calcGlobalOrientation
Calculates the global motion orientation in some selected region.
:param orientation:Motion gradient orientation image, calculated by the function :func:`calcMotionGradient`
:param mask:Mask image. It may be a conjunction of a valid gradient mask, also calculated by :func:`calcMotionGradient` , and the mask of the region, whose direction needs to be calculated
:param mhi:The motion history image, calculated by :func:`updateMotionHistory`
:param timestamp:The timestamp passed to :func:`updateMotionHistory`
:param duration:Maximal duration of motion track in milliseconds, passed to :func:`updateMotionHistory`
The function calculates the average
motion direction in the selected region and returns the angle between
0 degrees and 360 degrees. The average direction is computed from
@ -165,9 +171,11 @@ CamShift
Finds the object center, size, and orientation
:param probImage:Back projection of the object histogram; see :func:`calcBackProject`
:param window:Initial search window
:param criteria:Stop criteria for the underlying :func:`meanShift`
The function implements the CAMSHIFT object tracking algrorithm