Commit 73f589e8 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

further docs cleanup

parent 23416e3d
This diff is collapsed.
Clustering Clustering
========== ==========
.. highlight:: cpp
.. index:: kmeans .. index:: kmeans
.. _kmeans:
kmeans kmeans
---------- ------
.. c:function:: double kmeans( const Mat\& samples, int clusterCount, Mat\& labels, TermCriteria termcrit, int attempts, int flags, Mat* centers ) .. c:function:: double kmeans( const Mat\& samples, int clusterCount, Mat\& labels, TermCriteria termcrit, int attempts, int flags, Mat* centers )
Finds the centers of clusters and groups the input samples around the clusters. Finds the centers of clusters and groups the input samples around the clusters.
......
Dynamic Structures
==================
.. highlight:: cpp
...@@ -2,11 +2,9 @@ ...@@ -2,11 +2,9 @@
Introduction Introduction
************ ************
OpenCV (Open Source Computer Vision Library: http://opencv.willowgarage.com/wiki/) is open-source BSD-licensed library that includes several hundreds computer vision algorithms. It is very popular in the Computer Vision community. Some people call it “de-facto standard” API. The document aims to specify the stable parts of the library, as well as some abstract interfaces for high-level interfaces, with the final goal to make it an official standard. OpenCV (Open Source Computer Vision Library: http://opencv.willowgarage.com/wiki/) is open-source BSD-licensed library that includes several hundreds computer vision algorithms. The document describes the so-called OpenCV 2.x API, which is essentially a C++ API, as opposite to the C-based OpenCV 1.x API. The latter is described in opencv1x.pdf.
API specifications in the document use the standard C++ (http://www.open-std.org/jtc1/sc22/wg21/) and the standard C++ library. OpenCV has a modular structure (i.e. package includes several shared or static libraries). The modules are:
The current OpenCV implementation has a modular structure (i.e. the binary package includes several shared or static libraries), where we have:
* **core** - the compact module defining basic data structures, including the dense multi-dimensional array ``Mat``, and basic functions, used by all other modules. * **core** - the compact module defining basic data structures, including the dense multi-dimensional array ``Mat``, and basic functions, used by all other modules.
* **imgproc** - image processing module that includes linear and non-linear image filtering, geometrical image transformations (resize, affine and perspective warping, generic table-based remap), color space conversion, histograms etc. * **imgproc** - image processing module that includes linear and non-linear image filtering, geometrical image transformations (resize, affine and perspective warping, generic table-based remap), color space conversion, histograms etc.
...@@ -18,9 +16,7 @@ The current OpenCV implementation has a modular structure (i.e. the binary packa ...@@ -18,9 +16,7 @@ The current OpenCV implementation has a modular structure (i.e. the binary packa
* **gpu** - GPU-accelerated algorithms from different OpenCV modules. * **gpu** - GPU-accelerated algorithms from different OpenCV modules.
* ... some other helper modules, such as FLANN and Google test wrappers, Python bindings etc. * ... some other helper modules, such as FLANN and Google test wrappers, Python bindings etc.
Although the alternative implementations of the proposed standard may be structured differently, the proposed standard draft is organized by the functionality groups that reflect the decomposition of the library by modules. The further chapters of the document describe functionality of each module. But first, let's make an overview of the common API concepts, used thoroughly in the library.
Below are the other main concepts of the OpenCV API, implied everywhere in the document.
The API Concepts The API Concepts
================ ================
......
This diff is collapsed.
...@@ -84,8 +84,6 @@ This is structure is similar to DevMem2D_but contains only pointer and row step ...@@ -84,8 +84,6 @@ This is structure is similar to DevMem2D_but contains only pointer and row step
.. index:: gpu::GpuMat .. index:: gpu::GpuMat
.. gpu::GpuMat:
gpu::GpuMat gpu::GpuMat
----------- -----------
.. c:type:: gpu::GpuMat .. c:type:: gpu::GpuMat
...@@ -216,8 +214,6 @@ gpu::CudaMem::canMapHostMemory ...@@ -216,8 +214,6 @@ gpu::CudaMem::canMapHostMemory
.. index:: gpu::Stream .. index:: gpu::Stream
.. _gpu::Stream:
gpu::Stream gpu::Stream
----------- -----------
.. c:type:: gpu::Stream .. c:type:: gpu::Stream
......
...@@ -126,13 +126,9 @@ See also: ...@@ -126,13 +126,9 @@ See also:
gpu::minMaxLoc gpu::minMaxLoc
------------------ ------------------
.. c:function:: void gpu::minMaxLoc(const GpuMat\& src, double\* minVal, double* maxVal=0, .. c:function:: void gpu::minMaxLoc(const GpuMat& src, double* minVal, double* maxVal=0, Point* minLoc=0, Point* maxLoc=0, const GpuMat& mask=GpuMat())
Point* minLoc=0, Point* maxLoc=0,
const GpuMat\& mask=GpuMat())
.. c:function:: void gpu::minMaxLoc(const GpuMat\& src, double* minVal, double* maxVal, .. c:function:: void gpu::minMaxLoc(const GpuMat& src, double* minVal, double* maxVal, Point* minLoc, Point* maxLoc, const GpuMat& mask, GpuMat& valbuf, GpuMat& locbuf)
Point* minLoc, Point* maxLoc, const GpuMat\& mask,
GpuMat\& valbuf, GpuMat\& locbuf)
Finds global minimum and maximum matrix elements and returns their values with locations. Finds global minimum and maximum matrix elements and returns their values with locations.
......
This diff is collapsed.
...@@ -7,7 +7,7 @@ Per-element Operations. ...@@ -7,7 +7,7 @@ Per-element Operations.
gpu::add gpu::add
------------ ------------
.. c:function:: void gpu::add(const GpuMat\& a, const GpuMat\& b, GpuMat\& c) .. c:function:: void gpu::add(const GpuMat& a, const GpuMat& b, GpuMat& c)
Computes matrix-matrix or matrix-scalar sum. Computes matrix-matrix or matrix-scalar sum.
...@@ -17,7 +17,7 @@ gpu::add ...@@ -17,7 +17,7 @@ gpu::add
:param c: Destination matrix. Will have the same size and type as ``a`` . :param c: Destination matrix. Will have the same size and type as ``a`` .
.. c:function:: void gpu::add(const GpuMat\& a, const Scalar\& sc, GpuMat\& c) .. c:function:: void gpu::add(const GpuMat& a, const Scalar& sc, GpuMat& c)
* **a** Source matrix. ``CV_32FC1`` and ``CV_32FC2`` matrixes are supported for now. * **a** Source matrix. ``CV_32FC1`` and ``CV_32FC2`` matrixes are supported for now.
...@@ -32,7 +32,7 @@ See also: ...@@ -32,7 +32,7 @@ See also:
gpu::subtract gpu::subtract
----------------- -----------------
.. c:function:: void gpu::subtract(const GpuMat\& a, const GpuMat\& b, GpuMat\& c) .. c:function:: void gpu::subtract(const GpuMat& a, const GpuMat& b, GpuMat& c)
Subtracts matrix from another matrix (or scalar from matrix). Subtracts matrix from another matrix (or scalar from matrix).
...@@ -42,7 +42,7 @@ gpu::subtract ...@@ -42,7 +42,7 @@ gpu::subtract
:param c: Destination matrix. Will have the same size and type as ``a`` . :param c: Destination matrix. Will have the same size and type as ``a`` .
.. c:function:: void subtract(const GpuMat\& a, const Scalar\& sc, GpuMat\& c) .. c:function:: void subtract(const GpuMat& a, const Scalar& sc, GpuMat& c)
* **a** Source matrix. ``CV_32FC1`` and ``CV_32FC2`` matrixes are supported for now. * **a** Source matrix. ``CV_32FC1`` and ``CV_32FC2`` matrixes are supported for now.
...@@ -57,7 +57,7 @@ See also: ...@@ -57,7 +57,7 @@ See also:
gpu::multiply gpu::multiply
----------------- -----------------
.. c:function:: void gpu::multiply(const GpuMat\& a, const GpuMat\& b, GpuMat\& c) .. c:function:: void gpu::multiply(const GpuMat& a, const GpuMat& b, GpuMat& c)
Computes per-element product of two matrices (or of matrix and scalar). Computes per-element product of two matrices (or of matrix and scalar).
...@@ -67,7 +67,7 @@ gpu::multiply ...@@ -67,7 +67,7 @@ gpu::multiply
:param c: Destionation matrix. Will have the same size and type as ``a`` . :param c: Destionation matrix. Will have the same size and type as ``a`` .
.. c:function:: void multiply(const GpuMat\& a, const Scalar\& sc, GpuMat\& c) .. c:function:: void multiply(const GpuMat& a, const Scalar& sc, GpuMat& c)
* **a** Source matrix. ``CV_32FC1`` and ``CV_32FC2`` matrixes are supported for now. * **a** Source matrix. ``CV_32FC1`` and ``CV_32FC2`` matrixes are supported for now.
...@@ -82,7 +82,7 @@ See also: ...@@ -82,7 +82,7 @@ See also:
gpu::divide gpu::divide
--------------- ---------------
.. c:function:: void gpu::divide(const GpuMat\& a, const GpuMat\& b, GpuMat\& c) .. c:function:: void gpu::divide(const GpuMat& a, const GpuMat& b, GpuMat& c)
Performs per-element division of two matrices (or division of matrix by scalar). Performs per-element division of two matrices (or division of matrix by scalar).
...@@ -92,7 +92,7 @@ gpu::divide ...@@ -92,7 +92,7 @@ gpu::divide
:param c: Destionation matrix. Will have the same size and type as ``a`` . :param c: Destionation matrix. Will have the same size and type as ``a`` .
.. c:function:: void divide(const GpuMat\& a, const Scalar\& sc, GpuMat\& c) .. c:function:: void divide(const GpuMat& a, const Scalar& sc, GpuMat& c)
* **a** Source matrix. ``CV_32FC1`` and ``CV_32FC2`` matrixes are supported for now. * **a** Source matrix. ``CV_32FC1`` and ``CV_32FC2`` matrixes are supported for now.
...@@ -110,7 +110,7 @@ See also: ...@@ -110,7 +110,7 @@ See also:
gpu::exp gpu::exp
------------ ------------
.. c:function:: void gpu::exp(const GpuMat\& a, GpuMat\& b) .. c:function:: void gpu::exp(const GpuMat& a, GpuMat& b)
Computes exponent of each matrix element. Computes exponent of each matrix element.
...@@ -125,7 +125,7 @@ See also: ...@@ -125,7 +125,7 @@ See also:
gpu::log gpu::log
------------ ------------
.. c:function:: void gpu::log(const GpuMat\& a, GpuMat\& b) .. c:function:: void gpu::log(const GpuMat& a, GpuMat& b)
Computes natural logarithm of absolute value of each matrix element. Computes natural logarithm of absolute value of each matrix element.
...@@ -140,7 +140,7 @@ See also: ...@@ -140,7 +140,7 @@ See also:
gpu::absdiff gpu::absdiff
---------------- ----------------
.. c:function:: void gpu::absdiff(const GpuMat\& a, const GpuMat\& b, GpuMat\& c) .. c:function:: void gpu::absdiff(const GpuMat& a, const GpuMat& b, GpuMat& c)
Computes per-element absolute difference of two matrices (or of matrix and scalar). Computes per-element absolute difference of two matrices (or of matrix and scalar).
...@@ -150,7 +150,7 @@ gpu::absdiff ...@@ -150,7 +150,7 @@ gpu::absdiff
:param c: Destionation matrix. Will have the same size and type as ``a`` . :param c: Destionation matrix. Will have the same size and type as ``a`` .
.. c:function:: void absdiff(const GpuMat\& a, const Scalar\& s, GpuMat\& c) .. c:function:: void absdiff(const GpuMat& a, const Scalar& s, GpuMat& c)
* **a** Source matrix. ``CV_32FC1`` matrixes are supported for now. * **a** Source matrix. ``CV_32FC1`` matrixes are supported for now.
...@@ -165,7 +165,7 @@ See also: ...@@ -165,7 +165,7 @@ See also:
gpu::compare gpu::compare
---------------- ----------------
.. c:function:: void gpu::compare(const GpuMat\& a, const GpuMat\& b, GpuMat\& c, int cmpop) .. c:function:: void gpu::compare(const GpuMat& a, const GpuMat& b, GpuMat& c, int cmpop)
Compares elements of two matrices. Compares elements of two matrices.
...@@ -190,15 +190,11 @@ See also: ...@@ -190,15 +190,11 @@ See also:
.. index:: gpu::bitwise_not .. index:: gpu::bitwise_not
.. _gpu::bitwise_not:
gpu::bitwise_not gpu::bitwise_not
-------------------- --------------------
.. c:function:: void gpu::bitwise_not(const GpuMat\& src, GpuMat\& dst, .. c:function:: void gpu::bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask=GpuMat())
const GpuMat\& mask=GpuMat())
.. c:function:: void gpu::bitwise_not(const GpuMat\& src, GpuMat\& dst, .. c:function:: void gpu::bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask, const Stream& stream)
const GpuMat\& mask, const Stream\& stream)
Performs per-element bitwise inversion. Performs per-element bitwise inversion.
...@@ -210,20 +206,14 @@ gpu::bitwise_not ...@@ -210,20 +206,14 @@ gpu::bitwise_not
:param stream: Stream for the asynchronous version. :param stream: Stream for the asynchronous version.
See also:
.
.. index:: gpu::bitwise_or .. index:: gpu::bitwise_or
.. _gpu::bitwise_or:
gpu::bitwise_or gpu::bitwise_or
------------------- -------------------
.. c:function:: void gpu::bitwise_or(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst, .. c:function:: void gpu::bitwise_or(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat())
const GpuMat\& mask=GpuMat())
.. c:function:: void gpu::bitwise_or(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst, .. c:function:: void gpu::bitwise_or(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream)
const GpuMat\& mask, const Stream\& stream)
Performs per-element bitwise disjunction of two matrices. Performs per-element bitwise disjunction of two matrices.
...@@ -237,20 +227,13 @@ gpu::bitwise_or ...@@ -237,20 +227,13 @@ gpu::bitwise_or
:param stream: Stream for the asynchronous version. :param stream: Stream for the asynchronous version.
See also:
.
.. index:: gpu::bitwise_and .. index:: gpu::bitwise_and
.. _gpu::bitwise_and:
gpu::bitwise_and gpu::bitwise_and
-------------------- --------------------
.. c:function:: void gpu::bitwise_and(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst, .. c:function:: void gpu::bitwise_and(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat())
const GpuMat\& mask=GpuMat())
.. c:function:: void gpu::bitwise_and(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst, .. c:function:: void gpu::bitwise_and(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream)
const GpuMat\& mask, const Stream\& stream)
Performs per-element bitwise conjunction of two matrices. Performs per-element bitwise conjunction of two matrices.
...@@ -264,20 +247,14 @@ gpu::bitwise_and ...@@ -264,20 +247,14 @@ gpu::bitwise_and
:param stream: Stream for the asynchronous version. :param stream: Stream for the asynchronous version.
See also:
.
.. index:: gpu::bitwise_xor .. index:: gpu::bitwise_xor
.. _gpu::bitwise_xor:
gpu::bitwise_xor gpu::bitwise_xor
-------------------- --------------------
.. c:function:: void gpu::bitwise_xor(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst, .. c:function:: void gpu::bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat())
const GpuMat\& mask=GpuMat())
.. c:function:: void gpu::bitwise_xor(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst, .. c:function:: void gpu::bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream)
const GpuMat\& mask, const Stream\& stream)
Performs per-element bitwise "exclusive or" of two matrices. Performs per-element bitwise "exclusive or" of two matrices.
...@@ -291,19 +268,16 @@ gpu::bitwise_xor ...@@ -291,19 +268,16 @@ gpu::bitwise_xor
:param stream: Stream for the asynchronous version. :param stream: Stream for the asynchronous version.
See also:
.
.. index:: gpu::min .. index:: gpu::min
gpu::min gpu::min
------------ ------------
.. c:function:: void gpu::min(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst) .. c:function:: void gpu::min(const GpuMat& src1, const GpuMat& src2, GpuMat& dst)
.. c:function:: void gpu::min(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst, .. c:function:: void gpu::min(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const Stream& stream)
const Stream\& stream)
Computes per-element minimum of two matrices (or of matrix and scalar). Computes per-element minimum of two matrices (or a matrix and a scalar).
:param src1: First source matrix. :param src1: First source matrix.
...@@ -313,10 +287,10 @@ gpu::min ...@@ -313,10 +287,10 @@ gpu::min
:param stream: Stream for the asynchronous version. :param stream: Stream for the asynchronous version.
.. c:function:: void gpu::min(const GpuMat\& src1, double src2, GpuMat\& dst) .. c:function:: void gpu::min(const GpuMat& src1, double src2, GpuMat& dst)
.. c:function:: void gpu::min(const GpuMat\& src1, double src2, GpuMat\& dst, .. c:function:: void gpu::min(const GpuMat& src1, double src2, GpuMat& dst,
const Stream\& stream) const Stream& stream)
* **src1** Source matrix. * **src1** Source matrix.
...@@ -333,33 +307,25 @@ See also: ...@@ -333,33 +307,25 @@ See also:
gpu::max gpu::max
------------ ------------
.. c:function:: void gpu::max(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst) .. c:function:: void gpu::max(const GpuMat& src1, const GpuMat& src2, GpuMat& dst)
.. c:function:: void gpu::max(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const Stream& stream)
.. c:function:: void gpu::max(const GpuMat& src1, double value, GpuMat& dst)
.. c:function:: void gpu::max(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst, .. c:function:: void gpu::max(const GpuMat& src1, double value, GpuMat& dst, const Stream& stream)
const Stream\& stream)
Computes per-element maximum of two matrices (or of matrix and scalar). Computes per-element maximum of two matrices (or a matrix and a scalar).
:param src1: First source matrix. :param src1: First source matrix.
:param src2: Second source matrix. :param src2: Second source matrix.
:param value: The scalar value to compare ``src1`` elements with
:param dst: Destination matrix. Will have the same size and type as ``src1`` . :param dst: Destination matrix. Will have the same size and type as ``src1`` .
:param stream: Stream for the asynchronous version. :param stream: Stream for the asynchronous version.
.. c:function:: void max(const GpuMat\& src1, double src2, GpuMat\& dst)
.. c:function:: void max(const GpuMat\& src1, double src2, GpuMat\& dst,
const Stream\& stream)
* **src1** Source matrix.
* **src2** Scalar to be compared with.
* **dst** Destination matrix. Will have the same size and type as ``src1`` .
* **stream** Stream for the asynchronous version.
See also: See also:
:func:`max` . :func:`max` .
...@@ -57,6 +57,8 @@ The following code is an example used to generate the figure. :: ...@@ -57,6 +57,8 @@ The following code is an example used to generate the figure. ::
.. index:: setWindowProperty .. index:: setWindowProperty
.. _setWindowProperty:
setWindowProperty setWindowProperty
--------------------- ---------------------
.. c:function:: void setWindowProperty(const string& name, int prop_id, double prop_value) .. c:function:: void setWindowProperty(const string& name, int prop_id, double prop_value)
...@@ -115,6 +117,8 @@ The function `` getWindowProperty`` return window's properties. ...@@ -115,6 +117,8 @@ The function `` getWindowProperty`` return window's properties.
.. index:: fontQt .. index:: fontQt
.. _fontQt:
fontQt fontQt
---------- ----------
.. c: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) .. c: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)
......
...@@ -5,6 +5,8 @@ Reading and Writing Images and Video ...@@ -5,6 +5,8 @@ Reading and Writing Images and Video
.. index:: imdecode .. index:: imdecode
.. _imdecode:
imdecode imdecode
------------ ------------
.. c:function:: Mat imdecode( const Mat\& buf, int flags ) .. c:function:: Mat imdecode( const Mat\& buf, int flags )
...@@ -23,6 +25,8 @@ See ...@@ -23,6 +25,8 @@ See
.. index:: imencode .. index:: imencode
.. _imencode:
imencode imencode
------------ ------------
.. c:function:: bool imencode( const string\& ext, const Mat\& img, vector<uchar>\& buf, const vector<int>\& params=vector<int>()) .. c:function:: bool imencode( const string\& ext, const Mat\& img, vector<uchar>\& buf, const vector<int>\& params=vector<int>())
...@@ -43,6 +47,8 @@ See ...@@ -43,6 +47,8 @@ See
.. index:: imread .. index:: imread
.. _imread:
imread imread
---------- ----------
.. c:function:: Mat imread( const string\& filename, int flags=1 ) .. c:function:: Mat imread( const string\& filename, int flags=1 )
...@@ -61,34 +67,19 @@ imread ...@@ -61,34 +67,19 @@ imread
The function ``imread`` loads an image from the specified file and returns it. If the image can not be read (because of missing file, improper permissions, unsupported or invalid format), the function returns empty matrix ( ``Mat::data==NULL`` ).Currently, the following file formats are supported: The function ``imread`` loads an image from the specified file and returns it. If the image can not be read (because of missing file, improper permissions, unsupported or invalid format), the function returns empty matrix ( ``Mat::data==NULL`` ).Currently, the following file formats are supported:
* * Windows bitmaps - ``*.bmp, *.dib`` (always supported)
Windows bitmaps - ``*.bmp, *.dib`` (always supported)
* * JPEG files - ``*.jpeg, *.jpg, *.jpe`` (see **Note2**)
JPEG files - ``*.jpeg, *.jpg, *.jpe`` (see
**Note2**
)
* * JPEG 2000 files - ``*.jp2`` (see **Note2**)
JPEG 2000 files - ``*.jp2`` (see
**Note2**
)
* * Portable Network Graphics - ``*.png`` (see **Note2**)
Portable Network Graphics - ``*.png`` (see
**Note2**
)
* * Portable image format - ``*.pbm, *.pgm, *.ppm`` (always supported)
Portable image format - ``*.pbm, *.pgm, *.ppm`` (always supported)
* * Sun rasters - ``*.sr, *.ras`` (always supported)
Sun rasters - ``*.sr, *.ras`` (always supported)
* * TIFF files - ``*.tiff, *.tif`` (see **Note2**)
TIFF files - ``*.tiff, *.tif`` (see
**Note2**
)
**Note1** **Note1**
: The function determines type of the image by the content, not by the file extension. : The function determines type of the image by the content, not by the file extension.
...@@ -100,6 +91,8 @@ On Linux, BSD flavors and other Unix-like open-source operating systems OpenCV l ...@@ -100,6 +91,8 @@ On Linux, BSD flavors and other Unix-like open-source operating systems OpenCV l
.. index:: imwrite .. index:: imwrite
.. _imwrite:
imwrite imwrite
----------- -----------
.. c:function:: bool imwrite( const string\& filename, const Mat\& img, const vector<int>\& params=vector<int>()) .. c:function:: bool imwrite( const string\& filename, const Mat\& img, const vector<int>\& params=vector<int>())
...@@ -211,6 +204,8 @@ The class provides C++ video capturing API. Here is how the class can be used: : ...@@ -211,6 +204,8 @@ The class provides C++ video capturing API. Here is how the class can be used: :
.. index:: VideoCapture::VideoCapture .. index:: VideoCapture::VideoCapture
.. _VideoCapture::VideoCapture:
VideoCapture::VideoCapture VideoCapture::VideoCapture
------------------------------ ------------------------------
.. c:function:: VideoCapture::VideoCapture() .. c:function:: VideoCapture::VideoCapture()
...@@ -227,6 +222,8 @@ VideoCapture constructors. ...@@ -227,6 +222,8 @@ VideoCapture constructors.
.. index:: VideoCapture::get .. index:: VideoCapture::get
.. _VideoCapture::get:
VideoCapture::get VideoCapture::get
--------------------- ---------------------
.. c:function:: double VideoCapture::get(int property_id) .. c:function:: double VideoCapture::get(int property_id)
...@@ -275,6 +272,8 @@ Note that when querying a property which is unsupported by the backend used by t ...@@ -275,6 +272,8 @@ Note that when querying a property which is unsupported by the backend used by t
.. index:: VideoCapture::set .. index:: VideoCapture::set
.. _VideoCapture::set:
VideoCapture::set VideoCapture::set
--------------------- ---------------------
.. c:function:: bool VideoCapture::set(int property_id, double value) .. c:function:: bool VideoCapture::set(int property_id, double value)
......
...@@ -5,9 +5,11 @@ User Interface ...@@ -5,9 +5,11 @@ User Interface
.. index:: createTrackbar .. index:: createTrackbar
.. _createTrackbar:
createTrackbar createTrackbar
------------------ ------------------
.. c:function:: int createTrackbar( const string\& trackbarname, const string\& winname, int* value, int count, TrackbarCallback onChange CV_DEFAULT(0), void* userdata CV_DEFAULT(0)) .. c:function:: int createTrackbar( const string& trackbarname, const string& winname, int* value, int count, TrackbarCallback onChange CV_DEFAULT(0), void* userdata CV_DEFAULT(0))
Creates a trackbar and attaches it to the specified window Creates a trackbar and attaches it to the specified window
...@@ -43,7 +45,7 @@ By clicking on the label of each trackbar, it is possible to edit the trackbar's ...@@ -43,7 +45,7 @@ By clicking on the label of each trackbar, it is possible to edit the trackbar's
getTrackbarPos getTrackbarPos
------------------ ------------------
.. c:function:: int getTrackbarPos( const string\& trackbarname, const string\& winname ) .. c:function:: int getTrackbarPos( const string& trackbarname, const string& winname )
Returns the trackbar position. Returns the trackbar position.
...@@ -61,9 +63,11 @@ qt-specific details: ...@@ -61,9 +63,11 @@ qt-specific details:
.. index:: imshow .. index:: imshow
.. _imshow:
imshow imshow
---------- ----------
.. c:function:: void imshow( const string\& winname, const Mat\& image ) .. c:function:: void imshow( const string& winname, const Mat& image )
Displays the image in the specified window Displays the image in the specified window
...@@ -84,9 +88,11 @@ The function ``imshow`` displays the image in the specified window. If the windo ...@@ -84,9 +88,11 @@ The function ``imshow`` displays the image in the specified window. If the windo
.. index:: namedWindow .. index:: namedWindow
.. _namedWindow:
namedWindow namedWindow
--------------- ---------------
.. c:function:: void namedWindow( const string\& winname, int flags ) .. c:function:: void namedWindow( const string& winname, int flags )
Creates a window. Creates a window.
...@@ -104,27 +110,29 @@ qt-specific details: ...@@ -104,27 +110,29 @@ qt-specific details:
* **flags** Flags of the window. Currently the supported flags are: * **flags** Flags of the window. Currently the supported flags are:
* **CV_WINDOW_NORMAL or CV_WINDOW_AUTOSIZE:** ``CV_WINDOW_NORMAL`` let the user resize the window, whereas ``CV_WINDOW_AUTOSIZE`` adjusts automatically the window's size to fit the displayed image (see :ref:`ShowImage` ), and the user can not change the window size manually. * **CV_WINDOW_NORMAL or CV_WINDOW_AUTOSIZE:** ``CV_WINDOW_NORMAL`` let the user resize the window, whereas ``CV_WINDOW_AUTOSIZE`` adjusts automatically the window's size to fit the displayed image (see :ref:`imshow` ), and the user can not change the window size manually.
* **CV_WINDOW_FREERATIO or CV_WINDOW_KEEPRATIO:** ``CV_WINDOW_FREERATIO`` adjust the image without respect the its ration, whereas ``CV_WINDOW_KEEPRATIO`` keep the image's ratio. * **CV_WINDOW_FREERATIO or CV_WINDOW_KEEPRATIO:** ``CV_WINDOW_FREERATIO`` adjust the image without respect the its ration, whereas ``CV_WINDOW_KEEPRATIO`` keep the image's ratio.
* **CV_GUI_NORMAL or CV_GUI_EXPANDED:** ``CV_GUI_NORMAL`` is the old way to draw the window without statusbar and toolbar, whereas ``CV_GUI_EXPANDED`` is the new enhance GUI. * **CV_GUI_NORMAL or CV_GUI_EXPANDED:** ``CV_GUI_NORMAL`` is the old way to draw the window without statusbar and toolbar, whereas ``CV_GUI_EXPANDED`` is the new enhance GUI.
This parameter is optional. The default flags set for a new window are ``CV_WINDOW_AUTOSIZE`` , ``CV_WINDOW_KEEPRATIO`` , and ``CV_GUI_EXPANDED`` . This parameter is optional. The default flags set for a new window are ``CV_WINDOW_AUTOSIZE`` , ``CV_WINDOW_KEEPRATIO`` , and ``CV_GUI_EXPANDED`` .
However, if you want to modify the flags, you can combine them using OR operator, ie: However, if you want to modify the flags, you can combine them using OR operator, ie:
:: ::
namedWindow( ``myWindow'', ``CV_WINDOW_NORMAL`` textbar ``CV_GUI_NORMAL`` ); namedWindow( ``myWindow'', ``CV_WINDOW_NORMAL`` textbar ``CV_GUI_NORMAL`` );
.. ..
.. index:: setTrackbarPos .. index:: setTrackbarPos
.. _setTrackbarPos:
setTrackbarPos setTrackbarPos
------------------ ------------------
.. c:function:: void setTrackbarPos( const string\& trackbarname, const string\& winname, int pos ) .. c:function:: void setTrackbarPos( const string& trackbarname, const string& winname, int pos )
Sets the trackbar position. Sets the trackbar position.
...@@ -144,6 +152,8 @@ qt-specific details: ...@@ -144,6 +152,8 @@ qt-specific details:
.. index:: waitKey .. index:: waitKey
.. _waitKey:
waitKey waitKey
----------- -----------
.. c:function:: int waitKey(int delay=0) .. c:function:: int waitKey(int delay=0)
......
...@@ -3,9 +3,11 @@ Feature Detection ...@@ -3,9 +3,11 @@ Feature Detection
.. index:: Canny .. index:: Canny
.. _Canny:
Canny Canny
--------- ---------
.. c:function:: void Canny( const Mat& image, Mat& edges, double threshold1, double threshold2, int apertureSize=3, bool L2gradient=false ) .. c:function:: void Canny( const Mat& image, Mat& edges, double threshold1, double threshold2, int apertureSize=3, bool L2gradient=false )
Finds edges in an image using Canny algorithm. Finds edges in an image using Canny algorithm.
...@@ -26,9 +28,12 @@ http://en.wikipedia.org/wiki/Canny_edge_detector ...@@ -26,9 +28,12 @@ http://en.wikipedia.org/wiki/Canny_edge_detector
.. index:: cornerEigenValsAndVecs .. index:: cornerEigenValsAndVecs
.. _cornerEigenValsAndVecs:
cornerEigenValsAndVecs cornerEigenValsAndVecs
-------------------------- ----------------------
.. c:function:: void cornerEigenValsAndVecs( const Mat& src, Mat& dst, int blockSize, int apertureSize, int borderType=BORDER_DEFAULT )
.. c:function:: void cornerEigenValsAndVecs( const Mat& src, Mat& dst, int blockSize, int apertureSize, int borderType=BORDER_DEFAULT )
Calculates eigenvalues and eigenvectors of image blocks for corner detection. Calculates eigenvalues and eigenvectors of image blocks for corner detection.
...@@ -67,11 +72,15 @@ The output of the function can be used for robust edge or corner detection. ...@@ -67,11 +72,15 @@ The output of the function can be used for robust edge or corner detection.
See also: See also:
:func:`cornerMinEigenVal`,:func:`cornerHarris`,:func:`preCornerDetect` :func:`cornerMinEigenVal`,:func:`cornerHarris`,:func:`preCornerDetect`
.. index:: cornerHarris .. index:: cornerHarris
.. _cornerHarris:
cornerHarris cornerHarris
---------------- ------------
.. c:function:: void cornerHarris( const Mat& src, Mat& dst, int blockSize, int apertureSize, double k, int borderType=BORDER_DEFAULT )
.. c:function:: void cornerHarris( const Mat& src, Mat& dst, int blockSize, int apertureSize, double k, int borderType=BORDER_DEFAULT )
Harris edge detector. Harris edge detector.
...@@ -103,9 +112,12 @@ Corners in the image can be found as the local maxima of this response map. ...@@ -103,9 +112,12 @@ Corners in the image can be found as the local maxima of this response map.
.. index:: cornerMinEigenVal .. index:: cornerMinEigenVal
.. _cornerMinEigenVal:
cornerMinEigenVal cornerMinEigenVal
--------------------- -----------------
.. c:function:: void cornerMinEigenVal( const Mat& src, Mat& dst, int blockSize, int apertureSize=3, int borderType=BORDER_DEFAULT )
.. c:function:: void cornerMinEigenVal( const Mat& src, Mat& dst, int blockSize, int apertureSize=3, int borderType=BORDER_DEFAULT )
Calculates the minimal eigenvalue of gradient matrices for corner detection. Calculates the minimal eigenvalue of gradient matrices for corner detection.
...@@ -126,9 +138,11 @@ The function is similar to ...@@ -126,9 +138,11 @@ The function is similar to
.. index:: cornerSubPix .. index:: cornerSubPix
.. _cornerSubPix:
cornerSubPix cornerSubPix
---------------- ----------------
.. c:function:: void cornerSubPix( const Mat& image, vector<Point2f>& corners, Size winSize, Size zeroZone, TermCriteria criteria ) .. c:function:: void cornerSubPix( const Mat& image, vector<Point2f>& corners, Size winSize, Size zeroZone, TermCriteria criteria )
Refines the corner locations. Refines the corner locations.
...@@ -182,9 +196,12 @@ The algorithm sets the center of the neighborhood window at this new center ...@@ -182,9 +196,12 @@ The algorithm sets the center of the neighborhood window at this new center
.. index:: goodFeaturesToTrack .. index:: goodFeaturesToTrack
.. _goodFeaturesToTrack:
goodFeaturesToTrack goodFeaturesToTrack
----------------------- -------------------
.. c:function:: void goodFeaturesToTrack( const Mat& image, vector<Point2f>& corners, int maxCorners, double qualityLevel, double minDistance, const Mat& mask=Mat(), int blockSize=3, bool useHarrisDetector=false, double k=0.04 )
.. c:function:: void goodFeaturesToTrack( const Mat& image, vector<Point2f>& corners, int maxCorners, double qualityLevel, double minDistance, const Mat& mask=Mat(), int blockSize=3, bool useHarrisDetector=false, double k=0.04 )
Determines strong corners on an image. Determines strong corners on an image.
...@@ -239,8 +256,11 @@ See also: :func:`cornerMinEigenVal`, :func:`cornerHarris`, :func:`calcOpticalFlo ...@@ -239,8 +256,11 @@ See also: :func:`cornerMinEigenVal`, :func:`cornerHarris`, :func:`calcOpticalFlo
.. index:: HoughCircles .. index:: HoughCircles
.. _HoughCircles:
HoughCircles HoughCircles
---------------- ------------
.. c:function:: void HoughCircles( Mat& image, vector<Vec3f>& circles, int method, double dp, double minDist, double param1=100, double param2=100, int minRadius=0, int maxRadius=0 ) .. c:function:: void HoughCircles( Mat& image, vector<Vec3f>& 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 a Hough transform. Finds circles in a grayscale image using a Hough transform.
...@@ -300,11 +320,15 @@ Note that usually the function detects the circles' centers well, however it may ...@@ -300,11 +320,15 @@ Note that usually the function detects the circles' centers well, however it may
See also: See also:
:func:`fitEllipse`,:func:`minEnclosingCircle` :func:`fitEllipse`,:func:`minEnclosingCircle`
.. index:: HoughLines .. index:: HoughLines
.. _HoughLines:
HoughLines HoughLines
-------------- ----------
.. c:function:: void HoughLines( Mat& image, vector<Vec2f>& lines, double rho, double theta, int threshold, double srn=0, double stn=0 )
.. c:function:: void HoughLines( Mat& image, vector<Vec2f>& lines, double rho, double theta, int threshold, double srn=0, double stn=0 )
Finds lines in a binary image using standard Hough transform. Finds lines in a binary image using standard Hough transform.
...@@ -327,9 +351,12 @@ The function implements standard or standard multi-scale Hough transform algorit ...@@ -327,9 +351,12 @@ The function implements standard or standard multi-scale Hough transform algorit
.. index:: HoughLinesP .. index:: HoughLinesP
.. _HoughLinesP:
HoughLinesP HoughLinesP
--------------- -----------
.. c:function:: void HoughLinesP( Mat& image, vector<Vec4i>& lines, double rho, double theta, int threshold, double minLineLength=0, double maxLineGap=0 )
.. c:function:: void HoughLinesP( Mat& image, vector<Vec4i>& lines, double rho, double theta, int threshold, double minLineLength=0, double maxLineGap=0 )
Finds lines segments in a binary image using probabilistic Hough transform. Finds lines segments in a binary image using probabilistic Hough transform.
...@@ -414,9 +441,12 @@ And this is the output of the above program in the case of probabilistic Hough t ...@@ -414,9 +441,12 @@ And this is the output of the above program in the case of probabilistic Hough t
.. index:: preCornerDetect .. index:: preCornerDetect
.. _preCornerDetect:
preCornerDetect preCornerDetect
------------------- ---------------
.. c:function:: void preCornerDetect( const Mat& src, Mat& dst, int apertureSize, int borderType=BORDER_DEFAULT )
.. c:function:: void preCornerDetect( const Mat& src, Mat& dst, int apertureSize, int borderType=BORDER_DEFAULT )
Calculates the feature map for corner detection Calculates the feature map for corner detection
......
...@@ -34,19 +34,25 @@ The actual implementations of the geometrical transformations, from the most gen ...@@ -34,19 +34,25 @@ The actual implementations of the geometrical transformations, from the most gen
.. index:: convertMaps .. index:: convertMaps
.. _convertMaps:
convertMaps convertMaps
--------------- -----------
.. c:function:: void convertMaps( const Mat\& map1, const Mat\& map2, Mat\& dstmap1, Mat\& dstmap2, int dstmap1type, bool nninterpolation=false )
.. c:function:: void convertMaps( const Mat& map1, const Mat& map2, Mat& dstmap1, Mat& dstmap2, int dstmap1type, bool nninterpolation=false )
Converts image transformation maps from one representation to another Converts image transformation maps from one representation to another
:param map1: The first input map of type ``CV_16SC2`` or ``CV_32FC1`` or ``CV_32FC2`` :param map1: The first input map of type ``CV_16SC2`` or ``CV_32FC1`` or ``CV_32FC2``
:param map2: The second input map of type ``CV_16UC1`` or ``CV_32FC1`` or none (empty matrix), respectively :param map2: The second input map of type ``CV_16UC1`` or ``CV_32FC1`` or none (empty matrix), respectively
:param dstmap1: The first output map; will have type ``dstmap1type`` and the same size as ``src`` :param dstmap1: The first output map; will have type ``dstmap1type`` and the same size as ``src``
:param dstmap2: The second output map :param dstmap2: The second output map
:param dstmap1type: The type of the first output map; should be ``CV_16SC2`` , ``CV_32FC1`` or ``CV_32FC2`` :param dstmap1type: The type of the first output map; should be ``CV_16SC2`` , ``CV_32FC1`` or ``CV_32FC2``
:param nninterpolation: Indicates whether the fixed-point maps will be used for nearest-neighbor or for more complex interpolation :param nninterpolation: Indicates whether the fixed-point maps will be used for nearest-neighbor or for more complex interpolation
The function converts a pair of maps for The function converts a pair of maps for
...@@ -64,8 +70,11 @@ The function converts a pair of maps for ...@@ -64,8 +70,11 @@ The function converts a pair of maps for
See also: See also:
:func:`remap`,:func:`undisort`,:func:`initUndistortRectifyMap` :func:`remap`,:func:`undisort`,:func:`initUndistortRectifyMap`
.. index:: getAffineTransform .. index:: getAffineTransform
.. _getAffineTransform:
getAffineTransform getAffineTransform
---------------------- ----------------------
.. c:function:: Mat getAffineTransform( const Point2f src[], const Point2f dst[] ) .. c:function:: Mat getAffineTransform( const Point2f src[], const Point2f dst[] )
...@@ -76,8 +85,7 @@ getAffineTransform ...@@ -76,8 +85,7 @@ getAffineTransform
:param dst: Coordinates of the corresponding triangle vertices in the destination image :param dst: Coordinates of the corresponding triangle vertices in the destination image
The function calculates the The function calculates the :math:`2 \times 3` matrix of an affine transform such that:
:math:`2 \times 3` matrix of an affine transform such that:
.. math:: .. math::
...@@ -93,11 +101,15 @@ where ...@@ -93,11 +101,15 @@ where
See also: See also:
:func:`warpAffine`,:func:`transform` :func:`warpAffine`,:func:`transform`
.. index:: getPerspectiveTransform .. index:: getPerspectiveTransform
.. _getPerspectiveTransform:
getPerspectiveTransform getPerspectiveTransform
--------------------------- ---------------------------
.. c:function:: Mat getPerspectiveTransform( const Point2f src[], const Point2f dst[] ) .. c:function:: Mat getPerspectiveTransform( const Point2f src[], const Point2f dst[] )
Calculates the perspective transform from 4 pairs of the corresponding points Calculates the perspective transform from 4 pairs of the corresponding points
...@@ -105,8 +117,7 @@ getPerspectiveTransform ...@@ -105,8 +117,7 @@ getPerspectiveTransform
:param dst: Coordinates of the corresponding quadrangle vertices in the destination image :param dst: Coordinates of the corresponding quadrangle vertices in the destination image
The function calculates the The function calculates the :math:`3 \times 3` matrix of a perspective transform such that:
:math:`3 \times 3` matrix of a perspective transform such that:
.. math:: .. math::
...@@ -122,11 +133,14 @@ where ...@@ -122,11 +133,14 @@ where
See also: See also:
:func:`findHomography`,:func:`warpPerspective`,:func:`perspectiveTransform` :func:`findHomography`,:func:`warpPerspective`,:func:`perspectiveTransform`
.. index:: getRectSubPix .. index:: getRectSubPix
.. getRectSubPix:
getRectSubPix getRectSubPix
----------------- -----------------
.. c:function:: void getRectSubPix( const Mat\& image, Size patchSize, Point2f center, Mat\& dst, int patchType=-1 ) .. c:function:: void getRectSubPix( const Mat& image, Size patchSize, Point2f center, Mat& dst, int patchType=-1 )
Retrieves the pixel rectangle from an image with sub-pixel accuracy Retrieves the pixel rectangle from an image with sub-pixel accuracy
...@@ -156,8 +170,11 @@ the pixel values outside of the image. ...@@ -156,8 +170,11 @@ the pixel values outside of the image.
See also: See also:
:func:`warpAffine`,:func:`warpPerspective` :func:`warpAffine`,:func:`warpPerspective`
.. index:: getRotationMatrix2D .. index:: getRotationMatrix2D
.. _getRotationMatrix2D:
getRotationMatrix2D getRotationMatrix2D
----------------------- -----------------------
.. c:function:: Mat getRotationMatrix2D( Point2f center, double angle, double scale ) .. c:function:: Mat getRotationMatrix2D( Point2f center, double angle, double scale )
...@@ -186,11 +203,14 @@ The transformation maps the rotation center to itself. If this is not the purpos ...@@ -186,11 +203,14 @@ The transformation maps the rotation center to itself. If this is not the purpos
See also: See also:
:func:`getAffineTransform`,:func:`warpAffine`,:func:`transform` :func:`getAffineTransform`,:func:`warpAffine`,:func:`transform`
.. index:: invertAffineTransform .. index:: invertAffineTransform
.. _invertAffineTransform:
invertAffineTransform invertAffineTransform
------------------------- -------------------------
.. c:function:: void invertAffineTransform(const Mat\& M, Mat\& iM) .. c:function:: void invertAffineTransform(const Mat& M, Mat& iM)
Inverts an affine transformation Inverts an affine transformation
...@@ -210,18 +230,21 @@ The result will also be a ...@@ -210,18 +230,21 @@ The result will also be a
.. index:: remap .. index:: remap
.. _remap:
remap remap
--------- -----
.. c:function:: void remap( const Mat\& src, Mat\& dst, const Mat\& map1, const Mat\& map2, int interpolation, int borderMode=BORDER_CONSTANT, const Scalar\& borderValue=Scalar())
.. c:function:: void remap( const Mat& src, Mat& dst, const Mat& map1, const Mat& map2, int interpolation, int borderMode=BORDER_CONSTANT, const Scalar& borderValue=Scalar())
Applies a generic geometrical transformation to an image. Applies a generic geometrical transformation to an image.
:param src: Source image :param src: Source image
:param dst: Destination image. It will have the same size as ``map1`` and the same type as ``src`` :param dst: Destination image. It will have the same size as ``map1`` and the same type as ``src``
:param map1: The first map of either ``(x,y)`` points or just ``x`` values having type ``CV_16SC2`` , ``CV_32FC1`` or ``CV_32FC2`` . See :func:`convertMaps` for converting floating point representation to fixed-point for speed. :param map1: The first map of either ``(x,y)`` points or just ``x`` values having type ``CV_16SC2`` , ``CV_32FC1`` or ``CV_32FC2`` . See :func:`convertMaps` for converting floating point representation to fixed-point for speed.
:param map2: The second map of ``y`` values having type ``CV_16UC1`` , ``CV_32FC1`` or none (empty map if map1 is ``(x,y)`` points), respectively :param map2: The second map of ``y`` values having type ``CV_16UC1`` , ``CV_32FC1`` or none (empty map if map1 is ``(x,y)`` points), respectively
:param interpolation: The interpolation method, see :func:`resize` . The method ``INTER_AREA`` is not supported by this function :param interpolation: The interpolation method, see :func:`resize` . The method ``INTER_AREA`` is not supported by this function
...@@ -252,9 +275,12 @@ This function can not operate in-place. ...@@ -252,9 +275,12 @@ This function can not operate in-place.
.. index:: resize .. index:: resize
.. _resize:
resize resize
---------- ----------
.. c:function:: void resize( const Mat\& src, Mat\& dst, Size dsize, double fx=0, double fy=0, int interpolation=INTER_LINEAR )
.. c:function:: void resize( const Mat& src, Mat& dst, Size dsize, double fx=0, double fy=0, int interpolation=INTER_LINEAR )
Resizes an image Resizes an image
...@@ -313,9 +339,11 @@ See also: ...@@ -313,9 +339,11 @@ See also:
.. index:: warpAffine .. index:: warpAffine
.. _warpAffine:
warpAffine warpAffine
-------------- --------------
.. c:function:: void warpAffine( const Mat\& src, Mat\& dst, const Mat\& M, Size dsize, int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT, const Scalar\& borderValue=Scalar()) .. c:function:: void warpAffine( const Mat& src, Mat& dst, const Mat& M, Size dsize, int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT, const Scalar& borderValue=Scalar())
Applies an affine transformation to an image. Applies an affine transformation to an image.
...@@ -337,7 +365,7 @@ The function ``warpAffine`` transforms the source image using the specified matr ...@@ -337,7 +365,7 @@ The function ``warpAffine`` transforms the source image using the specified matr
.. math:: .. math::
\texttt{dst} (x,y) = \texttt{src} ( \texttt{M} _{11} x + \texttt{M} _{12} y + \texttt{M} _{13}, \texttt{M} _{21} x + \texttt{M} _{22} y + \texttt{M} _{23}) \texttt{dst} (x,y) = \texttt{src} ( \texttt{M} _{11} x + \texttt{M} _{12} y + \texttt{M} _{13}, \texttt{M} _{21} x + \texttt{M} _{22} y + \texttt{M} _{23})
when the flag ``WARP_INVERSE_MAP`` is set. Otherwise, the transformation is first inverted with when the flag ``WARP_INVERSE_MAP`` is set. Otherwise, the transformation is first inverted with
:func:`invertAffineTransform` and then put in the formula above instead of ``M`` . :func:`invertAffineTransform` and then put in the formula above instead of ``M`` .
...@@ -345,11 +373,14 @@ The function can not operate in-place. ...@@ -345,11 +373,14 @@ The function can not operate in-place.
See also: See also:
:func:`warpPerspective`,:func:`resize`,:func:`remap`,:func:`getRectSubPix`,:func:`transform` :func:`warpPerspective`,:func:`resize`,:func:`remap`,:func:`getRectSubPix`,:func:`transform`
.. index:: warpPerspective .. index:: warpPerspective
.. _warpPerspective:
warpPerspective warpPerspective
------------------- -------------------
.. c:function:: void warpPerspective( const Mat\& src, Mat\& dst, const Mat\& M, Size dsize, int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT, const Scalar\& borderValue=Scalar()) .. c:function:: void warpPerspective( const Mat& src, Mat& dst, const Mat& M, Size dsize, int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT, const Scalar& borderValue=Scalar())
Applies a perspective transformation to an image. Applies a perspective transformation to an image.
...@@ -378,4 +409,5 @@ when the flag ``WARP_INVERSE_MAP`` is set. Otherwise, the transformation is firs ...@@ -378,4 +409,5 @@ when the flag ``WARP_INVERSE_MAP`` is set. Otherwise, the transformation is firs
The function can not operate in-place. The function can not operate in-place.
See also: See also:
:func:`warpAffine`,:func:`resize`,:func:`remap`,:func:`getRectSubPix`,:func:`perspectiveTransform` :func:`warpAffine`,:func:`resize`,:func:`remap`,:func:`getRectSubPix`,:func:`perspectiveTransform`
\ No newline at end of file
\ No newline at end of file
...@@ -3,6 +3,8 @@ Histograms ...@@ -3,6 +3,8 @@ Histograms
.. index:: calcHist .. index:: calcHist
.. _calcHist:
calcHist calcHist
------------ ------------
.. c:function:: void calcHist( const Mat* arrays, int narrays, const int* channels, const Mat\& mask, MatND\& hist, int dims, const int* histSize, const float** ranges, bool uniform=true, bool accumulate=false ) .. c:function:: void calcHist( const Mat* arrays, int narrays, const int* channels, const Mat\& mask, MatND\& hist, int dims, const int* histSize, const float** ranges, bool uniform=true, bool accumulate=false )
...@@ -95,6 +97,8 @@ input arrays. The sample below shows how to compute 2D Hue-Saturation histogram ...@@ -95,6 +97,8 @@ input arrays. The sample below shows how to compute 2D Hue-Saturation histogram
.. index:: calcBackProject .. index:: calcBackProject
.. _calcBackProject:
calcBackProject calcBackProject
------------------- -------------------
.. c:function:: void calcBackProject( const Mat* arrays, int narrays, const int* channels, const MatND\& hist, Mat\& backProject, const float** ranges, double scale=1, bool uniform=true ) .. c:function:: void calcBackProject( const Mat* arrays, int narrays, const int* channels, const MatND\& hist, Mat\& backProject, const float** ranges, double scale=1, bool uniform=true )
...@@ -133,10 +137,14 @@ That is the approximate algorithm of ...@@ -133,10 +137,14 @@ That is the approximate algorithm of
See also: See also:
:func:`calcHist` :func:`calcHist`
.. index:: compareHist .. index:: compareHist
.. _compareHist:
compareHist compareHist
--------------- -----------
.. c:function:: double compareHist( const MatND\& H1, const MatND\& H2, int method ) .. c:function:: double compareHist( const MatND\& H1, const MatND\& H2, int method )
.. c:function:: double compareHist( const SparseMat\& H1, const SparseMat\& H2, int method ) .. c:function:: double compareHist( const SparseMat\& H1, const SparseMat\& H2, int method )
...@@ -199,6 +207,8 @@ While the function works well with 1-, 2-, 3-dimensional dense histograms, it ma ...@@ -199,6 +207,8 @@ While the function works well with 1-, 2-, 3-dimensional dense histograms, it ma
.. index:: equalizeHist .. index:: equalizeHist
.. _equalizeHist:
equalizeHist equalizeHist
---------------- ----------------
.. c:function:: void equalizeHist( const Mat\& src, Mat\& dst ) .. c:function:: void equalizeHist( const Mat\& src, Mat\& dst )
......
...@@ -3,6 +3,8 @@ Miscellaneous Image Transformations ...@@ -3,6 +3,8 @@ Miscellaneous Image Transformations
.. index:: adaptiveThreshold .. index:: adaptiveThreshold
.. _adaptiveThreshold:
adaptiveThreshold adaptiveThreshold
--------------------- ---------------------
.. c:function:: void adaptiveThreshold( const Mat& src, Mat& dst, double maxValue, int adaptiveMethod, int thresholdType, int blockSize, double C ) .. c:function:: void adaptiveThreshold( const Mat& src, Mat& dst, double maxValue, int adaptiveMethod, int thresholdType, int blockSize, double C )
...@@ -56,8 +58,12 @@ The function can process the image in-place. ...@@ -56,8 +58,12 @@ The function can process the image in-place.
See also: See also:
:func:`threshold`,:func:`blur`,:func:`GaussianBlur` :func:`threshold`,:func:`blur`,:func:`GaussianBlur`
.. index:: cvtColor .. index:: cvtColor
.. _cvtColor:
cvtColor cvtColor
------------ ------------
.. c:function:: void cvtColor( const Mat& src, Mat& dst, int code, int dstCn=0 ) .. c:function:: void cvtColor( const Mat& src, Mat& dst, int code, int dstCn=0 )
...@@ -389,6 +395,8 @@ The function can do the following transformations: ...@@ -389,6 +395,8 @@ The function can do the following transformations:
.. index:: distanceTransform .. index:: distanceTransform
.. _distanceTransform:
distanceTransform distanceTransform
--------------------- ---------------------
.. c:function:: void distanceTransform( const Mat& src, Mat& dst, int distanceType, int maskSize ) .. c:function:: void distanceTransform( const Mat& src, Mat& dst, int distanceType, int maskSize )
...@@ -457,6 +465,8 @@ Currently, this second variant can only use the approximate distance transform a ...@@ -457,6 +465,8 @@ Currently, this second variant can only use the approximate distance transform a
.. index:: floodFill .. index:: floodFill
.. _floodFill:
floodFill floodFill
------------- -------------
.. c:function:: int floodFill( Mat& image, Point seed, Scalar newVal, Rect* rect=0, Scalar loDiff=Scalar(), Scalar upDiff=Scalar(), int flags=4 ) .. c:function:: int floodFill( Mat& image, Point seed, Scalar newVal, Rect* rect=0, Scalar loDiff=Scalar(), Scalar upDiff=Scalar(), int flags=4 )
...@@ -540,8 +550,11 @@ By using these functions you can either mark a connected component with the spec ...@@ -540,8 +550,11 @@ By using these functions you can either mark a connected component with the spec
See also: See also:
:func:`findContours` :func:`findContours`
.. index:: inpaint .. index:: inpaint
.. _inpaint:
inpaint inpaint
----------- -----------
.. c:function:: void inpaint( const Mat& src, const Mat& inpaintMask, Mat& dst, double inpaintRadius, int flags ) .. c:function:: void inpaint( const Mat& src, const Mat& inpaintMask, Mat& dst, double inpaintRadius, int flags )
...@@ -568,6 +581,8 @@ for more details. ...@@ -568,6 +581,8 @@ for more details.
.. index:: integral .. index:: integral
.. _integral:
integral integral
------------ ------------
.. c:function:: void integral( const Mat& image, Mat& sum, int sdepth=-1 ) .. c:function:: void integral( const Mat& image, Mat& sum, int sdepth=-1 )
...@@ -620,6 +635,8 @@ As a practical example, the next figure shows the calculation of the integral of ...@@ -620,6 +635,8 @@ As a practical example, the next figure shows the calculation of the integral of
.. index:: threshold .. index:: threshold
.. _threshold:
threshold threshold
------------- -------------
.. c:function:: double threshold( const Mat& src, Mat& dst, double thresh, double maxVal, int thresholdType ) .. c:function:: double threshold( const Mat& src, Mat& dst, double thresh, double maxVal, int thresholdType )
...@@ -684,8 +701,11 @@ Currently, Otsu's method is implemented only for 8-bit images. ...@@ -684,8 +701,11 @@ Currently, Otsu's method is implemented only for 8-bit images.
See also: See also:
:func:`adaptiveThreshold`,:func:`findContours`,:func:`compare`,:func:`min`,:func:`max` :func:`adaptiveThreshold`,:func:`findContours`,:func:`compare`,:func:`min`,:func:`max`
.. index:: watershed .. index:: watershed
.. _watershed:
watershed watershed
------------- -------------
.. c:function:: void watershed( const Mat& image, Mat& markers ) .. c:function:: void watershed( const Mat& image, Mat& markers )
...@@ -723,10 +743,14 @@ can be found in OpenCV samples directory; see ``watershed.cpp`` demo. ...@@ -723,10 +743,14 @@ can be found in OpenCV samples directory; see ``watershed.cpp`` demo.
See also: See also:
:func:`findContours` :func:`findContours`
.. index:: grabCut .. index:: grabCut
.. _grabCut:
grabCut grabCut
----------- -------
.. c:function:: void grabCut(const Mat& image, Mat& mask, Rect rect, Mat& bgdModel, Mat& fgdModel, int iterCount, int mode ) .. c:function:: void grabCut(const Mat& image, Mat& mask, Rect rect, Mat& bgdModel, Mat& fgdModel, int iterCount, int mode )
Runs GrabCut algorithm Runs GrabCut algorithm
...@@ -756,7 +780,5 @@ grabCut ...@@ -756,7 +780,5 @@ grabCut
* **GC_EVAL** The value means that algorithm should just resume. * **GC_EVAL** The value means that algorithm should just resume.
The function implements the `GrabCut <http://en.wikipedia.org/wiki/GrabCut>`_ The function implements the `GrabCut image segmentation algorithm <http://en.wikipedia.org/wiki/GrabCut>`_.
image segmentation algorithm.
See the sample grabcut.cpp on how to use the function. See the sample grabcut.cpp on how to use the function.
Planar Subdivisions
===================
.. highlight:: cpp
.. _Boosting:
Boosting Boosting
======== ========
...@@ -7,7 +9,7 @@ A common machine learning task is supervised learning. In supervised learning, t ...@@ -7,7 +9,7 @@ A common machine learning task is supervised learning. In supervised learning, t
:math:`y` . Predicting the qualitative output is called classification, while predicting the quantitative output is called regression. :math:`y` . Predicting the qualitative output is called classification, while predicting the quantitative output is called regression.
Boosting is a powerful learning concept, which provide a solution to the supervised classification learning task. It combines the performance of many "weak" classifiers to produce a powerful 'committee' Boosting is a powerful learning concept, which provide a solution to the supervised classification learning task. It combines the performance of many "weak" classifiers to produce a powerful 'committee'
:ref:`HTF01` . A weak classifier is only required to be better than chance, and thus can be very simple and computationally inexpensive. Many of them smartly combined, however, results in a strong classifier, which often outperforms most 'monolithic' strong classifiers such as SVMs and Neural Networks. :ref:`[HTF01] <HTF01>` . A weak classifier is only required to be better than chance, and thus can be very simple and computationally inexpensive. Many of them smartly combined, however, results in a strong classifier, which often outperforms most 'monolithic' strong classifiers such as SVMs and Neural Networks.
Decision trees are the most popular weak classifiers used in boosting schemes. Often the simplest decision trees with only a single split node per tree (called stumps) are sufficient. Decision trees are the most popular weak classifiers used in boosting schemes. Often the simplest decision trees with only a single split node per tree (called stumps) are sufficient.
...@@ -20,7 +22,7 @@ The boosted model is based on ...@@ -20,7 +22,7 @@ The boosted model is based on
:math:`K` -component vector. Each component encodes a feature relevant for the learning task at hand. The desired two-class output is encoded as -1 and +1. :math:`K` -component vector. Each component encodes a feature relevant for the learning task at hand. The desired two-class output is encoded as -1 and +1.
Different variants of boosting are known such as Discrete Adaboost, Real AdaBoost, LogitBoost, and Gentle AdaBoost Different variants of boosting are known such as Discrete Adaboost, Real AdaBoost, LogitBoost, and Gentle AdaBoost
:ref:`FHT98` . All of them are very similar in their overall structure. Therefore, we will look only at the standard two-class Discrete AdaBoost algorithm as shown in the box below. Each sample is initially assigned the same weight (step 2). Next a weak classifier :ref:`[FHT98] <FHT98>` . All of them are very similar in their overall structure. Therefore, we will look only at the standard two-class Discrete AdaBoost algorithm as shown in the box below. Each sample is initially assigned the same weight (step 2). Next a weak classifier
:math:`f_{m(x)}` is trained on the weighted training data (step 3a). Its weighted training error and scaling factor :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, which have been misclassified (step 3c). All weights are then normalized, and the process of finding the next weak classifier continues for another :math:`c_m` is computed (step 3b). The weights are increased for training samples, which 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:`M` -1 times. The final classifier
...@@ -65,15 +67,20 @@ As well as the classical boosting methods, the current implementation supports 2 ...@@ -65,15 +67,20 @@ As well as the classical boosting methods, the current implementation supports 2
:math:`>` 2 classes there is the :math:`>` 2 classes there is the
**AdaBoost.MH** **AdaBoost.MH**
algorithm, described in algorithm, described in
:ref:`FHT98` , that reduces the problem to the 2-class problem, yet with a much larger training set. :ref:`[FHT98] <FHT98>` , that reduces the problem to the 2-class problem, yet with a much larger training set.
In order to reduce computation time for boosted models without substantially losing accuracy, the influence trimming technique may be employed. As the training algorithm proceeds and the number of trees in the ensemble is increased, a larger number of the training samples are classified correctly and with increasing confidence, thereby those samples receive smaller weights on the subsequent iterations. Examples with very low relative weight have small impact on training of the weak classifier. Thus such examples may be excluded during the weak classifier training without having much effect on the induced classifier. This process is controlled with the weight_trim_rate parameter. Only examples with the summary fraction weight_trim_rate of the total weight mass are used in the weak classifier training. Note that the weights for In order to reduce computation time for boosted models without substantially losing accuracy, the influence trimming technique may be employed. As the training algorithm proceeds and the number of trees in the ensemble is increased, a larger number of the training samples are classified correctly and with increasing confidence, thereby those samples receive smaller weights on the subsequent iterations. Examples with very low relative weight have small impact on training of the weak classifier. Thus such examples may be excluded during the weak classifier training without having much effect on the induced classifier. This process is controlled with the weight_trim_rate parameter. Only examples with the summary fraction weight_trim_rate of the total weight mass are used in the weak classifier training. Note that the weights for
**all** **all**
training examples are recomputed at each training iteration. Examples deleted at a particular iteration may be used again for learning some of the weak classifiers further training examples are recomputed at each training iteration. Examples deleted at a particular iteration may be used again for learning some of the weak classifiers further
:ref:`FHT98` . :ref:`[FHT98] <FHT98>` .
.. _HTF01:
[HTF01] Hastie, T., Tibshirani, R., Friedman, J. H. The Elements of Statistical Learning: Data Mining, Inference, and Prediction. Springer Series in Statistics. 2001.**
.. _FHT98:
**[HTF01] Hastie, T., Tibshirani, R., Friedman, J. H. The Elements of Statistical Learning: Data Mining, Inference, and Prediction. Springer Series in Statistics. 2001.** [FHT98] Friedman, J. H., Hastie, T. and Tibshirani, R. Additive Logistic Regression: a Statistical View of Boosting. Technical Report, Dept. of Statistics, Stanford University, 1998.**
**[FHT98] Friedman, J. H., Hastie, T. and Tibshirani, R. Additive Logistic Regression: a Statistical View of Boosting. Technical Report, Dept. of Statistics, Stanford University, 1998.**
.. index:: CvBoostParams .. index:: CvBoostParams
......
...@@ -57,7 +57,7 @@ Alternatively, the algorithm may start with the M-step when the initial values f ...@@ -57,7 +57,7 @@ Alternatively, the algorithm may start with the M-step when the initial values f
:math:`p_{i,k}` can be provided. Another alternative when :math:`p_{i,k}` can be provided. Another alternative when
:math:`p_{i,k}` are unknown, is to use a simpler clustering algorithm to pre-cluster the input samples and thus obtain initial :math:`p_{i,k}` are unknown, is to use a simpler clustering algorithm to pre-cluster the input samples and thus obtain initial
:math:`p_{i,k}` . Often (and in ML) the :math:`p_{i,k}` . Often (and in ML) the
:ref:`KMeans2` algorithm is used for that purpose. :ref:`kmeans` algorithm is used for that purpose.
One of the main that EM algorithm should deal with is the large number One of the main that EM algorithm should deal with is the large number
of parameters to estimate. The majority of the parameters sits in of parameters to estimate. The majority of the parameters sits in
...@@ -197,12 +197,12 @@ CvEM::train ...@@ -197,12 +197,12 @@ CvEM::train
Estimates the Gaussian mixture parameters from the sample set. Estimates the Gaussian mixture parameters from the sample set.
Unlike many of the ML models, EM is an unsupervised learning algorithm and it does not take responses (class labels or the function values) on input. Instead, it computes the Unlike many of the ML models, EM is an unsupervised learning algorithm and it does not take responses (class labels or the function values) on input. Instead, it computes the
:ref:`MLE` of the Gaussian mixture parameters from the input sample set, stores all the parameters inside the structure: *Maximum Likelihood Estimate* of the Gaussian mixture parameters from the input sample set, stores all the parameters inside the structure:
:math:`p_{i,k}` in ``probs``,:math:`a_k` in ``means`` :math:`S_k` in ``covs[k]``,:math:`\pi_k` in ``weights`` and optionally computes the output "class label" for each sample: :math:`p_{i,k}` in ``probs``,:math:`a_k` in ``means`` :math:`S_k` in ``covs[k]``,:math:`\pi_k` in ``weights`` and optionally computes the output "class label" for each sample:
:math:`\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N` (i.e. indices of the most-probable mixture for each sample). :math:`\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N` (i.e. indices of the most-probable mixture for each sample).
The trained model can be used further for prediction, just like any other classifier. The model trained is similar to the The trained model can be used further for prediction, just like any other classifier. The model trained is similar to the
:ref:`Bayes classifier` . :ref:`Bayes classifier`.
Example: Clustering random samples of multi-Gaussian distribution using EM :: Example: Clustering random samples of multi-Gaussian distribution using EM ::
......
...@@ -61,7 +61,7 @@ so the error on the test set usually starts increasing after the network ...@@ -61,7 +61,7 @@ so the error on the test set usually starts increasing after the network
size reaches some limit. Besides, the larger networks are train much size reaches some limit. Besides, the larger networks are train much
longer than the smaller ones, so it is reasonable to preprocess the data longer than the smaller ones, so it is reasonable to preprocess the data
(using (using
:ref:`CalcPCA` or similar technique) and train a smaller network :ref:`PCA::operator ()` or similar technique) and train a smaller network
on only the essential features. on only the essential features.
Another feature of the MLP's is their inability to handle categorical Another feature of the MLP's is their inability to handle categorical
......
.. _Bayes Classifier:
Normal Bayes Classifier Normal Bayes Classifier
======================= =======================
.. highlight:: cpp
This is a simple classification model assuming that feature vectors from each class are normally distributed (though, not necessarily independently distributed), so the whole data distribution function is assumed to be a Gaussian mixture, one component per class. Using the training data the algorithm estimates mean vectors and covariance matrices for every class, and then it uses them for prediction. This is a simple classification model assuming that feature vectors from each class are normally distributed (though, not necessarily independently distributed), so the whole data distribution function is assumed to be a Gaussian mixture, one component per class. Using the training data the algorithm estimates mean vectors and covariance matrices for every class, and then it uses them for prediction.
**[Fukunaga90] K. Fukunaga. Introduction to Statistical Pattern Recognition. second ed., New York: Academic Press, 1990.** **[Fukunaga90] K. Fukunaga. Introduction to Statistical Pattern Recognition. second ed., New York: Academic Press, 1990.**
......
.. _Random Trees:
Random Trees Random Trees
============ ============
.. highlight:: cpp
Random trees have been introduced by Leo Breiman and Adele Cutler: Random trees have been introduced by Leo Breiman and Adele Cutler:
http://www.stat.berkeley.edu/users/breiman/RandomForests/ http://www.stat.berkeley.edu/users/breiman/RandomForests/
. The algorithm can deal with both classification and regression problems. Random trees is a collection (ensemble) of tree predictors that is called . The algorithm can deal with both classification and regression problems. Random trees is a collection (ensemble) of tree predictors that is called
......
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