rp.show_warnings = False
rp.show_errors = False
+allmodules = rp.allmodules
DOCUMENTED_MARKER = "verified"
ERROR_001_NOTACLASS = 1
"gpu::DevMem2D_", "gpu::PtrStep_", "gpu::PtrElemStep_",
# black boxes
"CvArr", "CvFileStorage",
+# other
+"InputArray", "OutputArray",
]
defines = ["cvGraphEdgeIdx", "cvFree", "CV_Assert", "cvSqrt", "cvGetGraphVtx", "cvGraphVtxIdx",
"cvCaptureFromCAM" : ["cvCreateCameraCapture"],
"cvCalcArrBackProjectPatch" : ["cvCalcBackProjectPatch"],
"cvCalcArrBackProject" : ["cvCalcBackProject"],
+ "InputArray" : ["_InputArray"],
+ "OutputArray" : ["_OutputArray"],
}
if do_python_crosscheck:
for idx, arg in enumerate(s[3]):
if idx > 0:
_str += ", "
- _str += re.sub(r"\bcv::", "", arg[0]) + " "
+ argtype = re.sub(r"\bcv::", "", arg[0])
+ bidx = argtype.find('[')
+ if bidx < 0:
+ _str += argtype + " "
+ else:
+ _srt += argtype[:bidx]
if arg[1]:
_str += arg[1]
else:
_str += "arg" + str(idx)
+ if bidx >= 0:
+ _str += argtype[bidx:]
if arg[2]:
_str += "=" + re.sub(r"\bcv::", "", arg[2])
_str += " )"
print "Usage:\n", os.path.basename(sys.argv[0]), " <module path>"
exit(0)
- for module in sys.argv[1:]:
+ modules = sys.argv[1:]
+ if modules[0] == "all":
+ modules = allmodules
+
+ for module in modules:
selfpath = os.path.dirname(os.path.abspath(sys.argv[0]))
module_path = os.path.join(selfpath, "..", "modules", module)
In the old interface all the vectors of object points from different views are concatenated together.
- :param pointCounts: In the old interface this is a vector of integers, containing as many elements, as the number of views of the calibration pattern. Each element is the number of points in each view. Usually, all the elements are the same and equal to the number of feature points on the calibration pattern.
+ :param point_counts: In the old interface this is a vector of integers, containing as many elements, as the number of views of the calibration pattern. Each element is the number of points in each view. Usually, all the elements are the same and equal to the number of feature points on the calibration pattern.
:param imageSize: Size of the image used only to initialize the intrinsic camera matrix.
then the point :math:`i` is considered an outlier. If ``srcPoints`` and ``dstPoints`` are measured in pixels, it usually makes sense to set this parameter somewhere in the range of 1 to 10.
- :param status: Optional output mask set by a robust method ( ``CV_RANSAC`` or ``CV_LMEDS`` ). Note that the input mask values are ignored.
+ :param mask: Optional output mask set by a robust method ( ``CV_RANSAC`` or ``CV_LMEDS`` ). Note that the input mask values are ignored.
The functions find and return the perspective transformation :math:`H` between the source and the destination planes:
.. ocv:pyfunction:: cv2.estimateAffine3D(src, dst[, out[, inliers[, ransacThreshold[, confidence]]]]) -> retval, out, inliers
- :param srcpt: First input 3D point set.
+ :param src: First input 3D point set.
- :param dstpt: Second input 3D point set.
+ :param dst: Second input 3D point set.
:param out: Output 3D affine transformation matrix :math:`3 \times 4` .
:param alpha: Free scaling parameter between 0 (when all the pixels in the undistorted image are valid) and 1 (when all the source image pixels are retained in the undistorted image). See :ocv:func:`stereoRectify` for details.
- :param newCameraMatrix: Output new camera matrix.
+ :param new_camera_matrix: Output new camera matrix.
- :param newImageSize: Image size after rectification. By default,it is set to ``imageSize`` .
+ :param new_imag_size: Image size after rectification. By default,it is set to ``imageSize`` .
:param validPixROI: Optional output rectangle that outlines all-good-pixels region in the undistorted image. See ``roi1, roi2`` description in :ocv:func:`stereoRectify` .
:param imagePoints: Vector of vectors of the projections of the calibration pattern points. In the old interface all the per-view vectors are concatenated.
- :param pointCounts: The integer vector of point counters for each view.
+ :param npoints: The integer vector of point counters for each view.
:param imageSize: Image size in pixels used to initialize the principal point.
.. ocv:cfunction:: void cvRQDecomp3x3( const CvMat * matrixM, CvMat * matrixR, CvMat * matrixQ, CvMat * matrixQx=NULL, CvMat * matrixQy=NULL, CvMat * matrixQz=NULL, CvPoint3D64f * eulerAngles=NULL )
.. ocv:pyoldfunction:: cv.RQDecomp3x3(M, R, Q, Qx=None, Qy=None, Qz=None) -> eulerAngles
- :param M: 3x3 input matrix.
+ :param src: 3x3 input matrix.
- :param R: Output 3x3 upper-triangular matrix.
+ :param mtxR: Output 3x3 upper-triangular matrix.
- :param Q: Output 3x3 orthogonal matrix.
+ :param mtxQ: Output 3x3 orthogonal matrix.
:param Qx: Optional output 3x3 rotation matrix around x-axis.
:param right: Right image of the same size and the same type as the left one.
- :param disp: Output disparity map. It has the same size as the input images. When ``disptype==CV_16S``, the map is a 16-bit signed single-channel image, containing disparity values scaled by 16. To get the true disparity values from such fixed-point representation, you will need to divide each ``disp`` element by 16. If ``disptype==CV_32F``, the disparity map will already contain the real disparity values on output.
+ :param disparity: Output disparity map. It has the same size as the input images. When ``disptype==CV_16S``, the map is a 16-bit signed single-channel image, containing disparity values scaled by 16. To get the true disparity values from such fixed-point representation, you will need to divide each ``disp`` element by 16. If ``disptype==CV_32F``, the disparity map will already contain the real disparity values on output.
:param disptype: Type of the output disparity map, ``CV_16S`` (default) or ``CV_32F``.
:param newImageSize: New image resolution after rectification. The same size should be passed to :ocv:func:`initUndistortRectifyMap` (see the ``stereo_calib.cpp`` sample in OpenCV samples directory). When (0,0) is passed (default), it is set to the original ``imageSize`` . Setting it to larger value can help you preserve details in the original image, especially when there is a big radial distortion.
- :param roi1:
+ :param validPixROI1: Optional output rectangles inside the rectified images where all the pixels are valid. If ``alpha=0`` , the ROIs cover the whole images. Otherwise, they are likely to be smaller (see the picture below).
- :param roi2: Optional output rectangles inside the rectified images where all the pixels are valid. If ``alpha=0`` , the ROIs cover the whole images. Otherwise, they are likely to be smaller (see the picture below).
+ :param validPixROI2: Optional output rectangles inside the rectified images where all the pixels are valid. If ``alpha=0`` , the ROIs cover the whole images. Otherwise, they are likely to be smaller (see the picture below).
The function computes the rotation matrices for each camera that (virtually) make both camera image planes the same plane. Consequently, this makes all the epipolar lines parallel and thus simplifies the dense stereo correspondence problem. The function takes the matrices computed by
:ocv:func:`stereoCalibrate` as input. As output, it provides two rotation matrices and also two projection matrices in the new coordinates. The function distinguishes the following two cases:
:param F: Input fundamental matrix. It can be computed from the same set of point pairs using :ocv:func:`findFundamentalMat` .
- :param imageSize: Size of the image.
+ :param imgSize: Size of the image.
:param H1: Output rectification homography matrix for the first image.
:param ranges: Array of selected ranges of ``m`` along each dimensionality.
- :param expr: Matrix expression. See :ref:`MatrixExpressions`.
-
These are various constructors that form a matrix. As noted in the :ref:`AutomaticAllocation`,
often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with
:ocv:func:`Mat::create` . In the former case, the old content is de-referenced.
.. ocv:function:: static Mat Mat::diag( const Mat& d )
- :param d: Index of the diagonal, with the following values:
+ :param d: Single-column matrix that forms a diagonal matrix or index of the diagonal, with the following values:
* **d=0** is the main diagonal.
* **d<0** is a diagonal from the upper half. For example, ``d=1`` means the diagonal is set immediately above the main one.
- :param matD: Single-column matrix that forms a diagonal matrix.
-
The method makes a new header for the specified matrix diagonal. The new matrix is represented as a single-column matrix. Similarly to
:ocv:func:`Mat::row` and
:ocv:func:`Mat::col` , this is an O(1) operation.
.. ocv:function:: Mat& Mat::setTo( InputArray value, InputArray mask=noArray() )
- :param s: Assigned scalar converted to the actual array type.
+ :param value: Assigned scalar converted to the actual array type.
:param mask: Operation mask of the same size as ``*this``. This is an advanced variant of the ``Mat::operator=(const Scalar& s)`` operator.
:param size: Alternative to the matrix size specification ``Size(cols, rows)`` .
- :param sizes: Array of integers specifying the array shape.
+ :param sz: Array of integers specifying the array shape.
:param type: Created matrix type.
:param size: Alternative to the matrix size specification ``Size(cols, rows)`` .
- :param sizes: Array of integers specifying the array shape.
+ :param sz: Array of integers specifying the array shape.
:param type: Created matrix type.
InputArray
----------
+.. ocv:class:: InputArray
This is the proxy class for passing read-only input arrays into OpenCV functions. It is defined as ::
OutputArray
-----------
+.. ocv:class:: OutputArray : public InputArray
This type is very similar to ``InputArray`` except that it is used for input/output and output function parameters. Just like with ``InputArray``, OpenCV users should not care about ``OutputArray``, they just pass ``Mat``, ``vector<T>`` etc. to the functions. The same limitation as for ``InputArray``: **Do not explicitly create OutputArray instances** applies here too.
Algorithm
---------
+.. ocv:class:: Algorithm
This is a base class for all more or less complex algorithms in OpenCV, especially for classes of algorithms, for which there can be multiple implementations. The examples are stereo correspondence (for which there are algorithms like block matching, semi-global block matching, graph-cut etc.), background subtraction (which can be done using mixture-of-gaussians models, codebook-based algorithm etc.), optical flow (block matching, Lucas-Kanade, Horn-Schunck etc.).
:param samples: Floating-point matrix of input samples, one row per sample.
- :param clusterCount: Number of clusters to split the set by.
+ :param cluster_count: Number of clusters to split the set by.
:param labels: Input/output integer array that stores the cluster indices for every sample.
:param compactness: The returned value that is described below.
The function ``kmeans`` implements a k-means algorithm that finds the
-centers of ``clusterCount`` clusters and groups the input samples
+centers of ``cluster_count`` clusters and groups the input samples
around the clusters. As an output,
:math:`\texttt{labels}_i` contains a 0-based cluster index for
the sample stored in the
:param angle: Rotation angle of the ellipse in degrees. See the :ocv:func:`ellipse` for details.
- :param startAngle: Starting angle of the elliptic arc in degrees.
+ :param arcStart: Starting angle of the elliptic arc in degrees.
- :param endAngle: Ending angle of the elliptic arc in degrees.
+ :param arcEnd: Ending angle of the elliptic arc in degrees.
:param delta: Angle between the subsequent polyline vertices. It defines the approximation accuracy.
:param font: Pointer to the font structure initialized by the function
- :param fontFace: Font name identifier. Only a subset of Hershey fonts http://sources.isc.org/utils/misc/hershey-font.txt are supported now:
+ :param font_face: Font name identifier. Only a subset of Hershey fonts http://sources.isc.org/utils/misc/hershey-font.txt are supported now:
* **CV_FONT_HERSHEY_SIMPLEX** normal size sans-serif font
:param thickness: Thickness of the text strokes
- :param lineType: Type of the strokes, see :ocv:func:`line` description
+ :param line_type: Type of the strokes, see :ocv:func:`line` description
The function initializes the font structure that can be passed to text rendering functions.
:param pt2: Vertex of the rectangle opposite to ``pt1`` .
- :param r: Alternative specification of the drawn rectangle.
+ :param rec: Alternative specification of the drawn rectangle.
:param color: Rectangle color or brightness (grayscale image).
----------------
Draws contours outlines or filled contours.
-.. ocv:function:: void drawContours( InputOutputArray image, InputArrayOfArrays contours, int contourIdx, const Scalar& color, int thickness=1, int lineType=8, InputArray hierarchy=noArray(), int maxLevel=INT_MAX, Point offset=Point() )
+.. ocv:function:: void drawContours( InputOutputArray image, InputArrayOfArrays contours, int contourIdx, const Scalar& color, int thickness=1, int lineType=8, InputArray hierarchy=noArray(), int maxLevel=INT_MAX, Point offset=Point() )
.. ocv:pyfunction:: cv2.drawContours(image, contours, contourIdx, color[, thickness[, lineType[, hierarchy[, maxLevel[, offset]]]]]) -> None
:param contour: Pointer to the first contour.
- :param externalColor: Color of external contours.
+ :param external_color: Color of external contours.
- :param holeColor: Color of internal contours (holes).
+ :param hole_color: Color of internal contours (holes).
The function draws contour outlines in the image if
:math:`\texttt{thickness} \ge 0` or fills the area bounded by the contours if
.. ocv:cfunction:: void cvClearSet( CvSet* set_header )
- :param setHeader: Cleared set
+ :param set_header: Cleared set
The function removes all elements from set. It has O(1) time complexity.
.. ocv:pyoldfunction:: cv.CreateMemStorage(blockSize=0) -> memstorage
- :param blockSize: Size of the storage blocks in bytes. If it is 0, the block size is set to a default value - currently it is about 64K.
+ :param block_size: Size of the storage blocks in bytes. If it is 0, the block size is set to a default value - currently it is about 64K.
The function creates an empty memory storage. See
:ocv:struct:`CvMemStorage`
.. ocv:cfunction:: CvSeq* cvCreateSeq( int seq_flags, size_t header_size, size_t elem_size, CvMemStorage* storage )
- :param seqFlags: Flags of the created sequence. If the sequence is not passed to any function working with a specific type of sequences, the sequence value may be set to 0, otherwise the appropriate type must be selected from the list of predefined sequence types.
+ :param seq_flags: Flags of the created sequence. If the sequence is not passed to any function working with a specific type of sequences, the sequence value may be set to 0, otherwise the appropriate type must be selected from the list of predefined sequence types.
- :param headerSize: Size of the sequence header; must be greater than or equal to ``sizeof(CvSeq)`` . If a specific type or its extension is indicated, this type must fit the base type header.
+ :param header_size: Size of the sequence header; must be greater than or equal to ``sizeof(CvSeq)`` . If a specific type or its extension is indicated, this type must fit the base type header.
- :param elemSize: Size of the sequence elements in bytes. The size must be consistent with the sequence type. For example, for a sequence of points to be created, the element type ``CV_SEQ_ELTYPE_POINT`` should be specified and the parameter ``elemSize`` must be equal to ``sizeof(CvPoint)`` .
+ :param elem_size: Size of the sequence elements in bytes. The size must be consistent with the sequence type. For example, for a sequence of points to be created, the element type ``CV_SEQ_ELTYPE_POINT`` should be specified and the parameter ``elem_size`` must be equal to ``sizeof(CvPoint)`` .
:param storage: Sequence location
:param graph: Graph
- :param startVtx: Pointer to the starting vertex of the edge
+ :param start_vtx: Pointer to the starting vertex of the edge
- :param endVtx: Pointer to the ending vertex of the edge. For an unoriented graph, the order of the vertex parameters does not matter.
+ :param end_vtx: Pointer to the ending vertex of the edge. For an unoriented graph, the order of the vertex parameters does not matter.
::
.. ocv:cfunction:: CvSetElem* cvGetSetElem( const CvSet* set_header, int index )
- :param setHeader: Set
+ :param set_header: Set
:param index: Index of the set element within a sequence
:param graph: Graph
- :param vtxIdx: Index of the graph vertex
+ :param vtx_idx: Index of the graph vertex
The function returns the number of edges incident to the specified vertex, both incoming and outgoing. To count the edges, the following code is used:
:param seq: Sequence
- :param beforeIndex: Index before which the element is inserted. Inserting before 0 (the minimal allowed value of the parameter) is equal to :ocv:cfunc:`SeqPushFront` and inserting before ``seq->total`` (the maximal allowed value of the parameter) is equal to :ocv:cfunc:`SeqPush` .
+ :param before_index: Index before which the element is inserted. Inserting before 0 (the minimal allowed value of the parameter) is equal to :ocv:cfunc:`SeqPushFront` and inserting before ``seq->total`` (the maximal allowed value of the parameter) is equal to :ocv:cfunc:`SeqPush` .
:param element: Inserted element
:param seq: Sequence
- :param beforeIndex: Index before which the array is inserted
+ :param before_index: Index before which the array is inserted
- :param fromArr: The array to take elements from
+ :param from_arr: The array to take elements from
The function inserts all
``fromArr``
.. ocv:cfunction:: int cvSetAdd( CvSet* set_header, CvSetElem* elem=NULL, CvSetElem** inserted_elem=NULL )
- :param setHeader: Set
+ :param set_header: Set
:param elem: Optional input argument, an inserted element. If not NULL, the function copies the data to the allocated node (the MSB of the first integer field is cleared after copying).
.. ocv:cfunction:: CvSetElem* cvSetNew( CvSet* set_header )
- :param setHeader: Set
+ :param set_header: Set
The function is an inline lightweight variant of
:ocv:cfunc:`SetAdd`
.. ocv:cfunction:: void cvSetRemove( CvSet* set_header, int index )
- :param setHeader: Set
+ :param set_header: Set
:param index: Index of the removed element
.. ocv:cfunction:: void cvSetRemoveByPtr( CvSet* set_header, void* elem )
- :param setHeader: Set
+ :param set_header: Set
:param elem: Removed element
:param seq: Sequence
- :param deltaElems: Desirable sequence block size for elements
+ :param delta_elems: Desirable sequence block size for elements
The function affects memory allocation
granularity. When the free space in the sequence buffers has run out,
the function allocates the space for
-``deltaElems``
+``delta_elems``
sequence
elements. If this block immediately follows the one previously allocated,
the two blocks are concatenated; otherwise, a new sequence block is
created. Therefore, the bigger the parameter is, the lower the possible
sequence fragmentation, but the more space in the storage block is wasted. When
the sequence is created, the parameter
-``deltaElems``
+``delta_elems``
is set to
the default value of about 1K. The function can be called any time after
the sequence is created and affects future allocations. The function
:param col: Zero-based index of the selected column
- :param startCol: Zero-based index of the starting column (inclusive) of the span
+ :param start_col: Zero-based index of the starting column (inclusive) of the span
- :param endCol: Zero-based index of the ending column (exclusive) of the span
+ :param end_col: Zero-based index of the ending column (exclusive) of the span
The functions return the header, corresponding to a specified column span of the input array. That is, no data is copied. Therefore, any modifications of the submatrix will affect the original array. If you need to copy the columns, use :ocv:cfunc:`CloneMat`. ``cvGetCol(arr, submat, col)`` is a shortcut for ``cvGetCols(arr, submat, col, col+1)``.
:param arr: Input array
- :param imageHeader: Pointer to ``IplImage`` structure used as a temporary buffer
+ :param image_header: Pointer to ``IplImage`` structure used as a temporary buffer
-The function returns the image header for the input array that can be a matrix (:ocv:struct:`CvMat`) or image (:ocv:struct:`IplImage`). In the case of an image the function simply returns the input pointer. In the case of ``CvMat`` it initializes an ``imageHeader`` structure with the parameters of the input matrix. Note that if we transform ``IplImage`` to ``CvMat`` using :ocv:cfunc:`GetMat` and then transform ``CvMat`` back to IplImage using this function, we will get different headers if the ROI is set in the original image.
+The function returns the image header for the input array that can be a matrix (:ocv:struct:`CvMat`) or image (:ocv:struct:`IplImage`). In the case of an image the function simply returns the input pointer. In the case of ``CvMat`` it initializes an ``image_header`` structure with the parameters of the input matrix. Note that if we transform ``IplImage`` to ``CvMat`` using :ocv:cfunc:`GetMat` and then transform ``CvMat`` back to IplImage using this function, we will get different headers if the ROI is set in the original image.
GetImageCOI
-----------
.. ocv:cfunction:: CvSparseNode* cvGetNextSparseNode( CvSparseMatIterator* mat_iterator )
- :param matIterator: Sparse array iterator
+ :param mat_iterator: Sparse array iterator
The function moves iterator to the next sparse matrix element and returns pointer to it. In the current version there is no any particular order of the elements, because they are stored in the hash table. The sample below demonstrates how to iterate through the sparse matrix: ::
:param step: Output full row length in bytes
- :param roiSize: Output ROI size
+ :param roi_size: Output ROI size
The function fills output variables with low-level information about the array data. All output parameters are optional, so some of the pointers may be set to ``NULL``. If the array is ``IplImage`` with ROI set, the parameters of ROI are returned.
:param row: Zero-based index of the selected row
- :param startRow: Zero-based index of the starting row (inclusive) of the span
+ :param start_row: Zero-based index of the starting row (inclusive) of the span
- :param endRow: Zero-based index of the ending row (exclusive) of the span
+ :param end_row: Zero-based index of the ending row (exclusive) of the span
- :param deltaRow: Index step in the row span. That is, the function extracts every ``deltaRow`` -th row from ``startRow`` and up to (but not including) ``endRow`` .
+ :param delta_row: Index step in the row span. That is, the function extracts every ``delta_row`` -th row from ``start_row`` and up to (but not including) ``end_row`` .
The functions return the header, corresponding to a specified row/row span of the input array. ``cvGetRow(arr, submat, row)`` is a shortcut for ``cvGetRows(arr, submat, row, row+1)``.
:param mat: Input array
- :param matIterator: Initialized iterator
+ :param mat_iterator: Initialized iterator
The function initializes iterator of sparse array elements and returns pointer to the first element, or NULL if the array is empty.
:param type: Optional output parameter: type of matrix elements
- :param createNode: Optional input parameter for sparse matrices. Non-zero value of the parameter means that the requested element is created if it does not exist already.
+ :param create_node: Optional input parameter for sparse matrices. Non-zero value of the parameter means that the requested element is created if it does not exist already.
- :param precalcHashval: Optional input parameter for sparse matrices. If the pointer is not NULL, the function does not recalculate the node hash value, but takes it from the specified location. It is useful for speeding up pair-wise operations (TODO: provide an example)
+ :param precalc_hashval: Optional input parameter for sparse matrices. If the pointer is not NULL, the function does not recalculate the node hash value, but takes it from the specified location. It is useful for speeding up pair-wise operations (TODO: provide an example)
The functions return a pointer to a specific array element. Number of array dimension should match to the number of indices passed to the function except for ``cvPtr1D`` function that can be used for sequential access to 1D, 2D or nD dense arrays.
:param header: Output header to be filled
- :param newCn: New number of channels. 'newCn = 0' means that the number of channels remains unchanged.
+ :param new_cn: New number of channels. 'new_cn = 0' means that the number of channels remains unchanged.
- :param newRows: New number of rows. 'newRows = 0' means that the number of rows remains unchanged unless it needs to be changed according to ``newCn`` value.
+ :param new_rows: New number of rows. 'new_rows = 0' means that the number of rows remains unchanged unless it needs to be changed according to ``new_cn`` value.
The function initializes the CvMat header so that it points to the same data as the original array but has a different shape - different number of channels, different number of rows, or both.
:param arr: Input array
- :param sizeofHeader: Size of output header to distinguish between IplImage, CvMat and CvMatND output headers
+ :param sizeof_header: Size of output header to distinguish between IplImage, CvMat and CvMatND output headers
:param header: Output header to be filled
- :param newCn: New number of channels. ``newCn = 0`` means that the number of channels remains unchanged.
+ :param new_cn: New number of channels. ``new_cn = 0`` means that the number of channels remains unchanged.
- :param newDims: New number of dimensions. ``newDims = 0`` means that the number of dimensions remains the same.
+ :param new_dims: New number of dimensions. ``new_dims = 0`` means that the number of dimensions remains the same.
- :param newSizes: Array of new dimension sizes. Only ``newDims-1`` values are used, because the total number of elements must remain the same. Thus, if ``newDims = 1``, ``newSizes`` array is not used.
+ :param new_sizes: Array of new dimension sizes. Only ``new_dims-1`` values are used, because the total number of elements must remain the same. Thus, if ``new_dims = 1``, ``new_sizes`` array is not used.
The function is an advanced version of :ocv:cfunc:`Reshape` that can work with multi-dimensional arrays as well (though it can work with ordinary images and matrices) and change the number of dimensions.
:param arr: The destination array
- :param distType: Distribution type
+ :param dist_type: Distribution type
* **CV_RAND_UNI** uniform distribution
.. ocv:cfunction:: void* cvClone( const void* struct_ptr )
- :param structPtr: The object to clone
+ :param struct_ptr: The object to clone
-The function finds the type of a given object and calls ``clone`` with the passed object. Of course, if you know the object type, for example, ``structPtr`` is ``CvMat*``, it is faster to call the specific function, like :ocv:cfunc:`CloneMat`.
+The function finds the type of a given object and calls ``clone`` with the passed object. Of course, if you know the object type, for example, ``struct_ptr`` is ``CvMat*``, it is faster to call the specific function, like :ocv:cfunc:`CloneMat`.
EndWriteStruct
--------------
.. ocv:cfunction:: CvTypeInfo* cvFindType( const char* type_name )
- :param typeName: Type name
+ :param type_name: Type name
The function finds a registered type by its name. It returns NULL if there is no type with the specified name.
:param key: Unique pointer to the node name, retrieved with :ocv:cfunc:`GetHashedKey`
- :param createMissing: Flag that specifies whether an absent node should be added to the map
+ :param create_missing: Flag that specifies whether an absent node should be added to the map
The function finds a file node. It is a faster version of :ocv:cfunc:`GetFileNodeByName`
(see :ocv:cfunc:`GetHashedKey` discussion). Also, the function can insert a new node, if it is not in the map yet.
:param len: Length of the name (if it is known apriori), or -1 if it needs to be calculated
- :param createMissing: Flag that specifies, whether an absent key should be added into the hash table
+ :param create_missing: Flag that specifies, whether an absent key should be added into the hash table
The function returns a unique pointer for each particular file node name. This pointer can be then passed to the :ocv:cfunc:`GetFileNode` function that is faster than :ocv:cfunc:`GetFileNodeByName`
because it compares text strings by comparing pointers rather than the strings' content.
:param filename: File name
- :param storage: Memory storage for dynamic structures, such as :ocv:struct:`CvSeq` or :ocv:struct:`CvGraph` . It is not used for matrices or images.
+ :param memstorage: Memory storage for dynamic structures, such as :ocv:struct:`CvSeq` or :ocv:struct:`CvGraph` . It is not used for matrices or images.
:param name: Optional object name. If it is NULL, the first top-level object in the storage will be loaded.
- :param realName: Optional output parameter that will contain the name of the loaded object (useful if ``name=NULL`` )
+ :param real_name: Optional output parameter that will contain the name of the loaded object (useful if ``name=NULL`` )
The function loads an object from a file. It basically reads the specified file, find the first top-level node and calls :ocv:cfunc:`Read` for that node. If the file node does not have type information or the type information can not be found by the type name, the function returns NULL. After the object is loaded, the file storage is closed and all the temporary buffers are deleted. Thus, to load a dynamic structure, such as a sequence, contour, or graph, one should pass a valid memory storage destination to the function.
:param node: File node
- :param defaultValue: The value that is returned if ``node`` is NULL
+ :param default_value: The value that is returned if ``node`` is NULL
The function returns an integer that is represented by the file node. If the file node is NULL, the
-``defaultValue`` is returned (thus, it is convenient to call the function right after :ocv:cfunc:`GetFileNode` without checking for a NULL pointer). If the file node has type ``CV_NODE_INT``, then ``node->data.i`` is returned. If the file node has type ``CV_NODE_REAL``, then ``node->data.f``
+``default_value`` is returned (thus, it is convenient to call the function right after :ocv:cfunc:`GetFileNode` without checking for a NULL pointer). If the file node has type ``CV_NODE_INT``, then ``node->data.i`` is returned. If the file node has type ``CV_NODE_REAL``, then ``node->data.f``
is converted to an integer and returned. Otherwise the error is reported.
ReadIntByName
:param name: The node name
- :param defaultValue: The value that is returned if the file node is not found
+ :param default_value: The value that is returned if the file node is not found
The function is a simple superposition of :ocv:cfunc:`GetFileNodeByName` and :ocv:cfunc:`ReadInt`.
:param node: File node
- :param defaultValue: The value that is returned if ``node`` is NULL
+ :param default_value: The value that is returned if ``node`` is NULL
The function returns a floating-point value
that is represented by the file node. If the file node is NULL, the
-``defaultValue``
+``default_value``
is returned (thus, it is convenient to call
the function right after
:ocv:cfunc:`GetFileNode`
:param name: The node name
- :param defaultValue: The value that is returned if the file node is not found
+ :param default_value: The value that is returned if the file node is not found
The function is a simple superposition of
:ocv:cfunc:`GetFileNodeByName`
:param node: File node
- :param defaultValue: The value that is returned if ``node`` is NULL
+ :param default_value: The value that is returned if ``node`` is NULL
The function returns a text string that is represented
by the file node. If the file node is NULL, the
-``defaultValue``
+``default_value``
is returned (thus, it is convenient to call the function right after
:ocv:cfunc:`GetFileNode`
without checking for a NULL pointer). If
:param name: The node name
- :param defaultValue: The value that is returned if the file node is not found
+ :param default_value: The value that is returned if the file node is not found
The function is a simple superposition of
:ocv:cfunc:`GetFileNodeByName`
.. ocv:cfunction:: void cvRelease( void** struct_ptr )
- :param structPtr: Double pointer to the object
+ :param struct_ptr: Double pointer to the object
The function finds the type of a given object and calls
``release``
:param filename: File name
- :param structPtr: Object to save
+ :param struct_ptr: Object to save
:param name: Optional object name. If it is NULL, the name will be formed from ``filename`` .
* **CV_NODE_FLOW** the optional flag that makes sense only for YAML streams. It means that the structure is written as a flow (not as a block), which is more compact. It is recommended to use this flag for structures or arrays whose elements are all scalars.
- :param typeName: Optional parameter - the object type name. In
+ :param type_name: Optional parameter - the object type name. In
case of XML it is written as a ``type_id`` attribute of the
structure opening tag. In the case of YAML it is written after a colon
following the structure name (see the example in :ocv:struct:`CvFileStorage`
.. ocv:cfunction:: CvTypeInfo* cvTypeOf( const void* struct_ptr )
- :param structPtr: The object pointer
+ :param struct_ptr: The object pointer
The function finds the type of a given object. It iterates through the list of registered types and calls the ``is_instance`` function/method for every type info structure with that object until one of them returns non-zero or until the whole list has been traversed. In the latter case, the function returns NULL.
.. ocv:cfunction:: void cvUnregisterType( const char* type_name )
- :param typeName: Name of an unregistered type
+ :param type_name: Name of an unregistered type
The function unregisters a type with a specified name. If the name is unknown, it is possible to locate the type info by an instance of the type using :ocv:cfunc:`TypeOf` or by iterating the type list, starting from :ocv:cfunc:`FirstType`, and then calling ``cvUnregisterType(info->typeName)``.
:param comment: The written comment, single-line or multi-line
- :param eolComment: If non-zero, the function tries to put the comment at the end of current line. If the flag is zero, if the comment is multi-line, or if it does not fit at the end of the current line, the comment starts a new line.
+ :param eol_comment: If non-zero, the function tries to put the comment at the end of current line. If the flag is zero, if the comment is multi-line, or if it does not fit at the end of the current line, the comment starts a new line.
The function writes a comment into file storage. The comments are skipped when the storage is read.
.. ocv:function:: MatExpr abs( const Mat& m )
.. ocv:function:: MatExpr abs( const MatExpr& e )
- :param src: Matrix or matrix expression.
+ :param m: Matrix.
+ :param e: Matrix expression.
``abs`` is a meta-function that is expanded to one of :ocv:func:`absdiff` forms:
.. ocv:pyfunction:: cv2.checkRange(a[, quiet[, minVal[, maxVal]]]) -> retval, pos
- :param src: Array to check.
+ :param a: Array to check.
:param quiet: Flag indicating whether the functions quietly return false when the array elements are out of range or they throw an exception.
.. ocv:pyoldfunction:: cv.CountNonZero(arr)-> int
- :param mtx: Single-channel array.
+ :param src: Single-channel array.
-The function returns the number of non-zero elements in ``mtx`` :
+The function returns the number of non-zero elements in ``src`` :
.. math::
- \sum _{I: \; \texttt{mtx} (I) \ne0 } 1
+ \sum _{I: \; \texttt{src} (I) \ne0 } 1
.. seealso::
.. ocv:function:: Mat cvarrToMat( const CvArr* arr, bool copyData=false, bool allowND=true, int coiMode=0 )
- :param src: Source ``CvMat``, ``IplImage`` , or ``CvMatND`` .
+ :param arr: Source ``CvMat``, ``IplImage`` , or ``CvMatND`` .
:param copyData: When it is false (default value), no data is copied and only the new header is created. In this case, the original array should not be deallocated while the new matrix header is used. If the parameter is true, all the data is copied and you may deallocate the original array right after the conversion.
The function ``cvarrToMat`` converts ``CvMat``, ``IplImage`` , or ``CvMatND`` header to
:ocv:class:`Mat` header, and optionally duplicates the underlying data. The constructed header is returned by the function.
-When ``copyData=false`` , the conversion is done really fast (in O(1) time) and the newly created matrix header will have ``refcount=0`` , which means that no reference counting is done for the matrix data. In this case, you have to preserve the data until the new header is destructed. Otherwise, when ``copyData=true`` , the new buffer is allocated and managed as if you created a new matrix from scratch and copied the data there. That is, ``cvarrToMat(src, true)`` is equivalent to ``cvarrToMat(src, false).clone()`` (assuming that COI is not set). The function provides a uniform way of supporting
+When ``copyData=false`` , the conversion is done really fast (in O(1) time) and the newly created matrix header will have ``refcount=0`` , which means that no reference counting is done for the matrix data. In this case, you have to preserve the data until the new header is destructed. Otherwise, when ``copyData=true`` , the new buffer is allocated and managed as if you created a new matrix from scratch and copied the data there. That is, ``cvarrToMat(arr, true)`` is equivalent to ``cvarrToMat(arr, false).clone()`` (assuming that COI is not set). The function provides a uniform way of supporting
``CvArr`` paradigm in the code that is migrated to use new-style data structures internally. The reverse transformation, from
``Mat`` to
``CvMat`` or
.. ocv:function:: void extractImageCOI( const CvArr* arr, OutputArray coiimg, int coi=-1 )
- :param src: Source array. It should be a pointer to ``CvMat`` or ``IplImage`` .
+ :param arr: Source array. It should be a pointer to ``CvMat`` or ``IplImage`` .
- :param dst: Destination array with a single channel and the same size and depth as ``src`` .
+ :param coiimg: Destination array with a single channel and the same size and depth as ``arr`` .
- :param coi: If the parameter is ``>=0`` , it specifies the channel to extract. If it is ``<0`` and ``src`` is a pointer to ``IplImage`` with a valid COI set, the selected COI is extracted.
+ :param coi: If the parameter is ``>=0`` , it specifies the channel to extract. If it is ``<0`` and ``arr`` is a pointer to ``IplImage`` with a valid COI set, the selected COI is extracted.
The function ``extractImageCOI`` is used to extract an image COI from an old-style array and put the result to the new-style C++ matrix. As usual, the destination matrix is reallocated using ``Mat::create`` if needed.
.. ocv:function:: void insertImageCOI( InputArray coiimg, CvArr* arr, int coi=-1 )
- :param src: Source array with a single channel and the same size and depth as ``dst``.
+ :param coiimg: Source array with a single channel and the same size and depth as ``arr``.
- :param dst: Destination array, it should be a pointer to ``CvMat`` or ``IplImage``.
+ :param arr: Destination array, it should be a pointer to ``CvMat`` or ``IplImage``.
- :param coi: If the parameter is ``>=0`` , it specifies the channel to insert. If it is ``<0`` and ``dst`` is a pointer to ``IplImage`` with a valid COI set, the selected COI is extracted.
+ :param coi: If the parameter is ``>=0`` , it specifies the channel to insert. If it is ``<0`` and ``arr`` is a pointer to ``IplImage`` with a valid COI set, the selected COI is extracted.
The function ``insertImageCOI`` is used to extract an image COI from a new-style C++ matrix and put the result to the old-style array.
:param src: Input array or vector of matrices. All the matrices must have the same size and the same depth.
- :param nsrc: Number of matrices in ``src`` .
+ :param nsrcs: Number of matrices in ``src`` .
:param dst: Output array or vector of matrices. All the matrices *must be allocated* . Their size and depth must be the same as in ``src[0]`` .
- :param ndst: Number of matrices in ``dst`` .
+ :param ndsts: Number of matrices in ``dst`` .
:param fromTo: Array of index pairs specifying which channels are copied and where. ``fromTo[k*2]`` is a 0-based index of the input channel in ``src`` . ``fromTo[k*2+1]`` is an index of the output channel in ``dst`` . The continuous channel numbering is used: the first input image channels are indexed from ``0`` to ``src[0].channels()-1`` , the second input image channels are indexed from ``src[0].channels()`` to ``src[0].channels() + src[1].channels()-1``, and so on. The same scheme is used for the output image channels. As a special case, when ``fromTo[k*2]`` is negative, the corresponding output channel is filled with zero .
:param flags: Operation flags. Currently, the only supported flag is ``DFT_ROWS``, which indicates that each row of ``src1`` and ``src2`` is an independent 1D Fourier spectrum.
- :param conj: Optional flag that conjugates the second source array before the multiplication (true) or not (false).
+ :param conjB: Optional flag that conjugates the second source array before the multiplication (true) or not (false).
The function ``mulSpectrums`` performs the per-element multiplication of the two CCS-packed or complex matrices that are results of a real or complex Fourier transform.
The function, together with
:ocv:func:`dft` and
-:ocv:func:`idft` , may be used to calculate convolution (pass ``conj=false`` ) or correlation (pass ``conj=true`` ) of two arrays rapidly. When the arrays are complex, they are simply multiplied (per element) with an optional conjugation of the second-array elements. When the arrays are real, they are assumed to be CCS-packed (see
+:ocv:func:`idft` , may be used to calculate convolution (pass ``conjB=false`` ) or correlation (pass ``conjB=true`` ) of two arrays rapidly. When the arrays are complex, they are simply multiplied (per element) with an optional conjugation of the second-array elements. When the arrays are real, they are assumed to be CCS-packed (see
:ocv:func:`dft` for details).
:param aTa: Flag specifying the multiplication ordering. See the description below.
- :param delta: Optional delta matrix subtracted from ``src`` before the multiplication. When the matrix is empty ( ``delta=noArray()`` ), it is assumed to be zero, that is, nothing is subtracted. If it has the same size as ``src`` , it is simply subtracted. Otherwise, it is "repeated" (see :ocv:func:`repeat` ) to cover the full ``src`` and then subtracted. Type of the delta matrix, when it is not empty, must be the same as the type of created destination matrix. See the ``rtype`` parameter description below.
+ :param delta: Optional delta matrix subtracted from ``src`` before the multiplication. When the matrix is empty ( ``delta=noArray()`` ), it is assumed to be zero, that is, nothing is subtracted. If it has the same size as ``src`` , it is simply subtracted. Otherwise, it is "repeated" (see :ocv:func:`repeat` ) to cover the full ``src`` and then subtracted. Type of the delta matrix, when it is not empty, must be the same as the type of created destination matrix. See the ``dtype`` parameter description below.
:param scale: Optional scale factor for the matrix product.
- :param rtype: Optional type of the destination matrix. When it is negative, the destination matrix will have the same type as ``src`` . Otherwise, it will be ``type=CV_MAT_DEPTH(rtype)`` that should be either ``CV_32F`` or ``CV_64F`` .
+ :param dtype: Optional type of the destination matrix. When it is negative, the destination matrix will have the same type as ``src`` . Otherwise, it will be ``type=CV_MAT_DEPTH(dtype)`` that should be either ``CV_32F`` or ``CV_64F`` .
The function ``mulTransposed`` calculates the product of ``src`` and its transposition:
:param normType: Normalization type. See the details below.
- :param rtype: When the parameter is negative, the destination array has the same type as ``src``. Otherwise, it has the same number of channels as ``src`` and the depth ``=CV_MAT_DEPTH(rtype)`` .
+ :param dtype: When the parameter is negative, the destination array has the same type as ``src``. Otherwise, it has the same number of channels as ``src`` and the depth ``=CV_MAT_DEPTH(dtype)`` .
:param mask: Optional operation mask.
:param dst: Destination array of the same size and type as ``src`` .
- :param mtx: ``3x3`` or ``4x4`` floating-point transformation matrix.
+ :param m: ``3x3`` or ``4x4`` floating-point transformation matrix.
The function ``perspectiveTransform`` transforms every element of ``src`` by treating it as a 2D or 3D vector, in the following way:
:param src: Source array.
- :param p: Exponent of power.
+ :param power: Exponent of power.
:param dst: Destination array of the same size and type as ``src`` .
-The function ``pow`` raises every element of the input array to ``p`` :
+The function ``pow`` raises every element of the input array to ``power`` :
.. math::
- \texttt{dst} (I) = \fork{\texttt{src}(I)^p}{if \texttt{p} is integer}{|\texttt{src}(I)|^p}{otherwise}
+ \texttt{dst} (I) = \fork{\texttt{src}(I)^power}{if \texttt{power} is integer}{|\texttt{src}(I)|^power}{otherwise}
So, for a non-integer power exponent, the absolute values of input array elements are used. However, it is possible to get true values for negative values using some extra operations. In the example below, computing the 5th root of array ``src`` shows: ::
subtract(Scalar::all(0), dst, dst, mask);
-For some values of ``p`` , such as integer values, 0.5 and -0.5, specialized faster algorithms are used.
+For some values of ``power`` , such as integer values, 0.5 and -0.5, specialized faster algorithms are used.
Special values (NaN, Inf) are not handled.
.. ocv:pyfunction:: cv2.randu(dst, low, high) -> None
- :param mtx: Output array of random numbers. The array must be pre-allocated.
+ :param dst: Output array of random numbers. The array must be pre-allocated.
:param low: Inclusive lower boundary of the generated random numbers.
The template functions ``randu`` generate and return the next uniformly-distributed random value of the specified type. ``randu<int>()`` is an equivalent to ``(int)theRNG();`` , and so on. See
:ocv:class:`RNG` description.
-The second non-template variant of the function fills the matrix ``mtx`` with uniformly-distributed random numbers from the specified range:
+The second non-template variant of the function fills the matrix ``dst`` with uniformly-distributed random numbers from the specified range:
.. math::
- \texttt{low} _c \leq \texttt{mtx} (I)_c < \texttt{high} _c
+ \texttt{low} _c \leq \texttt{dst} (I)_c < \texttt{high} _c
.. seealso::
.. ocv:pyfunction:: cv2.randn(dst, mean, stddev) -> None
- :param mtx: Output array of random numbers. The array must be pre-allocated and have 1 to 4 channels.
+ :param dst: Output array of random numbers. The array must be pre-allocated and have 1 to 4 channels.
:param mean: Mean value (expectation) of the generated random numbers.
:param stddev: Standard deviation of the generated random numbers. It can be either a vector (in which case a diagonal standard deviation matrix is assumed) or a square matrix.
-The function ``randn`` fills the matrix ``mtx`` with normally distributed random numbers with the specified mean vector and the standard deviation matrix. The generated random numbers are clipped to fit the value range of the destination array data type.
+The function ``randn`` fills the matrix ``dst`` with normally distributed random numbers with the specified mean vector and the standard deviation matrix. The generated random numbers are clipped to fit the value range of the destination array data type.
.. seealso::
.. ocv:pyfunction:: cv2.randShuffle(dst[, iterFactor]) -> None
- :param mtx: Input/output numerical 1D array.
+ :param dst: Input/output numerical 1D array.
:param iterFactor: Scale factor that determines the number of random swap operations. See the details below.
:param rng: Optional random number generator used for shuffling. If it is zero, :ocv:func:`theRNG` () is used instead.
-The function ``randShuffle`` shuffles the specified 1D array by randomly choosing pairs of elements and swapping them. The number of such swap operations will be ``mtx.rows*mtx.cols*iterFactor`` .
+The function ``randShuffle`` shuffles the specified 1D array by randomly choosing pairs of elements and swapping them. The number of such swap operations will be ``dst.rows*dst.cols*iterFactor`` .
.. seealso::
.. ocv:cfunction:: void cvReduce(const CvArr* src, CvArr* dst, int dim=-1, int op=CV_REDUCE_SUM)
.. ocv:pyoldfunction:: cv.Reduce(src, dst, dim=-1, op=CV_REDUCE_SUM)-> None
- :param mtx: Source 2D matrix.
+ :param src: Source 2D matrix.
- :param vec: Destination vector. Its size and type is defined by ``dim`` and ``dtype`` parameters.
+ :param dst: Destination vector. Its size and type is defined by ``dim`` and ``dtype`` parameters.
:param dim: Dimension index along which the matrix is reduced. 0 means that the matrix is reduced to a single row. 1 means that the matrix is reduced to a single column.
- :param reduceOp: Reduction operation that could be one of the following:
+ :param rtype: Reduction operation that could be one of the following:
* **CV_REDUCE_SUM** The output is the sum of all rows/columns of the matrix.
* **CV_REDUCE_MIN** The output is the minimum (column/row-wise) of all rows/columns of the matrix.
- :param dtype: When it is negative, the destination vector will have the same type as the source matrix. Otherwise, its type will be ``CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), mtx.channels())`` .
+ :param dtype: When it is negative, the destination vector will have the same type as the source matrix. Otherwise, its type will be ``CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), src.channels())`` .
The function ``reduce`` reduces the matrix to a vector by treating the matrix rows/columns as a set of 1D vectors and performing the specified operation on the vectors until a single row/column is obtained. For example, the function can be used to compute horizontal and vertical projections of a raster image. In case of ``CV_REDUCE_SUM`` and ``CV_REDUCE_AVG`` , the output may have a larger element bit-depth to preserve accuracy. And multi-channel arrays are also supported in these two reduction modes.
.. ocv:pyoldfunction:: cv.SetIdentity(mat, value=1)-> None
- :param dst: Matrix to initialize (not necessarily square).
+ :param mtx: Matrix to initialize (not necessarily square).
:param value: Value to assign to diagonal elements.
.. math::
- \texttt{dst} (i,j)= \fork{\texttt{value}}{ if $i=j$}{0}{otherwise}
+ \texttt{mtx} (i,j)= \fork{\texttt{value}}{ if $i=j$}{0}{otherwise}
The function can also be emulated using the matrix initializers and the matrix expressions: ::
.. ocv:pyoldfunction:: cv.Split(src, dst0, dst1, dst2, dst3)-> None
- :param mtx: Source multi-channel array.
+ :param src: Source multi-channel array.
- :param mv: Destination array or vector of arrays. In the first variant of the function the number of arrays must match ``mtx.channels()`` . The arrays themselves are reallocated, if needed.
+ :param mv: Destination array or vector of arrays. In the first variant of the function the number of arrays must match ``src.channels()`` . The arrays themselves are reallocated, if needed.
The functions ``split`` split a multi-channel array into separate single-channel arrays:
.. math::
- \texttt{mv} [c](I) = \texttt{mtx} (I)_c
+ \texttt{mv} [c](I) = \texttt{src} (I)_c
If you need to extract a single channel or do some other sophisticated channel permutation, use
:ocv:func:`mixChannels` .
:param u: Computed left singular vectors
- :param v: Computed right singular vectors
+ :param V: Computed right singular vectors
:param vt: Transposed matrix of right singular values
:param u: Left singular vectors
- :param v: Right singular vectors
+ :param V: Right singular vectors
:param vt: Transposed matrix of right singular vectors.
.. ocv:pyoldfunction:: cv.Transform(src, dst, transmat, shiftvec=None)-> None
- :param src: Source array that must have as many channels (1 to 4) as ``mtx.cols`` or ``mtx.cols-1``.
+ :param src: Source array that must have as many channels (1 to 4) as ``m.cols`` or ``m.cols-1``.
- :param dst: Destination array of the same size and depth as ``src`` . It has as many channels as ``mtx.rows`` .
+ :param dst: Destination array of the same size and depth as ``src`` . It has as many channels as ``m.rows`` .
- :param mtx: Transformation ``2x2`` or ``2x3`` floating-point matrix.
+ :param m: Transformation ``2x2`` or ``2x3`` floating-point matrix.
- :param shiftvec: Optional translation vector (when ``mtx`` is ``2x2``)
+ :param shiftvec: Optional translation vector (when ``m`` is ``2x2``)
The function ``transform`` performs the matrix transformation of every element of the array ``src`` and stores the results in ``dst`` :
.. math::
- \texttt{dst} (I) = \texttt{mtx} \cdot \texttt{src} (I)
+ \texttt{dst} (I) = \texttt{m} \cdot \texttt{src} (I)
-(when ``mtx.cols=src.channels()`` ), or
+(when ``m.cols=src.channels()`` ), or
.. math::
- \texttt{dst} (I) = \texttt{mtx} \cdot [ \texttt{src} (I); 1]
+ \texttt{dst} (I) = \texttt{m} \cdot [ \texttt{src} (I); 1]
-(when ``mtx.cols=src.channels()+1`` )
+(when ``m.cols=src.channels()+1`` )
Every element of the ``N`` -channel array ``src`` is interpreted as ``N`` -element vector that is transformed using
-the ``M x N`` or ``M x (N+1)`` matrix ``mtx``
+the ``M x N`` or ``M x (N+1)`` matrix ``m``
to ``M``-element vector - the corresponding element of the destination array ``dst`` .
The function may be used for geometrical transformation of
.. ocv:cfunction:: int cvUseOptimized( int on_off )
- :param onoff: The boolean flag specifying whether the optimized code should be used (``onoff=true``) or not (``onoff=false``).
+ :param on_off: The boolean flag specifying whether the optimized code should be used (``on_off=true``) or not (``on_off=false``).
The function can be used to dynamically turn on and off optimized code (code that uses SSE2, AVX, and other instructions on the platforms that support it). It sets a global flag that is further checked by OpenCV functions. Since the flag is not checked in the inner OpenCV loops, it is only safe to call the function on the very top level in your application where you can be sure that no other OpenCV function is currently executed.
-----------------------------
Moves iterator forward by the specified offset.
-.. ocv:function:: FileNodeIterator& FileNodeIterator::operator +=( int param )
+.. ocv:function:: FileNodeIterator& FileNodeIterator::operator +=( int ofs )
:param ofs: Offset (possibly negative) to move the iterator.
-----------------------------
Moves iterator backward by the specified offset (possibly negative).
-.. ocv:function:: FileNodeIterator& FileNodeIterator::operator -=( int param )
+.. ocv:function:: FileNodeIterator& FileNodeIterator::operator -=( int ofs )
:param ofs: Offset (possibly negative) to move the iterator.
//! moves iterator to the previous node
FileNodeIterator operator -- (int);
//! moves iterator forward by the specified offset (possibly negative)
- FileNodeIterator& operator += (int);
+ FileNodeIterator& operator += (int ofs);
//! moves iterator backward by the specified offset (possibly negative)
- FileNodeIterator& operator -= (int);
+ FileNodeIterator& operator -= (int ofs);
//! reads the next maxCount elements (or less, if the sequence/mapping last element occurs earlier) to the buffer with the specified format
FileNodeIterator& readRaw( const string& fmt, uchar* vec,
.. ocv:function:: BFMatcher::BFMatcher( int normType, bool crossCheck=false )
- :param distanceType: One of ``NORM_L1``, ``NORM_L2``, ``NORM_HAMMING``, ``NORM_HAMMING2``. ``L1`` and ``L2`` norms are preferable choices for SIFT and SURF descriptors, ``NORM_HAMMING`` should be used with ORB and BRIEF, ``NORM_HAMMING2`` should be used with ORB when ``WTA_K==3`` or ``4`` (see ORB::ORB constructor description).
+ :param normType: One of ``NORM_L1``, ``NORM_L2``, ``NORM_HAMMING``, ``NORM_HAMMING2``. ``L1`` and ``L2`` norms are preferable choices for SIFT and SURF descriptors, ``NORM_HAMMING`` should be used with ORB and BRIEF, ``NORM_HAMMING2`` should be used with ORB when ``WTA_K==3`` or ``4`` (see ORB::ORB constructor description).
:param crossCheck: If it is false, this is will be default BFMatcher behaviour when it finds the k nearest neighbors for each query descriptor. If ``crossCheck==true``, then the ``knnMatch()`` method with ``k=1`` will only return pairs ``(i,j)`` such that for ``i-th`` query descriptor the ``j-th`` descriptor in the matcher's collection is the nearest and vice versa, i.e. the ``BFMathcher`` will only return consistent pairs. Such technique usually produces best results with minimal number of outliers when there are enough matches. This is alternative to the ratio test, used by D. Lowe in SIFT paper.
----------------------------------------------------------------
The constructor
-.. ocv:function:: DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector( const Ptr<AdjusterAdapter>& adjaster, int min_features=400, int max_features=500, int max_iters=5 )
+.. ocv:function:: DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector( const Ptr<AdjusterAdapter>& adjuster, int min_features=400, int max_features=500, int max_iters=5 )
:param adjuster: :ocv:class:`AdjusterAdapter` that detects features and adjusts parameters.
:param keypoints: Keypoints from the source image.
- :param outImg: Output image. Its content depends on the ``flags`` value defining what is drawn in the output image. See possible ``flags`` bit values below.
+ :param outImage: Output image. Its content depends on the ``flags`` value defining what is drawn in the output image. See possible ``flags`` bit values below.
:param color: Color of keypoints.
namespace cv
{
-
+
CV_EXPORTS bool initModule_features2d();
/*!
The Keypoint Class
-
+
The class instance stores a keypoint, i.e. a point feature found by one of many available keypoint detectors, such as
Harris corner detector, cv::FAST, cv::StarDetector, cv::SURF, cv::SIFT, cv::LDetector etc.
-
+
The keypoint is characterized by the 2D position, scale
(proportional to the diameter of the neighborhood that needs to be taken into account),
orientation and some other parameters. The keypoint neighborhood is then analyzed by another algorithm that builds a descriptor
float _response=0, int _octave=0, int _class_id=-1)
: pt(x, y), size(_size), angle(_angle),
response(_response), octave(_octave), class_id(_class_id) {}
-
+
size_t hash() const;
-
+
//! converts vector of keypoints to vector of points
static void convert(const vector<KeyPoint>& keypoints,
CV_OUT vector<Point2f>& points2f,
CV_PROP_RW float angle; //!< computed orientation of the keypoint (-1 if not applicable)
CV_PROP_RW float response; //!< the response by which the most strong keypoints have been selected. Can be used for the further sorting or subsampling
CV_PROP_RW int octave; //!< octave (pyramid layer) from which the keypoint has been extracted
- CV_PROP_RW int class_id; //!< object class (if the keypoints need to be clustered by an object they belong to)
+ CV_PROP_RW int class_id; //!< object class (if the keypoints need to be clustered by an object they belong to)
};
-
+
//! writes vector of keypoints to the file storage
CV_EXPORTS void write(FileStorage& fs, const string& name, const vector<KeyPoint>& keypoints);
//! reads vector of keypoints from the specified file storage node
-CV_EXPORTS void read(const FileNode& node, CV_OUT vector<KeyPoint>& keypoints);
+CV_EXPORTS void read(const FileNode& node, CV_OUT vector<KeyPoint>& keypoints);
/*
* A class filters a vector of keypoints.
* Remove duplicated keypoints.
*/
static void removeDuplicated( vector<KeyPoint>& keypoints );
-
+
/*
* Retain the specified number of the best keypoints (according to the response)
*/
static void retainBest(vector<KeyPoint>& keypoints, int npoints);
};
-
+
/************************************ Base Classes ************************************/
/*
{
public:
virtual ~FeatureDetector();
-
+
/*
* Detect keypoints in an image.
* image The image.
* matrix with non-zero values in the region of interest.
*/
CV_WRAP void detect( const Mat& image, CV_OUT vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;
-
+
/*
* Detect keypoints in an image set.
* images Image collection.
* masks Masks for image set. masks[i] is a mask for images[i].
*/
void detect( const vector<Mat>& images, vector<vector<KeyPoint> >& keypoints, const vector<Mat>& masks=vector<Mat>() ) const;
-
+
// Return true if detector object is empty
CV_WRAP virtual bool empty() const;
-
+
// Create feature detector by detector name.
CV_WRAP static Ptr<FeatureDetector> create( const string& detectorType );
-
+
protected:
virtual void detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const = 0;
-
+
/*
* Remove keypoints that are not in the mask.
* Helper function, useful when wrapping a library call for keypoint detection that
*/
static void removeInvalidPoints( const Mat& mask, vector<KeyPoint>& keypoints );
};
-
-
+
+
/*
* Abstract base class for computing descriptors for image keypoints.
*
{
public:
virtual ~DescriptorExtractor();
-
+
/*
* Compute the descriptors for a set of keypoints in an image.
* image The image.
* descriptors Copmputed descriptors. Row i is the descriptor for keypoint i.
*/
CV_WRAP void compute( const Mat& image, CV_OUT CV_IN_OUT vector<KeyPoint>& keypoints, CV_OUT Mat& descriptors ) const;
-
+
/*
* Compute the descriptors for a keypoints collection detected in image collection.
* images Image collection.
* descriptors Descriptor collection. descriptors[i] are descriptors computed for set keypoints[i].
*/
void compute( const vector<Mat>& images, vector<vector<KeyPoint> >& keypoints, vector<Mat>& descriptors ) const;
-
+
CV_WRAP virtual int descriptorSize() const = 0;
CV_WRAP virtual int descriptorType() const = 0;
-
+
CV_WRAP virtual bool empty() const;
-
+
CV_WRAP static Ptr<DescriptorExtractor> create( const string& descriptorExtractorType );
-
+
protected:
virtual void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const = 0;
-
+
/*
* Remove keypoints within borderPixels of an image edge.
*/
static void removeBorderKeypoints( vector<KeyPoint>& keypoints,
Size imageSize, int borderSize );
};
-
-
-
+
+
+
/*
* Abstract base class for simultaneous 2D feature detection descriptor extraction.
*/
* mask Mask specifying where to look for keypoints (optional). Must be a char
* matrix with non-zero values in the region of interest.
* useProvidedKeypoints If true, the method will skip the detection phase and will compute
- * descriptors for the provided keypoints
+ * descriptors for the provided keypoints
*/
CV_WRAP_AS(detectAndCompute) virtual void operator()( InputArray image, InputArray mask,
CV_OUT vector<KeyPoint>& keypoints,
OutputArray descriptors,
bool useProvidedKeypoints=false ) const = 0;
-
+
// Create feature detector and descriptor extractor by name.
static Ptr<Feature2D> create( const string& name );
};
-
-
+
+
/*!
ORB implementation.
*/
// Compute the ORB features and descriptors on an image
void operator()( InputArray image, InputArray mask, vector<KeyPoint>& keypoints,
OutputArray descriptors, bool useProvidedKeypoints=false ) const;
-
+
AlgorithmInfo* info() const;
-
+
protected:
void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const;
void detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;
-
+
CV_PROP_RW int nfeatures;
CV_PROP_RW double scaleFactor;
CV_PROP_RW int nlevels;
CV_PROP_RW int scoreType;
CV_PROP_RW int patchSize;
};
-
+
typedef ORB OrbFeatureDetector;
typedef ORB OrbDescriptorExtractor;
/*!
Maximal Stable Extremal Regions class.
-
+
The class implements MSER algorithm introduced by J. Matas.
Unlike SIFT, SURF and many other detectors in OpenCV, this is salient region detector,
not the salient point detector.
-
+
It returns the regions, each of those is encoded as a contour.
*/
class CV_EXPORTS_W MSER : public FeatureDetector
double _max_variation=0.25, double _min_diversity=.2,
int _max_evolution=200, double _area_threshold=1.01,
double _min_margin=0.003, int _edge_blur_size=5 );
-
+
//! the operator that extracts the MSERs from the image or the specific part of it
CV_WRAP_AS(detect) void operator()( const Mat& image, CV_OUT vector<vector<Point> >& msers,
- const Mat& mask=Mat() ) const;
+ const Mat& mask=Mat() ) const;
AlgorithmInfo* info() const;
-
+
protected:
void detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;
-
+
int delta;
int minArea;
int maxArea;
double minMargin;
int edgeBlurSize;
};
-
+
typedef MSER MserFeatureDetector;
/*!
The "Star" Detector.
-
+
The class implements the keypoint detector introduced by K. Konolige.
*/
class CV_EXPORTS_W StarDetector : public FeatureDetector
int _lineThresholdProjected=10,
int _lineThresholdBinarized=8,
int _suppressNonmaxSize=5);
-
+
//! finds the keypoints in the image
CV_WRAP_AS(detect) void operator()(const Mat& image,
CV_OUT vector<KeyPoint>& keypoints) const;
-
+
AlgorithmInfo* info() const;
-
+
protected:
void detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;
-
+
int maxSize;
int responseThreshold;
int lineThresholdProjected;
public:
CV_WRAP FastFeatureDetector( int threshold=10, bool nonmaxSuppression=true );
AlgorithmInfo* info() const;
-
+
protected:
virtual void detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;
Params params;
};
-
+
class CV_EXPORTS DenseFeatureDetector : public FeatureDetector
{
public:
double initFeatureScale;
int featureScaleLevels;
double featureScaleMul;
-
+
int initXyStep;
int initImgBound;
-
+
bool varyXyStepWithScale;
bool varyImgBoundWithScale;
};
CV_WRAP GridAdaptedFeatureDetector( const Ptr<FeatureDetector>& detector,
int maxTotalKeypoints=1000,
int gridRows=4, int gridCols=4 );
-
+
// TODO implement read/write
virtual bool empty() const;
public:
// maxLevel - The 0-based index of the last pyramid layer
CV_WRAP PyramidAdaptedFeatureDetector( const Ptr<FeatureDetector>& detector, int maxLevel=2 );
-
+
// TODO implement read/write
virtual bool empty() const;
*/
class CV_EXPORTS AdjusterAdapter: public FeatureDetector
{
-public:
+public:
/** pure virtual interface
*/
virtual ~AdjusterAdapter() {}
{
public:
- /** \param adjaster an AdjusterAdapter that will do the detection and parameter adjustment
+ /** \param adjuster an AdjusterAdapter that will do the detection and parameter adjustment
* \param max_features the maximum desired number of features
* \param max_iters the maximum number of times to try to adjust the feature detector params
* for the FastAdjuster this can be high, but with Star or Surf this can get time consuming
* \param min_features the minimum desired features
*/
- DynamicAdaptedFeatureDetector( const Ptr<AdjusterAdapter>& adjaster, int min_features=400, int max_features=500, int max_iters=5 );
+ DynamicAdaptedFeatureDetector( const Ptr<AdjusterAdapter>& adjuster, int min_features=400, int max_features=500, int max_iters=5 );
virtual bool empty() const;
/****************************************************************************************\
* Distance *
\****************************************************************************************/
-
+
template<typename T>
struct CV_EXPORTS Accumulator
{
enum { normType = NORM_L2SQR };
typedef T ValueType;
typedef typename Accumulator<T>::Type ResultType;
-
+
ResultType operator()( const T* a, const T* b, int size ) const
{
return normL2Sqr<ValueType, ResultType>(a, b, size);
enum { normType = NORM_L2 };
typedef T ValueType;
typedef typename Accumulator<T>::Type ResultType;
-
+
ResultType operator()( const T* a, const T* b, int size ) const
{
return (ResultType)sqrt((double)normL2Sqr<ValueType, ResultType>(a, b, size));
enum { normType = NORM_L1 };
typedef T ValueType;
typedef typename Accumulator<T>::Type ResultType;
-
+
ResultType operator()( const T* a, const T* b, int size ) const
{
return normL1<ValueType, ResultType>(a, b, size);
enum { normType = NORM_HAMMING };
typedef unsigned char ValueType;
typedef int ResultType;
-
+
/** this will count the bits in a ^ b
*/
ResultType operator()( const unsigned char* a, const unsigned char* b, int size ) const
enum { normType = NORM_HAMMING + (cellsize>1) };
typedef unsigned char ValueType;
typedef int ResultType;
-
+
ResultType operator()( const unsigned char* a, const unsigned char* b, int size ) const
{
return normHamming(a, b, size, cellsize);
}
-};
-
+};
+
/****************************************************************************************\
* DMatch *
\****************************************************************************************/
virtual void train();
virtual bool isMaskSupported() const;
-
+
virtual Ptr<DescriptorMatcher> clone( bool emptyTrainData=false ) const;
protected:
:param ksize: Aperture size. See :ocv:func:`getGaussianKernel` for details.
- :param sigmaX: Gaussian sigma in the horizontal direction. See :ocv:func:`getGaussianKernel` for details.
+ :param sigma1: Gaussian sigma in the horizontal direction. See :ocv:func:`getGaussianKernel` for details.
- :param sigmaY: Gaussian sigma in the vertical direction. If 0, then :math:`\texttt{sigmaY}\leftarrow\texttt{sigmaX}` .
+ :param sigma2: Gaussian sigma in the vertical direction. If 0, then :math:`\texttt{sigma2}\leftarrow\texttt{sigma1}` .
:param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see :ocv:func:`borderInterpolate`.
:param dst: Destination image with the same size and type as ``src`` .
- :param ksize: Gaussian kernel size. ``ksize.width`` and ``ksize.height`` can differ but they both must be positive and odd. If they are zeros, they are computed from ``sigmaX`` and ``sigmaY`` .
+ :param ksize: Gaussian kernel size. ``ksize.width`` and ``ksize.height`` can differ but they both must be positive and odd. If they are zeros, they are computed from ``sigma1`` and ``sigma2`` .
- :param sigmaX: Gaussian kernel standard deviation in X direction.
+ :param sigma1: Gaussian kernel standard deviation in X direction.
- :param sigmaY: Gaussian kernel standard deviation in Y direction. If ``sigmaY`` is zero, it is set to be equal to ``sigmaX`` . If they are both zeros, they are computed from ``ksize.width`` and ``ksize.height``, respectively. See :ocv:func:`getGaussianKernel` for details. To fully control the result regardless of possible future modification of all this semantics, you are recommended to specify all of ``ksize`` , ``sigmaX`` , and ``sigmaY`` .
+ :param sigma2: Gaussian kernel standard deviation in Y direction. If ``sigma2`` is zero, it is set to be equal to ``sigma1`` . If they are both zeros, they are computed from ``ksize.width`` and ``ksize.height``, respectively. See :ocv:func:`getGaussianKernel` for details. To fully control the result regardless of possible future modification of all this semantics, you are recommended to specify all of ``ksize`` , ``sigma1`` , and ``sigma2`` .
:param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see :ocv:func:`borderInterpolate`.
.. ocv:function:: static bool gpu::TargetArchs::builtWith( FeatureSet feature_set )
- :param feature: Feature to be checked. See :ocv:class:`gpu::FeatureSet`.
+ :param feature_set: Features to be checked. See :ocv:class:`gpu::FeatureSet`.
There is a set of methods to check whether the module contains intermediate (PTX) or binary GPU code for the given architecture(s):
.. ocv:function:: bool gpu::DeviceInfo::supports( FeatureSet feature_set ) const
- :param feature: Feature to be checked. See :ocv:class:`gpu::FeatureSet`.
+ :param feature_set: Features to be checked. See :ocv:class:`gpu::FeatureSet`.
This function returns ``true`` if the device has the specified GPU feature. Otherwise, it returns ``false`` .
.. ocv:function:: void gpu::transpose( const GpuMat& src1, GpuMat& dst, Stream& stream=Stream::Null() )
- :param src: Source matrix. 1-, 4-, 8-byte element sizes are supported for now (CV_8UC1, CV_8UC4, CV_16UC2, CV_32FC1, etc).
+ :param src1: Source matrix. 1-, 4-, 8-byte element sizes are supported for now (CV_8UC1, CV_8UC4, CV_16UC2, CV_32FC1, etc).
:param dst: Destination matrix.
.. ocv:function:: void gpu::flip( const GpuMat& a, GpuMat& b, int flipCode, Stream& stream=Stream::Null() )
- :param src: Source matrix. Supports 1, 3 and 4 channels images with ``CV_8U``, ``CV_16U``, ``CV_32S`` or ``CV_32F`` depth.
+ :param a: Source matrix. Supports 1, 3 and 4 channels images with ``CV_8U``, ``CV_16U``, ``CV_32S`` or ``CV_32F`` depth.
- :param dst: Destination matrix.
+ :param b: Destination matrix.
:param flipCode: Flip mode for the source:
------------------
Computes magnitudes of complex matrix elements.
-.. ocv:function:: void gpu::magnitude( const GpuMat& x, GpuMat& magnitude, Stream& stream=Stream::Null() )
+.. ocv:function:: void gpu::magnitude( const GpuMat& xy, GpuMat& magnitude, Stream& stream=Stream::Null() )
.. ocv:function:: void gpu::magnitude(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, Stream& stream = Stream::Null())
---------------------
Computes squared magnitudes of complex matrix elements.
-.. ocv:function:: void gpu::magnitudeSqr( const GpuMat& x, GpuMat& magnitude, Stream& stream=Stream::Null() )
+.. ocv:function:: void gpu::magnitudeSqr( const GpuMat& xy, GpuMat& magnitude, Stream& stream=Stream::Null() )
.. ocv:function:: void gpu::magnitudeSqr(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, Stream& stream = Stream::Null())
.. ocv:function:: void gpu::add( const GpuMat& a, const Scalar& sc, GpuMat& c, const GpuMat& mask=GpuMat(), int dtype=-1, Stream& stream=Stream::Null() )
- :param src1: First source matrix.
+ :param a: First source matrix.
+
+ :param b: Second source matrix to be added to ``a`` . Matrix should have the same size and type as ``a`` .
- :param src2: Second source matrix or a scalar to be added to ``src1`` . Matrix should have the same size and type as ``src1`` .
+ :param sc: A scalar to be added to ``a`` .
+
+ :param c: Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by ``dtype`` or ``a`` depth.
- :param dst: Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by ``dtype`` or ``src1`` depth.
-
:param mask: Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed.
-
+
:param dtype: Optional depth of the output array.
:param stream: Stream for the asynchronous version.
.. ocv:function:: void gpu::subtract( const GpuMat& a, const Scalar& sc, GpuMat& c, const GpuMat& mask=GpuMat(), int dtype=-1, Stream& stream=Stream::Null() )
- :param src1: First source matrix.
+ :param a: First source matrix.
+
+ :param b: Second source matrix to be added to ``a`` . Matrix should have the same size and type as ``a`` .
+
+ :param sc: A scalar to be added to ``a`` .
- :param src2: Second source matrix or a scalar to be added to ``src1`` . Matrix should have the same size and type as ``src1`` .
+ :param c: Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by ``dtype`` or ``a`` depth.
- :param dst: Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by ``dtype`` or ``src1`` depth.
-
:param mask: Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed.
-
+
:param dtype: Optional depth of the output array.
:param stream: Stream for the asynchronous version.
.. ocv:function:: void gpu::multiply( const GpuMat& a, const Scalar& sc, GpuMat& c, double scale=1, int dtype=-1, Stream& stream=Stream::Null() )
- :param src1: First source matrix.
+ :param a: First source matrix.
- :param src2: Second source matrix or a scalar to be multiplied by ``src1`` elements.
+ :param b: Second source matrix to be multiplied by ``a`` elements.
- :param dst: Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by ``dtype`` or ``src1`` depth.
+ :param sc: A scalar to be multiplied by ``a`` elements.
+
+ :param c: Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by ``dtype`` or ``a`` depth.
:param scale: Optional scale factor.
-
+
:param dtype: Optional depth of the output array.
:param stream: Stream for the asynchronous version.
.. ocv:function:: void gpu::divide( const GpuMat& a, const GpuMat& b, GpuMat& c, double scale=1, int dtype=-1, Stream& stream=Stream::Null() )
-.. ocv:function:: void gpu::divide( double scale, const GpuMat& src2, GpuMat& dst, int dtype=-1, Stream& stream=Stream::Null() )
+.. ocv:function:: void gpu::divide(const GpuMat& a, const Scalar& sc, GpuMat& c, double scale = 1, int dtype = -1, Stream& stream = Stream::Null())
- :param src1: First source matrix or a scalar.
+.. ocv:function:: void gpu::divide( double scale, const GpuMat& b, GpuMat& c, int dtype=-1, Stream& stream=Stream::Null() )
- :param src2: Second source matrix or a scalar. The ``src1`` elements are divided by it.
+ :param a: First source matrix or a scalar.
- :param dst: Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by ``dtype`` or ``src1`` depth.
+ :param b: Second source matrix. The ``a`` elements are divided by it.
+
+ :param sc: A scalar to be divided by the elements of ``a`` matrix.
+
+ :param c: Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by ``dtype`` or ``a`` depth.
:param scale: Optional scale factor.
-
+
:param dtype: Optional depth of the output array.
:param stream: Stream for the asynchronous version.
:param alpha: Weight for the first array elements.
:param src2: Second source array of the same size and channel number as ``src1`` .
-
+
:param beta: Weight for the second array elements.
:param dst: Destination array that has the same size and number of channels as the input arrays.
-
+
:param gamma: Scalar added to each sum.
-
+
:param dtype: Optional depth of the destination array. When both input arrays have the same depth, ``dtype`` can be set to ``-1``, which will be equivalent to ``src1.depth()``.
:param stream: Stream for the asynchronous version.
.. ocv:function:: void gpu::exp( const GpuMat& a, GpuMat& b, Stream& stream=Stream::Null() )
- :param src: Source matrix. Supports ``CV_8U`` , ``CV_16U`` , ``CV_16S`` and ``CV_32F`` depth.
+ :param a: Source matrix. Supports ``CV_8U`` , ``CV_16U`` , ``CV_16S`` and ``CV_32F`` depth.
- :param dst: Destination matrix with the same size and type as ``src`` .
+ :param b: Destination matrix with the same size and type as ``a`` .
:param stream: Stream for the asynchronous version.
.. ocv:function:: void gpu::log( const GpuMat& a, GpuMat& b, Stream& stream=Stream::Null() )
- :param src: Source matrix. Supports ``CV_8U`` , ``CV_16U`` , ``CV_16S`` and ``CV_32F`` depth.
+ :param a: Source matrix. Supports ``CV_8U`` , ``CV_16U`` , ``CV_16S`` and ``CV_32F`` depth.
- :param dst: Destination matrix with the same size and type as ``src`` .
+ :param b: Destination matrix with the same size and type as ``a`` .
:param stream: Stream for the asynchronous version.
.. ocv:function:: void gpu::absdiff( const GpuMat& a, const Scalar& s, GpuMat& c, Stream& stream=Stream::Null() )
- :param src1: First source matrix.
+ :param a: First source matrix.
- :param src2: Second source matrix or a scalar to be added to ``src1`` .
+ :param b: Second source matrix to be added to ``a`` .
- :param dst: Destination matrix with the same size and type as ``src1`` .
+ :param s: A scalar to be added to ``a`` .
+
+ :param c: Destination matrix with the same size and type as ``a`` .
:param stream: Stream for the asynchronous version.
.. ocv:function:: void gpu::compare( const GpuMat& a, const GpuMat& b, GpuMat& c, int cmpop, Stream& stream=Stream::Null() )
- :param src1: First source matrix.
+.. ocv:function:: void gpu::compare(const GpuMat& a, Scalar sc, GpuMat& c, int cmpop, Stream& stream = Stream::Null())
- :param src2: Second source matrix with the same size and type as ``src1`` .
+ :param a: First source matrix.
+
+ :param b: Second source matrix with the same size and type as ``a`` .
+
+ :param sc: A scalar to be compared with ``a`` .
- :param dst: Destination matrix with the same size as ``src1`` and the ``CV_8UC1`` type.
+ :param c: Destination matrix with the same size as ``a`` and the ``CV_8UC1`` type.
:param cmpop: Flag specifying the relation between the elements to be checked:
- * **CMP_EQ:** ``src1(.) == src2(.)``
- * **CMP_GT:** ``src1(.) < src2(.)``
- * **CMP_GE:** ``src1(.) <= src2(.)``
- * **CMP_LT:** ``src1(.) < src2(.)``
- * **CMP_LE:** ``src1(.) <= src2(.)``
- * **CMP_NE:** ``src1(.) != src2(.)``
+ * **CMP_EQ:** ``a(.) == b(.)``
+ * **CMP_GT:** ``a(.) < b(.)``
+ * **CMP_GE:** ``a(.) <= b(.)``
+ * **CMP_LT:** ``a(.) < b(.)``
+ * **CMP_LE:** ``a(.) <= b(.)``
+ * **CMP_NE:** ``a(.) != b(.)``
:param stream: Stream for the asynchronous version.
\r
//! computes magnitude of complex (x(i).re, x(i).im) vector\r
//! supports only CV_32FC2 type\r
-CV_EXPORTS void magnitude(const GpuMat& x, GpuMat& magnitude, Stream& stream = Stream::Null());\r
+CV_EXPORTS void magnitude(const GpuMat& xy, GpuMat& magnitude, Stream& stream = Stream::Null());\r
\r
//! computes squared magnitude of complex (x(i).re, x(i).im) vector\r
//! supports only CV_32FC2 type\r
-CV_EXPORTS void magnitudeSqr(const GpuMat& x, GpuMat& magnitude, Stream& stream = Stream::Null());\r
+CV_EXPORTS void magnitudeSqr(const GpuMat& xy, GpuMat& magnitude, Stream& stream = Stream::Null());\r
\r
//! computes magnitude of each (x(i), y(i)) vector\r
//! supports only floating-point source\r
//! computes element-wise weighted quotient of matrix and scalar (c = a / s)\r
CV_EXPORTS void divide(const GpuMat& a, const Scalar& sc, GpuMat& c, double scale = 1, int dtype = -1, Stream& stream = Stream::Null());\r
//! computes element-wise weighted reciprocal of an array (dst = scale/src2)\r
-CV_EXPORTS void divide(double scale, const GpuMat& src2, GpuMat& dst, int dtype = -1, Stream& stream = Stream::Null());\r
+CV_EXPORTS void divide(double scale, const GpuMat& b, GpuMat& c, int dtype = -1, Stream& stream = Stream::Null());\r
\r
//! computes the weighted sum of two arrays (dst = alpha*src1 + beta*src2 + gamma)\r
CV_EXPORTS void addWeighted(const GpuMat& src1, double alpha, const GpuMat& src2, double beta, double gamma, GpuMat& dst,\r
\r
//! compares elements of two arrays (c = a <cmpop> b)\r
CV_EXPORTS void compare(const GpuMat& a, const GpuMat& b, GpuMat& c, int cmpop, Stream& stream = Stream::Null());\r
-CV_EXPORTS void compare(const GpuMat& a, Scalar sc, GpuMat& dst, int cmpop, Stream& stream = Stream::Null());\r
+CV_EXPORTS void compare(const GpuMat& a, Scalar sc, GpuMat& c, int cmpop, Stream& stream = Stream::Null());\r
\r
//! performs per-elements bit-wise inversion\r
CV_EXPORTS void bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask=GpuMat(), Stream& stream = Stream::Null());\r
:param text: Text to write on an image.
- :param location: Point(x,y) where the text should start on an image.
+ :param org: Point(x,y) where the text should start on an image.
:param font: Font to use to draw a text.
:param window_name: Name of the window.
- :param callbackOpenGL: Pointer to the function to be called every frame. This function should be prototyped as ``void Foo(void*)`` .
+ :param onOpenGlDraw: Pointer to the function to be called every frame. This function should be prototyped as ``void Foo(void*)`` .
:param userdata: Pointer passed to the callback function. *(Optional)*
.. ocv:cfunction:: void cvSetMouseCallback( const char* window_name, CvMouseCallback on_mouse, void* param=NULL )
.. ocv:pyoldfunction:: cv.SetMouseCallback(windowName, onMouse, param=None) -> None
- :param name: Window name
+ :param window_name: Window name
- :param onMouse: Mouse callback. See OpenCV samples, such as http://code.opencv.org/svn/opencv/trunk/opencv/samples/cpp/ffilldemo.cpp, on how to specify and use the callback.
+ :param on_mouse: Mouse callback. See OpenCV samples, such as http://code.opencv.org/svn/opencv/trunk/opencv/samples/cpp/ffilldemo.cpp, on how to specify and use the callback.
:param param: The optional parameter passed to the callback.
:param blockSize: Neighborhood size (see details below).
- :param apertureSize: Aperture parameter for the :ocv:func:`Sobel` operator.
+ :param ksize: Aperture parameter for the :ocv:func:`Sobel` operator.
:param borderType: Pixel extrapolation method. See :ocv:func:`borderInterpolate` .
:param blockSize: Neighborhood size (see the details on :ocv:func:`cornerEigenValsAndVecs` ).
- :param apertureSize: Aperture parameter for the :ocv:func:`Sobel` operator.
+ :param ksize: Aperture parameter for the :ocv:func:`Sobel` operator.
:param k: Harris detector free parameter. See the formula below.
:param blockSize: Neighborhood size (see the details on :ocv:func:`cornerEigenValsAndVecs` ).
- :param apertureSize: Aperture parameter for the :ocv:func:`Sobel` operator.
+ :param ksize: Aperture parameter for the :ocv:func:`Sobel` operator.
:param borderType: Pixel extrapolation method. See :ocv:func:`borderInterpolate` .
:param image: Input 8-bit or floating-point 32-bit, single-channel image.
- :param eigImage: The parameter is ignored.
+ :param eig_image: The parameter is ignored.
- :param tempImage: The parameter is ignored.
+ :param temp_image: The parameter is ignored.
:param corners: Output vector of detected corners.
:param circles: Output vector of found circles. Each vector is encoded as a 3-element floating-point vector :math:`(x, y, radius)` .
- :param circleStorage: In C function this is a memory storage that will contain the output sequence of found circles.
+ :param circle_storage: In C function this is a memory storage that will contain the output sequence of found circles.
:param method: Detection method to use. Currently, the only implemented method is ``CV_HOUGH_GRADIENT`` , which is basically *21HT* , described in [Yuen90]_.
:param dst: Output image that has the type ``CV_32F`` and the same size as ``src`` .
- :param apertureSize: Aperture size of the :ocv:func:`Sobel` .
+ :param ksize: Aperture size of the :ocv:func:`Sobel` .
:param borderType: Pixel extrapolation method. See :ocv:func:`borderInterpolate` .
:param ksize: Aperture size. See :ocv:func:`getGaussianKernel` .
- :param sigmaX: Gaussian sigma in the horizontal direction. See :ocv:func:`getGaussianKernel` .
+ :param sigma1: Gaussian sigma in the horizontal direction. See :ocv:func:`getGaussianKernel` .
- :param sigmaY: Gaussian sigma in the vertical direction. If 0, then :math:`\texttt{sigmaY}\leftarrow\texttt{sigmaX}` .
+ :param sigma2: Gaussian sigma in the vertical direction. If 0, then :math:`\texttt{sigma2}\leftarrow\texttt{sigma1}` .
:param borderType: Border type to use. See :ocv:func:`borderInterpolate` .
----------------------
Creates a non-separable linear filter engine.
-.. ocv:function:: Ptr<FilterEngine> createLinearFilter( int srcType, int dstType, InputArray kernel, Point _anchor=Point(-1,-1), double delta=0, int _rowBorderType=BORDER_DEFAULT, int _columnBorderType=-1, const Scalar& _borderValue=Scalar() )
+.. ocv:function:: Ptr<FilterEngine> createLinearFilter( int srcType, int dstType, InputArray kernel, Point _anchor=Point(-1,-1), double delta=0, int rowBorderType=BORDER_DEFAULT, int columnBorderType=-1, const Scalar& borderValue=Scalar() )
.. ocv:function:: Ptr<BaseFilter> getLinearFilter(int srcType, int dstType, InputArray kernel, Point anchor=Point(-1,-1), double delta=0, int bits=0)
--------------------------
Creates an engine for non-separable morphological operations.
-.. ocv:function:: Ptr<FilterEngine> createMorphologyFilter( int op, int type, InputArray kernel, Point anchor=Point(-1,-1), int _rowBorderType=BORDER_CONSTANT, int _columnBorderType=-1, const Scalar& _borderValue=morphologyDefaultBorderValue() )
+.. ocv:function:: Ptr<FilterEngine> createMorphologyFilter( int op, int type, InputArray kernel, Point anchor=Point(-1,-1), int rowBorderType=BORDER_CONSTANT, int columnBorderType=-1, const Scalar& borderValue=morphologyDefaultBorderValue() )
.. ocv:function:: Ptr<BaseFilter> getMorphologyFilter( int op, int type, InputArray kernel, Point anchor=Point(-1,-1) )
:param type: Input/output image type. The number of channels can be arbitrary. The depth should be one of ``CV_8U``, ``CV_16U``, ``CV_16S``, ``CV_32F` or ``CV_64F``.
- :param element: 2D 8-bit structuring element for a morphological operation. Non-zero elements indicate the pixels that belong to the element.
+ :param kernel: 2D 8-bit structuring element for a morphological operation. Non-zero elements indicate the pixels that belong to the element.
- :param esize: Horizontal or vertical structuring element size for separable morphological operations.
+ :param ksize: Horizontal or vertical structuring element size for separable morphological operations.
:param anchor: Anchor position within the structuring element. Negative values mean that the anchor is at the kernel center.
-------------------------------
Creates an engine for a separable linear filter.
-.. ocv:function:: Ptr<FilterEngine> createSeparableLinearFilter( int srcType, int dstType, InputArray rowKernel, InputArray columnKernel, Point _anchor=Point(-1,-1), double delta=0, int _rowBorderType=BORDER_DEFAULT, int _columnBorderType=-1, const Scalar& _borderValue=Scalar() )
+.. ocv:function:: Ptr<FilterEngine> createSeparableLinearFilter( int srcType, int dstType, InputArray rowKernel, InputArray columnKernel, Point anchor=Point(-1,-1), double delta=0, int rowBorderType=BORDER_DEFAULT, int columnBorderType=-1, const Scalar& borderValue=Scalar() )
.. ocv:function:: Ptr<BaseColumnFilter> getLinearColumnFilter( int bufType, int dstType, InputArray kernel, int anchor, int symmetryType, double delta=0, int bits=0 )
:param anchor: Anchor position within the element. The default value :math:`(-1, -1)` means that the anchor is at the center. Note that only the shape of a cross-shaped element depends on the anchor position. In other cases the anchor just regulates how much the result of the morphological operation is shifted.
- :param anchorX: x-coordinate of the anchor
+ :param anchor_x: x-coordinate of the anchor
- :param anchorY: y-coordinate of the anchor
+ :param anchor_y: y-coordinate of the anchor
:param values: integer array of ``cols``*``rows`` elements that specifies the custom shape of the structuring element, when ``shape=CV_SHAPE_CUSTOM``.
when ``ddepth=-1``, the destination image will have the same depth as the source.
- :param rowKernel: Coefficients for filtering each row.
+ :param kernelX: Coefficients for filtering each row.
- :param columnKernel: Coefficients for filtering each column.
+ :param kernelY: Coefficients for filtering each column.
:param anchor: Anchor position within the kernel. The default value :math:`(-1, 1)` means that the anchor is at the kernel center.
:param borderType: Pixel extrapolation method. See :ocv:func:`borderInterpolate` for details.
-The function applies a separable linear filter to the image. That is, first, every row of ``src`` is filtered with the 1D kernel ``rowKernel`` . Then, every column of the result is filtered with the 1D kernel ``columnKernel`` . The final result shifted by ``delta`` is stored in ``dst`` .
+The function applies a separable linear filter to the image. That is, first, every row of ``src`` is filtered with the 1D kernel ``kernelX`` . Then, every column of the result is filtered with the 1D kernel ``kernelY`` . The final result shifted by ``delta`` is stored in ``dst`` .
.. seealso::
:param smoothtype: Type of the smoothing:
- * **CV_BLUR_NO_SCALE** linear convolution with :math:`\texttt{param1}\times\texttt{param2}` box kernel (all 1's). If you want to smooth different pixels with different-size box kernels, you can use the integral image that is computed using :ocv:func:`integral`
+ * **CV_BLUR_NO_SCALE** linear convolution with :math:`\texttt{size1}\times\texttt{size2}` box kernel (all 1's). If you want to smooth different pixels with different-size box kernels, you can use the integral image that is computed using :ocv:func:`integral`
- * **CV_BLUR** linear convolution with :math:`\texttt{param1}\times\texttt{param2}` box kernel (all 1's) with subsequent scaling by :math:`1/(\texttt{param1}\cdot\texttt{param2})`
+ * **CV_BLUR** linear convolution with :math:`\texttt{size1}\times\texttt{size2}` box kernel (all 1's) with subsequent scaling by :math:`1/(\texttt{size1}\cdot\texttt{size2})`
- * **CV_GAUSSIAN** linear convolution with a :math:`\texttt{param1}\times\texttt{param2}` Gaussian kernel
+ * **CV_GAUSSIAN** linear convolution with a :math:`\texttt{size1}\times\texttt{size2}` Gaussian kernel
- * **CV_MEDIAN** median filter with a :math:`\texttt{param1}\times\texttt{param1}` square aperture
+ * **CV_MEDIAN** median filter with a :math:`\texttt{size1}\times\texttt{size1}` square aperture
- * **CV_BILATERAL** bilateral filter with a :math:`\texttt{param1}\times\texttt{param1}` square aperture, color sigma= ``param3`` and spatial sigma= ``param4`` . If ``param1=0`` , the aperture square side is set to ``cvRound(param4*1.5)*2+1`` . Information about bilateral filtering can be found at http://www.dai.ed.ac.uk/CVonline/LOCAL\_COPIES/MANDUCHI1/Bilateral\_Filtering.html
+ * **CV_BILATERAL** bilateral filter with a :math:`\texttt{size1}\times\texttt{size1}` square aperture, color sigma= ``sigma1`` and spatial sigma= ``sigma2`` . If ``size1=0`` , the aperture square side is set to ``cvRound(sigma2*1.5)*2+1`` . Information about bilateral filtering can be found at http://www.dai.ed.ac.uk/CVonline/LOCAL\_COPIES/MANDUCHI1/Bilateral\_Filtering.html
- :param param1: The first parameter of the smoothing operation, the aperture width. Must be a positive odd number (1, 3, 5, ...)
+ :param size1: The first parameter of the smoothing operation, the aperture width. Must be a positive odd number (1, 3, 5, ...)
- :param param2: The second parameter of the smoothing operation, the aperture height. Ignored by ``CV_MEDIAN`` and ``CV_BILATERAL`` methods. In the case of simple scaled/non-scaled and Gaussian blur if ``param2`` is zero, it is set to ``param1`` . Otherwise it must be a positive odd number.
+ :param size2: The second parameter of the smoothing operation, the aperture height. Ignored by ``CV_MEDIAN`` and ``CV_BILATERAL`` methods. In the case of simple scaled/non-scaled and Gaussian blur if ``size2`` is zero, it is set to ``size1`` . Otherwise it must be a positive odd number.
- :param param3: In the case of a Gaussian parameter this parameter may specify Gaussian :math:`\sigma` (standard deviation). If it is zero, it is calculated from the kernel size:
+ :param sigma1: In the case of a Gaussian parameter this parameter may specify Gaussian :math:`\sigma` (standard deviation). If it is zero, it is calculated from the kernel size:
.. math::
- \sigma = 0.3 (n/2 - 1) + 0.8 \quad \text{where} \quad n= \begin{array}{l l} \mbox{\texttt{param1} for horizontal kernel} \\ \mbox{\texttt{param2} for vertical kernel} \end{array}
+ \sigma = 0.3 (n/2 - 1) + 0.8 \quad \text{where} \quad n= \begin{array}{l l} \mbox{\texttt{size1} for horizontal kernel} \\ \mbox{\texttt{size2} for vertical kernel} \end{array}
- Using standard sigma for small kernels ( :math:`3\times 3` to :math:`7\times 7` ) gives better speed. If ``param3`` is not zero, while ``param1`` and ``param2`` are zeros, the kernel size is calculated from the sigma (to provide accurate enough operation).
+ Using standard sigma for small kernels ( :math:`3\times 3` to :math:`7\times 7` ) gives better speed. If ``sigma1`` is not zero, while ``size1`` and ``size2`` are zeros, the kernel size is calculated from the sigma (to provide accurate enough operation).
The function smooths an image using one of several methods. Every of the methods has some features and restrictions listed below:
:param ddepth: Destination image depth. See :ocv:func:`Sobel` for the list of supported combination of ``src.depth()`` and ``ddepth``.
- :param xorder: Order of the derivative x.
+ :param dx: Order of the derivative x.
- :param yorder: Order of the derivative y.
+ :param dy: Order of the derivative y.
:param scale: Optional scale factor for the computed derivative values. By default, no scaling is applied. See :ocv:func:`getDerivKernels` for details.
.. math::
- \texttt{Scharr(src, dst, ddepth, xorder, yorder, scale, delta, borderType)}
+ \texttt{Scharr(src, dst, ddepth, dx, dy, scale, delta, borderType)}
is equivalent to
.. math::
- \texttt{Sobel(src, dst, ddepth, xorder, yorder, CV\_SCHARR, scale, delta, borderType)} .
+ \texttt{Sobel(src, dst, ddepth, dx, dy, CV\_SCHARR, scale, delta, borderType)} .
.. seealso::
:param scale: Isotropic scale factor.
- :param mapMatrix: The output affine transformation, 2x3 floating-point matrix.
+ :param map_matrix: The output affine transformation, 2x3 floating-point matrix.
The function calculates the following matrix:
.. ocv:cfunction:: void cvCalcHist( IplImage** image, CvHistogram* hist, int accumulate=0, const CvArr* mask=NULL )
.. ocv:pyoldfunction:: cv.CalcHist(image, hist, accumulate=0, mask=None)-> None
- :param arrays: Source arrays. They all should have the same depth, ``CV_8U`` or ``CV_32F`` , and the same size. Each of them can have an arbitrary number of channels.
+ :param images: Source arrays. They all should have the same depth, ``CV_8U`` or ``CV_32F`` , and the same size. Each of them can have an arbitrary number of channels.
- :param narrays: Number of source arrays.
+ :param nimages: Number of source images.
- :param channels: List of the ``dims`` channels used to compute the histogram. The first array channels are numerated from 0 to ``arrays[0].channels()-1`` , the second array channels are counted from ``arrays[0].channels()`` to ``arrays[0].channels() + arrays[1].channels()-1``, and so on.
+ :param channels: List of the ``dims`` channels used to compute the histogram. The first array channels are numerated from 0 to ``images[0].channels()-1`` , the second array channels are counted from ``images[0].channels()`` to ``images[0].channels() + images[1].channels()-1``, and so on.
- :param mask: Optional mask. If the matrix is not empty, it must be an 8-bit array of the same size as ``arrays[i]`` . The non-zero mask elements mark the array elements counted in the histogram.
+ :param mask: Optional mask. If the matrix is not empty, it must be an 8-bit array of the same size as ``images[i]`` . The non-zero mask elements mark the array elements counted in the histogram.
:param hist: Output histogram, which is a dense or sparse ``dims`` -dimensional array.
.. ocv:cfunction:: void cvCalcBackProject( IplImage** image, CvArr* backProject, const CvHistogram* hist )
.. ocv:pyoldfunction:: cv.CalcBackProject(image, back_project, hist) -> None
- :param arrays: Source arrays. They all should have the same depth, ``CV_8U`` or ``CV_32F`` , and the same size. Each of them can have an arbitrary number of channels.
+ :param images: Source arrays. They all should have the same depth, ``CV_8U`` or ``CV_32F`` , and the same size. Each of them can have an arbitrary number of channels.
- :param narrays: Number of source arrays.
+ :param nimages: Number of source images.
- :param channels: The list of channels used to compute the back projection. The number of channels must match the histogram dimensionality. The first array channels are numerated from 0 to ``arrays[0].channels()-1`` , the second array channels are counted from ``arrays[0].channels()`` to ``arrays[0].channels() + arrays[1].channels()-1``, and so on.
+ :param channels: The list of channels used to compute the back projection. The number of channels must match the histogram dimensionality. The first array channels are numerated from 0 to ``images[0].channels()-1`` , the second array channels are counted from ``images[0].channels()`` to ``images[0].channels() + images[1].channels()-1``, and so on.
:param hist: Input histogram that can be dense or sparse.
- :param backProject: Destination back projection array that is a single-channel array of the same size and depth as ``arrays[0]`` .
+ :param backProject: Destination back projection array that is a single-channel array of the same size and depth as ``images[0]`` .
:param ranges: Array of arrays of the histogram bin boundaries in each dimension. See :ocv:func:`calcHist` .
: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: ::
+ :param distance_func: 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 );
:param hist2: Second histogram.
- :param dsthist: Destination histogram.
+ :param dst_hist: Destination histogram.
:param scale: Scale factor for the destination histogram.
.. note:: Since the mask is larger than the filled image, a pixel :math:`(x, y)` in ``image`` corresponds to the pixel :math:`(x+1, y+1)` in the ``mask`` .
- :param seed: Starting point.
+ :param seedPoint: Starting point.
:param newVal: New value of the repainted domain pixels.
.. math::
- \texttt{src} ( \texttt{seed} .x, \texttt{seed} .y)- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} ( \texttt{seed} .x, \texttt{seed} .y)+ \texttt{upDiff}
+ \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)+ \texttt{upDiff}
in case of a grayscale image and fixed range
.. math::
- \texttt{src} ( \texttt{seed} .x, \texttt{seed} .y)_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} ( \texttt{seed} .x, \texttt{seed} .y)_r+ \texttt{upDiff} _r,
+ \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r+ \texttt{upDiff} _r,
.. math::
- \texttt{src} ( \texttt{seed} .x, \texttt{seed} .y)_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} ( \texttt{seed} .x, \texttt{seed} .y)_g+ \texttt{upDiff} _g
+ \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g+ \texttt{upDiff} _g
and
.. math::
- \texttt{src} ( \texttt{seed} .x, \texttt{seed} .y)_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} ( \texttt{seed} .x, \texttt{seed} .y)_b+ \texttt{upDiff} _b
+ \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b+ \texttt{upDiff} _b
in case of a color image and fixed range
:param thresh: Threshold value.
- :param maxVal: Maximum value to use with the ``THRESH_BINARY`` and ``THRESH_BINARY_INV`` thresholding types.
+ :param maxval: Maximum value to use with the ``THRESH_BINARY`` and ``THRESH_BINARY_INV`` thresholding types.
- :param thresholdType: Thresholding type (see the details below).
+ :param type: Thresholding type (see the details below).
The function applies fixed-level thresholding
to a single-channel array. The function is typically used to get a
:ocv:func:`compare` could
be also used for this purpose) or for removing a noise, that is, filtering
out pixels with too small or too large values. There are several
-types of thresholding supported by the function. They are determined by ``thresholdType`` :
+types of thresholding supported by the function. They are determined by ``type`` :
* **THRESH_BINARY**
.. math::
- \texttt{dst} (x,y) = \fork{\texttt{maxVal}}{if $\texttt{src}(x,y) > \texttt{thresh}$}{0}{otherwise}
+ \texttt{dst} (x,y) = \fork{\texttt{maxval}}{if $\texttt{src}(x,y) > \texttt{thresh}$}{0}{otherwise}
* **THRESH_BINARY_INV**
.. math::
- \texttt{dst} (x,y) = \fork{0}{if $\texttt{src}(x,y) > \texttt{thresh}$}{\texttt{maxVal}}{otherwise}
+ \texttt{dst} (x,y) = \fork{0}{if $\texttt{src}(x,y) > \texttt{thresh}$}{\texttt{maxval}}{otherwise}
* **THRESH_TRUNC**
.. ocv:pyfunction:: cv2.grabCut(img, mask, rect, bgdModel, fgdModel, iterCount[, mode]) -> None
- :param image: Input 8-bit 3-channel image.
+ :param img: Input 8-bit 3-channel image.
:param mask: Input/output 8-bit single-channel mask. The mask is initialized by the function when ``mode`` is set to ``GC_INIT_WITH_RECT``. Its elements may have one of following values:
.. ocv:pyfunction:: cv2.approxPolyDP(curve, epsilon, closed[, approxCurve]) -> approxCurve
-.. ocv:cfunction:: CvSeq* cvApproxPoly( const void* src_seq, int header_size, CvMemStorage* storage, int method, double parameter, int parameter2=0 )
+.. ocv:cfunction:: CvSeq* cvApproxPoly( const void* src_seq, int header_size, CvMemStorage* storage, int method, double eps, int recursive=0 )
:param curve: Input vector of a 2D point stored in:
: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 header_size: Header size of the approximated curve. Normally, ``sizeof(CvContour)`` is used.
:param storage: Memory storage where the approximated curve is stored.
.. ocv:pyoldfunction:: cv.ApproxChains(src_seq, storage, method=CV_CHAIN_APPROX_SIMPLE, parameter=0, minimal_perimeter=0, recursive=0)-> contours
- :param chain: Pointer to the approximated Freeman chain that can refer to other chains.
+ :param src_seq: Pointer to the approximated Freeman chain that can refer to other chains.
:param storage: Storage location for the resulting polylines.
: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 minimal_perimeter: 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 from ``chain`` by using the ``h_next`` or ``v_next`` links. Otherwise, the single input chain is approximated.
:param hull: Output convex hull. It is either an integer vector of indices or vector of points. In the first case, the ``hull`` elements are 0-based indices of the convex hull points in the original array (since the set of convex hull points is a subset of the original point set). In the second case, ``hull`` elements are the convex hull points themselves.
- :param storage: Output memory storage in the old API (``cvConvexHull2`` returns a sequence containing the convex hull points or their indices).
+ :param hull_storage: Output memory storage in the old API (``cvConvexHull2`` returns a sequence containing the convex hull points or their indices).
:param clockwise: Orientation flag. If it is true, the output convex hull is oriented clockwise. Otherwise, it is oriented counter-clockwise. The usual screen coordinate system is assumed so that the origin is at the top-left corner, x axis is oriented to the right, and y axis is oriented downwards.
//! various border interpolation methods
enum { BORDER_REPLICATE=IPL_BORDER_REPLICATE, BORDER_CONSTANT=IPL_BORDER_CONSTANT,
- BORDER_REFLECT=IPL_BORDER_REFLECT, BORDER_WRAP=IPL_BORDER_WRAP,
+ BORDER_REFLECT=IPL_BORDER_REFLECT, BORDER_WRAP=IPL_BORDER_WRAP,
BORDER_REFLECT_101=IPL_BORDER_REFLECT_101, BORDER_REFLECT101=BORDER_REFLECT_101,
BORDER_TRANSPARENT=IPL_BORDER_TRANSPARENT,
BORDER_DEFAULT=BORDER_REFLECT_101, BORDER_ISOLATED=16 };
-//! 1D interpolation function: returns coordinate of the "donor" pixel for the specified location p.
+//! 1D interpolation function: returns coordinate of the "donor" pixel for the specified location p.
CV_EXPORTS_W int borderInterpolate( int p, int len, int borderType );
/*!
The Base Class for 1D or Row-wise Filters
-
+
This is the base class for linear or non-linear filters that process 1D data.
In particular, such filters are used for the "horizontal" filtering parts in separable filters.
-
+
Several functions in OpenCV return Ptr<BaseRowFilter> for the specific types of filters,
and those pointers can be used directly or within cv::FilterEngine.
*/
/*!
The Base Class for Column-wise Filters
-
+
This is the base class for linear or non-linear filters that process columns of 2D arrays.
Such filters are used for the "vertical" filtering parts in separable filters.
-
+
Several functions in OpenCV return Ptr<BaseColumnFilter> for the specific types of filters,
and those pointers can be used directly or within cv::FilterEngine.
-
+
Unlike cv::BaseRowFilter, cv::BaseColumnFilter may have some context information,
i.e. box filter keeps the sliding sum of elements. To reset the state BaseColumnFilter::reset()
must be called (e.g. the method is called by cv::FilterEngine)
- */
+ */
class CV_EXPORTS BaseColumnFilter
{
public:
/*!
The Base Class for Non-Separable 2D Filters.
-
+
This is the base class for linear or non-linear 2D filters.
-
+
Several functions in OpenCV return Ptr<BaseFilter> for the specific types of filters,
and those pointers can be used directly or within cv::FilterEngine.
-
+
Similar to cv::BaseColumnFilter, the class may have some context information,
that should be reset using BaseFilter::reset() method before processing the new array.
-*/
+*/
class CV_EXPORTS BaseFilter
{
public:
/*!
The Main Class for Image Filtering.
-
+
The class can be used to apply an arbitrary filtering operation to an image.
It contains all the necessary intermediate buffers, it computes extrapolated values
of the "virtual" pixels outside of the image etc.
are returned by various OpenCV functions, such as cv::createSeparableLinearFilter(),
cv::createLinearFilter(), cv::createGaussianFilter(), cv::createDerivFilter(),
cv::createBoxFilter() and cv::createMorphologyFilter().
-
+
Using the class you can process large images by parts and build complex pipelines
that include filtering as some of the stages. If all you need is to apply some pre-defined
filtering operation, you may use cv::filter2D(), cv::erode(), cv::dilate() etc.
functions that create FilterEngine internally.
-
+
Here is the example on how to use the class to implement Laplacian operator, which is the sum of
second-order derivatives. More complex variant for different types is implemented in cv::Laplacian().
-
+
\code
void laplace_f(const Mat& src, Mat& dst)
{
CV_Assert( src.type() == CV_32F );
// make sure the destination array has the proper size and type
dst.create(src.size(), src.type());
-
+
// get the derivative and smooth kernels for d2I/dx2.
// for d2I/dy2 we could use the same kernels, just swapped
Mat kd, ks;
getSobelKernels( kd, ks, 2, 0, ksize, false, ktype );
-
+
// let's process 10 source rows at once
int DELTA = std::min(10, src.rows);
Ptr<FilterEngine> Fxx = createSeparableLinearFilter(src.type(),
- dst.type(), kd, ks, Point(-1,-1), 0, borderType, borderType, Scalar() );
+ dst.type(), kd, ks, Point(-1,-1), 0, borderType, borderType, Scalar() );
Ptr<FilterEngine> Fyy = createSeparableLinearFilter(src.type(),
dst.type(), ks, kd, Point(-1,-1), 0, borderType, borderType, Scalar() );
-
+
int y = Fxx->start(src), dsty = 0, dy = 0;
Fyy->start(src);
const uchar* sptr = src.data + y*src.step;
-
+
// allocate the buffers for the spatial image derivatives;
// the buffers need to have more than DELTA rows, because at the
// last iteration the output may take max(kd.rows-1,ks.rows-1)
// rows more than the input.
Mat Ixx( DELTA + kd.rows - 1, src.cols, dst.type() );
Mat Iyy( DELTA + kd.rows - 1, src.cols, dst.type() );
-
+
// inside the loop we always pass DELTA rows to the filter
// (note that the "proceed" method takes care of possibe overflow, since
// it was given the actual image height in the "start" method)
int srcType, int dstType, int bufType,
int _rowBorderType=BORDER_REPLICATE, int _columnBorderType=-1,
const Scalar& _borderValue=Scalar());
- //! starts filtering of the specified ROI of an image of size wholeSize.
+ //! starts filtering of the specified ROI of an image of size wholeSize.
virtual int start(Size wholeSize, Rect roi, int maxBufRows=-1);
//! starts filtering of the specified ROI of the specified image.
virtual int start(const Mat& src, const Rect& srcRoi=Rect(0,0,-1,-1),
bool isolated=false);
//! returns true if the filter is separable
bool isSeparable() const { return (const BaseFilter*)filter2D == 0; }
- //! returns the number
+ //! returns the number
int remainingInputRows() const;
int remainingOutputRows() const;
-
+
int srcType, dstType, bufType;
Size ksize;
Point anchor;
vector<uchar> constBorderRow;
int bufStep, startY, startY0, endY, rowCount, dstY;
vector<uchar*> rows;
-
+
Ptr<BaseFilter> filter2D;
Ptr<BaseRowFilter> rowFilter;
Ptr<BaseColumnFilter> columnFilter;
//! returns the separable linear filter engine
CV_EXPORTS Ptr<FilterEngine> createSeparableLinearFilter(int srcType, int dstType,
InputArray rowKernel, InputArray columnKernel,
- Point _anchor=Point(-1,-1), double delta=0,
- int _rowBorderType=BORDER_DEFAULT,
- int _columnBorderType=-1,
- const Scalar& _borderValue=Scalar());
+ Point anchor=Point(-1,-1), double delta=0,
+ int rowBorderType=BORDER_DEFAULT,
+ int columnBorderType=-1,
+ const Scalar& borderValue=Scalar());
//! returns the non-separable linear filter engine
CV_EXPORTS Ptr<FilterEngine> createLinearFilter(int srcType, int dstType,
InputArray kernel, Point _anchor=Point(-1,-1),
- double delta=0, int _rowBorderType=BORDER_DEFAULT,
- int _columnBorderType=-1, const Scalar& _borderValue=Scalar());
+ double delta=0, int rowBorderType=BORDER_DEFAULT,
+ int columnBorderType=-1, const Scalar& borderValue=Scalar());
//! returns the Gaussian kernel with the specified parameters
CV_EXPORTS_W Mat getGaussianKernel( int ksize, double sigma, int ktype=CV_64F );
CV_EXPORTS Ptr<FilterEngine> createDerivFilter( int srcType, int dstType,
int dx, int dy, int ksize,
int borderType=BORDER_DEFAULT );
-//! returns horizontal 1D box filter
+//! returns horizontal 1D box filter
CV_EXPORTS Ptr<BaseRowFilter> getRowSumFilter(int srcType, int sumType,
int ksize, int anchor=-1);
//! returns vertical 1D box filter
Point anchor=Point(-1,-1),
bool normalize=true,
int borderType=BORDER_DEFAULT);
-
+
//! returns the Gabor kernel with the specified parameters
CV_EXPORTS_W Mat getGaborKernel( Size ksize, double sigma, double theta, double lambd,
double gamma, double psi=CV_PI*0.5, int ktype=CV_64F );
-
+
//! type of morphological operation
enum { MORPH_ERODE=CV_MOP_ERODE, MORPH_DILATE=CV_MOP_DILATE,
MORPH_OPEN=CV_MOP_OPEN, MORPH_CLOSE=CV_MOP_CLOSE,
//! returns 2D morphological filter
CV_EXPORTS Ptr<BaseFilter> getMorphologyFilter(int op, int type, InputArray kernel,
Point anchor=Point(-1,-1));
-
+
//! returns "magic" border value for erosion and dilation. It is automatically transformed to Scalar::all(-DBL_MAX) for dilation.
static inline Scalar morphologyDefaultBorderValue() { return Scalar::all(DBL_MAX); }
//! returns morphological filter engine. Only MORPH_ERODE and MORPH_DILATE are supported.
CV_EXPORTS Ptr<FilterEngine> createMorphologyFilter(int op, int type, InputArray kernel,
- Point anchor=Point(-1,-1), int _rowBorderType=BORDER_CONSTANT,
- int _columnBorderType=-1,
- const Scalar& _borderValue=morphologyDefaultBorderValue());
+ Point anchor=Point(-1,-1), int rowBorderType=BORDER_CONSTANT,
+ int columnBorderType=-1,
+ const Scalar& borderValue=morphologyDefaultBorderValue());
//! shape of the structuring element
enum { MORPH_RECT=0, MORPH_CROSS=1, MORPH_ELLIPSE=2 };
template<> CV_EXPORTS void Ptr<IplConvKernel>::delete_obj();
-//! copies 2D array to a larger destination array with extrapolation of the outer part of src using the specified border mode
+//! copies 2D array to a larger destination array with extrapolation of the outer part of src using the specified border mode
CV_EXPORTS_W void copyMakeBorder( InputArray src, OutputArray dst,
int top, int bottom, int left, int right,
int borderType, const Scalar& value=Scalar() );
InputArray kernelX, InputArray kernelY,
Point anchor=Point(-1,-1),
double delta=0, int borderType=BORDER_DEFAULT );
-
+
//! applies generalized Sobel operator to the image
CV_EXPORTS_W void Sobel( InputArray src, OutputArray dst, int ddepth,
int dx, int dy, int ksize=3,
// low-level function for computing eigenvalues and eigenvectors of 2x2 matrices
CV_EXPORTS void eigen2x2( const float* a, float* e, int n );
-
+
//! computes both eigenvalues and the eigenvectors of 2x2 derivative covariation matrix at each pixel. The output is stored as 6-channel matrix.
CV_EXPORTS_W void cornerEigenValsAndVecs( InputArray src, OutputArray dst,
int blockSize, int ksize,
double rho, double theta, int threshold,
double minLineLength=0, double maxLineGap=0 );
-//! finds circles in the grayscale image using 2+1 gradient Hough transform
+//! finds circles in the grayscale image using 2+1 gradient Hough transform
CV_EXPORTS_W void HoughCircles( InputArray image, OutputArray circles,
int method, double dp, double minDist,
double param1=100, double param2=100,
Point anchor=Point(-1,-1), int iterations=1,
int borderType=BORDER_CONSTANT,
const Scalar& borderValue=morphologyDefaultBorderValue() );
-
+
//! dilates the image (applies the local maximum operator)
CV_EXPORTS_W void dilate( InputArray src, OutputArray dst, InputArray kernel,
Point anchor=Point(-1,-1), int iterations=1,
int borderType=BORDER_CONSTANT,
const Scalar& borderValue=morphologyDefaultBorderValue() );
-
+
//! applies an advanced morphological operation to the image
CV_EXPORTS_W void morphologyEx( InputArray src, OutputArray dst,
int op, InputArray kernel,
int flags=INTER_LINEAR,
int borderMode=BORDER_CONSTANT,
const Scalar& borderValue=Scalar());
-
+
//! warps the image using perspective transformation
CV_EXPORTS_W void warpPerspective( InputArray src, OutputArray dst,
InputArray M, Size dsize,
CV_EXPORTS_W void convertMaps( InputArray map1, InputArray map2,
OutputArray dstmap1, OutputArray dstmap2,
int dstmap1type, bool nninterpolation=false );
-
+
//! returns 2x3 affine transformation matrix for the planar rotation.
CV_EXPORTS_W Mat getRotationMatrix2D( Point2f center, double angle, double scale );
//! returns 3x3 perspective transformation for the corresponding 4 point pairs.
CV_EXPORTS_W void accumulateWeighted( InputArray src, InputOutputArray dst,
double alpha, InputArray mask=noArray() );
-//! computes PSNR image/video quality metric
+//! computes PSNR image/video quality metric
CV_EXPORTS_W double PSNR(InputArray src1, InputArray src2);
-
+
CV_EXPORTS_W Point2d phaseCorrelate(InputArray src1, InputArray src2, InputArray window = noArray());
CV_EXPORTS_W void createHanningWindow(OutputArray dst, Size winSize, int type);
-
+
//! type of the threshold operation
enum { THRESH_BINARY=CV_THRESH_BINARY, THRESH_BINARY_INV=CV_THRESH_BINARY_INV,
THRESH_TRUNC=CV_THRESH_TRUNC, THRESH_TOZERO=CV_THRESH_TOZERO,
InputArray cameraMatrix,
InputArray distCoeffs,
InputArray newCameraMatrix=noArray() );
-
+
//! initializes maps for cv::remap() to correct lens distortion and optionally rectify the image
CV_EXPORTS_W void initUndistortRectifyMap( InputArray cameraMatrix, InputArray distCoeffs,
InputArray R, InputArray newCameraMatrix,
{
PROJ_SPHERICAL_ORTHO = 0,
PROJ_SPHERICAL_EQRECT = 1
-};
-
+};
+
//! initializes maps for cv::remap() for wide-angle
CV_EXPORTS_W float initWideAngleProjMap( InputArray cameraMatrix, InputArray distCoeffs,
Size imageSize, int destImageWidth,
int m1type, OutputArray map1, OutputArray map2,
int projType=PROJ_SPHERICAL_EQRECT, double alpha=0);
-
+
//! returns the default new camera matrix (by default it is the same as cameraMatrix unless centerPricipalPoint=true)
CV_EXPORTS_W Mat getDefaultNewCameraMatrix( InputArray cameraMatrix, Size imgsize=Size(),
bool centerPrincipalPoint=false );
-
+
//! returns points' coordinates after lens distortion correction
CV_EXPORTS_W void undistortPoints( InputArray src, OutputArray dst,
InputArray cameraMatrix, InputArray distCoeffs,
InputArray R=noArray(), InputArray P=noArray());
template<> CV_EXPORTS void Ptr<CvHistogram>::delete_obj();
-
+
//! computes the joint dense histogram for a set of images.
CV_EXPORTS void calcHist( const Mat* images, int nimages,
const int* channels, InputArray mask,
SparseMat& hist, int dims,
const int* histSize, const float** ranges,
bool uniform=true, bool accumulate=false );
-
+
CV_EXPORTS_W void calcHist( InputArrayOfArrays images,
const vector<int>& channels,
InputArray mask, OutputArray hist,
//! computes back projection for the set of images
CV_EXPORTS void calcBackProject( const Mat* images, int nimages,
- const int* channels, const SparseMat& hist,
+ const int* channels, const SparseMat& hist,
OutputArray backProject, const float** ranges,
double scale=1, bool uniform=true );
/*CV_EXPORTS void calcBackProjectPatch( const Mat* images, int nimages, const int* channels,
InputArray hist, OutputArray dst, Size patchSize,
- int method, double factor=1 );
-
+ int method, double factor=1 );
+
CV_EXPORTS_W void calcBackProjectPatch( InputArrayOfArrays images, const vector<int>& channels,
InputArray hist, OutputArray dst, Size patchSize,
int method, double factor=1 );*/
//! normalizes the grayscale image brightness and contrast by normalizing its histogram
CV_EXPORTS_W void equalizeHist( InputArray src, OutputArray dst );
-
+
CV_EXPORTS float EMD( InputArray signature1, InputArray signature2,
int distType, InputArray cost=noArray(),
float* lowerBound=0, OutputArray flow=noArray() );
GC_BGD = 0, //!< background
GC_FGD = 1, //!< foreground
GC_PR_BGD = 2, //!< most probably background
- GC_PR_FGD = 3 //!< most probably foreground
+ GC_PR_FGD = 3 //!< most probably foreground
};
//! GrabCut algorithm flags
};
//! segments the image using GrabCut algorithm
-CV_EXPORTS_W void grabCut( InputArray img, InputOutputArray mask, Rect rect,
+CV_EXPORTS_W void grabCut( InputArray img, InputOutputArray mask, Rect rect,
InputOutputArray bgdModel, InputOutputArray fgdModel,
int iterCount, int mode = GC_EVAL );
DIST_LABEL_CCOMP = 0,
DIST_LABEL_PIXEL = 1
};
-
+
//! builds the discrete Voronoi diagram
CV_EXPORTS_AS(distanceTransformWithLabels) void distanceTransform( InputArray src, OutputArray dst,
OutputArray labels, int distanceType, int maskSize,
Scalar loDiff=Scalar(), Scalar upDiff=Scalar(),
int flags=4 );
-
+
enum
{
COLOR_BGR2BGRA =0,
COLOR_RGB2RGBA =COLOR_BGR2BGRA,
-
+
COLOR_BGRA2BGR =1,
COLOR_RGBA2RGB =COLOR_BGRA2BGR,
-
+
COLOR_BGR2RGBA =2,
COLOR_RGB2BGRA =COLOR_BGR2RGBA,
-
+
COLOR_RGBA2BGR =3,
COLOR_BGRA2RGB =COLOR_RGBA2BGR,
-
+
COLOR_BGR2RGB =4,
COLOR_RGB2BGR =COLOR_BGR2RGB,
-
+
COLOR_BGRA2RGBA =5,
COLOR_RGBA2BGRA =COLOR_BGRA2RGBA,
-
+
COLOR_BGR2GRAY =6,
COLOR_RGB2GRAY =7,
COLOR_GRAY2BGR =8,
COLOR_GRAY2RGBA =COLOR_GRAY2BGRA,
COLOR_BGRA2GRAY =10,
COLOR_RGBA2GRAY =11,
-
+
COLOR_BGR2BGR565 =12,
COLOR_RGB2BGR565 =13,
COLOR_BGR5652BGR =14,
COLOR_RGBA2BGR565 =17,
COLOR_BGR5652BGRA =18,
COLOR_BGR5652RGBA =19,
-
+
COLOR_GRAY2BGR565 =20,
COLOR_BGR5652GRAY =21,
-
+
COLOR_BGR2BGR555 =22,
COLOR_RGB2BGR555 =23,
COLOR_BGR5552BGR =24,
COLOR_RGBA2BGR555 =27,
COLOR_BGR5552BGRA =28,
COLOR_BGR5552RGBA =29,
-
+
COLOR_GRAY2BGR555 =30,
COLOR_BGR5552GRAY =31,
-
+
COLOR_BGR2XYZ =32,
COLOR_RGB2XYZ =33,
COLOR_XYZ2BGR =34,
COLOR_XYZ2RGB =35,
-
+
COLOR_BGR2YCrCb =36,
COLOR_RGB2YCrCb =37,
COLOR_YCrCb2BGR =38,
COLOR_YCrCb2RGB =39,
-
+
COLOR_BGR2HSV =40,
COLOR_RGB2HSV =41,
-
+
COLOR_BGR2Lab =44,
COLOR_RGB2Lab =45,
-
+
COLOR_BayerBG2BGR =46,
COLOR_BayerGB2BGR =47,
COLOR_BayerRG2BGR =48,
COLOR_BayerGR2BGR =49,
-
+
COLOR_BayerBG2RGB =COLOR_BayerRG2BGR,
COLOR_BayerGB2RGB =COLOR_BayerGR2BGR,
COLOR_BayerRG2RGB =COLOR_BayerBG2BGR,
COLOR_BayerGR2RGB =COLOR_BayerGB2BGR,
-
+
COLOR_BGR2Luv =50,
COLOR_RGB2Luv =51,
COLOR_BGR2HLS =52,
COLOR_RGB2HLS =53,
-
+
COLOR_HSV2BGR =54,
COLOR_HSV2RGB =55,
-
+
COLOR_Lab2BGR =56,
COLOR_Lab2RGB =57,
COLOR_Luv2BGR =58,
COLOR_Luv2RGB =59,
COLOR_HLS2BGR =60,
COLOR_HLS2RGB =61,
-
+
COLOR_BayerBG2BGR_VNG =62,
COLOR_BayerGB2BGR_VNG =63,
COLOR_BayerRG2BGR_VNG =64,
COLOR_BayerGR2BGR_VNG =65,
-
+
COLOR_BayerBG2RGB_VNG =COLOR_BayerRG2BGR_VNG,
COLOR_BayerGB2RGB_VNG =COLOR_BayerGR2BGR_VNG,
COLOR_BayerRG2RGB_VNG =COLOR_BayerBG2BGR_VNG,
COLOR_BayerGR2RGB_VNG =COLOR_BayerGB2BGR_VNG,
-
+
COLOR_BGR2HSV_FULL = 66,
COLOR_RGB2HSV_FULL = 67,
COLOR_BGR2HLS_FULL = 68,
COLOR_RGB2HLS_FULL = 69,
-
+
COLOR_HSV2BGR_FULL = 70,
COLOR_HSV2RGB_FULL = 71,
COLOR_HLS2BGR_FULL = 72,
COLOR_HLS2RGB_FULL = 73,
-
+
COLOR_LBGR2Lab = 74,
COLOR_LRGB2Lab = 75,
COLOR_LBGR2Luv = 76,
COLOR_LRGB2Luv = 77,
-
+
COLOR_Lab2LBGR = 78,
COLOR_Lab2LRGB = 79,
COLOR_Luv2LBGR = 80,
COLOR_Luv2LRGB = 81,
-
+
COLOR_BGR2YUV = 82,
COLOR_RGB2YUV = 83,
COLOR_YUV2BGR = 84,
COLOR_YUV2RGB = 85,
-
+
COLOR_BayerBG2GRAY = 86,
COLOR_BayerGB2GRAY = 87,
COLOR_BayerRG2GRAY = 88,
//YUV 4:2:0 formats family
COLOR_YUV2RGB_NV12 = 90,
- COLOR_YUV2BGR_NV12 = 91,
+ COLOR_YUV2BGR_NV12 = 91,
COLOR_YUV2RGB_NV21 = 92,
COLOR_YUV2BGR_NV21 = 93,
COLOR_YUV420sp2RGB = COLOR_YUV2RGB_NV21,
COLOR_YUV2BGRA_NV21 = 97,
COLOR_YUV420sp2RGBA = COLOR_YUV2RGBA_NV21,
COLOR_YUV420sp2BGRA = COLOR_YUV2BGRA_NV21,
-
+
COLOR_YUV2RGB_YV12 = 98,
COLOR_YUV2BGR_YV12 = 99,
COLOR_YUV2RGB_IYUV = 100,
COLOR_YUV2BGR_I420 = COLOR_YUV2BGR_IYUV,
COLOR_YUV420p2RGB = COLOR_YUV2RGB_YV12,
COLOR_YUV420p2BGR = COLOR_YUV2BGR_YV12,
-
+
COLOR_YUV2RGBA_YV12 = 102,
COLOR_YUV2BGRA_YV12 = 103,
COLOR_YUV2RGBA_IYUV = 104,
COLOR_YUV2BGRA_I420 = COLOR_YUV2BGRA_IYUV,
COLOR_YUV420p2RGBA = COLOR_YUV2RGBA_YV12,
COLOR_YUV420p2BGRA = COLOR_YUV2BGRA_YV12,
-
+
COLOR_YUV2GRAY_420 = 106,
COLOR_YUV2GRAY_NV21 = COLOR_YUV2GRAY_420,
COLOR_YUV2GRAY_NV12 = COLOR_YUV2GRAY_420,
COLOR_YUV2GRAY_I420 = COLOR_YUV2GRAY_420,
COLOR_YUV420sp2GRAY = COLOR_YUV2GRAY_420,
COLOR_YUV420p2GRAY = COLOR_YUV2GRAY_420,
-
+
//YUV 4:2:2 formats family
COLOR_YUV2RGB_UYVY = 107,
COLOR_YUV2BGR_UYVY = 108,
COLOR_YUV2BGR_Y422 = COLOR_YUV2BGR_UYVY,
COLOR_YUV2RGB_UYNV = COLOR_YUV2RGB_UYVY,
COLOR_YUV2BGR_UYNV = COLOR_YUV2BGR_UYVY,
-
+
COLOR_YUV2RGBA_UYVY = 111,
COLOR_YUV2BGRA_UYVY = 112,
//COLOR_YUV2RGBA_VYUY = 113,
COLOR_YUV2BGRA_Y422 = COLOR_YUV2BGRA_UYVY,
COLOR_YUV2RGBA_UYNV = COLOR_YUV2RGBA_UYVY,
COLOR_YUV2BGRA_UYNV = COLOR_YUV2BGRA_UYVY,
-
+
COLOR_YUV2RGB_YUY2 = 115,
COLOR_YUV2BGR_YUY2 = 116,
COLOR_YUV2RGB_YVYU = 117,
COLOR_YUV2BGR_YUYV = COLOR_YUV2BGR_YUY2,
COLOR_YUV2RGB_YUNV = COLOR_YUV2RGB_YUY2,
COLOR_YUV2BGR_YUNV = COLOR_YUV2BGR_YUY2,
-
+
COLOR_YUV2RGBA_YUY2 = 119,
COLOR_YUV2BGRA_YUY2 = 120,
COLOR_YUV2RGBA_YVYU = 121,
COLOR_YUV2BGRA_YUYV = COLOR_YUV2BGRA_YUY2,
COLOR_YUV2RGBA_YUNV = COLOR_YUV2RGBA_YUY2,
COLOR_YUV2BGRA_YUNV = COLOR_YUV2BGRA_YUY2,
-
+
COLOR_YUV2GRAY_UYVY = 123,
COLOR_YUV2GRAY_YUY2 = 124,
//COLOR_YUV2GRAY_VYUY = COLOR_YUV2GRAY_UYVY,
COLOR_YUV2GRAY_YVYU = COLOR_YUV2GRAY_YUY2,
COLOR_YUV2GRAY_YUYV = COLOR_YUV2GRAY_YUY2,
COLOR_YUV2GRAY_YUNV = COLOR_YUV2GRAY_YUY2,
-
+
COLOR_COLORCVT_MAX = 125
};
-
-
+
+
//! converts image from one color space to another
CV_EXPORTS_W void cvtColor( InputArray src, OutputArray dst, int code, int dstCn=0 );
Moments( const CvMoments& moments );
//! the conversion to CvMoments
operator CvMoments() const;
-
+
//! spatial moments
CV_PROP_RW double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03;
//! central moments
CV_EXPORTS_W RotatedRect minAreaRect( InputArray points );
//! computes the minimal enclosing circle for a set of points
CV_EXPORTS_W void minEnclosingCircle( InputArray points,
- CV_OUT Point2f& center, CV_OUT float& radius );
+ CV_OUT Point2f& center, CV_OUT float& radius );
//! matches two contours using one of the available algorithms
CV_EXPORTS_W double matchShapes( InputArray contour1, InputArray contour2,
int method, double parameter );
double param, double reps, double aeps );
//! checks if the point is inside the contour. Optionally computes the signed distance from the point to the contour boundary
CV_EXPORTS_W double pointPolygonTest( InputArray contour, Point2f pt, bool measureDist );
-
+
class CV_EXPORTS_W Subdiv2D
{
PTLOC_VERTEX = 1,
PTLOC_ON_EDGE = 2
};
-
+
enum
{
NEXT_AROUND_ORG = 0x00,
PREV_AROUND_LEFT = 0x20,
PREV_AROUND_RIGHT = 0x02
};
-
+
CV_WRAP Subdiv2D();
CV_WRAP Subdiv2D(Rect rect);
CV_WRAP void initDelaunay(Rect rect);
-
+
CV_WRAP int insert(Point2f pt);
CV_WRAP void insert(const vector<Point2f>& ptvec);
CV_WRAP int locate(Point2f pt, CV_OUT int& edge, CV_OUT int& vertex);
-
+
CV_WRAP int findNearest(Point2f pt, CV_OUT Point2f* nearestPt=0);
CV_WRAP void getEdgeList(CV_OUT vector<Vec4f>& edgeList) const;
CV_WRAP void getTriangleList(CV_OUT vector<Vec6f>& triangleList) const;
CV_WRAP void getVoronoiFacetList(const vector<int>& idx, CV_OUT vector<vector<Point2f> >& facetList,
CV_OUT vector<Point2f>& facetCenters);
-
+
CV_WRAP Point2f getVertex(int vertex, CV_OUT int* firstEdge=0) const;
-
+
CV_WRAP int getEdge( int edge, int nextEdgeType ) const;
CV_WRAP int nextEdge(int edge) const;
CV_WRAP int rotateEdge(int edge, int rotate) const;
CV_WRAP int symEdge(int edge) const;
CV_WRAP int edgeOrg(int edge, CV_OUT Point2f* orgpt=0) const;
CV_WRAP int edgeDst(int edge, CV_OUT Point2f* dstpt=0) const;
-
+
protected:
int newEdge();
void deleteEdge(int edge);
void calcVoronoi();
void clearVoronoi();
void checkSubdiv() const;
-
+
struct CV_EXPORTS Vertex
{
Vertex();
int next[4];
int pt[4];
};
-
+
vector<Vertex> vtx;
vector<QuadEdge> qedges;
int freeQEdge;
int freePoint;
bool validGeometry;
-
+
int recentEdge;
Point2f topLeft;
Point2f bottomRight;
a tree of polygonal curves (contours) */
CVAPI(CvSeq*) cvApproxPoly( const void* src_seq,
int header_size, CvMemStorage* storage,
- int method, double parameter,
- int parameter2 CV_DEFAULT(0));
+ int method, double eps,
+ int recursive CV_DEFAULT(0));
/* Calculates perimeter of a contour or length of a part of contour */
CVAPI(double) cvArcLength( const void* curve,
CvChainPtReader reader;
CvSeqWriter writer;
CvPoint pt = chain->origin;
-
+
CV_Assert( CV_IS_SEQ_CHAIN_CONTOUR( chain ));
CV_Assert( header_size >= (int)sizeof(CvContour) );
-
+
cvStartWriteSeq( (chain->flags & ~CV_SEQ_ELTYPE_MASK) | CV_SEQ_ELTYPE_POINT,
header_size, sizeof( CvPoint ), storage, &writer );
-
+
if( chain->total == 0 )
- {
+ {
CV_WRITE_SEQ_ELEM( pt, writer );
return cvEndWriteSeq( &writer );
}
cvApproxChains( CvSeq* src_seq,
CvMemStorage* storage,
int method,
- double /*parameter*/,
- int minimal_perimeter,
+ double /*parameter*/,
+ int minimal_perimeter,
int recursive )
{
CvSeq *prev_contour = 0, *parent = 0;
CvSeq *dst_seq = 0;
-
+
if( !src_seq || !storage )
CV_Error( CV_StsNullPtr, "" );
if( method > CV_CHAIN_APPROX_TC89_KCOS || method <= 0 || minimal_perimeter < 0 )
if( len >= minimal_perimeter )
{
CvSeq *contour = 0;
-
+
switch( method )
{
case CV_CHAIN_APPROX_NONE:
/* the version for integer point coordinates */
template<typename T> static CvSeq*
-icvApproxPolyDP( CvSeq* src_contour, int header_size,
+icvApproxPolyDP( CvSeq* src_contour, int header_size,
CvMemStorage* storage, double eps )
{
typedef cv::Point_<T> PT;
CvMemStorage* temp_storage = 0;
CvSeq* stack = 0;
CvSeq* dst_contour;
-
+
assert( CV_SEQ_ELTYPE(src_contour) == cv::DataType<PT>::type );
cvStartWriteSeq( src_contour->flags, header_size, sizeof(pt), storage, &writer );
init_iters = 1;
}
}
-
+
if( is_closed )
{
/* 1. Find approximately two farthest points of the contour */
CV_WRITE_SEQ_ELEM( end_pt, writer );
dst_contour = cvEndWriteSeq( &writer );
-
+
// last stage: do final clean-up of the approximated contour -
- // remove extra points on the [almost] stright lines.
-
+ // remove extra points on the [almost] stright lines.
+
cvStartReadSeq( dst_contour, &reader, is_closed );
CV_READ_SEQ_ELEM( start_pt, reader );
CV_IMPL CvSeq*
cvApproxPoly( const void* array, int header_size,
- CvMemStorage* storage, int method,
+ CvMemStorage* storage, int method,
double parameter, int parameter2 )
{
CvSeq* dst_seq = 0;
"gpu::swapChannels" : ("dstOrder") # parameter is not parsed correctly by the hdr_parser
}
+ERROR_001_SECTIONFAILURE = 1
+ERROR_002_HDRWHITESPACE = 2
+ERROR_003_PARENTHESES = 3
+WARNING_004_TABS = 4
+ERROR_005_REDEFENITIONPARAM = 5
+ERROR_006_REDEFENITIONFUNC = 6
+WARNING_007_UNDOCUMENTEDPARAM = 7
+WARNING_008_MISSINGPARAM = 8
+WARNING_009_HDRMISMATCH = 9
+ERROR_010_NOMODULE = 10
+
params_mapping = {
"composeRT" : {
"dr3dr1" : "d*d*",
self.parse_section(module_name, section_name, file_name, lineno, lines)
except AssertionError, args:
if show_errors:
- print >> sys.stderr, "RST parser error: assertion in \"%s\" File: %s (line %s)" % (section_name, file_name, lineno)
+ print >> sys.stderr, "RST parser error E%03d: assertion in \"%s\" at %s:%s" % (ERROR_001_SECTIONFAILURE, section_name, file_name, lineno)
print >> sys.stderr, " Details: %s" % args
def parse_section(self, module_name, section_name, file_name, lineno, lines):
self.sections_total += 1
# skip sections having whitespace in name
- if section_name.find(" ") >= 0 and section_name.find("::operator") < 0:
+ #if section_name.find(" ") >= 0 and section_name.find("::operator") < 0:
+ if section_name.find(" ") >= 0 and not bool(re.match(r"(\w+::)*operator\s*(\w+|>>|<<|\(\)|->|\+\+|--|=|==|\+=|-=)", section_name)):
if show_errors:
- print "SKIPPED: \"%s\" File: %s (line %s)" % (section_name, file_name, lineno)
+ print "RST parser error E%03d: SKIPPED: \"%s\" File: %s:%s" % (ERROR_002_HDRWHITESPACE, section_name, file_name, lineno)
self.sections_skipped += 1
return
if fdecl.balance != 0:
if show_critical_errors:
- print >> sys.stderr, "RST parser error: invalid parentheses balance in \"%s\" File: %s:%s" % (section_name, file_name, lineno)
+ print >> sys.stderr, "RST parser error E%03d: invalid parentheses balance in \"%s\" at %s:%s" % (ERROR_003_PARENTHESES, section_name, file_name, lineno)
return
# save last parameter if needed
if l.find("\t") >= 0:
whitespace_warnings += 1
if whitespace_warnings <= max_whitespace_warnings and show_warnings:
- print >> sys.stderr, "RST parser warning: tab symbol instead of space is used at file %s (line %s)" % (doc, lineno)
+ print >> sys.stderr, "RST parser warning W%03d: tab symbol instead of space is used at %s:%s" % (WARNING_004_TABS, doc, lineno)
l = l.replace("\t", " ")
# handle first line
if show_errors:
#check black_list
if decl.name not in params_blacklist.get(func["name"], []):
- print >> sys.stderr, "RST parser error: redefinition of parameter \"%s\" in \"%s\" File: %s (line %s)" \
- % (decl.name, func["name"], func["file"], func["line"])
+ print >> sys.stderr, "RST parser error E%03d: redefinition of parameter \"%s\" in \"%s\" at %s:%s" \
+ % (ERROR_005_REDEFENITIONPARAM, decl.name, func["name"], func["file"], func["line"])
else:
params[decl.name] = decl.comment
func["params"] = params
if skipped:
print >> out, "SKIPPED DEFINITION:"
print >> out, "name: %s" % (func.get("name","~empty~"))
- print >> out, "file: %s (line %s)" % (func.get("file","~empty~"), func.get("line","~empty~"))
+ print >> out, "file: %s:%s" % (func.get("file","~empty~"), func.get("line","~empty~"))
print >> out, "is class: %s" % func.get("isclass",False)
print >> out, "is struct: %s" % func.get("isstruct",False)
print >> out, "module: %s" % func.get("module","~unknown~")
return False
if func["name"] in self.definitions:
if show_errors:
- print >> sys.stderr, "RST parser error: \"%s\" from file: %s (line %s) is already documented in file: %s (line %s)" \
- % (func["name"], func["file"], func["line"], self.definitions[func["name"]]["file"], self.definitions[func["name"]]["line"])
+ print >> sys.stderr, "RST parser error E%03d: \"%s\" from: %s:%s is already documented at %s:%s" \
+ % (ERROR_006_REDEFENITIONFUNC, func["name"], func["file"], func["line"], self.definitions[func["name"]]["file"], self.definitions[func["name"]]["line"])
return False
return self.validateParams(func)
# 1. all params are documented
for p in params:
if p not in documentedParams and show_warnings:
- print >> sys.stderr, "RST parser warning: parameter \"%s\" of \"%s\" is undocumented. File: %s (line %s)" % (p, func["name"], func["file"], func["line"])
+ print >> sys.stderr, "RST parser warning W%03d: parameter \"%s\" of \"%s\" is undocumented. %s:%s" % (WARNING_007_UNDOCUMENTEDPARAM, p, func["name"], func["file"], func["line"])
# 2. only real params are documented
for p in documentedParams:
if p not in params and show_warnings:
if p not in params_blacklist.get(func["name"], []):
- print >> sys.stderr, "RST parser warning: unexisting parameter \"%s\" of \"%s\" is documented. File: %s (line %s)" % (p, func["name"], func["file"], func["line"])
+ print >> sys.stderr, "RST parser warning W%03d: unexisting parameter \"%s\" of \"%s\" is documented at %s:%s" % (WARNING_008_MISSINGPARAM, p, func["name"], func["file"], func["line"])
return True
def normalize(self, func):
fname = fname.replace(".", "::")
if fname.startswith("cv::cv"):
- if fname[6:] == func.get("name", ""):
+ if fname[6:] == func.get("name", "").replace("*", "_n"):
func["name"] = fname[4:]
func["method"] = fname[4:]
elif show_warnings:
- print >> sys.stderr, "\"%s\" - section name is \"%s\" instead of \"%s\". File: %s (line %s)" % (fname, func["name"], fname[6:], func["file"], func["line"])
+ print >> sys.stderr, "RST parser warning W%03d: \"%s\" - section name is \"%s\" instead of \"%s\" at %s:%s" % (WARNING_009_HDRMISMATCH, fname, func["name"], fname[6:], func["file"], func["line"])
#self.print_info(func)
def normalizeText(self, s):
module = sys.argv[1]
if module != "all" and not os.path.isdir(os.path.join(rst_parser_dir, "../" + module)):
- print "Module \"" + module + "\" could not be found."
+ print "RST parser error E%03d: module \"%s\" could not be found." % (ERROR_010_NOMODULE, module)
exit(1)
parser = RstParser(hdr_parser.CppHeaderParser())
:param samples: Samples from which the Gaussian mixture model will be estimated.
- :param sample_idx: Mask of samples to use. All samples are used by default.
+ :param sampleIdx: Mask of samples to use. All samples are used by default.
:param params: Parameters of the EM algorithm.
:param num_quant_bits: Number of bits used for quantization.
- :param print_status: Current status of training printed on the console.
-
-
RTreeClassifier::getSignature
---------------------------------
:param curr: Second image, 8-bit, single-channel
- :param blockSize: Size of basic blocks that are compared
+ :param block_size: Size of basic blocks that are compared
- :param shiftSize: Block coordinate increments
+ :param shift_size: Block coordinate increments
- :param maxRange: Size of the scanned neighborhood in pixels around the block
+ :param max_range: Size of the scanned neighborhood in pixels around the block
- :param usePrevious: Flag that specifies whether to use the input velocity as initial approximations or not.
+ :param use_previous: Flag that specifies whether to use the input velocity as initial approximations or not.
:param velx: Horizontal component of the optical flow of
.. math::
- \left \lfloor \frac{\texttt{prev->width} - \texttt{blockSize.width}}{\texttt{shiftSize.width}} \right \rfloor \times \left \lfloor \frac{\texttt{prev->height} - \texttt{blockSize.height}}{\texttt{shiftSize.height}} \right \rfloor
+ \left \lfloor \frac{\texttt{prev->width} - \texttt{block_size.width}}{\texttt{shift_size.width}} \right \rfloor \times \left \lfloor \frac{\texttt{prev->height} - \texttt{block_size.height}}{\texttt{shift_size.height}} \right \rfloor
size, 32-bit floating-point, single-channel
:param vely: Vertical component of the optical flow of the same size ``velx`` , 32-bit floating-point, single-channel
-The function calculates the optical flow for overlapped blocks ``blockSize.width x blockSize.height`` pixels each, thus the velocity fields are smaller than the original images. For every block in ``prev``
-the functions tries to find a similar block in ``curr`` in some neighborhood of the original block or shifted by ``(velx(x0,y0), vely(x0,y0))`` block as has been calculated by previous function call (if ``usePrevious=1``)
+The function calculates the optical flow for overlapped blocks ``block_size.width x block_size.height`` pixels each, thus the velocity fields are smaller than the original images. For every block in ``prev``
+the functions tries to find a similar block in ``curr`` in some neighborhood of the original block or shifted by ``(velx(x0,y0), vely(x0,y0))`` block as has been calculated by previous function call (if ``use_previous=1``)
CalcOpticalFlowHS
:param curr: Second image, 8-bit, single-channel
- :param usePrevious: Flag that specifies whether to use the input velocity as initial approximations or not.
+ :param use_previous: Flag that specifies whether to use the input velocity as initial approximations or not.
:param velx: Horizontal component of the optical flow of the same size as input images, 32-bit floating-point, single-channel
:param curr: Second image, 8-bit, single-channel
- :param winSize: Size of the averaging window used for grouping pixels
+ :param win_size: Size of the averaging window used for grouping pixels
:param velx: Horizontal component of the optical flow of the same size as input images, 32-bit floating-point, single-channel
.. ocv:function:: void SIFT::operator()(InputArray img, InputArray mask, vector<KeyPoint>& keypoints, OutputArray descriptors, bool useProvidedKeypoints=false)
- :param image: Input 8-bit grayscale image
+ :param img: Input 8-bit grayscale image
:param mask: Optional input mask that marks the regions where we should detect features.
else:
atype = arg
aname = "param"
+ if aname.endswith("]"):
+ bidx = aname.find('[')
+ atype += aname[bidx:]
+ aname = aname[:bidx]
decl[3].append([atype, aname, defval, []])
if static_method:
.. ocv:pyfunction:: cv2.calcOpticalFlowFarneback(prev, next, pyr_scale, levels, winsize, iterations, poly_n, poly_sigma, flags[, flow]) -> flow
- :param prevImg: First 8-bit single-channel input image.
+ :param prev: First 8-bit single-channel input image.
- :param nextImg: Second input image of the same size and the same type as ``prevImg`` .
+ :param next: Second input image of the same size and the same type as ``prev`` .
- :param flow: Computed flow image that has the same size as ``prevImg`` and type ``CV_32FC2`` .
+ :param flow: Computed flow image that has the same size as ``prev`` and type ``CV_32FC2`` .
- :param pyrScale: Parameter specifying the image scale (<1) to build pyramids for each image. ``pyrScale=0.5`` means a classical pyramid, where each next layer is twice smaller than the previous one.
+ :param pyr_scale: Parameter specifying the image scale (<1) to build pyramids for each image. ``pyr_scale=0.5`` means a classical pyramid, where each next layer is twice smaller than the previous one.
:param levels: Number of pyramid layers including the initial image. ``levels=1`` means that no extra layers are created and only the original images are used.
:param iterations: Number of iterations the algorithm does at each pyramid level.
- :param polyN: Size of the pixel neighborhood used to find polynomial expansion in each pixel. Larger values mean that the image will be approximated with smoother surfaces, yielding more robust algorithm and more blurred motion field. Typically, ``polyN`` =5 or 7.
+ :param poly_n: Size of the pixel neighborhood used to find polynomial expansion in each pixel. Larger values mean that the image will be approximated with smoother surfaces, yielding more robust algorithm and more blurred motion field. Typically, ``poly_n`` =5 or 7.
- :param polySigma: Standard deviation of the Gaussian that is used to smooth derivatives used as a basis for the polynomial expansion. For ``polyN=5`` , you can set ``polySigma=1.1`` . For ``polyN=7`` , a good value would be ``polySigma=1.5`` .
+ :param poly_sigma: Standard deviation of the Gaussian that is used to smooth derivatives used as a basis for the polynomial expansion. For ``poly_n=5`` , you can set ``poly_sigma=1.1`` . For ``poly_n=7`` , a good value would be ``poly_sigma=1.5`` .
:param flags: Operation flags that can be a combination of the following:
* **OPTFLOW_FARNEBACK_GAUSSIAN** Use the Gaussian :math:`\texttt{winsize}\times\texttt{winsize}` filter instead of a box filter of the same size for optical flow estimation. Usually, this option gives z more accurate flow than with a box filter, at the cost of lower speed. Normally, ``winsize`` for a Gaussian window should be set to a larger value to achieve the same level of robustness.
-The function finds an optical flow for each ``prevImg`` pixel using the [Farneback2003]_ algorithm so that
+The function finds an optical flow for each ``prev`` pixel using the [Farneback2003]_ algorithm so that
.. math::
- \texttt{prevImg} (y,x) \sim \texttt{nextImg} ( y + \texttt{flow} (y,x)[1], x + \texttt{flow} (y,x)[0])
+ \texttt{prev} (y,x) \sim \texttt{next} ( y + \texttt{flow} (y,x)[1], x + \texttt{flow} (y,x)[0])
estimateRigidTransform