mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 08:13:04 +04:00
continued merging of C, Python and C++ reference manuals
This commit is contained in:
@@ -159,6 +159,10 @@ Refines the corner locations.
|
||||
|
||||
.. ocv:pyfunction:: cv2.cornerSubPix(image, corners, winSize, zeroZone, criteria) -> None
|
||||
|
||||
.. ocv:cfunction:: void cvFindCornerSubPix( const CvArr* image, CvPoint2D32f* corners, int count, CvSize winSize, CvSize zeroZone, CvTermCriteria criteria )
|
||||
|
||||
.. ocv:pyoldfunction:: cv.FindCornerSubPix(image, corners, winSize, zeroZone, criteria)-> corners
|
||||
|
||||
:param image: Input image.
|
||||
|
||||
:param corners: Initial coordinates of the input corners and refined coordinates provided for output.
|
||||
@@ -346,6 +350,10 @@ Finds lines in a binary image using the standard Hough transform.
|
||||
|
||||
.. ocv:pyfunction:: cv2.HoughLines(image, rho, theta, threshold[, lines[, srn[, stn]]]) -> lines
|
||||
|
||||
.. ocv:cfunction:: CvSeq* cvHoughLines2( CvArr* image, void* storage, int method, double rho, double theta, int threshold, double param1=0, double param2=0 )
|
||||
|
||||
.. ocv:pyoldfunction:: cv.HoughLines2(image, storage, method, rho, theta, threshold, param1=0, param2=0)-> lines
|
||||
|
||||
:param image: 8-bit, single-channel binary source image. The image may be modified by the function.
|
||||
|
||||
:param lines: Output vector of lines. Each line is represented by a two-element vector :math:`(\rho, \theta)` . :math:`\rho` is the distance from the coordinate origin :math:`(0,0)` (top-left corner of the image). :math:`\theta` is the line rotation angle in radians ( :math:`0 \sim \textrm{vertical line}, \pi/2 \sim \textrm{horizontal line}` ).
|
||||
@@ -358,13 +366,36 @@ Finds lines in a binary image using the standard Hough transform.
|
||||
|
||||
:param srn: For the multi-scale Hough transform, it is a divisor for the distance resolution ``rho`` . The coarse accumulator distance resolution is ``rho`` and the accurate accumulator resolution is ``rho/srn`` . If both ``srn=0`` and ``stn=0`` , the classical Hough transform is used. Otherwise, both these parameters should be positive.
|
||||
|
||||
:param stn: For the multi-scale Hough transform, it is a divisor for the distance resolution ``theta`` .
|
||||
:param stn: For the multi-scale Hough transform, it is a divisor for the distance resolution ``theta``.
|
||||
|
||||
:param method: The Hough transform variant, one of the following:
|
||||
|
||||
* **CV_HOUGH_STANDARD** classical or standard Hough transform. Every line is represented by two floating-point numbers :math:`(\rho, \theta)` , where :math:`\rho` is a distance between (0,0) point and the line, and :math:`\theta` is the angle between x-axis and the normal to the line. Thus, the matrix must be (the created sequence will be) of ``CV_32FC2`` type
|
||||
|
||||
|
||||
* **CV_HOUGH_PROBABILISTIC** probabilistic Hough transform (more efficient in case if picture contains a few long linear segments). It returns line segments rather than the whole line. Each segment is represented by starting and ending points, and the matrix must be (the created sequence will be) of ``CV_32SC4`` type
|
||||
|
||||
* **CV_HOUGH_MULTI_SCALE** multi-scale variant of the classical Hough transform. The lines are encoded the same way as ``CV_HOUGH_STANDARD``
|
||||
|
||||
The function implements the standard or standard multi-scale Hough transform algorithm for line detection. See
|
||||
:ocv:func:`HoughLinesP` for the code example. Also see http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm for a good explanation of Hough transform.
|
||||
|
||||
:param param1: The first method-dependent parameter:
|
||||
|
||||
* For the classical Hough transform it is not used (0).
|
||||
|
||||
* For the probabilistic Hough transform it is the minimum line length.
|
||||
|
||||
* For the multi-scale Hough transform it is ``srn``.
|
||||
|
||||
:param param2: The second method-dependent parameter:
|
||||
|
||||
* For the classical Hough transform it is not used (0).
|
||||
|
||||
* For the probabilistic Hough transform it is the maximum gap between line segments lying on the same line to treat them as a single line segment (that is, to join them).
|
||||
|
||||
* For the multi-scale Hough transform it is ``stn``.
|
||||
|
||||
The function implements the standard or standard multi-scale Hough transform algorithm for line detection. See http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm for a good explanation of Hough transform.
|
||||
See also the example in :ocv:func:`HoughLinesP` description.
|
||||
|
||||
HoughLinesP
|
||||
-----------
|
||||
|
||||
@@ -1185,6 +1185,10 @@ Calculates the Laplacian of an image.
|
||||
|
||||
.. ocv:pyfunction:: cv2.Laplacian(src, ddepth[, dst[, ksize[, scale[, delta[, borderType]]]]]) -> dst
|
||||
|
||||
.. ocv:cfunction:: void cvLaplace( const CvArr* src, CvArr* dst, int ksize=3)
|
||||
|
||||
.. ocv:pyoldfunction:: cv.Laplace(src, dst, ksize=3)-> None
|
||||
|
||||
:param src: Source image.
|
||||
|
||||
:param dst: Destination image of the same size and the same number of channels as ``src`` .
|
||||
|
||||
@@ -557,6 +557,10 @@ Transforms an image to compensate for lens distortion.
|
||||
|
||||
.. ocv:pyfunction:: cv2.undistort(src, cameraMatrix, distCoeffs[, dst[, newCameraMatrix]]) -> dst
|
||||
|
||||
.. ocv:cfunction:: void cvUndistort2( const CvArr* src, CvArr* dst, const CvMat* cameraMatrix, const CvMat* distCoeffs, const CvMat* newCameraMatrix=NULL )
|
||||
|
||||
.. ocv:pyoldfunction:: cv.Undistort2(src, dst, cameraMatrix, distCoeffs)-> None
|
||||
|
||||
:param src: Input (distorted) image.
|
||||
|
||||
:param dst: Output (corrected) image that has the same size and type as ``src`` .
|
||||
|
||||
@@ -226,17 +226,29 @@ Computes the "minimal work" distance between two weighted point configurations.
|
||||
|
||||
.. ocv:function:: float EMD( InputArray signature1, InputArray signature2, int distType, InputArray cost=noArray(), float* lowerBound=0, OutputArray flow=noArray() )
|
||||
|
||||
.. ocv:cfunction:: float cvCalcEMD2( const CvArr* signature1, const CvArr* signature2, int distType, CvDistanceFunction distFunc=NULL, const CvArr* cost=NULL, CvArr* flow=NULL, float* lowerBound=NULL, void* userdata=NULL )
|
||||
.. ocv:pyoldfunction:: cv.CalcEMD2(signature1, signature2, distType, distFunc=None, cost=None, flow=None, lowerBound=None, userdata=None) -> float
|
||||
|
||||
:param signature1: The first signature, a :math:`\texttt{size1}\times \texttt{dims}+1` floating-point matrix. Each row stores the point weight followed by the point coordinates. The matrix is allowed to have a single column (weights only) if the user-defined cost matrix is used.
|
||||
|
||||
:param signature2: The second signature of the same format as ``signature1`` , though the number of rows may be different. The total weights may be different, in this case an extra "dummy" point is added to either ``signature1`` or ``signature2`` .
|
||||
|
||||
:param distType: Used metric. ``CV_DIST_L1, CV_DIST_L2`` , and ``CV_DIST_C`` stand for one of the standard metrics; ``CV_DIST_USER`` means that a pre-calculated cost matrix ``cost`` is used.
|
||||
|
||||
:param distFunc: custom distance function, supported by the old interface. ``CvDistanceFunction`` is defined as: ::
|
||||
|
||||
typedef float (CV_CDECL * CvDistanceFunction)( const float* a,
|
||||
const float* b, void* userdata );
|
||||
|
||||
where ``a`` and ``b`` are point coordinates and ``userdata`` is the same as the last parameter.
|
||||
|
||||
:param cost: The user-defined :math:`\texttt{size1}\times \texttt{size2}` cost matrix. Also, if a cost matrix is used, lower boundary ``lowerBound`` can not be calculated, because it needs a metric function.
|
||||
|
||||
:param lowerBound: Optional input/output parameter: lower boundary of distance between the two signatures that is a distance between mass centers. The lower boundary may not be calculated if the user-defined cost matrix is used, the total weights of point configurations are not equal, or if the signatures consist of weights only (i.e. the signature matrices have a single column). The user **must** initialize ``*lowerBound`` . If the calculated distance between mass centers is greater or equal to ``*lowerBound`` (it means that the signatures are far enough) the function does not calculate EMD. In any case ``*lowerBound`` is set to the calculated distance between mass centers on return. Thus, if user wants to calculate both distance between mass centers and EMD, ``*lowerBound`` should be set to 0.
|
||||
|
||||
:param flow: The resultant :math:`\texttt{size1} \times \texttt{size2}` flow matrix: :math:`\texttt{flow}_{i,j}` is a flow from :math:`i` th point of ``signature1`` to :math:`j` th point of ``signature2`` .
|
||||
|
||||
:param userdata: Optional pointer directly passed to the custom distance function.
|
||||
|
||||
The function computes the earth mover distance and/or a lower boundary of the distance between the two weighted point configurations. One of the applications described in :ref:`RubnerSept98` is multi-dimensional histogram comparison for image retrieval. EMD is a transportation problem that is solved using some modification of a simplex algorithm, thus the complexity is exponential in the worst case, though, on average it is much faster. In the case of a real metric the lower boundary can be calculated even faster (using linear-time algorithm) and it can be used to determine roughly whether the two signatures are far enough so that they cannot relate to the same object.
|
||||
|
||||
|
||||
@@ -414,6 +414,10 @@ Calculates the distance to the closest zero pixel for each pixel of the source i
|
||||
|
||||
.. ocv:pyfunction:: cv2.distanceTransform(src, distanceType, maskSize[, dst[, labels]]) -> dst, labels
|
||||
|
||||
.. ocv:cfunction:: void cvDistTransform( const CvArr* src, CvArr* dst, int distanceType=CV_DIST_L2, int maskSize=3, const float* mask=NULL, CvArr* labels=NULL )
|
||||
|
||||
.. ocv:pyoldfunction:: cv.DistTransform(src, dst, distanceType=CV_DIST_L2, maskSize=3, mask=None, labels=None)-> None
|
||||
|
||||
:param src: 8-bit, single-channel (binary) source image.
|
||||
|
||||
:param dst: Output image with calculated distances. It is a 32-bit floating-point, single-channel image of the same size as ``src`` .
|
||||
@@ -624,6 +628,10 @@ Calculates the integral of an image.
|
||||
|
||||
.. ocv:pyfunction:: cv2.integral(src[, sum[, sdepth]]) -> sum
|
||||
|
||||
.. ocv:pyfunction:: cv2.integral2(src[, sum[, sqsum[, sdepth]]]) -> sum, sqsum
|
||||
|
||||
.. ocv:pyfunction:: cv2.integral3(src[, sum[, sqsum[, tilted[, sdepth]]]]) -> sum, sqsum, tilted
|
||||
|
||||
.. ocv:cfunction:: void cvIntegral( const CvArr* image, CvArr* sum, CvArr* sqsum=NULL, CvArr* tiltedSum=NULL )
|
||||
.. ocv:pyoldfunction:: cv.Integral(image, sum, sqsum=None, tiltedSum=None)-> None
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@ Adds an image to the accumulator.
|
||||
|
||||
.. ocv:pyfunction:: cv2.accumulate(src, dst[, mask]) -> dst
|
||||
|
||||
.. ocv:cfunction:: void cvAcc( const CvArr* src, CvArr* dst, const CvArr* mask=NULL )
|
||||
.. ocv:pyoldfunction:: cv.Acc(src, dst, mask=None)-> None
|
||||
|
||||
:param src: Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
|
||||
|
||||
:param dst: Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point.
|
||||
@@ -42,6 +45,9 @@ Adds the square of a source image to the accumulator.
|
||||
|
||||
.. ocv:pyfunction:: cv2.accumulateSquare(src, dst[, mask]) -> dst
|
||||
|
||||
.. ocv:cfunction:: void cvSquareAcc( const CvArr* src, CvArr* dst, const CvArr* mask=NULL )
|
||||
.. ocv:pyoldfunction:: cv.SquareAcc(src, dst, mask=None)-> None
|
||||
|
||||
:param src: Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
|
||||
|
||||
:param dst: Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point.
|
||||
@@ -71,6 +77,9 @@ Adds the per-element product of two input images to the accumulator.
|
||||
|
||||
.. ocv:pyfunction:: cv2.accumulateProduct(src1, src2, dst[, mask]) -> dst
|
||||
|
||||
.. ocv:cfunction:: void cvMultiplyAcc( const CvArr* src1, const CvArr* src2, CvArr* dst, const CvArr* mask=NULL )
|
||||
.. ocv:pyoldfunction:: cv.MultiplyAcc(src1, src2, dst, mask=None)-> None
|
||||
|
||||
:param src1: First input image, 1- or 3-channel, 8-bit or 32-bit floating point.
|
||||
|
||||
:param src2: Second input image of the same type and the same size as ``src1`` .
|
||||
@@ -102,6 +111,9 @@ Updates a running average.
|
||||
|
||||
.. ocv:pyfunction:: cv2.accumulateWeighted(src, dst, alpha[, mask]) -> dst
|
||||
|
||||
.. ocv:cfunction:: void cvRunningAvg( const CvArr* src, CvArr* dst, double alpha, const CvArr* mask=NULL )
|
||||
.. ocv:pyoldfunction:: cv.RunningAvg(src, dst, alpha, mask=None)-> None
|
||||
|
||||
:param src: Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
|
||||
|
||||
:param dst: Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point.
|
||||
|
||||
@@ -11,13 +11,14 @@ Calculates all of the moments up to the third order of a polygon or rasterized s
|
||||
|
||||
.. ocv:pyfunction:: cv2.moments(array[, binaryImage]) -> retval
|
||||
|
||||
.. ocv:cfunction:: void cvMoments( const CvArr* arr, CvMoments* moments, int binary=0 )
|
||||
.. ocv:pyoldfunction:: cv.Moments(arr, binary=0) -> moments
|
||||
.. ocv:cfunction:: void cvMoments( const CvArr* array, CvMoments* moments, int binary=0 )
|
||||
.. ocv:pyoldfunction:: cv.Moments(array, binary=0) -> moments
|
||||
|
||||
:param array: A raster image (single-channel, 8-bit or floating-point 2D array) or an array ( :math:`1 \times N` or :math:`N \times 1` ) of 2D points (``Point`` or ``Point2f`` ).
|
||||
|
||||
:param binaryImage: If it is true, all non-zero image pixels are treated as 1's. The parameter is used for images only.
|
||||
|
||||
|
||||
:param moments: The output moments
|
||||
|
||||
The function computes moments, up to the 3rd order, of a vector shape or a rasterized shape. The results are returned in a structure ``Moments``, defined as: ::
|
||||
|
||||
@@ -90,6 +91,10 @@ Calculates the seven Hu invariants.
|
||||
|
||||
.. ocv:pyfunction:: cv2.HuMoments(m) -> hu
|
||||
|
||||
.. ocv:cfunction:: void cvGetHuMoments( const CvMoments* moments, CvHuMoments* hu )
|
||||
|
||||
.. ocv:pyoldfunction:: cv.GetHuMoments(moments) -> hu
|
||||
|
||||
:param moments: Input moments computed with :ocv:func:`moments` .
|
||||
:param h: Output Hu invariants.
|
||||
|
||||
@@ -241,13 +246,29 @@ Approximates a polygonal curve(s) with the specified precision.
|
||||
|
||||
.. ocv:pyfunction:: cv2.approxPolyDP(curve, epsilon, closed[, approxCurve]) -> approxCurve
|
||||
|
||||
:param curve: Input vector of 2d point, stored in ``std::vector`` or ``Mat``.
|
||||
.. ocv:cfunction:: CvSeq* cvApproxPoly( const void* curve, int headerSize, CvMemStorage* storage, int method, double epsilon, int recursive=0 )
|
||||
|
||||
:param approxCurve: Result of the approximation. The type should match the type of the input curve.
|
||||
:param curve: Input vector of 2d point, stored in:
|
||||
|
||||
* ``std::vector`` or ``Mat`` (C++ interface)
|
||||
|
||||
* ``Nx2`` numpy array (Python interface).
|
||||
|
||||
* ``CvSeq`` or `` ``CvMat`` (C interface)
|
||||
|
||||
:param approxCurve: Result of the approximation. The type should match the type of the input curve. In the case of C interface the approximated curve is stored in the memory storage and pointer to it is returned.
|
||||
|
||||
:param epsilon: Parameter specifying the approximation accuracy. This is the maximum distance between the original curve and its approximation.
|
||||
|
||||
:param closed: If true, the approximated curve is closed (its first and last vertices are connected). Otherwise, it is not closed.
|
||||
|
||||
:param headerSize: Header size of the approximated curve. Normally, ``sizeof(CvContour)`` is used.
|
||||
|
||||
:param storage: Memory storage where the approximated curve will be stored.
|
||||
|
||||
:param method: The contour approximation algorithm. Only ``CV_POLY_APPROX_DP`` is supported.
|
||||
|
||||
:param recursive: The recursion flag. If it is non-zero and ``curve`` is ``CvSeq*``, the function ``cvApproxPoly`` will approximate all the contours accessible from ``curve`` by ``h_next`` and ``v_next`` links.
|
||||
|
||||
The functions ``approxPolyDP`` approximate a curve or a polygon with another curve/polygon with less vertices, so that the distance between them is less or equal to the specified precision. It uses the Douglas-Peucker algorithm
|
||||
http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm
|
||||
@@ -255,6 +276,28 @@ http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm
|
||||
See http://code.ros.org/svn/opencv/trunk/opencv/samples/cpp/contours.cpp on how to use the function.
|
||||
|
||||
|
||||
ApproxChains
|
||||
-------------
|
||||
Approximates Freeman chain(s) with a polygonal curve.
|
||||
|
||||
.. ocv:cfunction:: CvSeq* cvApproxChains( CvSeq* chain, CvMemStorage* storage, int method=CV_CHAIN_APPROX_SIMPLE, double parameter=0, int minimalPerimeter=0, int recursive=0 )
|
||||
|
||||
.. ocv:pyoldfunction:: cv.ApproxChains(chain, storage, method=CV_CHAIN_APPROX_SIMPLE, parameter=0, minimalPerimeter=0, recursive=0)-> contours
|
||||
|
||||
:param chain: Pointer to the approximated Freeman chain that can refer to other chains
|
||||
|
||||
:param storage: Storage location for the resulting polylines
|
||||
|
||||
:param method: Approximation method (see the description of the function :ref:`FindContours` )
|
||||
|
||||
:param parameter: Method parameter (not used now)
|
||||
|
||||
:param minimalPerimeter: Approximates only those contours whose perimeters are not less than ``minimal_perimeter`` . Other chains are removed from the resulting structure
|
||||
|
||||
:param recursive: Recursion flag. If it is non-zero, the function approximates all chains that can be obtained to from ``chain`` by using the ``h_next`` or ``v_next`` links. Otherwise, the single input chain is approximated.
|
||||
|
||||
This is a stand-alone contour approximation routine, not represented in the new interface. When :ocv:cfunc:`FindContours` retrieves contours as Freeman chains, it calls to the function to get approximated contours, represented as polygons.
|
||||
|
||||
|
||||
arcLength
|
||||
-------------
|
||||
@@ -460,7 +503,17 @@ Finds a rotated rectangle of the minimum area enclosing the input 2D point set.
|
||||
|
||||
.. ocv:pyfunction:: cv2.minAreaRect(points) -> retval
|
||||
|
||||
:param points: The input vector of 2D points, stored in ``std::vector<>`` or ``Mat``.
|
||||
.. ocv:cfunction:: CvBox2D cvMinAreaRect2( const CvArr* points, CvMemStorage* storage=NULL )
|
||||
|
||||
.. ocv:pyoldfunction:: cv.MinAreaRect2(points, storage=None)-> CvBox2D
|
||||
|
||||
:param points: The input vector of 2D points, stored in:
|
||||
|
||||
* ``std::vector<>`` or ``Mat`` (C++ interface).
|
||||
|
||||
* ``CvSeq*`` or ``CvMat*`` (C interface)
|
||||
|
||||
* Nx2 numpy array (Python interface)
|
||||
|
||||
The function calculates and returns the minimum-area bounding rectangle (possibly rotated) for a specified point set. See the OpenCV sample ``minarea.cpp`` .
|
||||
|
||||
@@ -475,9 +528,16 @@ Finds a circle of the minimum area enclosing a 2D point set.
|
||||
.. ocv:pyfunction:: cv2.minEnclosingCircle(points, center, radius) -> None
|
||||
|
||||
.. ocv:cfunction:: int cvMinEnclosingCircle( const CvArr* points, CvPoint2D32f* center, float* radius )
|
||||
|
||||
.. ocv:pyoldfunction:: cv.MinEnclosingCircle(points)-> (int, center, radius)
|
||||
|
||||
:param points: The input vector of 2D points, stored in ``std::vector<>`` or ``Mat``.
|
||||
:param points: The input vector of 2D points, stored in:
|
||||
|
||||
* ``std::vector<>`` or ``Mat`` (C++ interface).
|
||||
|
||||
* ``CvSeq*`` or ``CvMat*`` (C interface)
|
||||
|
||||
* Nx2 numpy array (Python interface)
|
||||
|
||||
:param center: Output center of the circle.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user