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

further docs cleanup

parent 23416e3d
This diff is collapsed.
Clustering
==========
.. highlight:: cpp
.. index:: kmeans
.. _kmeans:
kmeans
----------
------
.. 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.
......
Dynamic Structures
==================
.. highlight:: cpp
......@@ -2,11 +2,9 @@
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.
The current OpenCV implementation has a modular structure (i.e. the binary package includes several shared or static libraries), where we have:
OpenCV has a modular structure (i.e. package includes several shared or static libraries). The modules are:
* **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.
......@@ -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.
* ... 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.
Below are the other main concepts of the OpenCV API, implied everywhere in the document.
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.
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
.. index:: gpu::GpuMat
.. gpu::GpuMat:
gpu::GpuMat
-----------
.. c:type:: gpu::GpuMat
......@@ -216,8 +214,6 @@ gpu::CudaMem::canMapHostMemory
.. index:: gpu::Stream
.. _gpu::Stream:
gpu::Stream
-----------
.. c:type:: gpu::Stream
......
......@@ -126,13 +126,9 @@ See also:
gpu::minMaxLoc
------------------
.. c:function:: void gpu::minMaxLoc(const GpuMat\& src, double\* minVal, double* maxVal=0,
Point* minLoc=0, Point* maxLoc=0,
const GpuMat\& mask=GpuMat())
.. c:function:: void gpu::minMaxLoc(const GpuMat& src, double* minVal, double* maxVal=0, Point* minLoc=0, Point* maxLoc=0, const GpuMat& mask=GpuMat())
.. c:function:: void gpu::minMaxLoc(const GpuMat\& src, double* minVal, double* maxVal,
Point* minLoc, Point* maxLoc, const GpuMat\& mask,
GpuMat\& valbuf, GpuMat\& locbuf)
.. c:function:: void gpu::minMaxLoc(const GpuMat& src, double* minVal, double* maxVal, Point* minLoc, Point* maxLoc, const GpuMat& mask, GpuMat& valbuf, GpuMat& locbuf)
Finds global minimum and maximum matrix elements and returns their values with locations.
......
This diff is collapsed.
......@@ -7,7 +7,7 @@ Per-element Operations.
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.
......@@ -17,7 +17,7 @@ gpu::add
: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.
......@@ -32,7 +32,7 @@ See also:
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).
......@@ -42,7 +42,7 @@ gpu::subtract
: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.
......@@ -57,7 +57,7 @@ See also:
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).
......@@ -67,7 +67,7 @@ gpu::multiply
: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.
......@@ -82,7 +82,7 @@ See also:
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).
......@@ -92,7 +92,7 @@ gpu::divide
: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.
......@@ -110,7 +110,7 @@ See also:
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.
......@@ -125,7 +125,7 @@ See also:
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.
......@@ -140,7 +140,7 @@ See also:
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).
......@@ -150,7 +150,7 @@ gpu::absdiff
: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.
......@@ -165,7 +165,7 @@ See also:
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.
......@@ -190,15 +190,11 @@ See also:
.. index:: gpu::bitwise_not
.. _gpu::bitwise_not:
gpu::bitwise_not
--------------------
.. c:function:: void gpu::bitwise_not(const GpuMat\& src, GpuMat\& dst,
const GpuMat\& mask=GpuMat())
.. c:function:: void gpu::bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask=GpuMat())
.. c:function:: void gpu::bitwise_not(const GpuMat\& src, GpuMat\& dst,
const GpuMat\& mask, const Stream\& stream)
.. c:function:: void gpu::bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask, const Stream& stream)
Performs per-element bitwise inversion.
......@@ -210,20 +206,14 @@ gpu::bitwise_not
:param stream: Stream for the asynchronous version.
See also:
.
.. index:: gpu::bitwise_or
.. _gpu::bitwise_or:
gpu::bitwise_or
-------------------
.. c:function:: void gpu::bitwise_or(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst,
const GpuMat\& mask=GpuMat())
.. c:function:: void gpu::bitwise_or(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat())
.. c:function:: void gpu::bitwise_or(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst,
const GpuMat\& mask, const Stream\& stream)
.. c:function:: void gpu::bitwise_or(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream)
Performs per-element bitwise disjunction of two matrices.
......@@ -237,20 +227,13 @@ gpu::bitwise_or
:param stream: Stream for the asynchronous version.
See also:
.
.. index:: gpu::bitwise_and
.. _gpu::bitwise_and:
gpu::bitwise_and
--------------------
.. c:function:: void gpu::bitwise_and(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst,
const GpuMat\& mask=GpuMat())
.. c:function:: void gpu::bitwise_and(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat())
.. c:function:: void gpu::bitwise_and(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst,
const GpuMat\& mask, const Stream\& stream)
.. c:function:: void gpu::bitwise_and(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream)
Performs per-element bitwise conjunction of two matrices.
......@@ -264,20 +247,14 @@ gpu::bitwise_and
:param stream: Stream for the asynchronous version.
See also:
.
.. index:: gpu::bitwise_xor
.. _gpu::bitwise_xor:
gpu::bitwise_xor
--------------------
.. c:function:: void gpu::bitwise_xor(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst,
const GpuMat\& mask=GpuMat())
.. c:function:: void gpu::bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat())
.. c:function:: void gpu::bitwise_xor(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst,
const GpuMat\& mask, const Stream\& stream)
.. c:function:: void gpu::bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream)
Performs per-element bitwise "exclusive or" of two matrices.
......@@ -291,19 +268,16 @@ gpu::bitwise_xor
:param stream: Stream for the asynchronous version.
See also:
.
.. index:: 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,
const Stream\& stream)
.. c:function:: void gpu::min(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, 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.
......@@ -313,10 +287,10 @@ gpu::min
: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,
const Stream\& stream)
.. c:function:: void gpu::min(const GpuMat& src1, double src2, GpuMat& dst,
const Stream& stream)
* **src1** Source matrix.
......@@ -333,33 +307,25 @@ See also:
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,
const Stream\& stream)
.. c:function:: void gpu::max(const GpuMat& src1, double value, GpuMat& dst, 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 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 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:
:func:`max` .
......@@ -57,6 +57,8 @@ The following code is an example used to generate the figure. ::
.. index:: setWindowProperty
.. _setWindowProperty:
setWindowProperty
---------------------
.. c:function:: void setWindowProperty(const string& name, int prop_id, double prop_value)
......@@ -115,6 +117,8 @@ The function `` getWindowProperty`` return window's properties.
.. index:: 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)
......
......@@ -5,6 +5,8 @@ Reading and Writing Images and Video
.. index:: imdecode
.. _imdecode:
imdecode
------------
.. c:function:: Mat imdecode( const Mat\& buf, int flags )
......@@ -23,6 +25,8 @@ See
.. index:: imencode
.. _imencode:
imencode
------------
.. c:function:: bool imencode( const string\& ext, const Mat\& img, vector<uchar>\& buf, const vector<int>\& params=vector<int>())
......@@ -43,6 +47,8 @@ See
.. index:: imread
.. _imread:
imread
----------
.. c:function:: Mat imread( const string\& filename, int flags=1 )
......@@ -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:
*
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**
: 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
.. index:: imwrite
.. _imwrite:
imwrite
-----------
.. 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: :
.. index:: VideoCapture::VideoCapture
.. _VideoCapture::VideoCapture:
VideoCapture::VideoCapture
------------------------------
.. c:function:: VideoCapture::VideoCapture()
......@@ -227,6 +222,8 @@ VideoCapture constructors.
.. index:: VideoCapture::get
.. _VideoCapture::get:
VideoCapture::get
---------------------
.. 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
.. index:: VideoCapture::set
.. _VideoCapture::set:
VideoCapture::set
---------------------
.. c:function:: bool VideoCapture::set(int property_id, double value)
......
......@@ -5,9 +5,11 @@ User Interface
.. index:: 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
......@@ -43,7 +45,7 @@ By clicking on the label of each trackbar, it is possible to edit the trackbar's
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.
......@@ -61,9 +63,11 @@ qt-specific details:
.. index:: 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
......@@ -84,9 +88,11 @@ The function ``imshow`` displays the image in the specified window. If the windo
.. index:: namedWindow
.. _namedWindow:
namedWindow
---------------
.. c:function:: void namedWindow( const string\& winname, int flags )
.. c:function:: void namedWindow( const string& winname, int flags )
Creates a window.
......@@ -104,27 +110,29 @@ qt-specific details:
* **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_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:
::
namedWindow( ``myWindow'', ``CV_WINDOW_NORMAL`` textbar ``CV_GUI_NORMAL`` );
namedWindow( ``myWindow'', ``CV_WINDOW_NORMAL`` textbar ``CV_GUI_NORMAL`` );
..
.. index:: 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.
......@@ -144,6 +152,8 @@ qt-specific details:
.. index:: waitKey
.. _waitKey:
waitKey
-----------
.. c:function:: int waitKey(int delay=0)
......
......@@ -3,9 +3,11 @@ Feature Detection
.. index:: 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.
......@@ -26,9 +28,12 @@ http://en.wikipedia.org/wiki/Canny_edge_detector
.. index:: 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.
......@@ -67,11 +72,15 @@ The output of the function can be used for robust edge or corner detection.
See also:
:func:`cornerMinEigenVal`,:func:`cornerHarris`,:func:`preCornerDetect`
.. index:: 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.
......@@ -103,9 +112,12 @@ Corners in the image can be found as the local maxima of this response map.
.. index:: 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.
......@@ -126,9 +138,11 @@ The function is similar to
.. index:: 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.
......@@ -182,9 +196,12 @@ The algorithm sets the center of the neighborhood window at this new center
.. index:: 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.
......@@ -239,8 +256,11 @@ See also: :func:`cornerMinEigenVal`, :func:`cornerHarris`, :func:`calcOpticalFlo
.. index:: 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 )
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
See also:
:func:`fitEllipse`,:func:`minEnclosingCircle`
.. index:: 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.
......@@ -327,9 +351,12 @@ The function implements standard or standard multi-scale Hough transform algorit
.. index:: 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.
......@@ -414,9 +441,12 @@ And this is the output of the above program in the case of probabilistic Hough t
.. index:: 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
......
......@@ -34,19 +34,25 @@ The actual implementations of the geometrical transformations, from the most gen
.. index:: 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
: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 dstmap1: The first output map; will have type ``dstmap1type`` and the same size as ``src``
: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
The function converts a pair of maps for
......@@ -64,8 +70,11 @@ The function converts a pair of maps for
See also:
:func:`remap`,:func:`undisort`,:func:`initUndistortRectifyMap`
.. index:: getAffineTransform
.. _getAffineTransform:
getAffineTransform
----------------------
.. c:function:: Mat getAffineTransform( const Point2f src[], const Point2f dst[] )
......@@ -76,8 +85,7 @@ getAffineTransform
:param dst: Coordinates of the corresponding triangle vertices in the destination image
The function calculates the
:math:`2 \times 3` matrix of an affine transform such that:
The function calculates the :math:`2 \times 3` matrix of an affine transform such that:
.. math::
......@@ -93,11 +101,15 @@ where
See also:
:func:`warpAffine`,:func:`transform`
.. index:: 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
......@@ -105,8 +117,7 @@ getPerspectiveTransform
:param dst: Coordinates of the corresponding quadrangle vertices in the destination image
The function calculates the
:math:`3 \times 3` matrix of a perspective transform such that:
The function calculates the :math:`3 \times 3` matrix of a perspective transform such that:
.. math::
......@@ -122,11 +133,14 @@ where
See also:
:func:`findHomography`,:func:`warpPerspective`,:func:`perspectiveTransform`
.. index:: 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
......@@ -156,8 +170,11 @@ the pixel values outside of the image.
See also:
:func:`warpAffine`,:func:`warpPerspective`
.. index:: getRotationMatrix2D
.. _getRotationMatrix2D:
getRotationMatrix2D
-----------------------
.. 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
See also:
:func:`getAffineTransform`,:func:`warpAffine`,:func:`transform`
.. index:: 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
......@@ -210,18 +230,21 @@ The result will also be a
.. index:: 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.
:param src: Source image
: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
......@@ -252,9 +275,12 @@ This function can not operate in-place.
.. index:: 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
......@@ -313,9 +339,11 @@ See also:
.. index:: 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.
......@@ -337,7 +365,7 @@ The function ``warpAffine`` transforms the source image using the specified matr
.. 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
:func:`invertAffineTransform` and then put in the formula above instead of ``M`` .
......@@ -345,11 +373,14 @@ The function can not operate in-place.
See also:
:func:`warpPerspective`,:func:`resize`,:func:`remap`,:func:`getRectSubPix`,:func:`transform`
.. index:: 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.
......@@ -378,4 +409,5 @@ when the flag ``WARP_INVERSE_MAP`` is set. Otherwise, the transformation is firs
The function can not operate in-place.
See also:
:func:`warpAffine`,:func:`resize`,:func:`remap`,:func:`getRectSubPix`,:func:`perspectiveTransform`
\ No newline at end of file
:func:`warpAffine`,:func:`resize`,:func:`remap`,:func:`getRectSubPix`,:func:`perspectiveTransform`
\ No newline at end of file
......@@ -3,6 +3,8 @@ Histograms
.. index:: 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 )
......@@ -95,6 +97,8 @@ input arrays. The sample below shows how to compute 2D Hue-Saturation histogram
.. index:: 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 )
......@@ -133,10 +137,14 @@ That is the approximate algorithm of
See also:
:func:`calcHist`
.. index:: compareHist
.. _compareHist:
compareHist
---------------
-----------
.. c:function:: double compareHist( const MatND\& H1, const MatND\& 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
.. index:: equalizeHist
.. _equalizeHist:
equalizeHist
----------------
.. c:function:: void equalizeHist( const Mat\& src, Mat\& dst )
......
......@@ -3,6 +3,8 @@ Miscellaneous Image Transformations
.. index:: adaptiveThreshold
.. _adaptiveThreshold:
adaptiveThreshold
---------------------
.. 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.
See also:
:func:`threshold`,:func:`blur`,:func:`GaussianBlur`
.. index:: cvtColor
.. _cvtColor:
cvtColor
------------
.. 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:
.. index:: distanceTransform
.. _distanceTransform:
distanceTransform
---------------------
.. 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
.. index:: 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 )
......@@ -540,8 +550,11 @@ By using these functions you can either mark a connected component with the spec
See also:
:func:`findContours`
.. index:: inpaint
.. _inpaint:
inpaint
-----------
.. c:function:: void inpaint( const Mat& src, const Mat& inpaintMask, Mat& dst, double inpaintRadius, int flags )
......@@ -568,6 +581,8 @@ for more details.
.. index:: integral
.. _integral:
integral
------------
.. 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
.. index:: threshold
.. _threshold:
threshold
-------------
.. 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.
See also:
:func:`adaptiveThreshold`,:func:`findContours`,:func:`compare`,:func:`min`,:func:`max`
.. index:: watershed
.. _watershed:
watershed
-------------
.. c:function:: void watershed( const Mat& image, Mat& markers )
......@@ -723,10 +743,14 @@ can be found in OpenCV samples directory; see ``watershed.cpp`` demo.
See also:
:func:`findContours`
.. index:: grabCut
.. _grabCut:
grabCut
-----------
-------
.. c:function:: void grabCut(const Mat& image, Mat& mask, Rect rect, Mat& bgdModel, Mat& fgdModel, int iterCount, int mode )
Runs GrabCut algorithm
......@@ -756,7 +780,5 @@ grabCut
* **GC_EVAL** The value means that algorithm should just resume.
The function implements the `GrabCut <http://en.wikipedia.org/wiki/GrabCut>`_
image segmentation algorithm.
The function implements the `GrabCut image segmentation algorithm <http://en.wikipedia.org/wiki/GrabCut>`_.
See the sample grabcut.cpp on how to use the function.
Planar Subdivisions
===================
.. highlight:: cpp
.. _Boosting:
Boosting
========
......@@ -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.
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.
......@@ -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.
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:`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
......@@ -65,15 +67,20 @@ As well as the classical boosting methods, the current implementation supports 2
:math:`>` 2 classes there is the
**AdaBoost.MH**
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
**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
: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
......
......@@ -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}` 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
: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
of parameters to estimate. The majority of the parameters sits in
......@@ -197,12 +197,12 @@ CvEM::train
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
: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:`\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
:ref:`Bayes classifier` .
:ref:`Bayes classifier`.
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
size reaches some limit. Besides, the larger networks are train much
longer than the smaller ones, so it is reasonable to preprocess the data
(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.
Another feature of the MLP's is their inability to handle categorical
......
.. _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.
**[Fukunaga90] K. Fukunaga. Introduction to Statistical Pattern Recognition. second ed., New York: Academic Press, 1990.**
......
.. _Random Trees:
Random Trees
============
.. highlight:: cpp
Random trees have been introduced by Leo Breiman and Adele Cutler:
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
......
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