Project 3D points to the image plane given intrinsic and extrinsic parameters
* Project 3D points to the image plane given intrinsic and extrinsic parameters
*
Compute extrinsic parameters given intrinsic parameters, a few 3D points and their projections.
* Compute extrinsic parameters given intrinsic parameters, a few 3D points and their projections.
*
Estimate intrinsic and extrinsic camera parameters from several views of a known calibration pattern (i.e. every view is described by several 3D-2D point correspondences).
* Estimate intrinsic and extrinsic camera parameters from several views of a known calibration pattern (i.e. every view is described by several 3D-2D point correspondences).
*
Estimate the relative position and orientation of the stereo camera "heads" and compute the
*rectification*
transformation that makes the camera optical axes parallel.
* Estimate the relative position and orientation of the stereo camera "heads" and compute the *rectification* transformation that makes the camera optical axes parallel.
:math:`\mathrm{rodrigues}` denotes a rotation vector to rotation matrix transformation, and
:math:`\mathrm{rodrigues}^{-1}` denotes the inverse transformation, see
:func:`Rodrigues` .
where :math:`\mathrm{rodrigues}` denotes a rotation vector to rotation matrix transformation, and
:math:`\mathrm{rodrigues}^{-1}` denotes the inverse transformation, see :func:`Rodrigues`.
Also, the functions can compute the derivatives of the output vectors w.r.t the input vectors (see
:func:`matMulDeriv` ).
The functions are used inside
:func:`stereoCalibrate` but can also be used in your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a function that contains matrix multiplication.
Also, the functions can compute the derivatives of the output vectors w.r.t the input vectors (see :func:`matMulDeriv` ).
The functions are used inside :func:`stereoCalibrate` but can also be used in your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a function that contains matrix multiplication.
For points in one image of a stereo pair, computes the corresponding epilines in the other image.
:param points:The input points. :math:`N \times 1` or :math:`1 \times N` matrix of type ``CV_32FC2`` or ``vector<Point2f>``
:param whichImage:Index of the image (1 or 2) that contains the ``points``
:param F:The fundamental matrix that can be estimated using :ref:`FindFundamentalMat` or :ref:`StereoRectify` .
:param lines:The output vector of the corresponding to the points epipolar lines in the other image. Each line :math:`ax + by + c=0` is encoded by 3 numbers :math:`(a, b, c)`
:param lines:The output vector of the corresponding to the points epipolar lines in the other image. Each line :math:`ax + by + c=0` is encoded by 3 numbers :math:`(a, b, c)`
For every point in one of the two images of a stereo-pair the function finds the equation of the
corresponding epipolar line in the other image.
@ -269,9 +264,9 @@ Line coefficients are defined up to a scale. They are normalized, such that
the function requires some white space (like a square-thick border, the wider the better) around the board to make the detection more robust in various environment (otherwise if there is no border and the background is dark, the outer black squares could not be segmented properly and so the square grouping and ordering algorithm will fail).
@ -407,7 +398,7 @@ the function requires some white space (like a square-thick border, the wider th
the function requires some white space (like a square-thick border, the wider the better) around the board to make the detection more robust in various environment.
@ -452,7 +442,7 @@ the function requires some white space (like a square-thick border, the wider th
Returns the new camera matrix based on the free scaling parameter
@ -668,8 +654,8 @@ cv::getOptimalNewCameraMatrix
:param newImageSize:The image size after rectification. By default it will be set to ``imageSize`` .
:param validPixROI:The optional output rectangle that will outline all-good-pixels region in the undistorted image. See ``roi1, roi2`` description in :ref:`StereoRectify`
The function computes
and returns
The function computes and returns
the optimal new camera matrix based on the free scaling parameter. By varying this parameter the user may retrieve only sensible pixels ``alpha=0`` , keep all the original image pixels if there is valuable information in the corners ``alpha=1`` , or get something in between. When ``alpha>0`` , the undistortion result will likely have some black pixels corresponding to "virtual" pixels outside of the captured distorted image. The original camera matrix, distortion coefficients, the computed new camera matrix and the ``newImageSize`` should be passed to
:ref:`InitUndistortRectifyMap` to produce the maps for
:ref:`Remap` .
@ -678,15 +664,18 @@ the optimal new camera matrix based on the free scaling parameter. By varying t
Finds the initial camera matrix from the 3D-2D point correspondences
:param objectPoints:The vector of vectors of the object points. See :func:`calibrateCamera`
:param imagePoints:The vector of vectors of the corresponding image points. See :func:`calibrateCamera`
:param imageSize:The image size in pixels; used to initialize the principal point
:param aspectRatio:If it is zero or negative, both :math:`f_x` and :math:`f_y` are estimated independently. Otherwise :math:`f_x = f_y * \texttt{aspectRatio}`
The function estimates and returns the initial camera matrix for camera calibration process.
Currently, the function only supports planar calibration patterns, i.e. patterns where each object point has z-coordinate =0.
@ -694,19 +683,23 @@ Currently, the function only supports planar calibration patterns, i.e. patterns
Computes the undistortion and rectification transformation map.
:param cameraMatrix:The input camera matrix :math:`A=\vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}`
:param distCoeffs:The input vector of distortion coefficients :math:`(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]])` of 4, 5 or 8 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
:param R:The optional rectification transformation in object space (3x3 matrix). ``R1`` or ``R2`` , computed by :ref:`StereoRectify` can be passed here. If the matrix is empty , the identity transformation is assumed
:param newCameraMatrix:The new camera matrix :math:`A'=\vecthreethree{f_x'}{0}{c_x'}{0}{f_y'}{c_y'}{0}{0}{1}`
:param size:The undistorted image size
:param m1type:The type of the first output map, can be ``CV_32FC1`` or ``CV_16SC2`` . See :func:`convertMaps`
:param map1:The first output map
:param map2:The second output map
@ -744,7 +737,8 @@ where the ``cameraMatrix`` can be chosen arbitrarily.
:param objectPoints:The array of object points, 3xN or Nx3 1-channel or 1xN or Nx1 3-channel (or ``vector<Point3f>`` ) , where N is the number of points in the view
:param rvec:The rotation vector, see :ref:`Rodrigues2`
:param tvec:The translation vector
:param cameraMatrix:The camera matrix :math:`A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{_1}`
:param distCoeffs:The input vector of distortion coefficients :math:`(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]])` of 4, 5 or 8 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
:param imagePoints:The output array of image points, 2xN or Nx2 1-channel or 1xN or Nx1 2-channel (or ``vector<Point2f>`` )
@ -783,7 +782,9 @@ cv::projectPoints
:param dpdt:Optional 2Nx3 matrix of derivatives of image points with respect to components of the translation vector
:param dpdf:Optional 2Nx2 matrix of derivatives of image points with respect to :math:`f_x` and :math:`f_y`
:param dpdc:Optional 2Nx2 matrix of derivatives of image points with respect to :math:`c_x` and :math:`c_y`
:param dpddist:Optional 2Nx4 matrix of derivatives of image points with respect to distortion coefficients
The function computes projections of 3D
@ -804,7 +805,8 @@ Note, that by setting ``rvec=tvec=(0,0,0)`` , or by setting ``cameraMatrix`` to
Each element of ``_3dImage(x,y)`` will contain the 3D coordinates of the point ``(x,y)`` , computed from the disparity map.
:param Q:The :math:`4 \times 4` perspective transformation matrix that can be obtained with :ref:`StereoRectify`
:param handleMissingValues:If true, when the pixels with the minimal disparity (that corresponds to the outliers; see :ref:`FindStereoCorrespondenceBM` ) will be transformed to 3D points with some very large Z value (currently set to 10000)
The function transforms 1-channel disparity map to 3-channel image representing a 3D surface. That is, for each pixel ``(x,y)`` and the corresponding disparity ``d=disparity(x,y)`` it computes:
@ -831,9 +834,9 @@ The matrix ``Q`` can be arbitrary
Converts a rotation matrix to a rotation vector or vice versa.
@ -894,7 +897,7 @@ used in the global 3D geometry optimization procedures like
StereoBM
--------
..ctype:: StereoBM
..c:type:: StereoBM
The class for computing stereo correspondence using block matching algorithm. ::
@ -920,11 +923,9 @@ The class for computing stereo correspondence using block matching algorithm. ::
Ptr<CvStereoBMState> state;
};
..
The class is a C++ wrapper for
and the associated functions. In particular, ``StereoBM::operator ()`` is the wrapper for
:ref:`FindStereoCorrespondceBM` . See the respective descriptions.
The class is a C++ wrapper for and the associated functions. In particular, ``StereoBM::operator ()`` is the wrapper for
:ref:`FindStereoCorrespondceBM`. See the respective descriptions.
..index:: StereoSGBM
@ -932,7 +933,7 @@ and the associated functions. In particular, ``StereoBM::operator ()`` is the wr
StereoSGBM
----------
..ctype:: StereoSGBM
..c:type:: StereoSGBM
The class for computing stereo correspondence using semi-global block matching algorithm. ::
@ -961,7 +962,6 @@ The class for computing stereo correspondence using semi-global block matching a
...
};
..
The class implements modified H. Hirschmuller algorithm
HH08
@ -988,9 +988,9 @@ HH08
cv::StereoSGBM::StereoSGBM
--------------------------
..cfunction:: StereoSGBM::StereoSGBM()
..c:function:: StereoSGBM::StereoSGBM()
..cfunction:: StereoSGBM::StereoSGBM( int minDisparity, int numDisparities, int SADWindowSize, int P1=0, int P2=0, int disp12MaxDiff=0, int preFilterCap=0, int uniquenessRatio=0, int speckleWindowSize=0, int speckleRange=0, bool fullDP=false)
..c:function:: StereoSGBM::StereoSGBM( int minDisparity, int numDisparities, int SADWindowSize, int P1=0, int P2=0, int disp12MaxDiff=0, int preFilterCap=0, int uniquenessRatio=0, int speckleWindowSize=0, int speckleRange=0, bool fullDP=false)
StereoSGBM constructors
@ -998,9 +998,7 @@ cv::StereoSGBM::StereoSGBM
:param numDisparities:This is maximum disparity minus minimum disparity. Always greater than 0. In the current implementation this parameter must be divisible by 16.
:param SADWindowSize:The matched block size. Must be an odd number ``>=1`` . Normally, it should be somewhere in ``3..11`` range
.
:param SADWindowSize:The matched block size. Must be an odd number ``>=1`` . Normally, it should be somewhere in ``3..11`` range.
:param P1, P2:Parameters that control disparity smoothness. The larger the values, the smoother the disparity. ``P1`` is the penalty on the disparity change by plus or minus 1 between neighbor pixels. ``P2`` is the penalty on the disparity change by more than 1 between neighbor pixels. The algorithm requires ``P2 > P1`` . See ``stereo_match.cpp`` sample where some reasonably good ``P1`` and ``P2`` values are shown (like ``8*number_of_image_channels*SADWindowSize*SADWindowSize`` and ``32*number_of_image_channels*SADWindowSize*SADWindowSize`` , respectively).
@ -1015,13 +1013,15 @@ cv::StereoSGBM::StereoSGBM
:param speckleRange:Maximum disparity variation within each connected component. If you do speckle filtering, set it to some positive value, multiple of 16. Normally, 16 or 32 is good enough.
:param fullDP:Set it to ``true`` to run full-scale 2-pass dynamic programming algorithm. It will consume O(W*H*numDisparities) bytes, which is large for 640x480 stereo and huge for HD-size pictures. By default this is ``false``
The first constructor initializes ``StereoSGBM`` with all the default parameters (so actually one will only have to set ``StereoSGBM::numberOfDisparities`` at minimum). The second constructor allows you to set each parameter to a custom value.
Transforms an image to compensate for lens distortion.
:param src:The input (distorted) image
:param dst:The output (corrected) image; will have the same size and the same type as ``src``
:param cameraMatrix:The input camera matrix :math:`A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}`
:param distCoeffs:The input vector of distortion coefficients :math:`(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]])` of 4, 5 or 8 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
:param newCameraMatrix:Camera matrix of the distorted image. By default it is the same as ``cameraMatrix`` , but you may additionally scale and shift the result by using some different matrix
@ -1259,9 +1261,9 @@ The camera matrix and the distortion parameters can be determined using
Computes the ideal point coordinates from the observed point coordinates.
@ -1270,6 +1272,7 @@ cv::undistortPoints
:param dst:The output ideal point coordinates, after undistortion and reverse perspective transformation .
:param cameraMatrix:The camera matrix :math:`\vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}`
:param distCoeffs:The input vector of distortion coefficients :math:`(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]])` of 4, 5 or 8 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
:param R:The rectification transformation in object space (3x3 matrix). ``R1`` or ``R2`` , computed by :func:`StereoRectify` can be passed here. If the matrix is empty, the identity transformation is used
@ -1291,7 +1294,6 @@ The function is similar to
x = X/W, y = Y/W
u' = x*fx' + cx'
v' = y*fy' + cy',
..
where undistort() is approximate iterative algorithm that estimates the normalized original point coordinates out of the normalized distorted point coordinates ("normalized" means that the coordinates do not depend on the camera matrix).
@ -76,11 +76,11 @@ They return ``false`` if the line segment is completely outside the rectangle an
..index:: ellipse
cv::ellipse
ellipse
-----------
..cfunction:: void ellipse(Mat\& img, Point center, Size axes, double angle, double startAngle, double endAngle, const Scalar\& color, int thickness=1, int lineType=8, int shift=0)
..c:function:: void ellipse(Mat& img, Point center, Size axes, double angle, double startAngle, double endAngle, const Scalar& color, int thickness=1, int lineType=8, int shift=0)
..cfunction:: void ellipse(Mat\& img, const RotatedRect\& box, const Scalar\& color, int thickness=1, int lineType=8)
..c:function:: void ellipse(Mat& img, const RotatedRect& box, const Scalar& color, int thickness=1, int lineType=8)
Draws a simple or thick elliptic arc or an fills ellipse sector.
@ -120,9 +120,9 @@ Parameters of Elliptic Arc
..index:: ellipse2Poly
cv::ellipse2Poly
ellipse2Poly
----------------
..cfunction:: void ellipse2Poly( Point center, Size axes, int angle, int startAngle, int endAngle, int delta, vector<Point>\& pts )
..c:function:: void ellipse2Poly( Point center, Size axes, int angle, int startAngle, int endAngle, int delta, vector<Point>& pts )
Approximates an elliptic arc with a polyline
@ -141,9 +141,9 @@ The function ``ellipse2Poly`` computes the vertices of a polyline that approxima
..index:: fillConvexPoly
cv::fillConvexPoly
fillConvexPoly
------------------
..cfunction:: void fillConvexPoly(Mat\& img, const Point* pts, int npts, const Scalar\& color, int lineType=8, int shift=0)
..c:function:: void fillConvexPoly(Mat& img, const Point* pts, int npts, const Scalar& color, int lineType=8, int shift=0)
Fills a convex polygon.
@ -166,9 +166,9 @@ line) twice at the most (though, its top-most and/or the bottom edge could be ho
..index:: fillPoly
cv::fillPoly
fillPoly
------------
..cfunction:: void fillPoly(Mat\& img, const Point** pts, const int* npts, int ncontours, const Scalar\& color, int lineType=8, int shift=0, Point offset=Point() )
..c:function:: void fillPoly(Mat& img, const Point** pts, const int* npts, int ncontours, const Scalar& color, int lineType=8, int shift=0, Point offset=Point() )
Fills the area bounded by one or more polygons
@ -192,9 +192,9 @@ areas with holes, contours with self-intersections (some of thier parts), and so
..index:: getTextSize
cv::getTextSize
getTextSize
---------------
..cfunction:: Size getTextSize(const string\& text, int fontFace, double fontScale, int thickness, int* baseLine)
..c:function:: Size getTextSize(const string& text, int fontFace, double fontScale, int thickness, int* baseLine)
Calculates the width and height of a text string.
@ -234,13 +234,12 @@ That is, the following code will render some text, the tight box surrounding it
// then put the text itself
putText(img, text, textOrg, fontFace, fontScale,
Scalar::all(255), thickness, 8);
..
..index:: line
cv::line
line
--------
..cfunction:: void line(Mat\& img, Point pt1, Point pt2, const Scalar\& color, int thickness=1, int lineType=8, int shift=0)
..c:function:: void line(Mat& img, Point pt1, Point pt2, const Scalar& color, int thickness=1, int lineType=8, int shift=0)
Draws a line segment connecting two points
@ -277,7 +276,7 @@ the line color, the user may use the macro ``CV_RGB(r, g, b)`` .
LineIterator
------------
..ctype:: LineIterator
..c:type:: LineIterator
Class for iterating pixels on a raster line ::
@ -304,7 +303,6 @@ Class for iterating pixels on a raster line ::
int minusDelta, plusDelta;
int minusStep, plusStep;
};
..
The class ``LineIterator`` is used to get each pixel of a raster line. It can be treated as versatile implementation of the Bresenham algorithm, where you can stop at each pixel and do some extra processing, for example, grab pixel values along the line, or draw a line with some effect (e.g. with XOR operation).
@ -317,13 +315,12 @@ The number of pixels along the line is store in ``LineIterator::count`` . ::
for(int i = 0; i < it.count; i++, ++it)
buf[i] = *(const Vec3b)*it;
..
..index:: rectangle
cv::rectangle
rectangle
-------------
..cfunction:: void rectangle(Mat\& img, Point pt1, Point pt2, const Scalar\& color, int thickness=1, int lineType=8, int shift=0)
..c:function:: void rectangle(Mat& img, Point pt1, Point pt2, const Scalar& color, int thickness=1, int lineType=8, int shift=0)
Draws a simple, thick, or filled up-right rectangle.
@ -345,9 +342,9 @@ The function ``rectangle`` draws a rectangle outline or a filled rectangle, whic
..index:: polylines
cv::polylines
polylines
-------------
..cfunction:: void polylines(Mat\& img, const Point** pts, const int* npts, int ncontours, bool isClosed, const Scalar\& color, int thickness=1, int lineType=8, int shift=0 )
..c:function:: void polylines(Mat& img, const Point** pts, const int* npts, int ncontours, bool isClosed, const Scalar& color, int thickness=1, int lineType=8, int shift=0 )
Draws several polygonal curves
@ -373,9 +370,9 @@ The function ``polylines`` draws one or more polygonal curves.
..index:: putText
cv::putText
putText
-----------
..cfunction:: void putText( Mat\& img, const string\& text, Point org, int fontFace, double fontScale, Scalar color, int thickness=1, int lineType=8, bool bottomLeftOrigin=false )
..c:function:: void putText( Mat& img, const string& text, Point org, int fontFace, double fontScale, Scalar color, int thickness=1, int lineType=8, bool bottomLeftOrigin=false )
Find the best match for each descriptor from a query set with train descriptors.
Supposed that the query descriptors are of keypoints detected on the same query image.
@ -172,7 +172,7 @@ supposed that they are of keypoints detected on the same train image. In second
of the method train descriptors collection that was set using addmethod is used.
Optional mask (or masks) can be set to describe which descriptors can be matched. queryDescriptors[i]can be matched with trainDescriptors[j]only if mask.at<uchar>(i,j)is non-zero.
..cfunction:: DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector( const Ptr<AdjusterAdapter>\& adjaster, int min_features, int max_features, int max_iters )
..c:function:: DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector( const Ptr<AdjusterAdapter>\& adjaster, int min_features, int max_features, int max_iters )
..cfunction:: void train(std::vector<BaseKeypoint> const\& base_set, cv::RNG \&rng, PatchGenerator \&make_patch, int depth, int views, size_t reduced_num_dim, int num_quant_bits)
..c:function:: void train(std::vector<BaseKeypoint> const& base_set, RNG&rng, PatchGenerator&make_patch, int depth, int views, size_t reduced_num_dim, int num_quant_bits)
Trains a randomized tree using input set of keypoints
..cfunction:: void train(std::vector<BaseKeypoint> const\& base_set, cv::RNG \&rng, PatchGenerator \&make_patch, int depth, int views, size_t reduced_num_dim, int num_quant_bits)
..c:function:: void train(std::vector<BaseKeypoint> const& base_set, RNG&rng, PatchGenerator&make_patch, int depth, int views, size_t reduced_num_dim, int num_quant_bits)
{Vector of ``BaseKeypoint``type. Contains keypoints from the image are used for training}
{Vector of ``BaseKeypoint`` type. Contains keypoints from the image are used for training}
{Random numbers generator is used for training}
{Patch generator is used for training}
{Maximum tree depth}
@ -319,13 +312,13 @@ cv::RandomizedTree::train
..index:: RandomizedTree::read
cv::RandomizedTree::read
RandomizedTree::read
------------------------
..cfunction:: read(const char* file_name, int num_quant_bits)
..c:function:: read(const char* file_name, int num_quant_bits)
Reads pre-saved randomized tree from file or stream
..cfunction:: read(std::istream \&is, int num_quant_bits)
..c:function:: read(std::istream \&is, int num_quant_bits)
:param file_name:Filename of file contains randomized tree data
The function is simular to getSignaturebut uses the threshold for removing all signature elements less than the threshold. So that the signature is compressed
{Image patch to calculate signature for}
{Output signature (array dimension is ``reduced_num_dim)``}
{Output signature (array dimension is ``reduced_num_dim)``}
{The threshold that is used for compressing the signature}
..index:: RTreeClassifier::countNonZeroElements
cv::RTreeClassifier::countNonZeroElements
RTreeClassifier::countNonZeroElements
-----------------------------------------
..cfunction:: static int countNonZeroElements(float *vec, int n, double tol=1e-10)
..c:function:: static int countNonZeroElements(float *vec, int n, double tol=1e-10)
The function returns the number of non-zero elements in the input array.
@ -9,7 +9,7 @@ Camera Calibration and 3d Reconstruction
gpu::StereoBM_GPU
-----------------
..ctype:: gpu::StereoBM_GPU
..c:type:: gpu::StereoBM_GPU
The class for computing stereo correspondence using block matching algorithm. ::
@ -39,7 +39,7 @@ The class for computing stereo correspondence using block matching algorithm. ::
...
};
..
This class computes the disparity map using block matching algorithm. The class also performs pre- and post- filtering steps: sobel prefiltering (if PREFILTER_XSOBEL flag is set) and low textureness filtering (if averageTexThreshols
:math:`>` 0). If ``avergeTexThreshold = 0`` low textureness filtering is disabled, otherwise disparity is set to 0 in each point ``(x, y)`` where for left image
@ -51,9 +51,9 @@ This class computes the disparity map using block matching algorithm. The class
cv::gpu::StereoBM_GPU::StereoBM_GPU
-----------------------------------_
..cfunction:: StereoBM_GPU::StereoBM_GPU()
..c:function:: StereoBM_GPU::StereoBM_GPU()
..cfunction:: StereoBM_GPU::StereoBM_GPU(int preset, int ndisparities = DEFAULT_NDISP, int winSize = DEFAULT_WINSZ)
..c:function:: StereoBM_GPU::StereoBM_GPU(int preset, int ndisparities = DEFAULT_NDISP, int winSize = DEFAULT_WINSZ)
..cfunction:: StereoBeliefPropagation::StereoBeliefPropagation( int ndisp = DEFAULT_NDISP, int iters = DEFAULT_ITERS, int levels = DEFAULT_LEVELS, int msg_type = CV_32F)
..c:function:: StereoBeliefPropagation::StereoBeliefPropagation( int ndisp = DEFAULT_NDISP, int iters = DEFAULT_ITERS, int levels = DEFAULT_LEVELS, int msg_type = CV_32F)
..cfunction:: StereoBeliefPropagation::StereoBeliefPropagation( int ndisp, int iters, int levels, float max_data_term, float data_weight, float max_disc_term, float disc_single_jump, int msg_type = CV_32F)
..c:function:: StereoBeliefPropagation::StereoBeliefPropagation( int ndisp, int iters, int levels, float max_data_term, float data_weight, float max_disc_term, float disc_single_jump, int msg_type = CV_32F)
StereoBeliefPropagation constructors.
@ -216,7 +216,7 @@ By default ``StereoBeliefPropagation`` uses floating-point arithmetics and ``CV_
* **data** The user specified data cost. It must have ``msg_type`` type and :math:`\texttt{imgRows} \cdot \texttt{ndisp} \times \texttt{imgCols}` size.
..cfunction:: StereoConstantSpaceBP::StereoConstantSpaceBP(int ndisp = DEFAULT_NDISP, int iters = DEFAULT_ITERS, int levels = DEFAULT_LEVELS, int nr_plane = DEFAULT_NR_PLANE, int msg_type = CV_32F)
..c:function:: StereoConstantSpaceBP::StereoConstantSpaceBP(int ndisp = DEFAULT_NDISP, int iters = DEFAULT_ITERS, int levels = DEFAULT_LEVELS, int nr_plane = DEFAULT_NR_PLANE, int msg_type = CV_32F)
..cfunction:: StereoConstantSpaceBP::StereoConstantSpaceBP(int ndisp, int iters, int levels, int nr_plane, float max_data_term, float data_weight, float max_disc_term, float disc_single_jump, int min_disp_th = 0, int msg_type = CV_32F)
..c:function:: StereoConstantSpaceBP::StereoConstantSpaceBP(int ndisp, int iters, int levels, int nr_plane, float max_data_term, float data_weight, float max_disc_term, float disc_single_jump, int min_disp_th = 0, int msg_type = CV_32F)
StereoConstantSpaceBP constructors.
@ -364,7 +364,7 @@ By default ``StereoConstantSpaceBP`` uses floating-point arithmetics and ``CV_32
..cfunction:: DisparityBilateralFilter::DisparityBilateralFilter( int ndisp = DEFAULT_NDISP, int radius = DEFAULT_RADIUS, int iters = DEFAULT_ITERS)
..c:function:: DisparityBilateralFilter::DisparityBilateralFilter( int ndisp = DEFAULT_NDISP, int radius = DEFAULT_RADIUS, int iters = DEFAULT_ITERS)
..cfunction:: DisparityBilateralFilter::DisparityBilateralFilter( int ndisp, int radius, int iters, float edge_threshold, float max_disc_threshold, float sigma_range)
..c:function:: DisparityBilateralFilter::DisparityBilateralFilter( int ndisp, int radius, int iters, float edge_threshold, float max_disc_threshold, float sigma_range)
This is a simple lightweight class that encapsulate pitched memory on GPU. It is intended to pass to nvcc-compiled code, i.e. CUDA kernels. So it is used internally by OpenCV and by users writes own device code. Its members can be called both from host and from device code. ::
@ -35,7 +35,7 @@ This is a simple lightweight class that encapsulate pitched memory on GPU. It is
__CV_GPU_HOST_DEVICE__ T* ptr(int y = 0);
__CV_GPU_HOST_DEVICE__ const T* ptr(int y = 0) const;
};
..
..index:: gpu::PtrStep_
@ -43,7 +43,7 @@ This is a simple lightweight class that encapsulate pitched memory on GPU. It is
gpu::PtrStep_
-------------
..ctype:: gpu::PtrStep_
..c:type:: gpu::PtrStep_
This is structure is similar to DevMem2D_but contains only pointer and row step. Width and height fields are excluded due to performance reasons. The structure is for internal use or for users who write own device code. ::
@ -62,7 +62,7 @@ This is structure is similar to DevMem2D_but contains only pointer and row step.
__CV_GPU_HOST_DEVICE__ T* ptr(int y = 0);
__CV_GPU_HOST_DEVICE__ const T* ptr(int y = 0) const;
};
..
..index:: gpu::PtrElemStrp_
@ -70,7 +70,7 @@ This is structure is similar to DevMem2D_but contains only pointer and row step.
gpu::PtrElemStrp_
-----------------
..ctype:: gpu::PtrElemStrp_
..c:type:: gpu::PtrElemStrp_
This is structure is similar to DevMem2D_but contains only pointer and row step in elements. Width and height fields are excluded due to performance reasons. This class is can only be constructed if sizeof(T) is a multiple of 256. The structure is for internal use or for users who write own device code. ::
@ -80,7 +80,7 @@ This is structure is similar to DevMem2D_but contains only pointer and row step
__CV_GPU_HOST_DEVICE__ T* ptr(int y = 0);
__CV_GPU_HOST_DEVICE__ const T* ptr(int y = 0) const;
};
..
..index:: gpu::GpuMat
@ -88,7 +88,7 @@ This is structure is similar to DevMem2D_but contains only pointer and row step
gpu::GpuMat
-----------
..ctype:: gpu::GpuMat
..c:type:: gpu::GpuMat
The base storage class for GPU memory with reference counting. Its interface is almost
:func:`Mat` interface with some limitations, so using it won't be a problem. The limitations are no arbitrary dimensions support (only 2D), no functions that returns references to its data (because references on GPU are not valid for CPU), no expression templates technique support. Because of last limitation please take care with overloaded matrix operators - they cause memory allocations. The GpuMat class is convertible to
@ -129,7 +129,7 @@ In contrast with
//! download async
void download(CudaMem& m, Stream& stream) const;
};
..
**Please note:**
Is it a bad practice to leave static or global GpuMat variables allocated, i.e. to rely on its destructor. That is because destruction order of such variables and CUDA context is undefined and GPU memory release function returns error if CUDA context has been destroyed before.
@ -142,7 +142,7 @@ See also:
gpu::CudaMem
------------
..ctype:: gpu::CudaMem
..c:type:: gpu::CudaMem
This is a class with reference counting that wraps special memory type allocation functions from CUDA. Its interface is also
:func:`Mat` -like but with additional memory type parameter:
@ -183,16 +183,16 @@ Please note that allocation size of such memory types is usually limited. For mo
int alloc_type;
};
..
..index:: gpu::CudaMem::createMatHeader
cv::gpu::CudaMem::createMatHeader
---------------------------------
:func:`Mat`
..cfunction:: Mat CudaMem::createMatHeader() const
..c:function:: Mat CudaMem::createMatHeader() const
..cfunction:: CudaMem::operator Mat() const
..c:function:: CudaMem::operator Mat() const
Creates header without reference counting to CudaMem data.
Maps CPU memory to GPU address space and creates header without reference counting for it. This can be done only if memory was allocated with ALLOCZEROCOPYflag and if it is supported by hardware (laptops often share video and CPU memory, so address spaces can be mapped, and that eliminates extra copy).
This class encapsulated queue of the asynchronous calls. Some functions have overloads with additional
:func:`gpu::Stream` parameter. The overloads do initialization work (allocate output buffers, upload constants, etc.), start GPU kernel and return before results are ready. A check if all operation are complete can be performed via
@ -266,13 +266,13 @@ This class encapsulated queue of the asynchronous calls. Some functions have ove
void enqueueConvert(const GpuMat& src, GpuMat& dst, int type,
double a = 1, double b = 0);
};
..
..index:: gpu::Stream::queryIfComplete
cv::gpu::Stream::queryIfComplete
--------------------------------
..cfunction:: bool Stream::queryIfComplete()
..c:function:: bool Stream::queryIfComplete()
Returns true if the current stream queue is finished, otherwise false.
This class provides possibility to get ``cudaStream_t`` from
:func:`gpu::Stream` . This class is declared in ``stream_accessor.hpp`` because that is only public header that depend on Cuda Runtime API. Including it will bring the dependency to your code. ::
@ -299,13 +299,13 @@ This class provides possibility to get ``cudaStream_t`` from
..cfunction:: void createContinuous(int rows, int cols, int type, GpuMat\& m)
..c:function:: void createContinuous(int rows, int cols, int type, GpuMat\& m)
Creates continuous matrix in GPU memory.
@ -319,11 +319,11 @@ cv::gpu::createContinuous
Also the following wrappers are available:
..cfunction:: GpuMat createContinuous(int rows, int cols, int type)
..c:function:: GpuMat createContinuous(int rows, int cols, int type)
..cfunction:: void createContinuous(Size size, int type, GpuMat\& m)
..c:function:: void createContinuous(Size size, int type, GpuMat\& m)
..cfunction:: GpuMat createContinuous(Size size, int type)
..c:function:: GpuMat createContinuous(Size size, int type)
Matrix is called continuous if its elements are stored continuously, i.e. wuthout gaps in the end of each row.
@ -331,7 +331,7 @@ Matrix is called continuous if its elements are stored continuously, i.e. wuthou
cv::gpu::ensureSizeIsEnough
---------------------------
..cfunction:: void ensureSizeIsEnough(int rows, int cols, int type, GpuMat\& m)
..c:function:: void ensureSizeIsEnough(int rows, int cols, int type, GpuMat\& m)
Ensures that size of matrix is big enough and matrix has proper type. The function doesn't reallocate memory if the matrix has proper attributes already.
@ -345,5 +345,5 @@ cv::gpu::ensureSizeIsEnough
Also the following wrapper is available:
..cfunction:: void ensureSizeIsEnough(Size size, int type, GpuMat\& m)
..c:function:: void ensureSizeIsEnough(Size size, int type, GpuMat\& m)
Class for extracting Speeded Up Robust Features from an image. ::
@ -62,7 +62,7 @@ Class for extracting Speeded Up Robust Features from an image. ::
GpuMat maxPosBuffer;
GpuMat featuresBuffer;
};
..
The class ``SURF_GPU`` implements Speeded Up Robust Features descriptor. There is fast multi-scale Hessian keypoint detector that can be used to find the keypoints (which is the default option), but the descriptors can be also computed for the user-specified keypoints. Supports only 8 bit grayscale images.
@ -81,7 +81,7 @@ See also:
gpu::BruteForceMatcher_GPU
--------------------------
..ctype:: gpu::BruteForceMatcher_GPU
..c:type:: gpu::BruteForceMatcher_GPU
Brute-force descriptor matcher. For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. This descriptor matcher supports masking permissible matches between descriptor sets. ::
@ -166,7 +166,7 @@ Brute-force descriptor matcher. For each descriptor in the first set, this match
private:
std::vector<GpuMat> trainDescCollection;
};
..
The class ``BruteForceMatcher_GPU`` has the similar interface to class
. It has two groups of match methods: for matching descriptors of one image with other image or with image set. Also all functions have alternative: save results to GPU memory or to CPU memory.
Finds the k best matches for each descriptor from a query set with train descriptors. Found k (or less if not possible) matches are returned in distance increasing order.
Finds the k best matches for each descriptor from a query set with train descriptors. Found k (or less if not possible) matches are returned in distance increasing order. Results will be stored to GPU memory.
Downloads trainIdxand distancematrices obtained via to CPU vector with . If compactResultis true matchesvector will not contain matches for fully masked out query descriptors.
Finds the best matches for each query descriptor which have distance less than given threshold. Found matches are returned in distance increasing order.
Downloads trainIdx, nMatchesand distancematrices obtained via to CPU vector with . If compactResultis true matchesvector will not contain matches for fully masked out query descriptors.
The base class for linear or non-linear filters that processes rows of 2D arrays. Such filters are used for the "horizontal" filtering passes in separable filters. ::
@ -25,7 +25,7 @@ The base class for linear or non-linear filters that processes rows of 2D arrays
This class doesn't allocate memory for destination image. Usually this class is used inside
@ -37,7 +37,7 @@ This class doesn't allocate memory for destination image. Usually this class is
gpu::BaseColumnFilter_GPU
-------------------------
..ctype:: gpu::BaseColumnFilter_GPU
..c:type:: gpu::BaseColumnFilter_GPU
The base class for linear or non-linear filters that processes columns of 2D arrays. Such filters are used for the "vertical" filtering passes in separable filters. ::
@ -49,7 +49,7 @@ The base class for linear or non-linear filters that processes columns of 2D arr
The class can be used to apply an arbitrary filtering operation to an image. It contains all the necessary intermediate buffers. Pointers to the initialized ``FilterEngine_GPU`` instances are returned by various ``create*Filter_GPU`` functions, see below, and they are used inside high-level functions such as
:func:`gpu::filter2D`,:func:`gpu::erode`,:func:`gpu::Sobel` etc.
@ -124,7 +124,7 @@ By using ``FilterEngine_GPU`` instead of functions you can avoid unnecessary mem
}
// Release buffers only once
filter.release();
..
``FilterEngine_GPU`` can process a rectangular sub-region of an image. By default, if ``roi == Rect(0,0,-1,-1)``,``FilterEngine_GPU`` processes inner region of image ( ``Rect(anchor.x, anchor.y, src_size.width - ksize.width, src_size.height - ksize.height)`` ), because some filters doesn't check if indices are outside the image for better perfomace. See below which filters supports processing the whole image and which not and image type limitations.
**Please note:**
@ -138,7 +138,7 @@ See also:,,,,,,,,,,
cv::gpu::createFilter2D_GPU
---------------------------
..cfunction:: Ptr<FilterEngine_GPU> createFilter2D_GPU( const Ptr<BaseFilter_GPU>\& filter2D, int srcType, int dstType)
..c:function:: Ptr<FilterEngine_GPU> createFilter2D_GPU( const Ptr<BaseFilter_GPU>\& filter2D, int srcType, int dstType)
Creates non-separable filter engine with the specified filter.
@ -156,7 +156,7 @@ Usually this function is used inside high-level functions, like,.
cv::gpu::createSeparableFilter_GPU
----------------------------------
..cfunction:: Ptr<FilterEngine_GPU> createSeparableFilter_GPU( const Ptr<BaseRowFilter_GPU>\& rowFilter, const Ptr<BaseColumnFilter_GPU>\& columnFilter, int srcType, int bufType, int dstType)
..c:function:: Ptr<FilterEngine_GPU> createSeparableFilter_GPU( const Ptr<BaseRowFilter_GPU>\& rowFilter, const Ptr<BaseColumnFilter_GPU>\& columnFilter, int srcType, int bufType, int dstType)
Creates separable filter engine with the specified filters.
@ -178,7 +178,7 @@ Usually this function is used inside high-level functions, like
cv::gpu::getRowSumFilter_GPU
----------------------------
..cfunction:: Ptr<BaseRowFilter_GPU> getRowSumFilter_GPU(int srcType, int sumType, int ksize, int anchor = -1)
..c:function:: Ptr<BaseRowFilter_GPU> getRowSumFilter_GPU(int srcType, int sumType, int ksize, int anchor = -1)
Creates horizontal 1D box filter.
@ -199,7 +199,7 @@ This filter doesn't check out of border accesses, so only proper submatrix of bi
cv::gpu::getColumnSumFilter_GPU
-------------------------------
..cfunction:: Ptr<BaseColumnFilter_GPU> getColumnSumFilter_GPU(int sumType, int dstType, int ksize, int anchor = -1)
..c:function:: Ptr<BaseColumnFilter_GPU> getColumnSumFilter_GPU(int sumType, int dstType, int ksize, int anchor = -1)
Creates vertical 1D box filter.
@ -220,11 +220,11 @@ This filter doesn't check out of border accesses, so only proper submatrix of bi
..cfunction:: Ptr<BaseFilter_GPU> getLinearFilter_GPU(int srcType, int dstType, const Mat\& kernel, const Size\& ksize, Point anchor = Point(-1, -1))
..c:function:: Ptr<BaseFilter_GPU> getLinearFilter_GPU(int srcType, int dstType, const Mat\& kernel, const Size\& ksize, Point anchor = Point(-1, -1))
:param srcType:Input image type. Supports ``CV_8UC1`` and ``CV_8UC4`` .
@ -430,7 +430,7 @@ See also:
cv::gpu::filter2D
-----------------
..cfunction:: void filter2D(const GpuMat\& src, GpuMat\& dst, int ddepth, const Mat\& kernel, Point anchor=Point(-1,-1))
..c:function:: void filter2D(const GpuMat\& src, GpuMat\& dst, int ddepth, const Mat\& kernel, Point anchor=Point(-1,-1))
Applies non-separable 2D linear filter to image.
@ -454,7 +454,7 @@ See also:
cv::gpu::Laplacian
------------------
..cfunction:: void Laplacian(const GpuMat\& src, GpuMat\& dst, int ddepth, int ksize = 1, double scale = 1)
..c:function:: void Laplacian(const GpuMat\& src, GpuMat\& dst, int ddepth, int ksize = 1, double scale = 1)
Applies Laplacian operator to image.
@ -480,7 +480,7 @@ See also:
cv::gpu::getLinearRowFilter_GPU
-------------------------------
..cfunction:: Ptr<BaseRowFilter_GPU> getLinearRowFilter_GPU(int srcType, int bufType, const Mat\& rowKernel, int anchor = -1, int borderType = BORDER_CONSTANT)
..c:function:: Ptr<BaseRowFilter_GPU> getLinearRowFilter_GPU(int srcType, int bufType, const Mat\& rowKernel, int anchor = -1, int borderType = BORDER_CONSTANT)
Creates primitive row filter with the specified kernel.
@ -504,7 +504,7 @@ See also:,:func:`createSeparableLinearFilter` .
cv::gpu::getLinearColumnFilter_GPU
----------------------------------
..cfunction:: Ptr<BaseColumnFilter_GPU> getLinearColumnFilter_GPU(int bufType, int dstType, const Mat\& columnKernel, int anchor = -1, int borderType = BORDER_CONSTANT)
..c:function:: Ptr<BaseColumnFilter_GPU> getLinearColumnFilter_GPU(int bufType, int dstType, const Mat\& columnKernel, int anchor = -1, int borderType = BORDER_CONSTANT)
Creates the primitive column filter with the specified kernel.
@ -527,7 +527,7 @@ See also:,:func:`createSeparableLinearFilter` .
cv::gpu::createSeparableLinearFilter_GPU
----------------------------------------
..cfunction:: Ptr<FilterEngine_GPU> createSeparableLinearFilter_GPU(int srcType, int dstType, const Mat\& rowKernel, const Mat\& columnKernel, const Point\& anchor = Point(-1,-1), int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
..c:function:: Ptr<FilterEngine_GPU> createSeparableLinearFilter_GPU(int srcType, int dstType, const Mat\& rowKernel, const Mat\& columnKernel, const Point\& anchor = Point(-1,-1), int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
Creates the separable linear filter engine.
@ -548,7 +548,7 @@ See also:,,
cv::gpu::sepFilter2D
--------------------
..cfunction:: void sepFilter2D(const GpuMat\& src, GpuMat\& dst, int ddepth, const Mat\& kernelX, const Mat\& kernelY, Point anchor = Point(-1,-1), int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
..c:function:: void sepFilter2D(const GpuMat\& src, GpuMat\& dst, int ddepth, const Mat\& kernelX, const Mat\& kernelY, Point anchor = Point(-1,-1), int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
Applies separable 2D linear filter to the image.
@ -572,7 +572,7 @@ See also:,:func:`sepFilter2D` .
cv::gpu::createDerivFilter_GPU
------------------------------
..cfunction:: Ptr<FilterEngine_GPU> createDerivFilter_GPU(int srcType, int dstType, int dx, int dy, int ksize, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
..c:function:: Ptr<FilterEngine_GPU> createDerivFilter_GPU(int srcType, int dstType, int dx, int dy, int ksize, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
Creates filter engine for the generalized Sobel operator.
@ -594,7 +594,7 @@ See also:,:func:`createDerivFilter` .
cv::gpu::Sobel
--------------
..cfunction:: void Sobel(const GpuMat\& src, GpuMat\& dst, int ddepth, int dx, int dy, int ksize = 3, double scale = 1, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
..c:function:: void Sobel(const GpuMat\& src, GpuMat\& dst, int ddepth, int dx, int dy, int ksize = 3, double scale = 1, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
Applies generalized Sobel operator to the image.
@ -620,7 +620,7 @@ See also:,:func:`Sobel` .
cv::gpu::Scharr
---------------
..cfunction:: void Scharr(const GpuMat\& src, GpuMat\& dst, int ddepth, int dx, int dy, double scale = 1, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
..c:function:: void Scharr(const GpuMat\& src, GpuMat\& dst, int ddepth, int dx, int dy, double scale = 1, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
Calculates the first x- or y- image derivative using Scharr operator.
@ -645,7 +645,7 @@ See also:,:func:`Scharr` .
cv::gpu::createGaussianFilter_GPU
---------------------------------
..cfunction:: Ptr<FilterEngine_GPU> createGaussianFilter_GPU(int type, Size ksize, double sigmaX, double sigmaY = 0, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
..c:function:: Ptr<FilterEngine_GPU> createGaussianFilter_GPU(int type, Size ksize, double sigmaX, double sigmaY = 0, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
Creates Gaussian filter engine.
@ -665,7 +665,7 @@ See also:,:func:`createGaussianFilter` .
Performs mean-shift filtering for each point of the source image. It maps each point of the source image into another point, and as the result we have new color and new position of each point.
Performs a forward or inverse discrete Fourier transform (1D or 2D) of floating point matrix. Can handle real matrices (CV32FC1) and complex matrices in the interleaved format (CV32FC2).
@ -215,7 +230,7 @@ cv::gpu::dft
:param dft_size:Size of discrete Fourier transform.
:param flags:Optional flags:
:param flags:Optional flags:
* **DFT_ROWS** Transform each individual row of the source matrix.
@ -224,7 +239,7 @@ cv::gpu::dft
* **DFT_INVERSE** Inverse DFT must be perfromed for complex-complex case (real-complex and complex-real cases are respectively forward and inverse always).
* **DFT_REAL_OUTPUT** The source matrix is the result of real-complex transform, so the destination matrix must be real.
The source matrix should be continuous, otherwise reallocation and data copying will be performed. Function chooses the operation mode depending on the flags, size and channel count of the source matrix:
Computes a proximity map for a raster template and an image where the template is searched for.
@ -307,37 +325,24 @@ cv::gpu::matchTemplate
:param templ:Template image. Must have the same size and type as ``image`` .
:param result:Map containing comparison results ( ``CV_32FC1`` ). If ``image`` is :math:`W \times H` and``templ`` is :math:`w \times h` then ``result`` must be :math:`(W-w+1) \times (H-h+1)` .
:param result:Map containing comparison results ( ``CV_32FC1`` ). If ``image`` is :math:`W \times H` and
``templ`` is :math:`w \times h` then ``result`` must be :math:`(W-w+1) \times (H-h+1)` .
:param method:Specifies the way which the template must be compared with the image.
Following methods are supported for the ``CV_8U`` depth images for now:
*
CV_ TM_ SQDIFF
*
CV_ TM_ SQDIFF_ NORMED
*
CV_ TM_ CCORR
*
CV_ TM_ CCORR_ NORMED
*
CV_ TM_ CCOEFF
*
CV_ TM_ CCOEFF_ NORMED
* CV_TM_SQDIFF
* CV_TM_SQDIFF_NORMED
* CV_TM_CCORR
* CV_TM_CCORR_NORMED
* CV_TM_CCOEFF
* CV_TM_CCOEFF_NORMED
Following methods are supported for the ``CV_32F`` images for now:
:param dst:Destination image. It will have size ``dsize`` (when it is non-zero) or the size computed from ``src.size()`` and ``fx`` and ``fy`` . The type of ``dst`` will be the same as of ``src`` .
:param dsize:Destination image size. If it is zero, then it is computed as:
:param dsize:Destination image size. If it is zero, then it is computed as:
Returns number of CUDA-enabled devices installed. It is to be used before any other GPU functions calls. If OpenCV is compiled without GPU support this function returns 0.
Sets device and initializes it for the current thread. Call of this function can be omitted, but in this case a default device will be initialized on fist GPU usage.
@ -25,7 +25,7 @@ cv::gpu::setDevice
cv::gpu::getDevice
------------------
..cfunction:: int getDevice()
..c:function:: int getDevice()
Returns the current device index, which was set by {gpu::getDevice} or initialized by default.
@ -35,7 +35,7 @@ cv::gpu::getDevice
gpu::GpuFeature
---------------
..ctype:: gpu::GpuFeature
..c:type:: gpu::GpuFeature
GPU compute features. ::
@ -46,7 +46,7 @@ GPU compute features. ::
COMPUTE_20, COMPUTE_21,
ATOMICS, NATIVE_DOUBLE
};
..
..index:: gpu::DeviceInfo
@ -54,7 +54,7 @@ GPU compute features. ::
gpu::DeviceInfo
---------------
..ctype:: gpu::DeviceInfo
..c:type:: gpu::DeviceInfo
This class provides functionality for querying the specified GPU properties. ::
@ -77,15 +77,15 @@ This class provides functionality for querying the specified GPU properties. ::
applications and can be used within functionally rich UI frameworks (such as Qt, WinForms or Cocoa) or without any UI at all, sometimes there is a need to try some functionality quickly and visualize the results. This is what the HighGUI module has been designed for.
It provides easy interface to:
*
create and manipulate windows that can display images and "remember" their content (no need to handle repaint events from OS)
*
add trackbars to the windows, handle simple mouse events as well as keyboard commmands
*
read and write images to/from disk or memory.
*
read video from camera or file and write video to a file.
This figure explains the new functionalities implemented with Qt GUI. As we can see, the new GUI provides a statusbar, a toolbar, and a control panel. The control panel can have trackbars and buttonbars attached to it.
*
To attach a trackbar, the window_ name parameter must be NULL.
To attach a trackbar, the window name parameter must be NULL.
*
To attach a buttonbar, a button must be created.
@ -56,60 +56,59 @@ The following code is an example used to generate the figure. ::
cvReleaseCapture(&video);
return 0;
}
..
..index:: setWindowProperty
cv::setWindowProperty
setWindowProperty
---------------------
..cfunction:: void setWindowProperty(const string\& name, int prop_id, double prop_value)
..c:function:: void setWindowProperty(const string& name, int prop_id, double prop_value)
Change the parameters of the window dynamically.
:param name:Name of the window.
:param prop_id:Window's property to edit. The operation flags:
:param prop_id:Window's property to edit. The operation flags:
* **CV_WND_PROP_FULLSCREEN** Change if the window is fullscreen ( ``CV_WINDOW_NORMAL`` or ``CV_WINDOW_FULLSCREEN`` ).
* **CV_WND_PROP_AUTOSIZE** Change if the user can resize the window (texttt {CV\_WINDOW\_NORMAL} or ``CV_WINDOW_AUTOSIZE`` ).
* **CV_WND_PROP_ASPECTRATIO** Change if the image's aspect ratio is preserved (texttt {CV\_WINDOW\_FREERATIO} or ``CV_WINDOW_KEEPRATIO`` ).
:param prop_value:New value of the Window's property. The operation flags:
:param prop_value:New value of the Window's property. The operation flags:
* **CV_WINDOW_NORMAL** Change the window in normal size, or allows the user to resize the window.
* **CV_WINDOW_AUTOSIZE** The user cannot resize the window, the size is constrainted by the image displayed.
* **CV_WINDOW_FULLSCREEN** Change the window to fullscreen.
* **CV_WINDOW_FREERATIO** The image expends as much as it can (no ratio constraint)
* **CV_WINDOW_KEEPRATIO** The ration image is respected.
The function `` setWindowProperty`` allows to change the window's properties.
..index:: getWindowProperty
cv::getWindowProperty
getWindowProperty
---------------------
..cfunction:: void getWindowProperty(const char* name, int prop_id)
..c:function:: void getWindowProperty(const char* name, int prop_id)
Get the parameters of the window.
:param name:Name of the window.
:param prop_id:Window's property to retrive. The operation flags:
:param prop_id:Window's property to retrive. The operation flags:
* **CV_WND_PROP_FULLSCREEN** Change if the window is fullscreen ( ``CV_WINDOW_NORMAL`` or ``CV_WINDOW_FULLSCREEN`` ).
* **CV_WND_PROP_AUTOSIZE** Change if the user can resize the window (texttt {CV\_WINDOW\_NORMAL} or ``CV_WINDOW_AUTOSIZE`` ).
* **CV_WND_PROP_ASPECTRATIO** Change if the image's aspect ratio is preserved (texttt {CV\_WINDOW\_FREERATIO} or ``CV_WINDOW_KEEPRATIO`` ).
See
:ref:`setWindowProperty` to know the meaning of the returned values.
@ -118,41 +117,40 @@ The function `` getWindowProperty`` return window's properties.
..index:: fontQt
cv::fontQt
fontQt
----------
..cfunction:: 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)
Create the font to be used to draw text on an image.
:param nameFont:Name of the font. The name should match the name of a system font (such as ``Times''). If the font is not found, a default one will be used.
:param nameFont:Name of the font. The name should match the name of a system font (such as *Times*). If the font is not found, a default one will be used.
:param pointSize:Size of the font. If not specified, equal zero or negative, the point size of the font is set to a system-dependent default value. Generally, this is 12 points.
:param color:Color of the font in BGRA -- A = 255 is fully transparent. Use the macro CV _ RGB for simplicity.
:param weight:The operation flags:
:param weight:The operation flags:
* **CV_FONT_LIGHT** Weight of 25
* **CV_FONT_NORMAL** Weight of 50
* **CV_FONT_DEMIBOLD** Weight of 63
* **CV_FONT_BOLD** Weight of 75
* **CV_FONT_BLACK** Weight of 87
You can also specify a positive integer for more control.
You can also specify a positive integer for more control.
:param style:The operation flags:
:param style:The operation flags:
* **CV_STYLE_NORMAL** Font is normal
* **CV_STYLE_ITALIC** Font is in italic
* **CV_STYLE_OBLIQUE** Font is oblique
:param spacing:Spacing between characters. Can be negative or positive
The function ``fontQt`` creates a CvFont object. This CvFont is not compatible with putText.
@ -161,13 +159,12 @@ A basic usage of this function is: ::
CvFont font = fontQt(''Times'');
addText( img1, ``Hello World !'', Point(50,50), font);
Create the font to be used to draw text on an image
@ -190,9 +187,9 @@ using a specific font
..index:: displayOverlay
cv::displayOverlay
displayOverlay
------------------
..cfunction:: void displayOverlay(const string\& name, const string\& text, int delay)
..c:function:: void displayOverlay(const string& name, const string& text, int delay)
Display text on the window's image as an overlay for delay milliseconds. This is not editing the image's data. The text is display on the top of the image.
@ -208,9 +205,9 @@ The function ``displayOverlay`` aims at displaying useful information/tips on th
..index:: displayStatusBar
cv::displayStatusBar
displayStatusBar
--------------------
..cfunction:: void displayStatusBar(const string\& name, const string\& text, int delayms)
..c:function:: void displayStatusBar(const string& name, const string& text, int delayms)
Display text on the window's statusbar as for delay milliseconds.
@ -226,11 +223,10 @@ The function ``displayOverlay`` aims at displaying useful information/tips on th
@ -312,11 +305,10 @@ The function ``loadWindowParameters`` load size, location, flags, trackbars' va
..index:: createButton
cv::createButton
createButton
----------------
*_*
..cfunction:: createButton( const string\& button_name CV_DEFAULT(NULL),ButtonCallback on_change CV_DEFAULT(NULL), void* userdata CV_DEFAULT(NULL), int button_type CV_DEFAULT(CV_PUSH_BUTTON), int initial_button_state CV_DEFAULT(0)
..c:function:: createButton( const string& button_name CV_DEFAULT(NULL),ButtonCallback on_change CV_DEFAULT(NULL), void* userdata CV_DEFAULT(NULL), int button_type CV_DEFAULT(CV_PUSH_BUTTON), int initial_button_state CV_DEFAULT(0))
Create a callback function called to draw OpenGL on top the the image display by windowname.
@ -329,7 +321,7 @@ cv::createButton
:param userdata:pointer passed to the callback function. *(Optional)*
The ``button_type`` parameter can be :
*(Optional -- Will be a push button by default.)
*(Optional -- Will be a push button by default.)
* **CV_PUSH_BUTTON** The button will be a push button.
@ -337,8 +329,6 @@ The ``button_type`` parameter can be :
* **CV_RADIOBOX** The button will be a radiobox button. The radiobox on the same buttonbar (same line) are exclusive; one on can be select at the time.
*
* **initial_button_state** Default state of the button. Use for checkbox and radiobox, its value could be 0 or 1. *(Optional)*
The function ``createButton`` attach a button to the control panel. Each button is added to a buttonbar on the right of the last button.
@ -351,5 +341,7 @@ Here are various example of ``createButton`` function call: ::
:param mask:The optional region of interest. If the image is not empty (then it needs to have the type ``CV_8UC1`` and the same size as ``image`` ), it will specify the region in which the corners are detected
:param blockSize:Size of the averaging block for computing derivative covariation matrix over each pixel neighborhood, see :func:`cornerEigenValsAndVecs`
:param useHarrisDetector:Indicates, whether to use operator or :func:`cornerMinEigenVal`
:param k:Free parameter of Harris detector
The function finds the most prominent corners in the image or in the specified image region, as described
in
Shi94
:
The function finds the most prominent corners in the image or in the specified image region, as described in Shi94:
#.
the function first calculates the corner quality measure at every source image pixel using the
:func:`cornerMinEigenVal` or
:func:`cornerHarris`
#.
then it performs non-maxima suppression (the local maxima in
:math:`3\times 3` neighborhood
@ -226,23 +232,25 @@ Shi94
:math:`pt_j` if there is a stronger corner
:math:`pt_i` (
:math:`i < j` ) such that the distance between them is less than ``minDistance``
The function can be used to initialize a point-based tracker of an object.
Note that the if the function is called with different values ``A`` and ``B`` of the parameter ``qualityLevel`` , and ``A`` > {B}, the vector of returned corners with ``qualityLevel=A`` will be the prefix of the output vector with ``qualityLevel=B`` .
:param circles:The output vector of found circles. Each vector is encoded as 3-element floating-point vector :math:`(x, y, radius)`
:param method:Currently, the only implemented method is ``CV_HOUGH_GRADIENT`` , which is basically *21HT* , described in Yuen90 .
:param dp:The inverse ratio of the accumulator resolution to the image resolution. For example, if ``dp=1`` , the accumulator will have the same resolution as the input image, if ``dp=2`` - accumulator will have half as big width and height, etc
@ -289,7 +297,6 @@ The function finds circles in a grayscale image using some modification of Hough
imshow( "circles", img );
return 0;
}
..
Note that usually the function detects the circles' centers well, however it may fail to find the correct radii. You can assist the function by specifying the radius range ( ``minRadius`` and ``maxRadius`` ) if you know it, or you may ignore the returned radius, use only the center and find the correct radius using some additional procedure.
Finds lines in a binary image using standard Hough transform.
@ -316,14 +323,15 @@ cv::HoughLines
:param srn:For the multi-scale Hough transform it is the divisor for the distance resolution ``rho`` . The coarse accumulator distance resolution will be ``rho`` and the accurate accumulator resolution will be ``rho/srn`` . If both ``srn=0`` and ``stn=0`` then the classical Hough transform is used, otherwise both these parameters should be positive.
:param stn:For the multi-scale Hough transform it is the divisor for the distance resolution ``theta``
The function implements standard or standard multi-scale Hough transform algorithm for line detection. See
@ -18,7 +18,7 @@ OpenCV let the user to specify the extrapolation method; see the function :func
BaseColumnFilter
----------------
..ctype:: BaseColumnFilter
..c:type:: BaseColumnFilter
Base class for filters with single-column kernels ::
@ -43,7 +43,7 @@ Base class for filters with single-column kernels ::
int anchor; // position of the anchor point,
// normally not used during the processing
};
..
The class ``BaseColumnFilter`` is the base class for filtering data using single-column kernels. The filtering does not have to be a linear operation. In general, it could be written as following:
@ -64,7 +64,7 @@ See also:
BaseFilter
----------
..ctype:: BaseFilter
..c:type:: BaseFilter
Base class for 2D image filters ::
@ -88,7 +88,7 @@ Base class for 2D image filters ::
Size ksize;
Point anchor;
};
..
The class ``BaseFilter`` is the base class for filtering data using 2D kernels. The filtering does not have to be a linear operation. In general, it could be written as following:
@ -111,7 +111,7 @@ See also:
BaseRowFilter
-------------
..ctype:: BaseRowFilter
..c:type:: BaseRowFilter
Base class for filters with single-row kernels ::
@ -129,7 +129,7 @@ Base class for filters with single-row kernels ::
int width, int cn) = 0;
int ksize, anchor;
};
..
The class ``BaseRowFilter`` is the base class for filtering data using single-row kernels. The filtering does not have to be a linear operation. In general, it could be written as following:
@ -150,7 +150,7 @@ See also:
FilterEngine
------------
..ctype:: FilterEngine
..c:type:: FilterEngine
Generic image filtering class ::
@ -166,7 +166,7 @@ Generic image filtering class ::
// _rowBorderType and _columnBorderType determine how the image
// will be extrapolated beyond the image boundaries.
// _borderValue is only used when _rowBorderType and/or _columnBorderType
// == cv::BORDER_CONSTANT
// == BORDER_CONSTANT
FilterEngine(const Ptr<BaseFilter>& _filter2D,
const Ptr<BaseRowFilter>& _rowFilter,
const Ptr<BaseColumnFilter>& _columnFilter,
@ -217,7 +217,7 @@ Generic image filtering class ::
Ptr<BaseRowFilter> rowFilter;
Ptr<BaseColumnFilter> columnFilter;
};
..
The class ``FilterEngine`` can be used to apply an arbitrary filtering operation to an image.
It contains all the necessary intermediate buffers, it computes extrapolated values
@ -278,7 +278,7 @@ This class makes it easier (though, maybe not very easy yet) to combine filterin
}
}
}
..
If you do not need that much control of the filtering process, you can simply use the ``FilterEngine::apply`` method. Here is how the method is actually implemented: ::
@ -310,7 +310,7 @@ If you do not need that much control of the filtering process, you can simply us
dst.data + dstOfs.y*dst.step +
dstOfs.x*dst.elemSize(), (int)dst.step );
}
..
Unlike the earlier versions of OpenCV, now the filtering operations fully support the notion of image ROI, that is, pixels outside of the ROI but inside the image can be used in the filtering operations. For example, you can take a ROI of a single pixel and filter it - that will be a filter response at that particular pixel (however, it's possible to emulate the old behavior by passing ``isolated=false`` to ``FilterEngine::start`` or ``FilterEngine::apply`` ). You can pass the ROI explicitly to ``FilterEngine::apply`` , or construct a new matrix headers: ::
@ -334,7 +334,7 @@ Unlike the earlier versions of OpenCV, now the filtering operations fully suppor
:func:`BaseFilter` description, the specific filters can process data of any type, despite that ``Base*Filter::operator()`` only takes ``uchar`` pointers and no information about the actual types. To make it all work, the following rules are used:
@ -477,9 +477,9 @@ The function constructs a vector of images and builds the gaussian pyramid by re
..index:: copyMakeBorder
cv::copyMakeBorder
copyMakeBorder
------------------
..cfunction:: void copyMakeBorder( const Mat\& src, Mat\& dst, int top, int bottom, int left, int right, int borderType, const Scalar\& value=Scalar() )
..c:function:: void copyMakeBorder( const Mat\& src, Mat\& dst, int top, int bottom, int left, int right, int borderType, const Scalar\& value=Scalar() )
Forms a border around the image
@ -508,19 +508,19 @@ The function supports the mode when ``src`` is already in the middle of ``dst``
border, border, BORDER_REPLICATE);
// now do some custom filtering ...
...
..
See also:
:func:`borderInterpolate`
..index:: createBoxFilter
cv::createBoxFilter
createBoxFilter
-------------------
..cfunction:: Ptr<FilterEngine> createBoxFilter( int srcType, int dstType, Size ksize, Point anchor=Point(-1,-1), bool normalize=true, int borderType=BORDER_DEFAULT)
..c:function:: Ptr<FilterEngine> createBoxFilter( int srcType, int dstType, Size ksize, Point anchor=Point(-1,-1), bool normalize=true, int borderType=BORDER_DEFAULT)
..cfunction:: Ptr<BaseRowFilter> getRowSumFilter(int srcType, int sumType, int ksize, int anchor=-1)
..c:function:: Ptr<BaseRowFilter> getRowSumFilter(int srcType, int sumType, int ksize, int anchor=-1)
..cfunction:: Ptr<BaseColumnFilter> getColumnSumFilter(int sumType, int dstType, int ksize, int anchor=-1, double scale=1)
..c:function:: Ptr<BaseColumnFilter> getColumnSumFilter(int sumType, int dstType, int ksize, int anchor=-1, double scale=1)
Returns box filter engine
@ -549,9 +549,9 @@ See also:
..index:: createDerivFilter
cv::createDerivFilter
createDerivFilter
---------------------
..cfunction:: Ptr<FilterEngine> createDerivFilter( int srcType, int dstType, int dx, int dy, int ksize, int borderType=BORDER_DEFAULT )
..c:function:: Ptr<FilterEngine> createDerivFilter( int srcType, int dstType, int dx, int dy, int ksize, int borderType=BORDER_DEFAULT )
Returns engine for computing image derivatives
@ -576,9 +576,9 @@ See also:
..index:: createGaussianFilter
cv::createGaussianFilter
createGaussianFilter
------------------------
..cfunction:: Ptr<FilterEngine> createGaussianFilter( int type, Size ksize, double sigmaX, double sigmaY=0, int borderType=BORDER_DEFAULT)
..c:function:: Ptr<FilterEngine> createGaussianFilter( int type, Size ksize, double sigmaX, double sigmaY=0, int borderType=BORDER_DEFAULT)
Returns engine for smoothing images with a Gaussian filter
@ -599,11 +599,11 @@ See also:
..index:: createLinearFilter
cv::createLinearFilter
createLinearFilter
----------------------
..cfunction:: Ptr<FilterEngine> createLinearFilter(int srcType, int dstType, const Mat\& kernel, Point _anchor=Point(-1,-1), double delta=0, int rowBorderType=BORDER_DEFAULT, int columnBorderType=-1, const Scalar\& borderValue=Scalar())
..c:function:: Ptr<FilterEngine> createLinearFilter(int srcType, int dstType, const Mat\& kernel, Point _anchor=Point(-1,-1), double delta=0, int rowBorderType=BORDER_DEFAULT, int columnBorderType=-1, const Scalar\& borderValue=Scalar())
..cfunction:: Ptr<BaseFilter> getLinearFilter(int srcType, int dstType, const Mat\& kernel, Point anchor=Point(-1,-1), double delta=0, int bits=0)
..c:function:: Ptr<BaseFilter> getLinearFilter(int srcType, int dstType, const Mat\& kernel, Point anchor=Point(-1,-1), double delta=0, int bits=0)
..cfunction:: Ptr<FilterEngine> createMorphologyFilter(int op, int type, const Mat\& element, Point anchor=Point(-1,-1), int rowBorderType=BORDER_CONSTANT, int columnBorderType=-1, const Scalar\& borderValue=morphologyDefaultBorderValue())
..c:function:: Ptr<FilterEngine> createMorphologyFilter(int op, int type, const Mat\& element, Point anchor=Point(-1,-1), int rowBorderType=BORDER_CONSTANT, int columnBorderType=-1, const Scalar\& borderValue=morphologyDefaultBorderValue())
..cfunction:: Ptr<BaseFilter> getMorphologyFilter(int op, int type, const Mat\& element, Point anchor=Point(-1,-1))
..c:function:: Ptr<BaseFilter> getMorphologyFilter(int op, int type, const Mat\& element, Point anchor=Point(-1,-1))
..cfunction:: Ptr<BaseRowFilter> getMorphologyRowFilter(int op, int type, int esize, int anchor=-1)
..c:function:: Ptr<BaseRowFilter> getMorphologyRowFilter(int op, int type, int esize, int anchor=-1)
..cfunction:: Ptr<BaseColumnFilter> getMorphologyColumnFilter(int op, int type, int esize, int anchor=-1)
..c:function:: Ptr<BaseColumnFilter> getMorphologyColumnFilter(int op, int type, int esize, int anchor=-1)
..cfunction:: Ptr<FilterEngine> createSeparableLinearFilter(int srcType, int dstType, const Mat\& rowKernel, const Mat\& columnKernel, Point anchor=Point(-1,-1), double delta=0, int rowBorderType=BORDER_DEFAULT, int columnBorderType=-1, const Scalar\& borderValue=Scalar())
..c:function:: Ptr<FilterEngine> createSeparableLinearFilter(int srcType, int dstType, const Mat\& rowKernel, const Mat\& columnKernel, Point anchor=Point(-1,-1), double delta=0, int rowBorderType=BORDER_DEFAULT, int columnBorderType=-1, const Scalar\& borderValue=Scalar())
..cfunction:: Ptr<BaseColumnFilter> getLinearColumnFilter(int bufType, int dstType, const Mat\& columnKernel, int anchor, int symmetryType, double delta=0, int bits=0)
..c:function:: Ptr<BaseColumnFilter> getLinearColumnFilter(int bufType, int dstType, const Mat\& columnKernel, int anchor, int symmetryType, double delta=0, int bits=0)
..cfunction:: Ptr<BaseRowFilter> getLinearRowFilter(int srcType, int bufType, const Mat\& rowKernel, int anchor, int symmetryType)
..c:function:: Ptr<BaseRowFilter> getLinearRowFilter(int srcType, int bufType, const Mat\& rowKernel, int anchor, int symmetryType)
@ -1090,9 +1090,9 @@ The function performs the upsampling step of the Gaussian pyramid construction (
..index:: sepFilter2D
cv::sepFilter2D
sepFilter2D
---------------
..cfunction:: void sepFilter2D( const Mat\& src, Mat\& dst, int ddepth, const Mat\& rowKernel, const Mat\& columnKernel, Point anchor=Point(-1,-1), double delta=0, int borderType=BORDER_DEFAULT )
..c:function:: void sepFilter2D( const Mat\& src, Mat\& dst, int ddepth, const Mat\& rowKernel, const Mat\& columnKernel, Point anchor=Point(-1,-1), double delta=0, int borderType=BORDER_DEFAULT )
Applies separable linear filter to an image
@ -1117,9 +1117,9 @@ See also:
..index:: Sobel
cv::Sobel
Sobel
---------
..cfunction:: void Sobel( const Mat\& src, Mat\& dst, int ddepth, int xorder, int yorder, int ksize=3, double scale=1, double delta=0, int borderType=BORDER_DEFAULT )
..c:function:: void Sobel( const Mat\& src, Mat\& dst, int ddepth, int xorder, int yorder, int ksize=3, double scale=1, double delta=0, int borderType=BORDER_DEFAULT )
Calculates the first, second, third or mixed image derivatives using an extended Sobel operator
..cfunction:: 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 )
Converts image from one color space to another
@ -71,6 +72,7 @@ cv::cvtColor
:param code:The color space conversion code; see the discussion
:param dstCn:The number of channels in the destination image; if the parameter is 0, the number of the channels will be derived automatically from ``src`` and the ``code``
The function converts the input image from one color
space to another. In the case of transformation to-from RGB color space the ordering of the channels should be specified explicitly (RGB or BGR).
@ -91,7 +93,6 @@ but in the non-linear cases the input RGB image should be normalized to the prop
img *= 1./255;
cvtColor(img, img, CV_BGR2Luv);
..
The function can do the following transformations:
@ -178,8 +179,7 @@ The function can do the following transformations:
R, G and B are converted to floating-point format and scaled to fit 0 to 1 range
@ -376,8 +373,7 @@ The function can do the following transformations:
http://www.poynton.com/ColorFAQ.html
*
Bayer
:math:`\rightarrow` RGB ( ``CV_BayerBG2BGR, CV_BayerGB2BGR, CV_BayerRG2BGR, CV_BayerGR2BGR, CV_BayerBG2RGB, CV_BayerGB2RGB, CV_BayerRG2RGB, CV_BayerGR2RGB`` ) The Bayer pattern is widely used in CCD and CMOS cameras. It allows one to get color pictures from a single plane where R,G and B pixels (sensors of a particular component) are interleaved like this:
Bayer :math:`\rightarrow` RGB ( ``CV_BayerBG2BGR, CV_BayerGB2BGR, CV_BayerRG2BGR, CV_BayerGR2BGR, CV_BayerBG2RGB, CV_BayerGB2RGB, CV_BayerRG2RGB, CV_BayerGR2RGB`` ) The Bayer pattern is widely used in CCD and CMOS cameras. It allows one to get color pictures from a single plane where R,G and B pixels (sensors of a particular component) are interleaved like this:
..math::
@ -395,11 +391,11 @@ The function can do the following transformations:
..index:: distanceTransform
cv::distanceTransform
distanceTransform
---------------------
..cfunction:: void distanceTransform( const Mat\& src, Mat\& dst, int distanceType, int maskSize )
..c:function:: void distanceTransform( const Mat& src, Mat& dst, int distanceType, int maskSize )
..cfunction:: void distanceTransform( const Mat\& src, Mat\& dst, Mat\& labels, int distanceType, int maskSize )
..c:function:: void distanceTransform( const Mat& src, Mat& dst, Mat& labels, int distanceType, int maskSize )
Calculates the distance to the closest zero pixel for each pixel of the source image.
@ -438,8 +434,12 @@ gives more accurate results). For ``a``,``b`` and ``c`` OpenCV uses the values s
..table::
============== =================== ====================== ``CV_DIST_C``:math:`(3\times 3)` a = 1, b = 1 \
Does marker-based image segmentation using watershed algrorithm
:param image:The input 8-bit 3-channel image.
:param markers:The input/output 32-bit single-channel image (map) of markers. It should have the same size as ``image``
The function implements one of the variants
of watershed, non-parametric marker-based segmentation algorithm,
described in
@ -722,9 +727,9 @@ See also:
:func:`findContours`
..index:: grabCut
cv::grabCut
grabCut
-----------
..cfunction:: 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
@ -740,15 +745,16 @@ cv::grabCut
* **GC_PR_BGD** Likely a foreground pixel
:param rect:The ROI containing the segmented object. The pixels outside of the ROI are marked as "certainly a background". The parameter is only used when ``mode==GC_INIT_WITH_RECT``
:param bgdModel, fgdModel:Temporary arrays used for segmentation. Do not modify them while you are processing the same image
:param iterCount:The number of iterations the algorithm should do before returning the result. Note that the result can be refined with further calls with the ``mode==GC_INIT_WITH_MASK`` or ``mode==GC_EVAL``
:param mode:The operation mode
* **GC_INIT_WITH_RECT** The function initializes the state and the mask using the provided rectangle. After that it runs ``iterCount`` iterations of the algorithm
* **GC_INIT_WITH_MASK** The function initializes the state using the provided mask. Note that ``GC_INIT_WITH_RECT`` and ``GC_INIT_WITH_MASK`` can be combined, then all the pixels outside of the ROI are automatically initialized with ``GC_BGD``
.
* **GC_INIT_WITH_MASK** The function initializes the state using the provided mask. Note that ``GC_INIT_WITH_RECT`` and ``GC_INIT_WITH_MASK`` can be combined, then all the pixels outside of the ROI are automatically initialized with ``GC_BGD``.
* **GC_EVAL** The value means that algorithm should just resume.
..cfunction:: void findContours( const Mat\& image, vector<vector<Point> >\& contours, vector<Vec4i>\& hierarchy, int mode, int method, Point offset=Point())
..c:function:: void findContours( const Mat& image, vector<vector<Point> >& contours, vector<Vec4i>& hierarchy, int mode, int method, Point offset=Point())
..cfunction:: void findContours( const Mat\& image, vector<vector<Point> >\& contours, int mode, int method, Point offset=Point())
..c:function:: void findContours( const Mat& image, vector<vector<Point> >& contours, int mode, int method, Point offset=Point())
Finds the contours in a binary image.
@ -148,9 +147,9 @@ the source ``image`` is modified by this function.
..index:: drawContours
cv::drawContours
drawContours
----------------
..cfunction:: void drawContours( Mat\& image, const vector<vector<Point> >\& contours, int contourIdx, const Scalar\& color, int thickness=1, int lineType=8, const vector<Vec4i>\& hierarchy=vector<Vec4i>(), int maxLevel=INT_MAX, Point offset=Point() )
..c:function:: void drawContours( Mat& image, const vector<vector<Point> >& contours, int contourIdx, const Scalar& color, int thickness=1, int lineType=8, const vector<Vec4i>& hierarchy=vector<Vec4i>(), int maxLevel=INT_MAX, Point offset=Point() )
Draws contours' outlines or filled contours.
@ -174,6 +173,7 @@ cv::drawContours
the specified contour is drawn. If 1, the function draws the contour(s) and all the nested contours. If 2, the function draws the contours, all the nested contours and all the nested into nested contours etc. This parameter is only taken into account when there is ``hierarchy`` available.
:param offset:The optional contour shift parameter. Shift all the drawn contours by the specified :math:`\texttt{offset}=(dx,dy)`
The function draws contour outlines in the image if
:math:`\texttt{thickness} \ge 0` or fills the area bounded by the contours if
:math:`\texttt{thickness}<0` . Here is the example on how to retrieve connected components from the binary image and label them ::
@ -216,15 +216,14 @@ The function draws contour outlines in the image if
:param points:The input 2D point set, represented by ``CV_32SC2`` or ``CV_32FC2`` matrix, or by ``vector<Point>`` , ``vector<Point2f>`` , ``vector<Point3i>`` or ``vector<Point3f>`` converted to the matrix by ``Mat(const vector<T>&)`` constructor
:param line:The output line parameters. In the case of a 2d fitting,
it is a vector of 4 floats ``(vx, vy,
x0, y0)`` where ``(vx, vy)`` is a normalized vector collinear to the
it is a vector of 4 floats ``(vx, vy, x0, y0)`` where ``(vx, vy)`` is a normalized vector collinear to the
line and ``(x0, y0)`` is some point on the line. in the case of a
3D fitting it is vector of 6 floats ``(vx, vy, vz, x0, y0, z0)`` where ``(vx, vy, vz)`` is a normalized vector collinear to the line
and ``(x0, y0, z0)`` is some point on the line
3D fitting it is vector of 6 floats ``(vx, vy, vz, x0, y0, z0)`` where ``(vx, vy, vz)`` is a normalized vector collinear to the line and ``(x0, y0, z0)`` is some point on the line
:param distType:The distance used by the M-estimator (see the discussion)
Finds the minimum area rotated rectangle enclosing a 2D point set.
@ -489,9 +485,9 @@ cv::minAreaRect
The function calculates and returns the minimum area bounding rectangle (possibly rotated) for the specified point set. See the OpenCV sample ``minarea.c``
The structure has default constructor that initializes parameters for ``RPROP`` algorithm. There is also more advanced constructor to customize the parameters and/or choose backpropagation algorithm. Finally, the individual parameters can be adjusted after the structure is created.
@ -130,7 +131,7 @@ The structure has default constructor that initializes parameters for ``RPROP``
CvANN_MLP
---------
..ctype:: CvANN_MLP
..c:type:: CvANN_MLP
MLP model. ::
@ -210,6 +211,7 @@ MLP model. ::
CvANN_MLP_TrainParams params;
CvRNG rng;
};
..
Unlike many other models in ML that are constructed and trained at once, in the MLP model these steps are separated. First, a network with the specified topology is created using the non-default constructor or the method ``create`` . All the weights are set to zeros. Then the network is trained using the set of input and output vectors. The training procedure can be repeated more than once, i.e. the weights can be adjusted based on the new training data.
@ -220,7 +222,7 @@ Unlike many other models in ML that are constructed and trained at once, in the