Fixed hundreds of documentation problems

This commit is contained in:
Andrey Kamaev 2012-05-28 07:36:14 +00:00
parent 7e698726e4
commit eb2f1f81ed
65 changed files with 1708 additions and 1680 deletions

View File

@ -111,11 +111,11 @@ calibrateCamera
--------------- ---------------
Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern. Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.
.. ocv:function:: double calibrateCamera( InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints, Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, int flags=0, TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON)) .. ocv:function:: double calibrateCamera( InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints, Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, int flags=0, TermCriteria criteria=TermCriteria( TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON) )
.. ocv:pyfunction:: cv2.calibrateCamera(objectPoints, imagePoints, imageSize[, cameraMatrix[, distCoeffs[, rvecs[, tvecs[, flags[, criteria]]]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs .. ocv:pyfunction:: cv2.calibrateCamera(objectPoints, imagePoints, imageSize[, cameraMatrix[, distCoeffs[, rvecs[, tvecs[, flags[, criteria]]]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs
.. ocv:cfunction:: double cvCalibrateCamera2(const CvMat* objectPoints, const CvMat* imagePoints, const CvMat* pointCounts, CvSize imageSize, CvMat* cameraMatrix, CvMat* distCoeffs, CvMat* rvecs=NULL, CvMat* tvecs=NULL, int flags=0, CvTermCriteria term_crit = cvTermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,30,DBL_EPSILON) ) .. ocv:cfunction:: double cvCalibrateCamera2( const CvMat* object_points, const CvMat* image_points, const CvMat* point_counts, CvSize image_size, CvMat* camera_matrix, CvMat* distortion_coeffs, CvMat* rotation_vectors=NULL, CvMat* translation_vectors=NULL, int flags=0, CvTermCriteria term_crit=cvTermCriteria( CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,30,DBL_EPSILON) )
.. ocv:pyoldfunction:: cv.CalibrateCamera2(objectPoints, imagePoints, pointCounts, imageSize, cameraMatrix, distCoeffs, rvecs, tvecs, flags=0)-> None .. ocv:pyoldfunction:: cv.CalibrateCamera2(objectPoints, imagePoints, pointCounts, imageSize, cameraMatrix, distCoeffs, rvecs, tvecs, flags=0)-> None
@ -268,7 +268,7 @@ For points in an image of a stereo pair, computes the corresponding epilines in
.. ocv:function:: void computeCorrespondEpilines( InputArray points, int whichImage, InputArray F, OutputArray lines ) .. ocv:function:: void computeCorrespondEpilines( InputArray points, int whichImage, InputArray F, OutputArray lines )
.. ocv:cfunction:: void cvComputeCorrespondEpilines( const CvMat* points, int whichImage, const CvMat* F, CvMat* lines) .. ocv:cfunction:: void cvComputeCorrespondEpilines( const CvMat* points, int which_image, const CvMat* fundamental_matrix, CvMat* correspondent_lines )
.. ocv:pyoldfunction:: cv.ComputeCorrespondEpilines(points, whichImage, F, lines) -> None .. ocv:pyoldfunction:: cv.ComputeCorrespondEpilines(points, whichImage, F, lines) -> None
@ -344,10 +344,8 @@ Converts points to/from homogeneous coordinates.
.. ocv:function:: void convertPointsHomogeneous( InputArray src, OutputArray dst ) .. ocv:function:: void convertPointsHomogeneous( InputArray src, OutputArray dst )
.. ocv:pyfunction:: cv2.convertPointsHomogeneous(src[, dst]) -> dst
.. ocv:cfunction:: void cvConvertPointsHomogeneous( const CvMat* src, CvMat* dst ) .. ocv:cfunction:: void cvConvertPointsHomogeneous( const CvMat* src, CvMat* dst )
.. ocv:pyoldfunction:: cv.ConvertPointsHomogeneous( src, dst ) -> None .. ocv:pyoldfunction:: cv.ConvertPointsHomogeneous(src, dst) -> None
:param src: Input array or vector of 2D, 3D, or 4D points. :param src: Input array or vector of 2D, 3D, or 4D points.
@ -391,7 +389,7 @@ Decomposes a projection matrix into a rotation matrix and a camera matrix.
.. ocv:pyfunction:: cv2.decomposeProjectionMatrix(projMatrix[, cameraMatrix[, rotMatrix[, transVect[, rotMatrixX[, rotMatrixY[, rotMatrixZ[, eulerAngles]]]]]]]) -> cameraMatrix, rotMatrix, transVect, rotMatrixX, rotMatrixY, rotMatrixZ, eulerAngles .. ocv:pyfunction:: cv2.decomposeProjectionMatrix(projMatrix[, cameraMatrix[, rotMatrix[, transVect[, rotMatrixX[, rotMatrixY[, rotMatrixZ[, eulerAngles]]]]]]]) -> cameraMatrix, rotMatrix, transVect, rotMatrixX, rotMatrixY, rotMatrixZ, eulerAngles
.. ocv:cfunction:: void cvDecomposeProjectionMatrix( const CvMat *projMatrix, CvMat *cameraMatrix, CvMat *rotMatrix, CvMat *transVect, CvMat *rotMatrX=NULL, CvMat *rotMatrY=NULL, CvMat *rotMatrZ=NULL, CvPoint3D64f *eulerAngles=NULL) .. ocv:cfunction:: void cvDecomposeProjectionMatrix( const CvMat * projMatr, CvMat * calibMatr, CvMat * rotMatr, CvMat * posVect, CvMat * rotMatrX=NULL, CvMat * rotMatrY=NULL, CvMat * rotMatrZ=NULL, CvPoint3D64f * eulerAngles=NULL )
.. ocv:pyoldfunction:: cv.DecomposeProjectionMatrix(projMatrix, cameraMatrix, rotMatrix, transVect, rotMatrX=None, rotMatrY=None, rotMatrZ=None) -> eulerAngles .. ocv:pyoldfunction:: cv.DecomposeProjectionMatrix(projMatrix, cameraMatrix, rotMatrix, transVect, rotMatrX=None, rotMatrY=None, rotMatrZ=None) -> eulerAngles
@ -428,7 +426,7 @@ Renders the detected chessboard corners.
.. ocv:pyfunction:: cv2.drawChessboardCorners(image, patternSize, corners, patternWasFound) -> None .. ocv:pyfunction:: cv2.drawChessboardCorners(image, patternSize, corners, patternWasFound) -> None
.. ocv:cfunction:: void cvDrawChessboardCorners( CvArr* image, CvSize patternSize, CvPoint2D32f* corners, int count, int patternWasFound ) .. ocv:cfunction:: void cvDrawChessboardCorners( CvArr* image, CvSize pattern_size, CvPoint2D32f* corners, int count, int pattern_was_found )
.. ocv:pyoldfunction:: cv.DrawChessboardCorners(image, patternSize, corners, patternWasFound)-> None .. ocv:pyoldfunction:: cv.DrawChessboardCorners(image, patternSize, corners, patternWasFound)-> None
:param image: Destination image. It must be an 8-bit color image. :param image: Destination image. It must be an 8-bit color image.
@ -447,11 +445,11 @@ findChessboardCorners
------------------------- -------------------------
Finds the positions of internal corners of the chessboard. Finds the positions of internal corners of the chessboard.
.. ocv:function:: bool findChessboardCorners( InputArray image, Size patternSize, OutputArray corners, int flags=CV_CALIB_CB_ADAPTIVE_THRESH+CV_CALIB_CB_NORMALIZE_IMAGE ) .. ocv:function:: bool findChessboardCorners( InputArray image, Size patternSize, OutputArray corners, int flags=CALIB_CB_ADAPTIVE_THRESH+CALIB_CB_NORMALIZE_IMAGE )
.. ocv:pyfunction:: cv2.findChessboardCorners(image, patternSize[, corners[, flags]]) -> retval, corners .. ocv:pyfunction:: cv2.findChessboardCorners(image, patternSize[, corners[, flags]]) -> retval, corners
.. ocv:cfunction:: int cvFindChessboardCorners( const void* image, CvSize patternSize, CvPoint2D32f* corners, int* cornerCount=NULL, int flags=CV_CALIB_CB_ADAPTIVE_THRESH ) .. ocv:cfunction:: int cvFindChessboardCorners( const void* image, CvSize pattern_size, CvPoint2D32f* corners, int* corner_count=NULL, int flags=CV_CALIB_CB_ADAPTIVE_THRESH+CV_CALIB_CB_NORMALIZE_IMAGE )
.. ocv:pyoldfunction:: cv.FindChessboardCorners(image, patternSize, flags=CV_CALIB_CB_ADAPTIVE_THRESH) -> corners .. ocv:pyoldfunction:: cv.FindChessboardCorners(image, patternSize, flags=CV_CALIB_CB_ADAPTIVE_THRESH) -> corners
:param image: Source chessboard view. It must be an 8-bit grayscale or color image. :param image: Source chessboard view. It must be an 8-bit grayscale or color image.
@ -508,7 +506,7 @@ Finds the centers in the grid of circles.
.. ocv:function:: bool findCirclesGrid( InputArray image, Size patternSize, OutputArray centers, int flags=CALIB_CB_SYMMETRIC_GRID, const Ptr<FeatureDetector> &blobDetector = new SimpleBlobDetector() ) .. ocv:function:: bool findCirclesGrid( InputArray image, Size patternSize, OutputArray centers, int flags=CALIB_CB_SYMMETRIC_GRID, const Ptr<FeatureDetector> &blobDetector = new SimpleBlobDetector() )
.. ocv:pyfunction:: cv2.findCirclesGridDefault(image, patternSize[, centers[, flags]]) -> centers .. ocv:pyfunction:: cv2.findCirclesGridDefault(image, patternSize[, centers[, flags]]) -> retval, centers
:param image: Grid view of source circles. It must be an 8-bit grayscale or color image. :param image: Grid view of source circles. It must be an 8-bit grayscale or color image.
@ -551,13 +549,13 @@ solvePnP
------------ ------------
Finds an object pose from 3D-2D point correspondences. Finds an object pose from 3D-2D point correspondences.
.. ocv:function:: void solvePnP( InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix, InputArray distCoeffs, OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess=false, int flags = CV_ITERATIVE ) .. ocv:function:: bool solvePnP( InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix, InputArray distCoeffs, OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess=false, int flags=ITERATIVE )
.. ocv:pyfunction:: cv2.solvePnP( objectPoints, imagePoints, cameraMatrix, distCoeffs[, rvec[, tvec[, useExtrinsicGuess[, flags]]]] ) -> rvec, tvec .. ocv:pyfunction:: cv2.solvePnP(objectPoints, imagePoints, cameraMatrix, distCoeffs[, rvec[, tvec[, useExtrinsicGuess[, flags]]]]) -> retval, rvec, tvec
.. ocv:cfunction:: void cvFindExtrinsicCameraParams2( const CvMat* objectPoints, const CvMat* imagePoints, const CvMat* cameraMatrix, const CvMat* distCoeffs, CvMat* rvec, CvMat* tvec, int useExtrinsicGuess=0 ) .. ocv:cfunction:: void cvFindExtrinsicCameraParams2( const CvMat* object_points, const CvMat* image_points, const CvMat* camera_matrix, const CvMat* distortion_coeffs, CvMat* rotation_vector, CvMat* translation_vector, int use_extrinsic_guess=0 )
.. ocv:pyoldfunction:: cv.FindExtrinsicCameraParams2( objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess=0 )-> None .. ocv:pyoldfunction:: cv.FindExtrinsicCameraParams2(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess=0 ) -> None
:param objectPoints: Array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, where N is the number of points. ``vector<Point3f>`` can be also passed here. :param objectPoints: Array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, where N is the number of points. ``vector<Point3f>`` can be also passed here.
@ -587,7 +585,7 @@ solvePnPRansac
------------------ ------------------
Finds an object pose from 3D-2D point correspondences using the RANSAC scheme. Finds an object pose from 3D-2D point correspondences using the RANSAC scheme.
.. ocv:function:: void solvePnPRansac( InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix, InputArray distCoeffs, OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess=false, int iterationsCount = 100, float reprojectionError = 8.0, int minInliersCount = 100, OutputArray inliers = noArray(), int flags = CV_ITERATIVE ) .. ocv:function:: void solvePnPRansac( InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix, InputArray distCoeffs, OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess=false, int iterationsCount = 100, float reprojectionError = 8.0, int minInliersCount = 100, OutputArray inliers = noArray(), int flags = ITERATIVE )
.. ocv:pyfunction:: cv2.solvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs[, rvec[, tvec[, useExtrinsicGuess[, iterationsCount[, reprojectionError[, minInliersCount[, inliers[, flags]]]]]]]]) -> rvec, tvec, inliers .. ocv:pyfunction:: cv2.solvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs[, rvec[, tvec[, useExtrinsicGuess[, iterationsCount[, reprojectionError[, minInliersCount[, inliers[, flags]]]]]]]]) -> rvec, tvec, inliers
@ -628,8 +626,8 @@ Calculates a fundamental matrix from the corresponding points in two images.
.. ocv:pyfunction:: cv2.findFundamentalMat(points1, points2[, method[, param1[, param2[, mask]]]]) -> retval, mask .. ocv:pyfunction:: cv2.findFundamentalMat(points1, points2[, method[, param1[, param2[, mask]]]]) -> retval, mask
.. ocv:cfunction:: int cvFindFundamentalMat( const CvMat* points1, const CvMat* points2, CvMat* fundamentalMatrix, int method=CV_FM_RANSAC, double param1=1., double param2=0.99, CvMat* status=NULL) .. ocv:cfunction:: int cvFindFundamentalMat( const CvMat* points1, const CvMat* points2, CvMat* fundamental_matrix, int method=CV_FM_RANSAC, double param1=3., double param2=0.99, CvMat* status=NULL )
.. ocv:pyoldfunction:: cv.FindFundamentalMat(points1, points2, fundamentalMatrix, method=CV_FM_RANSAC, param1=1., param2=0.99, status=None) -> None .. ocv:pyoldfunction:: cv.FindFundamentalMat(points1, points2, fundamentalMatrix, method=CV_FM_RANSAC, param1=1., param2=0.99, status=None) -> retval
:param points1: Array of ``N`` points from the first image. The point coordinates should be floating-point (single or double precision). :param points1: Array of ``N`` points from the first image. The point coordinates should be floating-point (single or double precision).
@ -693,9 +691,9 @@ Finds a perspective transformation between two planes.
.. ocv:pyfunction:: cv2.findHomography(srcPoints, dstPoints[, method[, ransacReprojThreshold[, mask]]]) -> retval, mask .. ocv:pyfunction:: cv2.findHomography(srcPoints, dstPoints[, method[, ransacReprojThreshold[, mask]]]) -> retval, mask
.. ocv:cfunction:: void cvFindHomography( const CvMat* srcPoints, const CvMat* dstPoints, CvMat* H, int method=0, double ransacReprojThreshold=3, CvMat* status=NULL) .. ocv:cfunction:: int cvFindHomography( const CvMat* src_points, const CvMat* dst_points, CvMat* homography, int method=0, double ransacReprojThreshold=3, CvMat* mask=0 )
.. ocv:pyoldfunction:: cv.FindHomography(srcPoints, dstPoints, H, method, ransacReprojThreshold=3.0, status=None)-> None .. ocv:pyoldfunction:: cv.FindHomography(srcPoints, dstPoints, H, method=0, ransacReprojThreshold=3.0, status=None) -> None
:param srcPoints: Coordinates of the points in the original plane, a matrix of the type ``CV_32FC2`` or ``vector<Point2f>`` . :param srcPoints: Coordinates of the points in the original plane, a matrix of the type ``CV_32FC2`` or ``vector<Point2f>`` .
@ -773,9 +771,9 @@ estimateAffine3D
-------------------- --------------------
Computes an optimal affine transformation between two 3D point sets. Computes an optimal affine transformation between two 3D point sets.
.. ocv:function:: int estimateAffine3D(InputArray srcpt, InputArray dstpt, OutputArray out, OutputArray inliers, double ransacThreshold = 3.0, double confidence = 0.99) .. ocv:function:: int estimateAffine3D(InputArray src, InputArray dst, OutputArray out, OutputArray inliers, double ransacThreshold = 3, double confidence = 0.99)
.. ocv:pyfunction:: cv2.estimateAffine3D(srcpt, dstpt[, out[, inliers[, ransacThreshold[, confidence]]]]) -> retval, out, inliers .. ocv:pyfunction:: cv2.estimateAffine3D(src, dst[, out[, inliers[, ransacThreshold[, confidence]]]]) -> retval, out, inliers
:param srcpt: First input 3D point set. :param srcpt: First input 3D point set.
@ -815,13 +813,13 @@ getOptimalNewCameraMatrix
----------------------------- -----------------------------
Returns the new camera matrix based on the free scaling parameter. Returns the new camera matrix based on the free scaling parameter.
.. ocv:function:: Mat getOptimalNewCameraMatrix( InputArray cameraMatrix, InputArray distCoeffs, Size imageSize, double alpha, Size newImageSize=Size(), Rect* validPixROI=0, bool centerPrincipalPoint=false) .. ocv:function:: Mat getOptimalNewCameraMatrix( InputArray cameraMatrix, InputArray distCoeffs, Size imageSize, double alpha, Size newImgSize=Size(), Rect* validPixROI=0, bool centerPrincipalPoint=false )
.. ocv:pyfunction:: cv2.getOptimalNewCameraMatrix(cameraMatrix, distCoeffs, imageSize, alpha[, newImgSize[, centerPrincipalPoint]]) -> retval, validPixROI .. ocv:pyfunction:: cv2.getOptimalNewCameraMatrix(cameraMatrix, distCoeffs, imageSize, alpha[, newImgSize[, centerPrincipalPoint]]) -> retval, validPixROI
.. ocv:cfunction:: void cvGetOptimalNewCameraMatrix( const CvMat* cameraMatrix, const CvMat* distCoeffs, CvSize imageSize, double alpha, CvMat* newCameraMatrix, CvSize newImageSize=cvSize(0, 0), CvRect* validPixROI=0, int centerPrincipalPoint=0) .. ocv:cfunction:: void cvGetOptimalNewCameraMatrix( const CvMat* camera_matrix, const CvMat* dist_coeffs, CvSize image_size, double alpha, CvMat* new_camera_matrix, CvSize new_imag_size=cvSize(0,0), CvRect* valid_pixel_ROI=0, int center_principal_point=0 )
.. ocv:pyoldfunction:: cv.GetOptimalNewCameraMatrix(cameraMatrix, distCoeffs, imageSize, alpha, newCameraMatrix, newImageSize=(0, 0), validPixROI=0) -> None .. ocv:pyoldfunction:: cv.GetOptimalNewCameraMatrix(cameraMatrix, distCoeffs, imageSize, alpha, newCameraMatrix, newImageSize=(0, 0), validPixROI=0, centerPrincipalPoint=0) -> None
:param cameraMatrix: Input camera matrix. :param cameraMatrix: Input camera matrix.
@ -854,9 +852,9 @@ Finds an initial camera matrix from 3D-2D point correspondences.
.. ocv:pyfunction:: cv2.initCameraMatrix2D(objectPoints, imagePoints, imageSize[, aspectRatio]) -> retval .. ocv:pyfunction:: cv2.initCameraMatrix2D(objectPoints, imagePoints, imageSize[, aspectRatio]) -> retval
.. ocv:cfunction:: void cvInitIntrinsicParams2D( const CvMat* objectPoints, const CvMat* imagePoints, const CvMat* pointCounts, CvSize imageSize, CvMat* cameraMatrix, double aspectRatio=1.) .. ocv:cfunction:: void cvInitIntrinsicParams2D( const CvMat* object_points, const CvMat* image_points, const CvMat* npoints, CvSize image_size, CvMat* camera_matrix, double aspect_ratio=1. )
.. ocv:pyoldfunction:: cv.InitIntrinsicParams2D(objectPoints, imagePoints, pointCounts, imageSize, cameraMatrix, aspectRatio=1.) -> None .. ocv:pyoldfunction:: cv.InitIntrinsicParams2D(objectPoints, imagePoints, npoints, imageSize, cameraMatrix, aspectRatio=1.) -> None
:param objectPoints: Vector of vectors of the calibration pattern points in the calibration pattern coordinate space. In the old interface all the per-view vectors are concatenated. See :ocv:func:`calibrateCamera` for details. :param objectPoints: Vector of vectors of the calibration pattern points in the calibration pattern coordinate space. In the old interface all the per-view vectors are concatenated. See :ocv:func:`calibrateCamera` for details.
@ -903,7 +901,8 @@ Projects 3D points to an image plane.
.. ocv:pyfunction:: cv2.projectPoints(objectPoints, rvec, tvec, cameraMatrix, distCoeffs[, imagePoints[, jacobian[, aspectRatio]]]) -> imagePoints, jacobian .. ocv:pyfunction:: cv2.projectPoints(objectPoints, rvec, tvec, cameraMatrix, distCoeffs[, imagePoints[, jacobian[, aspectRatio]]]) -> imagePoints, jacobian
.. ocv:cfunction:: void cvProjectPoints2( const CvMat* objectPoints, const CvMat* rvec, const CvMat* tvec, const CvMat* cameraMatrix, const CvMat* distCoeffs, CvMat* imagePoints, CvMat* dpdrot=NULL, CvMat* dpdt=NULL, CvMat* dpdf=NULL, CvMat* dpdc=NULL, CvMat* dpddist=NULL ) .. ocv:cfunction:: void cvProjectPoints2( const CvMat* object_points, const CvMat* rotation_vector, const CvMat* translation_vector, const CvMat* camera_matrix, const CvMat* distortion_coeffs, CvMat* image_points, CvMat* dpdrot=NULL, CvMat* dpdt=NULL, CvMat* dpdf=NULL, CvMat* dpdc=NULL, CvMat* dpddist=NULL, double aspect_ratio=0 )
.. ocv:pyoldfunction:: cv.ProjectPoints2(objectPoints, rvec, tvec, cameraMatrix, distCoeffs, imagePoints, dpdrot=None, dpdt=None, dpdf=None, dpdc=None, dpddist=None)-> None .. ocv:pyoldfunction:: cv.ProjectPoints2(objectPoints, rvec, tvec, cameraMatrix, distCoeffs, imagePoints, dpdrot=None, dpdt=None, dpdf=None, dpdc=None, dpddist=None)-> None
:param objectPoints: Array of object points, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel (or ``vector<Point3f>`` ), where N is the number of points in the view. :param objectPoints: Array of object points, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel (or ``vector<Point3f>`` ), where N is the number of points in the view.
@ -943,11 +942,11 @@ reprojectImageTo3D
---------------------- ----------------------
Reprojects a disparity image to 3D space. Reprojects a disparity image to 3D space.
.. ocv:function:: void reprojectImageTo3D( InputArray disparity, OutputArray _3dImage, InputArray Q, bool handleMissingValues=false, int depth=-1 ) .. ocv:function:: void reprojectImageTo3D( InputArray disparity, OutputArray _3dImage, InputArray Q, bool handleMissingValues=false, int ddepth=-1 )
.. ocv:pyfunction:: cv2.reprojectImageTo3D(disparity, Q[, _3dImage[, handleMissingValues[, ddepth]]]) -> _3dImage .. ocv:pyfunction:: cv2.reprojectImageTo3D(disparity, Q[, _3dImage[, handleMissingValues[, ddepth]]]) -> _3dImage
.. ocv:cfunction:: void cvReprojectImageTo3D( const CvArr* disparity, CvArr* _3dImage, const CvMat* Q, int handleMissingValues=0) .. ocv:cfunction:: void cvReprojectImageTo3D( const CvArr* disparityImage, CvArr* _3dImage, const CvMat* Q, int handleMissingValues=0 )
.. ocv:pyoldfunction:: cv.ReprojectImageTo3D(disparity, _3dImage, Q, handleMissingValues=0) -> None .. ocv:pyoldfunction:: cv.ReprojectImageTo3D(disparity, _3dImage, Q, handleMissingValues=0) -> None
@ -978,11 +977,11 @@ RQDecomp3x3
--------------- ---------------
Computes an RQ decomposition of 3x3 matrices. Computes an RQ decomposition of 3x3 matrices.
.. ocv:function:: Vec3d RQDecomp3x3( InputArray M, OutputArray R, OutputArray Q, OutputArray Qx=noArray(), OutputArray Qy=noArray(), OutputArray Qz=noArray() ) .. ocv:function:: Vec3d RQDecomp3x3( InputArray src, OutputArray mtxR, OutputArray mtxQ, OutputArray Qx=noArray(), OutputArray Qy=noArray(), OutputArray Qz=noArray() )
.. ocv:pyfunction:: cv2.RQDecomp3x3(src[, mtxR[, mtxQ[, Qx[, Qy[, Qz]]]]]) -> retval, mtxR, mtxQ, Qx, Qy, Qz .. ocv:pyfunction:: cv2.RQDecomp3x3(src[, mtxR[, mtxQ[, Qx[, Qy[, Qz]]]]]) -> retval, mtxR, mtxQ, Qx, Qy, Qz
.. ocv:cfunction:: void cvRQDecomp3x3( const CvMat *M, CvMat *R, CvMat *Q, CvMat *Qx=NULL, CvMat *Qy=NULL, CvMat *Qz=NULL, CvPoint3D64f *eulerAngles=NULL) .. 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 .. ocv:pyoldfunction:: cv.RQDecomp3x3(M, R, Q, Qx=None, Qy=None, Qz=None) -> eulerAngles
:param M: 3x3 input matrix. :param M: 3x3 input matrix.
@ -1083,11 +1082,11 @@ The constructors.
.. ocv:function:: StereoBM::StereoBM() .. ocv:function:: StereoBM::StereoBM()
.. ocv:function:: StereoBM::StereoBM(int preset, int ndisparities=0, int SADWindowSize=21) .. ocv:function:: StereoBM::StereoBM(int preset, int ndisparities=0, int SADWindowSize=21)
.. ocv:pyfunction:: cv2.StereoBM.StereoBM(preset[, ndisparities[, SADWindowSize]]) -> <StereoBM object> .. ocv:pyfunction:: cv2.StereoBM([preset[, ndisparities[, SADWindowSize]]]) -> <StereoBM object>
.. ocv:cfunction:: CvStereoBMState* cvCreateStereoBMState( int preset=CV_STEREO_BM_BASIC, int ndisparities=0 ) .. ocv:cfunction:: CvStereoBMState* cvCreateStereoBMState( int preset=CV_STEREO_BM_BASIC, int numberOfDisparities=0 )
.. ocv:pyoldfunction:: cv.CreateStereoBMState(preset=CV_STEREO_BM_BASIC, ndisparities=0)-> StereoBMState .. ocv:pyoldfunction:: cv.CreateStereoBMState(preset=CV_STEREO_BM_BASIC, numberOfDisparities=0)-> CvStereoBMState
:param preset: specifies the whole set of algorithm parameters, one of: :param preset: specifies the whole set of algorithm parameters, one of:
@ -1109,7 +1108,7 @@ StereoBM::operator()
----------------------- -----------------------
Computes disparity using the BM algorithm for a rectified stereo pair. Computes disparity using the BM algorithm for a rectified stereo pair.
.. ocv:function:: void StereoBM::operator()(InputArray left, InputArray right, OutputArray disp, int disptype=CV_16S ) .. ocv:function:: void StereoBM::operator()( InputArray left, InputArray right, OutputArray disparity, int disptype=CV_16S )
.. ocv:pyfunction:: cv2.StereoBM.compute(left, right[, disparity[, disptype]]) -> disparity .. ocv:pyfunction:: cv2.StereoBM.compute(left, right[, disparity[, disptype]]) -> disparity
@ -1182,7 +1181,7 @@ StereoSGBM::StereoSGBM
.. ocv:function:: StereoSGBM::StereoSGBM( int minDisparity, int numDisparities, int SADWindowSize, int P1=0, int P2=0, int disp12MaxDiff=0, int preFilterCap=0, int uniquenessRatio=0, int speckleWindowSize=0, int speckleRange=0, bool fullDP=false) .. ocv:function:: StereoSGBM::StereoSGBM( int minDisparity, int numDisparities, int SADWindowSize, int P1=0, int P2=0, int disp12MaxDiff=0, int preFilterCap=0, int uniquenessRatio=0, int speckleWindowSize=0, int speckleRange=0, bool fullDP=false)
.. ocv:pyfunction:: cv2.StereoSGBM.StereoSGBM(minDisparity, numDisparities, SADWindowSize[, P1[, P2[, disp12MaxDiff[, preFilterCap[, uniquenessRatio[, speckleWindowSize[, speckleRange[, fullDP]]]]]]]]) -> <StereoSGBM object> .. ocv:pyfunction:: cv2.StereoSGBM([minDisparity, numDisparities, SADWindowSize[, P1[, P2[, disp12MaxDiff[, preFilterCap[, uniquenessRatio[, speckleWindowSize[, speckleRange[, fullDP]]]]]]]]]) -> <StereoSGBM object>
Initializes ``StereoSGBM`` and sets parameters to custom values.?? Initializes ``StereoSGBM`` and sets parameters to custom values.??
@ -1349,12 +1348,13 @@ stereoCalibrate
------------------- -------------------
Calibrates the stereo camera. Calibrates the stereo camera.
.. ocv:function:: double stereoCalibrate( InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2, InputOutputArray cameraMatrix1, InputOutputArray distCoeffs1, InputOutputArray cameraMatrix2, InputOutputArray distCoeffs2, Size imageSize, OutputArray R, OutputArray T, OutputArray E, OutputArray F, TermCriteria term_crit = TermCriteria(TermCriteria::COUNT+ TermCriteria::EPS, 30, 1e-6), int flags=CALIB_FIX_INTRINSIC ) .. ocv:function:: double stereoCalibrate( InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2, InputOutputArray cameraMatrix1, InputOutputArray distCoeffs1, InputOutputArray cameraMatrix2, InputOutputArray distCoeffs2, Size imageSize, OutputArray R, OutputArray T, OutputArray E, OutputArray F, TermCriteria criteria=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6), int flags=CALIB_FIX_INTRINSIC )
.. ocv:pyfunction:: cv2.stereoCalibrate(objectPoints, imagePoints1, imagePoints2, imageSize[, cameraMatrix1[, distCoeffs1[, cameraMatrix2[, distCoeffs2[, R[, T[, E[, F[, criteria[, flags]]]]]]) -> retval, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, R, T, E, F .. ocv:pyfunction:: cv2.stereoCalibrate(objectPoints, imagePoints1, imagePoints2, imageSize[, cameraMatrix1[, distCoeffs1[, cameraMatrix2[, distCoeffs2[, R[, T[, E[, F[, criteria[, flags]]]]]]]]]]) -> retval, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, R, T, E, F
.. ocv:cfunction:: double cvStereoCalibrate( const CvMat* objectPoints, const CvMat* imagePoints1, const CvMat* imagePoints2, const CvMat* pointCounts, CvMat* cameraMatrix1, CvMat* distCoeffs1, CvMat* cameraMatrix2, CvMat* distCoeffs2, CvSize imageSize, CvMat* R, CvMat* T, CvMat* E=0, CvMat* F=0, CvTermCriteria termCrit=cvTermCriteria( CV_TERMCRIT_ITER+CV_TERMCRIT_EPS, 30, 1e-6), int flags=CV_CALIB_FIX_INTRINSIC ) .. ocv:cfunction:: double cvStereoCalibrate( const CvMat* object_points, const CvMat* image_points1, const CvMat* image_points2, const CvMat* npoints, CvMat* camera_matrix1, CvMat* dist_coeffs1, CvMat* camera_matrix2, CvMat* dist_coeffs2, CvSize image_size, CvMat* R, CvMat* T, CvMat* E=0, CvMat* F=0, CvTermCriteria term_crit=cvTermCriteria( CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,30,1e-6), int flags=CV_CALIB_FIX_INTRINSIC )
.. ocv:pyoldfunction:: cv.StereoCalibrate( objectPoints, imagePoints1, imagePoints2, pointCounts, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, R, T, E=None, F=None, termCrit=(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS, 30, 1e-6), flags=CV_CALIB_FIX_INTRINSIC)-> None
.. ocv:pyoldfunction:: cv.StereoCalibrate(objectPoints, imagePoints1, imagePoints2, pointCounts, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, R, T, E=None, F=None, term_crit=(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS, 30, 1e-6), flags=CV_CALIB_FIX_INTRINSIC)-> None
:param objectPoints: Vector of vectors of the calibration pattern points. :param objectPoints: Vector of vectors of the calibration pattern points.
@ -1439,10 +1439,11 @@ stereoRectify
----------------- -----------------
Computes rectification transforms for each head of a calibrated stereo camera. Computes rectification transforms for each head of a calibrated stereo camera.
.. ocv:function:: void stereoRectify( InputArray cameraMatrix1, InputArray distCoeffs1, InputArray cameraMatrix2, InputArray distCoeffs2, Size imageSize, InputArray R, InputArray T, OutputArray R1, OutputArray R2, OutputArray P1, OutputArray P2, OutputArray Q, int flags=CALIB_ZERO_DISPARITY, double alpha, Size newImageSize=Size(), Rect* roi1=0, Rect* roi2=0 ) .. ocv:function:: void stereoRectify( InputArray cameraMatrix1, InputArray distCoeffs1, InputArray cameraMatrix2, InputArray distCoeffs2, Size imageSize, InputArray R, InputArray T, OutputArray R1, OutputArray R2, OutputArray P1, OutputArray P2, OutputArray Q, int flags=CALIB_ZERO_DISPARITY, double alpha=-1, Size newImageSize=Size(), Rect* validPixROI1=0, Rect* validPixROI2=0 )
.. ocv:cfunction:: void cvStereoRectify( const CvMat* cameraMatrix1, const CvMat* cameraMatrix2, const CvMat* distCoeffs1, const CvMat* distCoeffs2, CvSize imageSize, const CvMat* R, const CvMat* T, CvMat* R1, CvMat* R2, CvMat* P1, CvMat* P2, CvMat* Q=0, int flags=CV_CALIB_ZERO_DISPARITY, double alpha=-1, CvSize newImageSize=cvSize(0, 0), CvRect* roi1=0, CvRect* roi2=0) .. ocv:cfunction:: void cvStereoRectify( const CvMat* camera_matrix1, const CvMat* camera_matrix2, const CvMat* dist_coeffs1, const CvMat* dist_coeffs2, CvSize image_size, const CvMat* R, const CvMat* T, CvMat* R1, CvMat* R2, CvMat* P1, CvMat* P2, CvMat* Q=0, int flags=CV_CALIB_ZERO_DISPARITY, double alpha=-1, CvSize new_image_size=cvSize(0,0), CvRect* valid_pix_ROI1=0, CvRect* valid_pix_ROI2=0 )
.. ocv:pyoldfunction:: cv.StereoRectify( cameraMatrix1, cameraMatrix2, distCoeffs1, distCoeffs2, imageSize, R, T, R1, R2, P1, P2, Q=None, flags=CV_CALIB_ZERO_DISPARITY, alpha=-1, newImageSize=(0, 0))-> (roi1, roi2)
.. ocv:pyoldfunction:: cv.StereoRectify(cameraMatrix1, cameraMatrix2, distCoeffs1, distCoeffs2, imageSize, R, T, R1, R2, P1, P2, Q=None, flags=CV_CALIB_ZERO_DISPARITY, alpha=-1, newImageSize=(0, 0)) -> (roi1, roi2)
:param cameraMatrix1: First camera matrix. :param cameraMatrix1: First camera matrix.
@ -1529,7 +1530,7 @@ Computes a rectification transform for an uncalibrated stereo camera.
.. ocv:pyfunction:: cv2.stereoRectifyUncalibrated(points1, points2, F, imgSize[, H1[, H2[, threshold]]]) -> retval, H1, H2 .. ocv:pyfunction:: cv2.stereoRectifyUncalibrated(points1, points2, F, imgSize[, H1[, H2[, threshold]]]) -> retval, H1, H2
.. ocv:cfunction:: void cvStereoRectifyUncalibrated( const CvMat* points1, const CvMat* points2, const CvMat* F, CvSize imageSize, CvMat* H1, CvMat* H2, double threshold=5 ) .. ocv:cfunction:: int cvStereoRectifyUncalibrated( const CvMat* points1, const CvMat* points2, const CvMat* F, CvSize img_size, CvMat* H1, CvMat* H2, double threshold=5 )
.. ocv:pyoldfunction:: cv.StereoRectifyUncalibrated(points1, points2, F, imageSize, H1, H2, threshold=5)-> None .. ocv:pyoldfunction:: cv.StereoRectifyUncalibrated(points1, points2, F, imageSize, H1, H2, threshold=5)-> None

View File

@ -81,7 +81,7 @@ CVAPI(void) cvConvertPointsHomogeneous( const CvMat* src, CvMat* dst );
#define CV_LMEDS 4 #define CV_LMEDS 4
#define CV_RANSAC 8 #define CV_RANSAC 8
#define CV_FM_LMEDS_ONLY CV_LMEDS #define CV_FM_LMEDS_ONLY CV_LMEDS
#define CV_FM_RANSAC_ONLY CV_RANSAC #define CV_FM_RANSAC_ONLY CV_RANSAC
#define CV_FM_LMEDS CV_LMEDS #define CV_FM_LMEDS CV_LMEDS
@ -93,7 +93,7 @@ enum
CV_EPNP = 1, // F.Moreno-Noguer, V.Lepetit and P.Fua "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" CV_EPNP = 1, // F.Moreno-Noguer, V.Lepetit and P.Fua "EPnP: Efficient Perspective-n-Point Camera Pose Estimation"
CV_P3P = 2 // X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang; "Complete Solution Classification for the Perspective-Three-Point Problem" CV_P3P = 2 // X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang; "Complete Solution Classification for the Perspective-Three-Point Problem"
}; };
CVAPI(int) cvFindFundamentalMat( const CvMat* points1, const CvMat* points2, CVAPI(int) cvFindFundamentalMat( const CvMat* points1, const CvMat* points2,
CvMat* fundamental_matrix, CvMat* fundamental_matrix,
int method CV_DEFAULT(CV_FM_RANSAC), int method CV_DEFAULT(CV_FM_RANSAC),
@ -117,7 +117,7 @@ CVAPI(void) cvTriangulatePoints(CvMat* projMatr1, CvMat* projMatr2,
CVAPI(void) cvCorrectMatches(CvMat* F, CvMat* points1, CvMat* points2, CVAPI(void) cvCorrectMatches(CvMat* F, CvMat* points1, CvMat* points2,
CvMat* new_points1, CvMat* new_points2); CvMat* new_points1, CvMat* new_points2);
/* Computes the optimal new camera matrix according to the free scaling parameter alpha: /* Computes the optimal new camera matrix according to the free scaling parameter alpha:
alpha=0 - only valid pixels will be retained in the undistorted image alpha=0 - only valid pixels will be retained in the undistorted image
alpha=1 - all the source image pixels will be retained in the undistorted image alpha=1 - all the source image pixels will be retained in the undistorted image
@ -203,20 +203,19 @@ CVAPI(void) cvInitIntrinsicParams2D( const CvMat* object_points,
#define CV_CALIB_CB_FILTER_QUADS 4 #define CV_CALIB_CB_FILTER_QUADS 4
#define CV_CALIB_CB_FAST_CHECK 8 #define CV_CALIB_CB_FAST_CHECK 8
// Performs a fast check if a chessboard is in the input image. This is a workaround to // Performs a fast check if a chessboard is in the input image. This is a workaround to
// a problem of cvFindChessboardCorners being slow on images with no chessboard // a problem of cvFindChessboardCorners being slow on images with no chessboard
// - src: input image // - src: input image
// - size: chessboard size // - size: chessboard size
// Returns 1 if a chessboard can be in this image and findChessboardCorners should be called, // Returns 1 if a chessboard can be in this image and findChessboardCorners should be called,
// 0 if there is no chessboard, -1 in case of error // 0 if there is no chessboard, -1 in case of error
CVAPI(int) cvCheckChessboard(IplImage* src, CvSize size); CVAPI(int) cvCheckChessboard(IplImage* src, CvSize size);
/* Detects corners on a chessboard calibration pattern */ /* Detects corners on a chessboard calibration pattern */
CVAPI(int) cvFindChessboardCorners( const void* image, CvSize pattern_size, CVAPI(int) cvFindChessboardCorners( const void* image, CvSize pattern_size,
CvPoint2D32f* corners, CvPoint2D32f* corners,
int* corner_count CV_DEFAULT(NULL), int* corner_count CV_DEFAULT(NULL),
int flags CV_DEFAULT(CV_CALIB_CB_ADAPTIVE_THRESH+ int flags CV_DEFAULT(CV_CALIB_CB_ADAPTIVE_THRESH+CV_CALIB_CB_NORMALIZE_IMAGE) );
CV_CALIB_CB_NORMALIZE_IMAGE) );
/* Draws individual chessboard corners or the whole chessboard detected */ /* Draws individual chessboard corners or the whole chessboard detected */
CVAPI(void) cvDrawChessboardCorners( CvArr* image, CvSize pattern_size, CVAPI(void) cvDrawChessboardCorners( CvArr* image, CvSize pattern_size,
@ -330,7 +329,7 @@ typedef struct CvStereoBMState
int speckleRange; // acceptable range of variation in window int speckleRange; // acceptable range of variation in window
int trySmallerWindows; // if 1, the results may be more accurate, int trySmallerWindows; // if 1, the results may be more accurate,
// at the expense of slower processing // at the expense of slower processing
CvRect roi1, roi2; CvRect roi1, roi2;
int disp12MaxDiff; int disp12MaxDiff;
@ -353,13 +352,13 @@ CVAPI(void) cvReleaseStereoBMState( CvStereoBMState** state );
CVAPI(void) cvFindStereoCorrespondenceBM( const CvArr* left, const CvArr* right, CVAPI(void) cvFindStereoCorrespondenceBM( const CvArr* left, const CvArr* right,
CvArr* disparity, CvStereoBMState* state ); CvArr* disparity, CvStereoBMState* state );
CVAPI(CvRect) cvGetValidDisparityROI( CvRect roi1, CvRect roi2, int minDisparity, CVAPI(CvRect) cvGetValidDisparityROI( CvRect roi1, CvRect roi2, int minDisparity,
int numberOfDisparities, int SADWindowSize ); int numberOfDisparities, int SADWindowSize );
CVAPI(void) cvValidateDisparity( CvArr* disparity, const CvArr* cost, CVAPI(void) cvValidateDisparity( CvArr* disparity, const CvArr* cost,
int minDisparity, int numberOfDisparities, int minDisparity, int numberOfDisparities,
int disp12MaxDiff CV_DEFAULT(1) ); int disp12MaxDiff CV_DEFAULT(1) );
/* Reprojects the computed disparity image to the 3D space using the specified 4x4 matrix */ /* Reprojects the computed disparity image to the 3D space using the specified 4x4 matrix */
CVAPI(void) cvReprojectImageTo3D( const CvArr* disparityImage, CVAPI(void) cvReprojectImageTo3D( const CvArr* disparityImage,
@ -384,11 +383,11 @@ public:
bool completeSymmFlag=false ); bool completeSymmFlag=false );
bool update( const CvMat*& param, CvMat*& J, CvMat*& err ); bool update( const CvMat*& param, CvMat*& J, CvMat*& err );
bool updateAlt( const CvMat*& param, CvMat*& JtJ, CvMat*& JtErr, double*& errNorm ); bool updateAlt( const CvMat*& param, CvMat*& JtJ, CvMat*& JtErr, double*& errNorm );
void clear(); void clear();
void step(); void step();
enum { DONE=0, STARTED=1, CALC_J=2, CHECK_ERR=3 }; enum { DONE=0, STARTED=1, CALC_J=2, CHECK_ERR=3 };
cv::Ptr<CvMat> mask; cv::Ptr<CvMat> mask;
cv::Ptr<CvMat> prevParam; cv::Ptr<CvMat> prevParam;
cv::Ptr<CvMat> param; cv::Ptr<CvMat> param;
@ -427,7 +426,7 @@ CV_EXPORTS_W Mat findHomography( InputArray srcPoints, InputArray dstPoints,
//! variant of findHomography for backward compatibility //! variant of findHomography for backward compatibility
CV_EXPORTS Mat findHomography( InputArray srcPoints, InputArray dstPoints, CV_EXPORTS Mat findHomography( InputArray srcPoints, InputArray dstPoints,
OutputArray mask, int method=0, double ransacReprojThreshold=3); OutputArray mask, int method=0, double ransacReprojThreshold=3);
//! Computes RQ decomposition of 3x3 matrix //! Computes RQ decomposition of 3x3 matrix
CV_EXPORTS_W Vec3d RQDecomp3x3( InputArray src, OutputArray mtxR, OutputArray mtxQ, CV_EXPORTS_W Vec3d RQDecomp3x3( InputArray src, OutputArray mtxR, OutputArray mtxQ,
OutputArray Qx=noArray(), OutputArray Qx=noArray(),
@ -440,7 +439,7 @@ CV_EXPORTS_W void decomposeProjectionMatrix( InputArray projMatrix, OutputArray
OutputArray rotMatrixX=noArray(), OutputArray rotMatrixX=noArray(),
OutputArray rotMatrixY=noArray(), OutputArray rotMatrixY=noArray(),
OutputArray rotMatrixZ=noArray(), OutputArray rotMatrixZ=noArray(),
OutputArray eulerAngles=noArray() ); OutputArray eulerAngles=noArray() );
//! computes derivatives of the matrix product w.r.t each of the multiplied matrix coefficients //! computes derivatives of the matrix product w.r.t each of the multiplied matrix coefficients
CV_EXPORTS_W void matMulDeriv( InputArray A, InputArray B, CV_EXPORTS_W void matMulDeriv( InputArray A, InputArray B,
@ -467,14 +466,14 @@ CV_EXPORTS_W void projectPoints( InputArray objectPoints,
//! computes the camera pose from a few 3D points and the corresponding projections. The outliers are not handled. //! computes the camera pose from a few 3D points and the corresponding projections. The outliers are not handled.
enum enum
{ {
ITERATIVE=CV_ITERATIVE, ITERATIVE=CV_ITERATIVE,
EPNP=CV_EPNP, EPNP=CV_EPNP,
P3P=CV_P3P P3P=CV_P3P
}; };
CV_EXPORTS_W bool solvePnP( InputArray objectPoints, InputArray imagePoints, CV_EXPORTS_W bool solvePnP( InputArray objectPoints, InputArray imagePoints,
InputArray cameraMatrix, InputArray distCoeffs, InputArray cameraMatrix, InputArray distCoeffs,
OutputArray rvec, OutputArray tvec, OutputArray rvec, OutputArray tvec,
bool useExtrinsicGuess=false, int flags=0); bool useExtrinsicGuess=false, int flags=ITERATIVE);
//! computes the camera pose from a few 3D points and the corresponding projections. The outliers are possible. //! computes the camera pose from a few 3D points and the corresponding projections. The outliers are possible.
CV_EXPORTS_W void solvePnPRansac( InputArray objectPoints, CV_EXPORTS_W void solvePnPRansac( InputArray objectPoints,
@ -483,12 +482,12 @@ CV_EXPORTS_W void solvePnPRansac( InputArray objectPoints,
InputArray distCoeffs, InputArray distCoeffs,
OutputArray rvec, OutputArray rvec,
OutputArray tvec, OutputArray tvec,
bool useExtrinsicGuess = false, bool useExtrinsicGuess = false,
int iterationsCount = 100, int iterationsCount = 100,
float reprojectionError = 8.0, float reprojectionError = 8.0,
int minInliersCount = 100, int minInliersCount = 100,
OutputArray inliers = noArray(), OutputArray inliers = noArray(),
int flags = 0); int flags = ITERATIVE);
//! initializes camera matrix from a few 3D points and the corresponding projections. //! initializes camera matrix from a few 3D points and the corresponding projections.
CV_EXPORTS_W Mat initCameraMatrix2D( InputArrayOfArrays objectPoints, CV_EXPORTS_W Mat initCameraMatrix2D( InputArrayOfArrays objectPoints,
@ -501,10 +500,9 @@ enum { CALIB_CB_ADAPTIVE_THRESH = 1, CALIB_CB_NORMALIZE_IMAGE = 2,
//! finds checkerboard pattern of the specified size in the image //! finds checkerboard pattern of the specified size in the image
CV_EXPORTS_W bool findChessboardCorners( InputArray image, Size patternSize, CV_EXPORTS_W bool findChessboardCorners( InputArray image, Size patternSize,
OutputArray corners, OutputArray corners,
int flags=CALIB_CB_ADAPTIVE_THRESH+ int flags=CALIB_CB_ADAPTIVE_THRESH+CALIB_CB_NORMALIZE_IMAGE );
CALIB_CB_NORMALIZE_IMAGE );
//! finds subpixel-accurate positions of the chessboard corners //! finds subpixel-accurate positions of the chessboard corners
CV_EXPORTS bool find4QuadCornerSubpix(InputArray img, InputOutputArray corners, Size region_size); CV_EXPORTS bool find4QuadCornerSubpix(InputArray img, InputOutputArray corners, Size region_size);
//! draws the checkerboard pattern (found or partly found) in the image //! draws the checkerboard pattern (found or partly found) in the image
@ -574,11 +572,10 @@ CV_EXPORTS_W double stereoCalibrate( InputArrayOfArrays objectPoints,
CV_OUT InputOutputArray distCoeffs2, CV_OUT InputOutputArray distCoeffs2,
Size imageSize, OutputArray R, Size imageSize, OutputArray R,
OutputArray T, OutputArray E, OutputArray F, OutputArray T, OutputArray E, OutputArray F,
TermCriteria criteria = TermCriteria(TermCriteria::COUNT+ TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6),
TermCriteria::EPS, 30, 1e-6),
int flags=CALIB_FIX_INTRINSIC ); int flags=CALIB_FIX_INTRINSIC );
//! computes the rectification transformation for a stereo camera from its intrinsic and extrinsic parameters //! computes the rectification transformation for a stereo camera from its intrinsic and extrinsic parameters
CV_EXPORTS_W void stereoRectify( InputArray cameraMatrix1, InputArray distCoeffs1, CV_EXPORTS_W void stereoRectify( InputArray cameraMatrix1, InputArray distCoeffs1,
InputArray cameraMatrix2, InputArray distCoeffs2, InputArray cameraMatrix2, InputArray distCoeffs2,
@ -606,7 +603,7 @@ CV_EXPORTS_W float rectify3Collinear( InputArray cameraMatrix1, InputArray distC
OutputArray P1, OutputArray P2, OutputArray P3, OutputArray P1, OutputArray P2, OutputArray P3,
OutputArray Q, double alpha, Size newImgSize, OutputArray Q, double alpha, Size newImgSize,
CV_OUT Rect* roi1, CV_OUT Rect* roi2, int flags ); CV_OUT Rect* roi1, CV_OUT Rect* roi2, int flags );
//! returns the optimal new camera matrix //! returns the optimal new camera matrix
CV_EXPORTS_W Mat getOptimalNewCameraMatrix( InputArray cameraMatrix, InputArray distCoeffs, CV_EXPORTS_W Mat getOptimalNewCameraMatrix( InputArray cameraMatrix, InputArray distCoeffs,
Size imageSize, double alpha, Size newImgSize=Size(), Size imageSize, double alpha, Size newImgSize=Size(),
@ -614,16 +611,16 @@ CV_EXPORTS_W Mat getOptimalNewCameraMatrix( InputArray cameraMatrix, InputArray
//! converts point coordinates from normal pixel coordinates to homogeneous coordinates ((x,y)->(x,y,1)) //! converts point coordinates from normal pixel coordinates to homogeneous coordinates ((x,y)->(x,y,1))
CV_EXPORTS_W void convertPointsToHomogeneous( InputArray src, OutputArray dst ); CV_EXPORTS_W void convertPointsToHomogeneous( InputArray src, OutputArray dst );
//! converts point coordinates from homogeneous to normal pixel coordinates ((x,y,z)->(x/z, y/z)) //! converts point coordinates from homogeneous to normal pixel coordinates ((x,y,z)->(x/z, y/z))
CV_EXPORTS_W void convertPointsFromHomogeneous( InputArray src, OutputArray dst ); CV_EXPORTS_W void convertPointsFromHomogeneous( InputArray src, OutputArray dst );
//! for backward compatibility //! for backward compatibility
CV_EXPORTS void convertPointsHomogeneous( InputArray src, OutputArray dst ); CV_EXPORTS void convertPointsHomogeneous( InputArray src, OutputArray dst );
//! the algorithm for finding fundamental matrix //! the algorithm for finding fundamental matrix
enum enum
{ {
FM_7POINT = CV_FM_7POINT, //!< 7-point algorithm FM_7POINT = CV_FM_7POINT, //!< 7-point algorithm
FM_8POINT = CV_FM_8POINT, //!< 8-point algorithm FM_8POINT = CV_FM_8POINT, //!< 8-point algorithm
FM_LMEDS = CV_FM_LMEDS, //!< least-median algorithm FM_LMEDS = CV_FM_LMEDS, //!< least-median algorithm
@ -642,7 +639,7 @@ CV_EXPORTS Mat findFundamentalMat( InputArray points1, InputArray points2,
double param1=3., double param2=0.99); double param1=3., double param2=0.99);
//! finds coordinates of epipolar lines corresponding the specified points //! finds coordinates of epipolar lines corresponding the specified points
CV_EXPORTS void computeCorrespondEpilines( InputArray points1, CV_EXPORTS void computeCorrespondEpilines( InputArray points,
int whichImage, InputArray F, int whichImage, InputArray F,
OutputArray lines ); OutputArray lines );
@ -657,7 +654,7 @@ template<> CV_EXPORTS void Ptr<CvStereoBMState>::delete_obj();
/*! /*!
Block Matching Stereo Correspondence Algorithm Block Matching Stereo Correspondence Algorithm
The class implements BM stereo correspondence algorithm by K. Konolige. The class implements BM stereo correspondence algorithm by K. Konolige.
*/ */
class CV_EXPORTS_W StereoBM class CV_EXPORTS_W StereoBM
@ -683,7 +680,7 @@ public:
/*! /*!
Semi-Global Block Matching Stereo Correspondence Algorithm Semi-Global Block Matching Stereo Correspondence Algorithm
The class implements the original SGBM stereo correspondence algorithm by H. Hirschmuller and some its modification. The class implements the original SGBM stereo correspondence algorithm by H. Hirschmuller and some its modification.
*/ */
class CV_EXPORTS_W StereoSGBM class CV_EXPORTS_W StereoSGBM
@ -693,7 +690,7 @@ public:
//! the default constructor //! the default constructor
CV_WRAP StereoSGBM(); CV_WRAP StereoSGBM();
//! the full constructor taking all the necessary algorithm parameters //! the full constructor taking all the necessary algorithm parameters
CV_WRAP StereoSGBM(int minDisparity, int numDisparities, int SADWindowSize, CV_WRAP StereoSGBM(int minDisparity, int numDisparities, int SADWindowSize,
int P1=0, int P2=0, int disp12MaxDiff=0, int P1=0, int P2=0, int disp12MaxDiff=0,
@ -742,11 +739,11 @@ CV_EXPORTS_W void reprojectImageTo3D( InputArray disparity,
OutputArray _3dImage, InputArray Q, OutputArray _3dImage, InputArray Q,
bool handleMissingValues=false, bool handleMissingValues=false,
int ddepth=-1 ); int ddepth=-1 );
CV_EXPORTS_W int estimateAffine3D(InputArray _from, InputArray _to, CV_EXPORTS_W int estimateAffine3D(InputArray src, InputArray dst,
OutputArray _out, OutputArray _inliers, OutputArray out, OutputArray inliers,
double param1=3, double param2=0.99); double ransacThreshold=3, double confidence=0.99);
} }
#endif #endif

View File

@ -13,7 +13,7 @@ Finds centers of clusters and groups input samples around the clusters.
.. ocv:cfunction:: int cvKMeans2(const CvArr* samples, int clusterCount, CvArr* labels, CvTermCriteria criteria, int attempts=1, CvRNG* rng=0, int flags=0, CvArr* centers=0, double* compactness=0) .. ocv:cfunction:: int cvKMeans2(const CvArr* samples, int clusterCount, CvArr* labels, CvTermCriteria criteria, int attempts=1, CvRNG* rng=0, int flags=0, CvArr* centers=0, double* compactness=0)
.. ocv:pyoldfunction:: cv.KMeans2(samples, clusterCount, labels, criteria)-> None .. ocv:pyoldfunction:: cv.KMeans2(samples, nclusters, labels, termcrit, attempts=1, flags=0, centers=None) -> float
:param samples: Floating-point matrix of input samples, one row per sample. :param samples: Floating-point matrix of input samples, one row per sample.

View File

@ -64,9 +64,9 @@ Clips the line against the image rectangle.
.. ocv:pyfunction:: cv2.clipLine(imgRect, pt1, pt2) -> retval, pt1, pt2 .. ocv:pyfunction:: cv2.clipLine(imgRect, pt1, pt2) -> retval, pt1, pt2
.. ocv:cfunction:: int cvClipLine( CvSize imgSize, CvPoint* pt1, CvPoint* pt2 ) .. ocv:cfunction:: int cvClipLine( CvSize imgSize, CvPoint* pt1, CvPoint* pt2 )
.. ocv:pyoldfunction:: cv.ClipLine(imgSize, pt1, pt2) -> (clippedPt1, clippedPt2) .. ocv:pyoldfunction:: cv.ClipLine(imgSize, pt1, pt2) -> (point1, point2)
:param imgSize: Image size. The image rectangle is ``Rect(0, 0, imgSize.width, imgSize.height)`` . :param imgSize: Image size. The image rectangle is ``Rect(0, 0, imgSize.width, imgSize.height)`` .
:param imgRect: Image rectangle. :param imgRect: Image rectangle.
@ -89,7 +89,7 @@ Draws a simple or thick elliptic arc or fills an ellipse sector.
.. ocv:pyfunction:: cv2.ellipse(img, box, color[, thickness[, lineType]]) -> None .. ocv:pyfunction:: cv2.ellipse(img, box, color[, thickness[, lineType]]) -> None
.. ocv:cfunction:: void cvEllipse( CvArr* img, CvPoint center, CvSize axes, double angle, double startAngle, double endAngle, CvScalar color, int thickness=1, int lineType=8, int shift=0 ) .. ocv:cfunction:: void cvEllipse( CvArr* img, CvPoint center, CvSize axes, double angle, double startAngle, double endAngle, CvScalar color, int thickness=1, int lineType=8, int shift=0 )
.. ocv:pyoldfunction:: cv.Ellipse(img, center, axes, angle, startAngle, endAngle, color, thickness=1, lineType=8, shift=0)-> None .. ocv:pyoldfunction:: cv.Ellipse(img, center, axes, angle, start_angle, end_angle, color, thickness=1, lineType=8, shift=0)-> None
.. ocv:cfunction:: void cvEllipseBox( CvArr* img, CvBox2D box, CvScalar color, int thickness=1, int lineType=8, int shift=0 ) .. ocv:cfunction:: void cvEllipseBox( CvArr* img, CvBox2D box, CvScalar color, int thickness=1, int lineType=8, int shift=0 )
.. ocv:pyoldfunction:: cv.EllipseBox(img, box, color, thickness=1, lineType=8, shift=0)-> None .. ocv:pyoldfunction:: cv.EllipseBox(img, box, color, thickness=1, lineType=8, shift=0)-> None
@ -136,10 +136,10 @@ Approximates an elliptic arc with a polyline.
:param center: Center of the arc. :param center: Center of the arc.
:param axes: Half-sizes of the arc. See the :ocv:func:`ellipse` for details. :param axes: Half-sizes of the arc. See the :ocv:func:`ellipse` for details.
:param angle: Rotation angle of the ellipse in degrees. See the :ocv:func:`ellipse` for details. :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 startAngle: Starting angle of the elliptic arc in degrees.
:param endAngle: Ending angle of the elliptic arc in degrees. :param endAngle: Ending angle of the elliptic arc in degrees.
@ -227,11 +227,11 @@ Calculates the width and height of a text string.
:param text: Input text string. :param text: Input text string.
:param fontFace: Font to use. See the :ocv:func:`putText` for details. :param fontFace: Font to use. See the :ocv:func:`putText` for details.
:param fontScale: Font scale. See the :ocv:func:`putText` for details. :param fontScale: Font scale. See the :ocv:func:`putText` for details.
:param thickness: Thickness of lines used to render the text. See :ocv:func:`putText` for details. :param thickness: Thickness of lines used to render the text. See :ocv:func:`putText` for details.
:param baseLine: Output parameter - y-coordinate of the baseline relative to the bottom-most text point. :param baseLine: Output parameter - y-coordinate of the baseline relative to the bottom-most text point.
@ -275,49 +275,49 @@ Initializes font structure (OpenCV 1.x API).
.. ocv:cfunction:: void cvInitFont( CvFont* font, int fontFace, double hscale, double vscale, double shear=0, int thickness=1, int lineType=8 ) .. ocv:cfunction:: void cvInitFont( CvFont* font, int fontFace, double hscale, double vscale, double shear=0, int thickness=1, int lineType=8 )
:param font: Pointer to the font structure initialized by the function :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 fontFace: 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 * **CV_FONT_HERSHEY_SIMPLEX** normal size sans-serif font
* **CV_FONT_HERSHEY_PLAIN** small size sans-serif font * **CV_FONT_HERSHEY_PLAIN** small size sans-serif font
* **CV_FONT_HERSHEY_DUPLEX** normal size sans-serif font (more complex than ``CV_FONT_HERSHEY_SIMPLEX`` ) * **CV_FONT_HERSHEY_DUPLEX** normal size sans-serif font (more complex than ``CV_FONT_HERSHEY_SIMPLEX`` )
* **CV_FONT_HERSHEY_COMPLEX** normal size serif font * **CV_FONT_HERSHEY_COMPLEX** normal size serif font
* **CV_FONT_HERSHEY_TRIPLEX** normal size serif font (more complex than ``CV_FONT_HERSHEY_COMPLEX`` ) * **CV_FONT_HERSHEY_TRIPLEX** normal size serif font (more complex than ``CV_FONT_HERSHEY_COMPLEX`` )
* **CV_FONT_HERSHEY_COMPLEX_SMALL** smaller version of ``CV_FONT_HERSHEY_COMPLEX`` * **CV_FONT_HERSHEY_COMPLEX_SMALL** smaller version of ``CV_FONT_HERSHEY_COMPLEX``
* **CV_FONT_HERSHEY_SCRIPT_SIMPLEX** hand-writing style font * **CV_FONT_HERSHEY_SCRIPT_SIMPLEX** hand-writing style font
* **CV_FONT_HERSHEY_SCRIPT_COMPLEX** more complex variant of ``CV_FONT_HERSHEY_SCRIPT_SIMPLEX`` * **CV_FONT_HERSHEY_SCRIPT_COMPLEX** more complex variant of ``CV_FONT_HERSHEY_SCRIPT_SIMPLEX``
The parameter can be composited from one of the values above and an optional ``CV_FONT_ITALIC`` flag, which indicates italic or oblique font. The parameter can be composited from one of the values above and an optional ``CV_FONT_ITALIC`` flag, which indicates italic or oblique font.
:param hscale: Horizontal scale. If equal to ``1.0f`` , the characters have the original width depending on the font type. If equal to ``0.5f`` , the characters are of half the original width. :param hscale: Horizontal scale. If equal to ``1.0f`` , the characters have the original width depending on the font type. If equal to ``0.5f`` , the characters are of half the original width.
:param vscale: Vertical scale. If equal to ``1.0f`` , the characters have the original height depending on the font type. If equal to ``0.5f`` , the characters are of half the original height. :param vscale: Vertical scale. If equal to ``1.0f`` , the characters have the original height depending on the font type. If equal to ``0.5f`` , the characters are of half the original height.
:param shear: Approximate tangent of the character slope relative to the vertical line. A zero value means a non-italic font, ``1.0f`` means about a 45 degree slope, etc. :param shear: Approximate tangent of the character slope relative to the vertical line. A zero value means a non-italic font, ``1.0f`` means about a 45 degree slope, etc.
:param thickness: Thickness of the text strokes :param thickness: Thickness of the text strokes
:param lineType: Type of the strokes, see :ocv:func:`line` description :param lineType: Type of the strokes, see :ocv:func:`line` description
The function initializes the font structure that can be passed to text rendering functions. The function initializes the font structure that can be passed to text rendering functions.
.. seealso:: :ocv:cfunc:`PutText` .. seealso:: :ocv:cfunc:`PutText`
.. _Line: .. _Line:
line line
-------- --------
@ -416,7 +416,7 @@ Draws a simple, thick, or filled up-right rectangle.
:param pt1: Vertex of the rectangle. :param pt1: Vertex of the rectangle.
:param pt2: Vertex of the rectangle opposite to ``pt1`` . :param pt2: Vertex of the rectangle opposite to ``pt1`` .
:param r: Alternative specification of the drawn rectangle. :param r: Alternative specification of the drawn rectangle.
:param color: Rectangle color or brightness (grayscale image). :param color: Rectangle color or brightness (grayscale image).
@ -441,7 +441,7 @@ Draws several polygonal curves.
.. ocv:cfunction:: void cvPolyLine( CvArr* img, CvPoint** pts, int* npts, int contours, int isClosed, CvScalar color, int thickness=1, int lineType=8, int shift=0 ) .. ocv:cfunction:: void cvPolyLine( CvArr* img, CvPoint** pts, int* npts, int contours, int isClosed, CvScalar color, int thickness=1, int lineType=8, int shift=0 )
.. ocv:pyoldfunction:: cv.PolyLine(img, polys, isClosed, color, thickness=1, lineType=8, shift=0)-> None .. ocv:pyoldfunction:: cv.PolyLine(img, polys, is_closed, color, thickness=1, lineType=8, shift=0) -> None
:param img: Image. :param img: Image.
@ -471,7 +471,7 @@ Draws a text string.
.. ocv:function:: void putText( Mat& img, const string& text, Point org, int fontFace, double fontScale, Scalar color, int thickness=1, int lineType=8, bool bottomLeftOrigin=false ) .. ocv:function:: void putText( Mat& img, const string& text, Point org, int fontFace, double fontScale, Scalar color, int thickness=1, int lineType=8, bool bottomLeftOrigin=false )
.. ocv:pyfunction:: cv2.putText(img, text, org, fontFace, fontScale, color[, thickness[, linetype[, bottomLeftOrigin]]]) -> None .. ocv:pyfunction:: cv2.putText(img, text, org, fontFace, fontScale, color[, thickness[, lineType[, bottomLeftOrigin]]]) -> None
.. ocv:cfunction:: void cvPutText( CvArr* img, const char* text, CvPoint org, const CvFont* font, CvScalar color ) .. ocv:cfunction:: void cvPutText( CvArr* img, const char* text, CvPoint org, const CvFont* font, CvScalar color )
.. ocv:pyoldfunction:: cv.PutText(img, text, org, font, color)-> None .. ocv:pyoldfunction:: cv.PutText(img, text, org, font, color)-> None

File diff suppressed because it is too large Load Diff

View File

@ -11,15 +11,15 @@ Computes an absolute value of each matrix element.
.. ocv:function:: MatExpr abs(const MatExpr& src) .. ocv:function:: MatExpr abs(const MatExpr& src)
:param src: Matrix or matrix expression. :param src: Matrix or matrix expression.
``abs`` is a meta-function that is expanded to one of :ocv:func:`absdiff` forms: ``abs`` is a meta-function that is expanded to one of :ocv:func:`absdiff` forms:
* ``C = abs(A-B)`` is equivalent to ``absdiff(A, B, C)`` * ``C = abs(A-B)`` is equivalent to ``absdiff(A, B, C)``
* ``C = abs(A)`` is equivalent to ``absdiff(A, Scalar::all(0), C)`` * ``C = abs(A)`` is equivalent to ``absdiff(A, Scalar::all(0), C)``
* ``C = Mat_<Vec<uchar,n> >(abs(A*alpha + beta))`` is equivalent to :ocv:funcx:`convertScaleAbs` (A, C, alpha, beta) * ``C = Mat_<Vec<uchar,n> >(abs(A*alpha + beta))`` is equivalent to :ocv:funcx:`convertScaleAbs` (A, C, alpha, beta)
The output matrix has the same size and the same type as the input one except for the last case, where ``C`` is ``depth=CV_8U`` . The output matrix has the same size and the same type as the input one except for the last case, where ``C`` is ``depth=CV_8U`` .
.. seealso:: :ref:`MatrixExpressions`, :ocv:func:`absdiff` .. seealso:: :ref:`MatrixExpressions`, :ocv:func:`absdiff`
@ -39,11 +39,11 @@ Computes the per-element absolute difference between two arrays or between an ar
.. ocv:pyoldfunction:: cv.AbsDiffS(src, dst, value)-> None .. ocv:pyoldfunction:: cv.AbsDiffS(src, dst, value)-> None
:param src1: First input array or a scalar. :param src1: First input array or a scalar.
:param src2: Second input array or a scalar. :param src2: Second input array or a scalar.
:param dst: Destination array that has the same size and type as ``src1`` (or ``src2``). :param dst: Destination array that has the same size and type as ``src1`` (or ``src2``).
The function ``absdiff`` computes: The function ``absdiff`` computes:
* *
@ -91,11 +91,11 @@ Computes the per-element sum of two arrays or an array and a scalar.
:param src1: First source array or a scalar. :param src1: First source array or a scalar.
:param src2: Second source array or a scalar. :param src2: Second source array or a scalar.
:param dst: Destination array that has the same size and number of channels as the input array(s). The depth is defined by ``dtype`` or ``src1``/``src2``. :param dst: Destination array that has the same size and number of channels as the input array(s). The depth is defined by ``dtype`` or ``src1``/``src2``.
:param mask: Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed. :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. See the discussion below. :param dtype: Optional depth of the output array. See the discussion below.
The function ``add`` computes: The function ``add`` computes:
@ -133,7 +133,7 @@ The input arrays and the destination array can all have the same or different de
.. note:: Saturation is not applied when the output array has the depth ``CV_32S``. You may even get result of an incorrect sign in the case of overflow. .. note:: Saturation is not applied when the output array has the depth ``CV_32S``. You may even get result of an incorrect sign in the case of overflow.
.. seealso:: .. seealso::
:ocv:func:`subtract`, :ocv:func:`subtract`,
:ocv:func:`addWeighted`, :ocv:func:`addWeighted`,
:ocv:func:`scaleAdd`, :ocv:func:`scaleAdd`,
@ -158,13 +158,13 @@ Computes the weighted sum of two arrays.
:param alpha: Weight for the first array elements. :param alpha: Weight for the first array elements.
:param src2: Second source array of the same size and channel number as ``src1`` . :param src2: Second source array of the same size and channel number as ``src1`` .
:param beta: Weight for the second array elements. :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 dst: Destination array that has the same size and number of channels as the input arrays.
:param gamma: Scalar added to each sum. :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 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()``.
The function ``addWeighted`` calculates the weighted sum of two arrays as follows: The function ``addWeighted`` calculates the weighted sum of two arrays as follows:
@ -209,7 +209,7 @@ Calculates the per-element bit-wise conjunction of two arrays or an array and a
:param src2: Second source array or a scalar. :param src2: Second source array or a scalar.
:param dst: Destination array that has the same size and type as the input array(s). :param dst: Destination array that has the same size and type as the input array(s).
:param mask: Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed. :param mask: Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed.
The function computes the per-element bit-wise logical conjunction for: The function computes the per-element bit-wise logical conjunction for:
@ -254,7 +254,7 @@ Inverts every bit of an array.
:param src: Source array. :param src: Source array.
:param dst: Destination array that has the same size and type as the input array. :param dst: Destination array that has the same size and type as the input array.
:param mask: Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed. :param mask: Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed.
The function computes per-element bit-wise inversion of the source array: The function computes per-element bit-wise inversion of the source array:
@ -313,7 +313,7 @@ The function computes the per-element bit-wise logical disjunction for:
In case of floating-point arrays, their machine-specific bit representations (usually IEEE754-compliant) are used for the operation. In case of multi-channel arrays, each channel is processed independently. In the second and third cases above, the scalar is first converted to the array type. In case of floating-point arrays, their machine-specific bit representations (usually IEEE754-compliant) are used for the operation. In case of multi-channel arrays, each channel is processed independently. In the second and third cases above, the scalar is first converted to the array type.
bitwise_xor bitwise_xor
----------- -----------
@ -361,7 +361,7 @@ The function computes the per-element bit-wise logical "exclusive-or" operation
In case of floating-point arrays, their machine-specific bit representations (usually IEEE754-compliant) are used for the operation. In case of multi-channel arrays, each channel is processed independently. In the 2nd and 3rd cases above, the scalar is first converted to the array type. In case of floating-point arrays, their machine-specific bit representations (usually IEEE754-compliant) are used for the operation. In case of multi-channel arrays, each channel is processed independently. In the 2nd and 3rd cases above, the scalar is first converted to the array type.
calcCovarMatrix calcCovarMatrix
--------------- ---------------
@ -391,7 +391,7 @@ Calculates the covariance matrix of a set of vectors.
.. math:: .. math::
\texttt{scale} \cdot [ \texttt{vects} [0]- \texttt{mean} , \texttt{vects} [1]- \texttt{mean} ,...]^T \cdot [ \texttt{vects} [0]- \texttt{mean} , \texttt{vects} [1]- \texttt{mean} ,...], \texttt{scale} \cdot [ \texttt{vects} [0]- \texttt{mean} , \texttt{vects} [1]- \texttt{mean} ,...]^T \cdot [ \texttt{vects} [0]- \texttt{mean} , \texttt{vects} [1]- \texttt{mean} ,...],
The covariance matrix will be ``nsamples x nsamples``. Such an unusual covariance matrix is used for fast PCA of a set of very large vectors (see, for example, the EigenFaces technique for face recognition). Eigenvalues of this "scrambled" matrix match the eigenvalues of the true covariance matrix. The "true" eigenvectors can be easily calculated from the eigenvectors of the "scrambled" covariance matrix. The covariance matrix will be ``nsamples x nsamples``. Such an unusual covariance matrix is used for fast PCA of a set of very large vectors (see, for example, the EigenFaces technique for face recognition). Eigenvalues of this "scrambled" matrix match the eigenvalues of the true covariance matrix. The "true" eigenvectors can be easily calculated from the eigenvectors of the "scrambled" covariance matrix.
* **CV_COVAR_NORMAL** The output covariance matrix is calculated as: * **CV_COVAR_NORMAL** The output covariance matrix is calculated as:
@ -399,7 +399,7 @@ Calculates the covariance matrix of a set of vectors.
.. math:: .. math::
\texttt{scale} \cdot [ \texttt{vects} [0]- \texttt{mean} , \texttt{vects} [1]- \texttt{mean} ,...] \cdot [ \texttt{vects} [0]- \texttt{mean} , \texttt{vects} [1]- \texttt{mean} ,...]^T, \texttt{scale} \cdot [ \texttt{vects} [0]- \texttt{mean} , \texttt{vects} [1]- \texttt{mean} ,...] \cdot [ \texttt{vects} [0]- \texttt{mean} , \texttt{vects} [1]- \texttt{mean} ,...]^T,
``covar`` will be a square matrix of the same size as the total number of elements in each input vector. One and only one of ``CV_COVAR_SCRAMBLED`` and ``CV_COVAR_NORMAL`` must be specified. ``covar`` will be a square matrix of the same size as the total number of elements in each input vector. One and only one of ``CV_COVAR_SCRAMBLED`` and ``CV_COVAR_NORMAL`` must be specified.
* **CV_COVAR_USE_AVG** If the flag is specified, the function does not calculate ``mean`` from the input vectors but, instead, uses the passed ``mean`` vector. This is useful if ``mean`` has been pre-computed or known in advance, or if the covariance matrix is calculated by parts. In this case, ``mean`` is not a mean vector of the input sub-set of vectors but rather the mean vector of the whole set. * **CV_COVAR_USE_AVG** If the flag is specified, the function does not calculate ``mean`` from the input vectors but, instead, uses the passed ``mean`` vector. This is useful if ``mean`` has been pre-computed or known in advance, or if the covariance matrix is calculated by parts. In this case, ``mean`` is not a mean vector of the input sub-set of vectors but rather the mean vector of the whole set.
@ -434,9 +434,9 @@ Calculates the magnitude and angle of 2D vectors.
:param x: Array of x-coordinates. This must be a single-precision or double-precision floating-point array. :param x: Array of x-coordinates. This must be a single-precision or double-precision floating-point array.
:param y: Array of y-coordinates that must have the same size and same type as ``x`` . :param y: Array of y-coordinates that must have the same size and same type as ``x`` .
:param magnitude: Destination array of magnitudes of the same size and type as ``x`` . :param magnitude: Destination array of magnitudes of the same size and type as ``x`` .
:param angle: Destination array of angles that has the same size and type as ``x`` . The angles are measured in radians (from 0 to 2*Pi) or in degrees (0 to 360 degrees). :param angle: Destination array of angles that has the same size and type as ``x`` . The angles are measured in radians (from 0 to 2*Pi) or in degrees (0 to 360 degrees).
:param angleInDegrees: Flag indicating whether the angles are measured in radians, which is the default mode, or in degrees. :param angleInDegrees: Flag indicating whether the angles are measured in radians, which is the default mode, or in degrees.
@ -460,7 +460,7 @@ Checks every element of an input array for invalid values.
.. ocv:function:: bool checkRange(InputArray src, bool quiet=true, Point* pos=0, double minVal=-DBL_MAX, double maxVal=DBL_MAX) .. ocv:function:: bool checkRange(InputArray src, bool quiet=true, Point* pos=0, double minVal=-DBL_MAX, double maxVal=DBL_MAX)
.. ocv:pyfunction:: cv2.checkRange(a[, quiet[, minVal[, maxVal]]]) -> retval, pt .. ocv:pyfunction:: cv2.checkRange(a[, quiet[, minVal[, maxVal]]]) -> retval, pos
:param src: Array to check. :param src: Array to check.
@ -493,23 +493,23 @@ Performs the per-element comparison of two arrays or an array and scalar value.
.. ocv:cfunction:: void cvCmpS(const CvArr* src1, double src2, CvArr* dst, int cmpOp) .. ocv:cfunction:: void cvCmpS(const CvArr* src1, double src2, CvArr* dst, int cmpOp)
.. ocv:pyoldfunction:: cv.CmpS(src1, src2, dst, cmpOp)-> None .. ocv:pyoldfunction:: cv.CmpS(src, value, dst, cmpOp)-> None
:param src1: First source array or a scalar (in the case of ``cvCmp``, ``cv.Cmp``, ``cvCmpS``, ``cv.CmpS`` it is always an array). When it is array, it must have a single channel. :param src1: First source array or a scalar (in the case of ``cvCmp``, ``cv.Cmp``, ``cvCmpS``, ``cv.CmpS`` it is always an array). When it is array, it must have a single channel.
:param src2: Second source array or a scalar (in the case of ``cvCmp`` and ``cv.Cmp`` it is always an array; in the case of ``cvCmpS``, ``cv.CmpS`` it is always a scalar). When it is array, it must have a single channel. :param src2: Second source array or a scalar (in the case of ``cvCmp`` and ``cv.Cmp`` it is always an array; in the case of ``cvCmpS``, ``cv.CmpS`` it is always a scalar). When it is array, it must have a single channel.
:param dst: Destination array that has the same size as the input array(s) and type= ``CV_8UC1`` . :param dst: Destination array that has the same size as the input array(s) and type= ``CV_8UC1`` .
:param cmpop: Flag specifying the relation between the elements to be checked. :param cmpop: Flag specifying the relation between the elements to be checked.
* **CMP_EQ** ``src1`` equal to ``src2``. * **CMP_EQ** ``src1`` equal to ``src2``.
* **CMP_GT** ``src1`` greater than ``src2``. * **CMP_GT** ``src1`` greater than ``src2``.
* **CMP_GE** ``src1`` greater than or equal to ``src2``. * **CMP_GE** ``src1`` greater than or equal to ``src2``.
* **CMP_LT** ``src1`` less than ``src2``. * **CMP_LT** ``src1`` less than ``src2``.
* **CMP_LE** ``src1`` less than or equal to ``src2``. * **CMP_LE** ``src1`` less than or equal to ``src2``.
* **CMP_NE** ``src1`` not equal to ``src2``. * **CMP_NE** ``src1`` not equal to ``src2``.
The function compares: The function compares:
@ -535,7 +535,7 @@ The function compares:
\texttt{dst} (I) = \texttt{src1} \,\texttt{cmpop}\, \texttt{src2} (I) \texttt{dst} (I) = \texttt{src1} \,\texttt{cmpop}\, \texttt{src2} (I)
When the comparison result is true, the corresponding element of destination array is set to 255. When the comparison result is true, the corresponding element of destination array is set to 255.
The comparison operations can be replaced with the equivalent matrix expressions: :: The comparison operations can be replaced with the equivalent matrix expressions: ::
Mat dst1 = src1 >= src2; Mat dst1 = src1 >= src2;
@ -570,11 +570,11 @@ The function ``completeSymm`` copies the lower half of a square matrix to its an
* *
:math:`\texttt{mtx}_{ij}=\texttt{mtx}_{ji}` for :math:`\texttt{mtx}_{ij}=\texttt{mtx}_{ji}` for
:math:`i > j` if ``lowerToUpper=false`` :math:`i > j` if ``lowerToUpper=false``
* *
:math:`\texttt{mtx}_{ij}=\texttt{mtx}_{ji}` for :math:`\texttt{mtx}_{ij}=\texttt{mtx}_{ji}` for
:math:`i < j` if ``lowerToUpper=true`` :math:`i < j` if ``lowerToUpper=true``
.. seealso:: .. seealso::
:ocv:func:`flip`, :ocv:func:`flip`,
@ -661,7 +661,7 @@ Converts ``CvMat``, ``IplImage`` , or ``CvMatND`` to ``Mat``.
.. ocv:function:: Mat cvarrToMat(const CvArr* src, bool copyData=false, bool allowND=true, int coiMode=0) .. ocv:function:: Mat cvarrToMat(const CvArr* src, bool copyData=false, bool allowND=true, int coiMode=0)
:param src: Source ``CvMat``, ``IplImage`` , or ``CvMatND`` . :param src: 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. :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.
:param allowND: When it is true (default value), ``CvMatND`` is converted to 2-dimensional ``Mat``, if it is possible (see the discussion below). If it is not possible, or when the parameter is false, the function will report an error. :param allowND: When it is true (default value), ``CvMatND`` is converted to 2-dimensional ``Mat``, if it is possible (see the discussion below). If it is not possible, or when the parameter is false, the function will report an error.
@ -715,7 +715,7 @@ The last parameter, ``coiMode`` , specifies how to deal with an image with COI s
:ocv:cfunc:`cvGetMat`, :ocv:cfunc:`cvGetMat`,
:ocv:func:`extractImageCOI`, :ocv:func:`extractImageCOI`,
:ocv:func:`insertImageCOI`, :ocv:func:`insertImageCOI`,
:ocv:func:`mixChannels` :ocv:func:`mixChannels`
dct dct
------- -------
@ -731,7 +731,7 @@ Performs a forward or inverse discrete Cosine transform of 1D or 2D array.
:param src: Source floating-point array. :param src: Source floating-point array.
:param dst: Destination array of the same size and type as ``src`` . :param dst: Destination array of the same size and type as ``src`` .
:param flags: Transformation flags as a combination of the following values: :param flags: Transformation flags as a combination of the following values:
* **DCT_INVERSE** performs an inverse 1D or 2D transform instead of the default forward transform. * **DCT_INVERSE** performs an inverse 1D or 2D transform instead of the default forward transform.
@ -754,7 +754,7 @@ The function ``dct`` performs a forward or inverse discrete Cosine transform (DC
C^{(N)}_{jk}= \sqrt{\alpha_j/N} \cos \left ( \frac{\pi(2k+1)j}{2N} \right ) C^{(N)}_{jk}= \sqrt{\alpha_j/N} \cos \left ( \frac{\pi(2k+1)j}{2N} \right )
and and
:math:`\alpha_0=1`, :math:`\alpha_j=2` for *j > 0*. :math:`\alpha_0=1`, :math:`\alpha_j=2` for *j > 0*.
* *
@ -798,7 +798,7 @@ The function chooses the mode of operation by looking at the flags and size of t
If none of the above is true, the function performs a 2D transform. If none of the above is true, the function performs a 2D transform.
.. note:: .. note::
Currently ``dct`` supports even-size arrays (2, 4, 6 ...). For data analysis and approximation, you can pad the array when necessary. Currently ``dct`` supports even-size arrays (2, 4, 6 ...). For data analysis and approximation, you can pad the array when necessary.
Also, the function performance depends very much, and not monotonically, on the array size (see Also, the function performance depends very much, and not monotonically, on the array size (see
@ -825,12 +825,12 @@ Performs a forward or inverse Discrete Fourier transform of a 1D or 2D floating-
:param src: Source array that could be real or complex. :param src: Source array that could be real or complex.
:param dst: Destination array whose size and type depends on the ``flags`` . :param dst: Destination array whose size and type depends on the ``flags`` .
:param flags: Transformation flags representing a combination of the following values: :param flags: Transformation flags representing a combination of the following values:
* **DFT_INVERSE** performs an inverse 1D or 2D transform instead of the default forward transform. * **DFT_INVERSE** performs an inverse 1D or 2D transform instead of the default forward transform.
* **DFT_SCALE** scales the result: divide it by the number of array elements. Normally, it is combined with ``DFT_INVERSE`` . * **DFT_SCALE** scales the result: divide it by the number of array elements. Normally, it is combined with ``DFT_INVERSE`` .
* **DFT_ROWS** performs a forward or inverse transform of every individual row of the input matrix. This flag enables you to transform multiple vectors simultaneously and can be used to decrease the overhead (which is sometimes several times larger than the processing itself) to perform 3D and higher-dimensional transforms and so forth. * **DFT_ROWS** performs a forward or inverse transform of every individual row of the input matrix. This flag enables you to transform multiple vectors simultaneously and can be used to decrease the overhead (which is sometimes several times larger than the processing itself) to perform 3D and higher-dimensional transforms and so forth.
* **DFT_COMPLEX_OUTPUT** performs a forward transformation of 1D or 2D real array. The result, though being a complex array, has complex-conjugate symmetry (*CCS*, see the function description below for details). Such an array can be packed into a real array of the same size as input, which is the fastest option and which is what the function does by default. However, you may wish to get a full complex array (for simpler spectrum analysis, and so on). Pass the flag to enable the function to produce a full-size complex output array. * **DFT_COMPLEX_OUTPUT** performs a forward transformation of 1D or 2D real array. The result, though being a complex array, has complex-conjugate symmetry (*CCS*, see the function description below for details). Such an array can be packed into a real array of the same size as input, which is the fastest option and which is what the function does by default. However, you may wish to get a full complex array (for simpler spectrum analysis, and so on). Pass the flag to enable the function to produce a full-size complex output array.
@ -852,7 +852,7 @@ The function performs one of the following:
where where
:math:`F^{(N)}_{jk}=\exp(-2\pi i j k/N)` and :math:`F^{(N)}_{jk}=\exp(-2\pi i j k/N)` and
:math:`i=\sqrt{-1}` :math:`i=\sqrt{-1}`
* *
Inverse the Fourier transform of a 1D vector of ``N`` elements: Inverse the Fourier transform of a 1D vector of ``N`` elements:
@ -863,7 +863,7 @@ The function performs one of the following:
where where
:math:`F^*=\left(\textrm{Re}(F^{(N)})-\textrm{Im}(F^{(N)})\right)^T` :math:`F^*=\left(\textrm{Re}(F^{(N)})-\textrm{Im}(F^{(N)})\right)^T`
* *
Forward the 2D Fourier transform of a ``M x N`` matrix: Forward the 2D Fourier transform of a ``M x N`` matrix:
.. math:: .. math::
@ -976,18 +976,18 @@ Performs per-element division of two arrays or a scalar by an array.
.. ocv:pyfunction:: cv2.divide(scale, src2[, dst[, dtype]]) -> dst .. ocv:pyfunction:: cv2.divide(scale, src2[, dst[, dtype]]) -> dst
.. ocv:cfunction:: void cvDiv(const CvArr* src1, const CvArr* src2, CvArr* dst, double scale=1) .. ocv:cfunction:: void cvDiv(const CvArr* src1, const CvArr* src2, CvArr* dst, double scale=1)
.. ocv:pyoldfunction:: cv.Div(src1, src2, dst, scale)-> None .. ocv:pyoldfunction:: cv.Div(src1, src2, dst, scale=1) -> None
:param src1: First source array. :param src1: First source array.
:param src2: Second source array of the same size and type as ``src1`` . :param src2: Second source array of the same size and type as ``src1`` .
:param scale: Scalar factor. :param scale: Scalar factor.
:param dst: Destination array of the same size and type as ``src2`` . :param dst: Destination array of the same size and type as ``src2`` .
:param dtype: Optional depth of the destination array. If it is ``-1``, ``dst`` will have depth ``src2.depth()``. In case of an array-by-array division, you can only pass ``-1`` when ``src1.depth()==src2.depth()``. :param dtype: Optional depth of the destination array. If it is ``-1``, ``dst`` will have depth ``src2.depth()``. In case of an array-by-array division, you can only pass ``-1`` when ``src1.depth()==src2.depth()``.
The functions ``divide`` divide one array by another: The functions ``divide`` divide one array by another:
.. math:: .. math::
@ -1022,7 +1022,7 @@ Returns the determinant of a square floating-point matrix.
.. ocv:pyfunction:: cv2.determinant(mtx) -> retval .. ocv:pyfunction:: cv2.determinant(mtx) -> retval
.. ocv:cfunction:: double cvDet(const CvArr* mtx) .. ocv:cfunction:: double cvDet(const CvArr* mtx)
.. ocv:pyoldfunction:: cv.Det(mtx)-> double .. ocv:pyoldfunction:: cv.Det(mat) -> float
:param mtx: Input matrix that must have ``CV_32FC1`` or ``CV_64FC1`` type and square size. :param mtx: Input matrix that must have ``CV_32FC1`` or ``CV_64FC1`` type and square size.
@ -1043,21 +1043,20 @@ For symmetric positively-determined matrices, it is also possible to use :ocv:fu
eigen eigen
----- -----
Computes eigenvalues and eigenvectors of a symmetric matrix.
.. ocv:function:: bool eigen(InputArray src, OutputArray eigenvalues, int lowindex=-1, int highindex=-1) .. ocv:function:: bool eigen(InputArray src, OutputArray eigenvalues, int lowindex=-1, int highindex=-1)
.. ocv:function:: bool eigen(InputArray src, OutputArray eigenvalues, OutputArray eigenvectors, int lowindex=-1,int highindex=-1) .. ocv:function:: bool eigen(InputArray src, OutputArray eigenvalues, OutputArray eigenvectors, int lowindex=-1,int highindex=-1)
.. ocv:pyfunction:: cv2.eigen(src, computeEigenvectors[, eigenvalues[, eigenvectors]]) -> retval, eigenvalues, eigenvectors
.. ocv:cfunction:: void cvEigenVV( CvArr* src, CvArr* eigenvectors, CvArr* eigenvalues, double eps=0, int lowindex=-1, int highindex=-1) .. ocv:cfunction:: void cvEigenVV( CvArr* src, CvArr* eigenvectors, CvArr* eigenvalues, double eps=0, int lowindex=-1, int highindex=-1)
.. ocv:pyoldfunction:: cv.EigenVV(src, eigenvectors, eigenvalues, eps, lowindex=-1, highindex=-1)-> None .. ocv:pyoldfunction:: cv.EigenVV(mat, evects, evals, eps, lowindex=-1, highindex=-1)-> None
Computes eigenvalues and eigenvectors of a symmetric matrix.
.. ocv:pyfunction:: cv2.eigen(src, computeEigenvectors[, eigenvalues[, eigenvectors[, lowindex[, highindex]]]]) -> retval, eigenvalues, eigenvectors
:param src: Input matrix that must have ``CV_32FC1`` or ``CV_64FC1`` type, square size and be symmetrical (``src`` :sup:`T` == ``src``). :param src: Input matrix that must have ``CV_32FC1`` or ``CV_64FC1`` type, square size and be symmetrical (``src`` :sup:`T` == ``src``).
:param eigenvalues: Output vector of eigenvalues of the same type as ``src`` . The eigenvalues are stored in the descending order. :param eigenvalues: Output vector of eigenvalues of the same type as ``src`` . The eigenvalues are stored in the descending order.
:param eigenvectors: Output matrix of eigenvectors. It has the same size and type as ``src`` . The eigenvectors are stored as subsequent matrix rows, in the same order as the corresponding eigenvalues. :param eigenvectors: Output matrix of eigenvectors. It has the same size and type as ``src`` . The eigenvectors are stored as subsequent matrix rows, in the same order as the corresponding eigenvalues.
@ -1110,9 +1109,9 @@ Extracts the selected image channel.
.. ocv:function:: void extractImageCOI(const CvArr* src, OutputArray dst, int coi=-1) .. ocv:function:: void extractImageCOI(const CvArr* src, OutputArray dst, int coi=-1)
:param src: Source array. It should be a pointer to ``CvMat`` or ``IplImage`` . :param src: 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 dst: Destination array with a single channel and the same size and depth as ``src`` .
: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 ``src`` 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. 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.
@ -1170,7 +1169,7 @@ Flips a 2D array around vertical, horizontal, or both axes.
:param src: Source array. :param src: Source array.
:param dst: Destination array of the same size and type as ``src`` . :param dst: Destination array of the same size and type as ``src`` .
:param flipCode: Flag to specify how to flip the array. 0 means flipping around the x-axis. Positive value (for example, 1) means flipping around y-axis. Negative value (for example, -1) means flipping around both axes. See the discussion below for the formulas. :param flipCode: Flag to specify how to flip the array. 0 means flipping around the x-axis. Positive value (for example, 1) means flipping around y-axis. Negative value (for example, -1) means flipping around both axes. See the discussion below for the formulas.
The function ``flip`` flips the array in one of three different ways (row and column indices are 0-based): The function ``flip`` flips the array in one of three different ways (row and column indices are 0-based):
@ -1218,13 +1217,13 @@ Performs generalized matrix multiplication.
:param src1: First multiplied input matrix that should have ``CV_32FC1`` , ``CV_64FC1`` , ``CV_32FC2`` , or ``CV_64FC2`` type. :param src1: First multiplied input matrix that should have ``CV_32FC1`` , ``CV_64FC1`` , ``CV_32FC2`` , or ``CV_64FC2`` type.
:param src2: Second multiplied input matrix of the same type as ``src1`` . :param src2: Second multiplied input matrix of the same type as ``src1`` .
:param alpha: Weight of the matrix product. :param alpha: Weight of the matrix product.
:param src3: Third optional delta matrix added to the matrix product. It should have the same type as ``src1`` and ``src2`` . :param src3: Third optional delta matrix added to the matrix product. It should have the same type as ``src1`` and ``src2`` .
:param beta: Weight of ``src3`` . :param beta: Weight of ``src3`` .
:param dst: Destination matrix. It has the proper size and the same type as input matrices. :param dst: Destination matrix. It has the proper size and the same type as input matrices.
:param flags: Operation flags: :param flags: Operation flags:
@ -1232,7 +1231,7 @@ Performs generalized matrix multiplication.
* **GEMM_1_T** transpose ``src1`` * **GEMM_1_T** transpose ``src1``
* **GEMM_2_T** transpose ``src2`` * **GEMM_2_T** transpose ``src2``
* **GEMM_3_T** transpose ``src3`` * **GEMM_3_T** transpose ``src3``
The function performs generalized matrix multiplication similar to the ``gemm`` functions in BLAS level 3. For example, ``gemm(src1, src2, alpha, src3, beta, dst, GEMM_1_T + GEMM_3_T)`` corresponds to The function performs generalized matrix multiplication similar to the ``gemm`` functions in BLAS level 3. For example, ``gemm(src1, src2, alpha, src3, beta, dst, GEMM_1_T + GEMM_3_T)`` corresponds to
.. math:: .. math::
@ -1319,9 +1318,9 @@ Computes the inverse Discrete Cosine Transform of a 1D or 2D array.
:param src: Source floating-point single-channel array. :param src: Source floating-point single-channel array.
:param dst: Destination array of the same size and type as ``src`` . :param dst: Destination array of the same size and type as ``src`` .
:param flags: Operation flags. :param flags: Operation flags.
``idct(src, dst, flags)`` is equivalent to ``dct(src, dst, flags | DCT_INVERSE)``. ``idct(src, dst, flags)`` is equivalent to ``dct(src, dst, flags | DCT_INVERSE)``.
.. seealso:: .. seealso::
@ -1344,11 +1343,11 @@ Computes the inverse Discrete Fourier Transform of a 1D or 2D array.
:param src: Source floating-point real or complex array. :param src: Source floating-point real or complex array.
:param dst: Destination array whose size and type depend on the ``flags`` . :param dst: Destination array whose size and type depend on the ``flags`` .
:param flags: Operation flags. See :ocv:func:`dft` . :param flags: Operation flags. See :ocv:func:`dft` .
:param nonzeroRows: Number of ``dst`` rows to compute. The rest of the rows have undefined content. See the convolution sample in :ocv:func:`dft` description. :param nonzeroRows: Number of ``dst`` rows to compute. The rest of the rows have undefined content. See the convolution sample in :ocv:func:`dft` description.
``idft(src, dst, flags)`` is equivalent to ``dft(src, dst, flags | DFT_INVERSE)`` . ``idft(src, dst, flags)`` is equivalent to ``dft(src, dst, flags | DFT_INVERSE)`` .
See :ocv:func:`dft` for details. See :ocv:func:`dft` for details.
@ -1381,9 +1380,9 @@ Checks if array elements lie between the elements of two other arrays.
:param src: First source array. :param src: First source array.
:param lowerb: Inclusive lower boundary array or a scalar. :param lowerb: Inclusive lower boundary array or a scalar.
:param upperb: Inclusive upper boundary array or a scalar. :param upperb: Inclusive upper boundary array or a scalar.
:param dst: Destination array of the same size as ``src`` and ``CV_8U`` type. :param dst: Destination array of the same size as ``src`` and ``CV_8U`` type.
The function checks the range as follows: The function checks the range as follows:
@ -1417,12 +1416,12 @@ Finds the inverse or pseudo-inverse of a matrix.
.. ocv:cfunction:: double cvInvert(const CvArr* src, CvArr* dst, int flags=CV_LU) .. ocv:cfunction:: double cvInvert(const CvArr* src, CvArr* dst, int flags=CV_LU)
.. ocv:pyoldfunction:: cv.Invert(src, dst, flags=CV_LU)-> double .. ocv:pyoldfunction:: cv.Invert(src, dst, method=CV_LU) -> float
:param src: Source floating-point ``M x N`` matrix. :param src: Source floating-point ``M x N`` matrix.
:param dst: Destination matrix of ``N x M`` size and the same type as ``src`` . :param dst: Destination matrix of ``N x M`` size and the same type as ``src`` .
:param flags: Inversion method : :param flags: Inversion method :
* **DECOMP_LU** Gaussian elimination with the optimal pivot element chosen. * **DECOMP_LU** Gaussian elimination with the optimal pivot element chosen.
@ -1461,7 +1460,7 @@ Calculates the natural logarithm of every array element.
:param src: Source array. :param src: Source array.
:param dst: Destination array of the same size and type as ``src`` . :param dst: Destination array of the same size and type as ``src`` .
The function ``log`` calculates the natural logarithm of the absolute value of every element of the input array: The function ``log`` calculates the natural logarithm of the absolute value of every element of the input array:
.. math:: .. math::
@ -1499,7 +1498,7 @@ Performs a look-up table transform of an array.
:param lut: Look-up table of 256 elements. In case of multi-channel source array, the table should either have a single channel (in this case the same table is used for all channels) or the same number of channels as in the source array. :param lut: Look-up table of 256 elements. In case of multi-channel source array, the table should either have a single channel (in this case the same table is used for all channels) or the same number of channels as in the source array.
:param dst: Destination array of the same size and the same number of channels as ``src`` , and the same depth as ``lut`` . :param dst: Destination array of the same size and the same number of channels as ``src`` , and the same depth as ``lut`` .
The function ``LUT`` fills the destination array with values from the look-up table. Indices of the entries are taken from the source array. That is, the function processes each element of ``src`` as follows: The function ``LUT`` fills the destination array with values from the look-up table. Indices of the entries are taken from the source array. That is, the function processes each element of ``src`` as follows:
.. math:: .. math::
@ -1530,9 +1529,9 @@ Calculates the magnitude of 2D vectors.
:param x: Floating-point array of x-coordinates of the vectors. :param x: Floating-point array of x-coordinates of the vectors.
:param y: Floating-point array of y-coordinates of the vectors. It must have the same size as ``x`` . :param y: Floating-point array of y-coordinates of the vectors. It must have the same size as ``x`` .
:param magnitude: Destination array of the same size and type as ``x`` . :param magnitude: Destination array of the same size and type as ``x`` .
The function ``magnitude`` calculates the magnitude of 2D vectors formed from the corresponding elements of ``x`` and ``y`` arrays: The function ``magnitude`` calculates the magnitude of 2D vectors formed from the corresponding elements of ``x`` and ``y`` arrays:
.. math:: .. math::
@ -1558,7 +1557,7 @@ Calculates the Mahalanobis distance between two vectors.
.. ocv:cfunction:: double cvMahalanobis( const CvArr* vec1, const CvArr* vec2, CvArr* icovar) .. ocv:cfunction:: double cvMahalanobis( const CvArr* vec1, const CvArr* vec2, CvArr* icovar)
.. ocv:pyoldfunction:: cv.Mahalanobis(vec1, vec2, icovar)-> None .. ocv:pyoldfunction:: cv.Mahalonobis(vec1, vec2, mat) -> None
:param vec1: First 1D source vector. :param vec1: First 1D source vector.
@ -1604,11 +1603,11 @@ Calculates per-element maximum of two arrays or an array and a scalar.
:param src1: First source array. :param src1: First source array.
:param src2: Second source array of the same size and type as ``src1`` . :param src2: Second source array of the same size and type as ``src1`` .
:param value: Real scalar value. :param value: Real scalar value.
:param dst: Destination array of the same size and type as ``src1`` . :param dst: Destination array of the same size and type as ``src1`` .
The functions ``max`` compute the per-element maximum of two arrays: The functions ``max`` compute the per-element maximum of two arrays:
.. math:: .. math::
@ -1644,7 +1643,7 @@ Calculates an average (mean) of array elements.
.. ocv:pyfunction:: cv2.mean(src[, mask]) -> retval .. ocv:pyfunction:: cv2.mean(src[, mask]) -> retval
.. ocv:cfunction:: CvScalar cvAvg(const CvArr* src, const CvArr* mask=NULL) .. ocv:cfunction:: CvScalar cvAvg(const CvArr* src, const CvArr* mask=NULL)
.. ocv:pyoldfunction:: cv.Avg(src, mask=None)-> CvScalar .. ocv:pyoldfunction:: cv.Avg(arr, mask=None) -> scalar
:param src: Source array that should have from 1 to 4 channels so that the result can be stored in :ocv:class:`Scalar_` . :param src: Source array that should have from 1 to 4 channels so that the result can be stored in :ocv:class:`Scalar_` .
@ -1676,7 +1675,7 @@ Calculates a mean and standard deviation of array elements.
.. ocv:pyfunction:: cv2.meanStdDev(src[, mean[, stddev[, mask]]]) -> mean, stddev .. ocv:pyfunction:: cv2.meanStdDev(src[, mean[, stddev[, mask]]]) -> mean, stddev
.. ocv:cfunction:: void cvAvgSdv(const CvArr* src, CvScalar* mean, CvScalar* stdDev, const CvArr* mask=NULL) .. ocv:cfunction:: void cvAvgSdv(const CvArr* src, CvScalar* mean, CvScalar* stdDev, const CvArr* mask=NULL)
.. ocv:pyoldfunction:: cv.AvgSdv(src, mask=None)-> (mean, stdDev) .. ocv:pyoldfunction:: cv.AvgSdv(arr, mask=None) -> (mean, stdDev)
:param src: Source array that should have from 1 to 4 channels so that the results can be stored in :ocv:class:`Scalar_` 's. :param src: Source array that should have from 1 to 4 channels so that the results can be stored in :ocv:class:`Scalar_` 's.
@ -1765,11 +1764,11 @@ Calculates per-element minimum of two arrays or array and a scalar.
:param src1: First source array. :param src1: First source array.
:param src2: Second source array of the same size and type as ``src1`` . :param src2: Second source array of the same size and type as ``src1`` .
:param value: Real scalar value. :param value: Real scalar value.
:param dst: Destination array of the same size and type as ``src1`` . :param dst: Destination array of the same size and type as ``src1`` .
The functions ``min`` compute the per-element minimum of two arrays: The functions ``min`` compute the per-element minimum of two arrays:
.. math:: .. math::
@ -1807,15 +1806,15 @@ Finds the global minimum and maximum in an array
:param minVal: Pointer to the returned minimum value. ``NULL`` is used if not required. :param minVal: Pointer to the returned minimum value. ``NULL`` is used if not required.
:param maxVal: Pointer to the returned maximum value. ``NULL`` is used if not required. :param maxVal: Pointer to the returned maximum value. ``NULL`` is used if not required.
:param minIdx: Pointer to the returned minimum location (in nD case). ``NULL`` is used if not required. Otherwise, it must point to an array of ``src.dims`` elements. The coordinates of the minimum element in each dimension are stored there sequentially. :param minIdx: Pointer to the returned minimum location (in nD case). ``NULL`` is used if not required. Otherwise, it must point to an array of ``src.dims`` elements. The coordinates of the minimum element in each dimension are stored there sequentially.
.. note:: .. note::
When ``minIdx`` is not NULL, it must have at least 2 elements (as well as ``maxIdx``), even if ``src`` is a single-row or single-column matrix. In OpenCV (following MATLAB) each array has at least 2 dimensions, i.e. single-row matrix is ``Mx1`` matrix (and therefore ``minIdx``/``maxIdx`` will be ``(i1,0)``/``(i2,0)``) and single-column matrix is ``1xN`` matrix (and therefore ``minIdx``/``maxIdx`` will be ``(0,j1)``/``(0,j2)``). When ``minIdx`` is not NULL, it must have at least 2 elements (as well as ``maxIdx``), even if ``src`` is a single-row or single-column matrix. In OpenCV (following MATLAB) each array has at least 2 dimensions, i.e. single-row matrix is ``Mx1`` matrix (and therefore ``minIdx``/``maxIdx`` will be ``(i1,0)``/``(i2,0)``) and single-column matrix is ``1xN`` matrix (and therefore ``minIdx``/``maxIdx`` will be ``(0,j1)``/``(0,j2)``).
:param maxIdx: Pointer to the returned maximum location (in nD case). ``NULL`` is used if not required. :param maxIdx: Pointer to the returned maximum location (in nD case). ``NULL`` is used if not required.
The function ``minMaxIdx`` finds the minimum and maximum element values and their positions. The extremums are searched across the whole array or, if ``mask`` is not an empty array, in the specified array region. The function ``minMaxIdx`` finds the minimum and maximum element values and their positions. The extremums are searched across the whole array or, if ``mask`` is not an empty array, in the specified array region.
The function does not work with multi-channel arrays. If you need to find minimum or maximum elements across all the channels, use The function does not work with multi-channel arrays. If you need to find minimum or maximum elements across all the channels, use
@ -1871,7 +1870,7 @@ The functions do not work with multi-channel arrays. If you need to find minimum
:ocv:func:`extractImageCOI`, :ocv:func:`extractImageCOI`,
:ocv:func:`mixChannels`, :ocv:func:`mixChannels`,
:ocv:func:`split`, :ocv:func:`split`,
:ocv:func:`Mat::reshape` :ocv:func:`Mat::reshape`
@ -1891,17 +1890,17 @@ Copies specified channels from input arrays to the specified channels of output
:param src: Input array or vector of matrices. All the matrices must have the same size and the same depth. :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 nsrc: 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 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 ndst: 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 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 npairs: Number of index pairs in ``fromTo``. :param npairs: Number of index pairs in ``fromTo``.
The functions ``mixChannels`` provide an advanced mechanism for shuffling image channels. The functions ``mixChannels`` provide an advanced mechanism for shuffling image channels.
:ocv:func:`split` and :ocv:func:`split` and
:ocv:func:`merge` and some forms of :ocv:func:`merge` and some forms of
:ocv:func:`cvtColor` are partial cases of ``mixChannels`` . :ocv:func:`cvtColor` are partial cases of ``mixChannels`` .
@ -1945,9 +1944,9 @@ Performs the per-element multiplication of two Fourier spectrums.
:param src1: First source array. :param src1: First source array.
:param src2: Second source array of the same size and type as ``src1`` . :param src2: Second source array of the same size and type as ``src1`` .
:param dst: Destination array of the same size and type as ``src1`` . :param dst: Destination array of the same size and type as ``src1`` .
: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 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 conj: Optional flag that conjugates the second source array before the multiplication (true) or not (false).
@ -1970,14 +1969,14 @@ Calculates the per-element scaled product of two arrays.
.. ocv:pyfunction:: cv2.multiply(src1, src2[, dst[, scale[, dtype]]]) -> dst .. ocv:pyfunction:: cv2.multiply(src1, src2[, dst[, scale[, dtype]]]) -> dst
.. ocv:cfunction:: void cvMul(const CvArr* src1, const CvArr* src2, CvArr* dst, double scale=1) .. ocv:cfunction:: void cvMul(const CvArr* src1, const CvArr* src2, CvArr* dst, double scale=1)
.. ocv:pyoldfunction:: cv.Mul(src1, src2, dst, scale)-> None .. ocv:pyoldfunction:: cv.Mul(src1, src2, dst, scale=1) -> None
:param src1: First source array. :param src1: First source array.
:param src2: Second source array of the same size and the same type as ``src1`` . :param src2: Second source array of the same size and the same type as ``src1`` .
:param dst: Destination array of the same size and type as ``src1`` . :param dst: Destination array of the same size and type as ``src1`` .
:param scale: Optional scale factor. :param scale: Optional scale factor.
The function ``multiply`` calculates the per-element product of two arrays: The function ``multiply`` calculates the per-element product of two arrays:
@ -2019,7 +2018,7 @@ Calculates the product of a matrix and its transposition.
.. ocv:pyfunction:: cv2.mulTransposed(src, aTa[, dst[, delta[, scale[, dtype]]]]) -> dst .. ocv:pyfunction:: cv2.mulTransposed(src, aTa[, dst[, delta[, scale[, dtype]]]]) -> dst
.. ocv:cfunction:: void cvMulTransposed(const CvArr* src, CvArr* dst, int order, const CvArr* delta=NULL, double scale=1.0) .. ocv:cfunction:: void cvMulTransposed(const CvArr* src, CvArr* dst, int order, const CvArr* delta=NULL, double scale=1.0)
.. ocv:pyoldfunction:: cv.MulTransposed(src, dst, order, delta=None, scale)-> None .. ocv:pyoldfunction:: cv.MulTransposed(src, dst, order, delta=None, scale=1.0) -> None
:param src: Source single-channel matrix. Note that unlike :ocv:func:`gemm`, the function can multiply not only floating-point matrices. :param src: Source single-channel matrix. Note that unlike :ocv:func:`gemm`, the function can multiply not only floating-point matrices.
@ -2032,7 +2031,7 @@ Calculates the product of a matrix and its transposition.
:param scale: Optional scale factor for the matrix product. :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 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`` .
The function ``mulTransposed`` calculates the product of ``src`` and its transposition: The function ``mulTransposed`` calculates the product of ``src`` and its transposition:
.. math:: .. math::
@ -2070,12 +2069,12 @@ Calculates an absolute array norm, an absolute difference norm, or a relative di
.. ocv:pyfunction:: cv2.norm(src1, src2[, normType[, mask]]) -> retval .. ocv:pyfunction:: cv2.norm(src1, src2[, normType[, mask]]) -> retval
.. ocv:cfunction:: double cvNorm(const CvArr* arr1, const CvArr* arr2=NULL, int normType=CV_L2, const CvArr* mask=NULL) .. ocv:cfunction:: double cvNorm(const CvArr* arr1, const CvArr* arr2=NULL, int normType=CV_L2, const CvArr* mask=NULL)
.. ocv:pyoldfunction:: cv.Norm(arr1, arr2, normType=CV_L2, mask=None)-> double .. ocv:pyoldfunction:: cv.Norm(arr1, arr2, normType=CV_L2, mask=None) -> float
:param src1: First source array. :param src1: First source array.
:param src2: Second source array of the same size and the same type as ``src1`` . :param src2: Second source array of the same size and the same type as ``src1`` .
:param normType: Type of the norm. See the details below. :param normType: Type of the norm. See the details below.
:param mask: Optional operation mask. It must have the same size as ``src1`` and ``CV_8UC1`` type. :param mask: Optional operation mask. It must have the same size as ``src1`` and ``CV_8UC1`` type.
@ -2125,7 +2124,7 @@ Normalizes the norm or value range of an array.
:param src: Source array. :param src: Source array.
:param dst: Destination array of the same size as ``src`` . :param dst: Destination array of the same size as ``src`` .
:param alpha: Norm value to normalize to or the lower range boundary in case of the range normalization. :param alpha: Norm value to normalize to or the lower range boundary in case of the range normalization.
:param beta: Upper range boundary in case of the range normalization. It is not used for the norm normalization. :param beta: Upper range boundary in case of the range normalization. It is not used for the norm normalization.
@ -2133,7 +2132,7 @@ Normalizes the norm or value range of an array.
:param normType: Normalization type. See the details below. :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 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 mask: Optional operation mask. :param mask: Optional operation mask.
@ -2279,7 +2278,7 @@ Projects vector(s) to the principal component subspace.
.. ocv:function:: void PCA::project(InputArray vec, OutputArray result) const .. ocv:function:: void PCA::project(InputArray vec, OutputArray result) const
.. ocv:pyfunction:: cv2.PCAProject(vec, mean, eigenvectors[, result]) -> result .. ocv:pyfunction:: cv2.PCAProject(data, mean, eigenvectors[, result]) -> result
:param vec: Input vector(s). They must have the same dimensionality and the same layout as the input data used at PCA phase. That is, if ``CV_PCA_DATA_AS_ROW`` are specified, then ``vec.cols==data.cols`` (vector dimensionality) and ``vec.rows`` is the number of vectors to project. The same is true for the ``CV_PCA_DATA_AS_COL`` case. :param vec: Input vector(s). They must have the same dimensionality and the same layout as the input data used at PCA phase. That is, if ``CV_PCA_DATA_AS_ROW`` are specified, then ``vec.cols==data.cols`` (vector dimensionality) and ``vec.rows`` is the number of vectors to project. The same is true for the ``CV_PCA_DATA_AS_COL`` case.
@ -2297,7 +2296,7 @@ Reconstructs vectors from their PC projections.
.. ocv:function:: void PCA::backProject(InputArray vec, OutputArray result) const .. ocv:function:: void PCA::backProject(InputArray vec, OutputArray result) const
.. ocv:pyfunction:: cv2.PCABackProject(vec, mean, eigenvectors[, result]) -> result .. ocv:pyfunction:: cv2.PCABackProject(data, mean, eigenvectors[, result]) -> result
:param vec: Coordinates of the vectors in the principal component subspace. The layout and size are the same as of ``PCA::project`` output vectors. :param vec: Coordinates of the vectors in the principal component subspace. The layout and size are the same as of ``PCA::project`` output vectors.
@ -2322,7 +2321,7 @@ Performs the perspective matrix transformation of vectors.
:param src: Source two-channel or three-channel floating-point array. Each element is a 2D/3D vector to be transformed. :param src: Source two-channel or three-channel floating-point array. Each element is a 2D/3D vector to be transformed.
:param dst: Destination array of the same size and type as ``src`` . :param dst: Destination array of the same size and type as ``src`` .
:param mtx: ``3x3`` or ``4x4`` floating-point transformation matrix. :param mtx: ``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: The function ``perspectiveTransform`` transforms every element of ``src`` by treating it as a 2D or 3D vector, in the following way:
@ -2366,10 +2365,10 @@ Calculates the rotation angle of 2D vectors.
:param x: Source floating-point array of x-coordinates of 2D vectors. :param x: Source floating-point array of x-coordinates of 2D vectors.
:param y: Source array of y-coordinates of 2D vectors. It must have the same size and the same type as ``x`` . :param y: Source array of y-coordinates of 2D vectors. It must have the same size and the same type as ``x`` .
:param angle: Destination array of vector angles. It has the same size and same type as ``x`` . :param angle: Destination array of vector angles. It has the same size and same type as ``x`` .
:param angleInDegrees: When it is true, the function computes the angle in degrees. Otherwise, they are measured in radians. :param angleInDegrees: When it is true, the function computes the angle in degrees. Otherwise, they are measured in radians.
The function ``phase`` computes the rotation angle of each 2D vector that is formed from the corresponding elements of ``x`` and ``y`` : The function ``phase`` computes the rotation angle of each 2D vector that is formed from the corresponding elements of ``x`` and ``y`` :
@ -2393,13 +2392,13 @@ Computes x and y coordinates of 2D vectors from their magnitude and angle.
.. ocv:pyoldfunction:: cv.PolarToCart(magnitude, angle, x, y, angleInDegrees=0)-> None .. ocv:pyoldfunction:: cv.PolarToCart(magnitude, angle, x, y, angleInDegrees=0)-> None
:param magnitude: Source floating-point array of magnitudes of 2D vectors. It can be an empty matrix ( ``=Mat()`` ). In this case, the function assumes that all the magnitudes are =1. If it is not empty, it must have the same size and type as ``angle`` . :param magnitude: Source floating-point array of magnitudes of 2D vectors. It can be an empty matrix ( ``=Mat()`` ). In this case, the function assumes that all the magnitudes are =1. If it is not empty, it must have the same size and type as ``angle`` .
:param angle: Source floating-point array of angles of 2D vectors. :param angle: Source floating-point array of angles of 2D vectors.
:param x: Destination array of x-coordinates of 2D vectors. It has the same size and type as ``angle``. :param x: Destination array of x-coordinates of 2D vectors. It has the same size and type as ``angle``.
:param y: Destination array of y-coordinates of 2D vectors. It has the same size and type as ``angle``. :param y: Destination array of y-coordinates of 2D vectors. It has the same size and type as ``angle``.
:param angleInDegrees: When it is true, the input angles are measured in degrees. Otherwise. they are measured in radians. :param angleInDegrees: When it is true, the input angles are measured in degrees. Otherwise. they are measured in radians.
The function ``polarToCart`` computes the Cartesian coordinates of each 2D vector represented by the corresponding elements of ``magnitude`` and ``angle`` : The function ``polarToCart`` computes the Cartesian coordinates of each 2D vector represented by the corresponding elements of ``magnitude`` and ``angle`` :
@ -2602,11 +2601,11 @@ Fills arrays with random numbers.
:param mat: 2D or N-dimensional matrix. Currently matrices with more than 4 channels are not supported by the methods. Use :ocv:func:`Mat::reshape` as a possible workaround. :param mat: 2D or N-dimensional matrix. Currently matrices with more than 4 channels are not supported by the methods. Use :ocv:func:`Mat::reshape` as a possible workaround.
:param distType: Distribution type, ``RNG::UNIFORM`` or ``RNG::NORMAL`` . :param distType: Distribution type, ``RNG::UNIFORM`` or ``RNG::NORMAL`` .
:param a: First distribution parameter. In case of the uniform distribution, this is an inclusive lower boundary. In case of the normal distribution, this is a mean value. :param a: First distribution parameter. In case of the uniform distribution, this is an inclusive lower boundary. In case of the normal distribution, this is a mean value.
:param b: Second distribution parameter. In case of the uniform distribution, this is a non-inclusive upper boundary. In case of the normal distribution, this is a standard deviation (diagonal of the standard deviation matrix or the full standard deviation matrix). :param b: Second distribution parameter. In case of the uniform distribution, this is a non-inclusive upper boundary. In case of the normal distribution, this is a standard deviation (diagonal of the standard deviation matrix or the full standard deviation matrix).
:param saturateRange: Pre-saturation flag; for uniform distribution only. If it is true, the method will first convert a and b to the acceptable value range (according to the mat datatype) and then will generate uniformly distributed random numbers within the range ``[saturate(a), saturate(b))``. If ``saturateRange=false``, the method will generate uniformly distributed random numbers in the original range ``[a, b)`` and then will saturate them. It means, for example, that ``theRNG().fill(mat_8u, RNG::UNIFORM, -DBL_MAX, DBL_MAX)`` will likely produce array mostly filled with 0's and 255's, since the range ``(0, 255)`` is significantly smaller than ``[-DBL_MAX, DBL_MAX)``. :param saturateRange: Pre-saturation flag; for uniform distribution only. If it is true, the method will first convert a and b to the acceptable value range (according to the mat datatype) and then will generate uniformly distributed random numbers within the range ``[saturate(a), saturate(b))``. If ``saturateRange=false``, the method will generate uniformly distributed random numbers in the original range ``[a, b)`` and then will saturate them. It means, for example, that ``theRNG().fill(mat_8u, RNG::UNIFORM, -DBL_MAX, DBL_MAX)`` will likely produce array mostly filled with 0's and 255's, since the range ``(0, 255)`` is significantly smaller than ``[-DBL_MAX, DBL_MAX)``.
Each of the methods fills the matrix with the random values from the specified distribution. As the new numbers are generated, the RNG state is updated accordingly. In case of multiple-channel images, every channel is filled independently, which means that RNG cannot generate samples from the multi-dimensional Gaussian distribution with non-diagonal covariance matrix directly. To do that, the method generates samples from multi-dimensional standard Gaussian distribution with zero mean and identity covariation matrix, and then transforms them using :ocv:func:`transform` to get samples from the specified Gaussian distribution. Each of the methods fills the matrix with the random values from the specified distribution. As the new numbers are generated, the RNG state is updated accordingly. In case of multiple-channel images, every channel is filled independently, which means that RNG cannot generate samples from the multi-dimensional Gaussian distribution with non-diagonal covariance matrix directly. To do that, the method generates samples from multi-dimensional standard Gaussian distribution with zero mean and identity covariation matrix, and then transforms them using :ocv:func:`transform` to get samples from the specified Gaussian distribution.
@ -2640,7 +2639,7 @@ The second non-template variant of the function fills the matrix ``mtx`` with un
:ocv:class:`RNG`, :ocv:class:`RNG`,
:ocv:func:`randn`, :ocv:func:`randn`,
:ocv:func:`theRNG` :ocv:func:`theRNG`
@ -2673,7 +2672,7 @@ Shuffles the array elements randomly.
.. ocv:function:: void randShuffle(InputOutputArray mtx, double iterFactor=1., RNG* rng=0) .. ocv:function:: void randShuffle(InputOutputArray mtx, double iterFactor=1., RNG* rng=0)
.. ocv:pyfunction:: cv2.randShuffle(src[, dst[, iterFactor]]) -> dst .. ocv:pyfunction:: cv2.randShuffle(dst[, iterFactor]) -> None
:param mtx: Input/output numerical 1D array. :param mtx: Input/output numerical 1D array.
@ -2718,7 +2717,7 @@ Reduces a matrix to a vector.
* **CV_REDUCE_MIN** The output is the minimum (column/row-wise) 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), mtx.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. 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.
.. seealso:: :ocv:func:`repeat` .. seealso:: :ocv:func:`repeat`
@ -2741,7 +2740,7 @@ Fills the destination array with repeated copies of the source array.
:param src: Source array to replicate. :param src: Source array to replicate.
:param dst: Destination array of the same type as ``src`` . :param dst: Destination array of the same type as ``src`` .
:param ny: Flag to specify how many times the ``src`` is repeated along the vertical axis. :param ny: Flag to specify how many times the ``src`` is repeated along the vertical axis.
:param nx: Flag to specify how many times the ``src`` is repeated along the horizontal axis. :param nx: Flag to specify how many times the ``src`` is repeated along the horizontal axis.
@ -2754,7 +2753,7 @@ The functions
\texttt{dst} _{ij}= \texttt{src} _{i\mod src.rows, \; j\mod src.cols } \texttt{dst} _{ij}= \texttt{src} _{i\mod src.rows, \; j\mod src.cols }
The second variant of the function is more convenient to use with The second variant of the function is more convenient to use with
:ref:`MatrixExpressions` . :ref:`MatrixExpressions` .
.. seealso:: .. seealso::
@ -2779,9 +2778,9 @@ Calculates the sum of a scaled array and another array.
:param scale: Scale factor for the first array. :param scale: Scale factor for the first array.
:param src2: Second source array of the same size and type as ``src1`` . :param src2: Second source array of the same size and type as ``src1`` .
:param dst: Destination array of the same size and type as ``src1`` . :param dst: Destination array of the same size and type as ``src1`` .
The function ``scaleAdd`` is one of the classical primitive linear algebra operations, known as ``DAXPY`` or ``SAXPY`` in `BLAS <http://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms>`_. It calculates the sum of a scaled array and another array: The function ``scaleAdd`` is one of the classical primitive linear algebra operations, known as ``DAXPY`` or ``SAXPY`` in `BLAS <http://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms>`_. It calculates the sum of a scaled array and another array:
.. math:: .. math::
@ -2874,7 +2873,7 @@ Solves one or more linear systems or least-squares problems.
* **DECOMP_QR** QR factorization. The system can be over-defined and/or the matrix ``src1`` can be singular. * **DECOMP_QR** QR factorization. The system can be over-defined and/or the matrix ``src1`` can be singular.
* **DECOMP_NORMAL** While all the previous flags are mutually exclusive, this flag can be used together with any of the previous. It means that the normal equations :math:`\texttt{src1}^T\cdot\texttt{src1}\cdot\texttt{dst}=\texttt{src1}^T\texttt{src2}` are solved instead of the original system :math:`\texttt{src1}\cdot\texttt{dst}=\texttt{src2}` . * **DECOMP_NORMAL** While all the previous flags are mutually exclusive, this flag can be used together with any of the previous. It means that the normal equations :math:`\texttt{src1}^T\cdot\texttt{src1}\cdot\texttt{dst}=\texttt{src1}^T\texttt{src2}` are solved instead of the original system :math:`\texttt{src1}\cdot\texttt{dst}=\texttt{src2}` .
The function ``solve`` solves a linear system or least-squares problem (the latter is possible with SVD or QR methods, or by specifying the flag ``DECOMP_NORMAL`` ): The function ``solve`` solves a linear system or least-squares problem (the latter is possible with SVD or QR methods, or by specifying the flag ``DECOMP_NORMAL`` ):
.. math:: .. math::
@ -2960,7 +2959,7 @@ Sorts each row or each column of a matrix.
:param src: Source single-channel array. :param src: Source single-channel array.
:param dst: Destination array of the same size and type as ``src`` . :param dst: Destination array of the same size and type as ``src`` .
:param flags: Operation flags, a combination of the following values: :param flags: Operation flags, a combination of the following values:
* **CV_SORT_EVERY_ROW** Each matrix row is sorted independently. * **CV_SORT_EVERY_ROW** Each matrix row is sorted independently.
@ -2991,7 +2990,7 @@ Sorts each row or each column of a matrix.
:param src: Source single-channel array. :param src: Source single-channel array.
:param dst: Destination integer array of the same size as ``src`` . :param dst: Destination integer array of the same size as ``src`` .
:param flags: Operation flags that could be a combination of the following values: :param flags: Operation flags that could be a combination of the following values:
* **CV_SORT_EVERY_ROW** Each matrix row is sorted independently. * **CV_SORT_EVERY_ROW** Each matrix row is sorted independently.
@ -3026,7 +3025,7 @@ Divides a multi-channel array into several single-channel arrays.
.. ocv:function:: void split(const Mat& mtx, vector<Mat>& mv) .. ocv:function:: void split(const Mat& mtx, vector<Mat>& mv)
.. ocv:pyfunction:: cv2.split(m, mv) -> None .. ocv:pyfunction:: cv2.split(m[, mv]) -> mv
.. ocv:cfunction:: void cvSplit(const CvArr* src, CvArr* dst0, CvArr* dst1, CvArr* dst2, CvArr* dst3) .. ocv:cfunction:: void cvSplit(const CvArr* src, CvArr* dst0, CvArr* dst1, CvArr* dst2, CvArr* dst3)
.. ocv:pyoldfunction:: cv.Split(src, dst0, dst1, dst2, dst3)-> None .. ocv:pyoldfunction:: cv.Split(src, dst0, dst1, dst2, dst3)-> None
@ -3066,7 +3065,7 @@ Calculates a square root of array elements.
:param src: Source floating-point array. :param src: Source floating-point array.
:param dst: Destination array of the same size and type as ``src`` . :param dst: Destination array of the same size and type as ``src`` .
The functions ``sqrt`` calculate a square root of each source array element. In case of multi-channel arrays, each channel is processed independently. The accuracy is approximately the same as of the built-in ``std::sqrt`` . The functions ``sqrt`` calculate a square root of each source array element. In case of multi-channel arrays, each channel is processed independently. The accuracy is approximately the same as of the built-in ``std::sqrt`` .
.. seealso:: .. seealso::
@ -3088,18 +3087,18 @@ Calculates the per-element difference between two arrays or array and a scalar.
.. ocv:cfunction:: void cvSubRS(const CvArr* src1, CvScalar src2, CvArr* dst, const CvArr* mask=NULL) .. ocv:cfunction:: void cvSubRS(const CvArr* src1, CvScalar src2, CvArr* dst, const CvArr* mask=NULL)
.. ocv:cfunction:: void cvSubS(const CvArr* src1, CvScalar src2, CvArr* dst, const CvArr* mask=NULL) .. ocv:cfunction:: void cvSubS(const CvArr* src1, CvScalar src2, CvArr* dst, const CvArr* mask=NULL)
.. ocv:pyoldfunction:: cv.Sub(src1, src2, dst, mask=None)-> None .. ocv:pyoldfunction:: cv.Sub(src1, src2, dst, mask=None) -> None
.. ocv:pyoldfunction:: cv.SubRS(src1, src2, dst, mask=None)-> None .. ocv:pyoldfunction:: cv.SubRS(src, value, dst, mask=None) -> None
.. ocv:pyoldfunction:: cv.SubS(src1, src2, dst, mask=None)-> None .. ocv:pyoldfunction:: cv.SubS(src, value, dst, mask=None) -> None
:param src1: First source array or a scalar. :param src1: First source array or a scalar.
:param src2: Second source array or a scalar. :param src2: Second source array or a scalar.
:param dst: Destination array of the same size and the same number of channels as the input array. :param dst: Destination array of the same size and the same number of channels as the input array.
:param mask: Optional operation mask. This is an 8-bit single channel array that specifies elements of the destination array to be changed. :param mask: Optional operation mask. This is an 8-bit single channel array that specifies elements of the destination array to be changed.
:param dtype: Optional depth of the output array. See the details below. :param dtype: Optional depth of the output array. See the details below.
The function ``subtract`` computes: The function ``subtract`` computes:
@ -3124,10 +3123,10 @@ The function ``subtract`` computes:
.. math:: .. math::
\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1} - \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0 \texttt{dst}(I) = \texttt{saturate} ( \texttt{src1} - \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0
* *
The reverse difference between a scalar and an array in the case of ``SubRS``: The reverse difference between a scalar and an array in the case of ``SubRS``:
.. math:: .. math::
\texttt{dst}(I) = \texttt{saturate} ( \texttt{src2} - \texttt{src1}(I) ) \quad \texttt{if mask}(I) \ne0 \texttt{dst}(I) = \texttt{saturate} ( \texttt{src2} - \texttt{src1}(I) ) \quad \texttt{if mask}(I) \ne0
@ -3224,25 +3223,25 @@ Performs SVD of a matrix
.. ocv:cfunction:: void cvSVD( CvArr* src, CvArr* w, CvArr* u=NULL, CvArr* v=NULL, int flags=0) .. ocv:cfunction:: void cvSVD( CvArr* src, CvArr* w, CvArr* u=NULL, CvArr* v=NULL, int flags=0)
.. ocv:pyoldfunction:: cv.SVD(src, w, u=None, v=None, flags=0)-> None .. ocv:pyoldfunction:: cv.SVD(A, W, U=None, V=None, flags=0) -> None
:param src: Decomposed matrix :param src: Decomposed matrix
:param w: Computed singular values :param w: Computed singular values
:param u: Computed left singular vectors :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 vt: Transposed matrix of right singular values
:param flags: Operation flags - see :ocv:func:`SVD::SVD`. :param flags: Operation flags - see :ocv:func:`SVD::SVD`.
The methods/functions perform SVD of matrix. Unlike ``SVD::SVD`` constructor and ``SVD::operator()``, they store the results to the user-provided matrices. :: The methods/functions perform SVD of matrix. Unlike ``SVD::SVD`` constructor and ``SVD::operator()``, they store the results to the user-provided matrices. ::
Mat A, w, u, vt; Mat A, w, u, vt;
SVD::compute(A, w, u, vt); SVD::compute(A, w, u, vt);
SVD::solveZ SVD::solveZ
----------- -----------
@ -3254,7 +3253,7 @@ Solves an under-determined singular linear system.
:param dst: Found solution. :param dst: Found solution.
The method finds a unit-length solution ``x`` of a singular linear system The method finds a unit-length solution ``x`` of a singular linear system
``A*x = 0``. Depending on the rank of ``A``, there can be no solutions, a single solution or an infinite number of solutions. In general, the algorithm solves the following problem: ``A*x = 0``. Depending on the rank of ``A``, there can be no solutions, a single solution or an infinite number of solutions. In general, the algorithm solves the following problem:
.. math:: .. math::
@ -3274,18 +3273,18 @@ Performs a singular value back substitution.
.. ocv:cfunction:: void cvSVBkSb( const CvArr* w, const CvArr* u, const CvArr* v, const CvArr* rhs, CvArr* dst, int flags) .. ocv:cfunction:: void cvSVBkSb( const CvArr* w, const CvArr* u, const CvArr* v, const CvArr* rhs, CvArr* dst, int flags)
.. ocv:pyoldfunction:: cv.SVBkSb(w, u, v, rhs, dst, flags)-> None .. ocv:pyoldfunction:: cv.SVBkSb(W, U, V, B, X, flags) -> None
:param w: Singular values :param w: Singular values
:param u: Left singular vectors :param u: Left singular vectors
:param v: Right singular vectors :param v: Right singular vectors
:param vt: Transposed matrix of right singular vectors. :param vt: Transposed matrix of right singular vectors.
:param rhs: Right-hand side of a linear system ``(u*w*v')*dst = rhs`` to be solved, where ``A`` has been previously decomposed. :param rhs: Right-hand side of a linear system ``(u*w*v')*dst = rhs`` to be solved, where ``A`` has been previously decomposed.
:param dst: Found solution of the system. :param dst: Found solution of the system.
The method computes a back substitution for the specified right-hand side: The method computes a back substitution for the specified right-hand side:
@ -3294,7 +3293,7 @@ The method computes a back substitution for the specified right-hand side:
\texttt{x} = \texttt{vt} ^T \cdot diag( \texttt{w} )^{-1} \cdot \texttt{u} ^T \cdot \texttt{rhs} \sim \texttt{A} ^{-1} \cdot \texttt{rhs} \texttt{x} = \texttt{vt} ^T \cdot diag( \texttt{w} )^{-1} \cdot \texttt{u} ^T \cdot \texttt{rhs} \sim \texttt{A} ^{-1} \cdot \texttt{rhs}
Using this technique you can either get a very accurate solution of the convenient linear system, or the best (in the least-squares terms) pseudo-solution of an overdetermined linear system. Using this technique you can either get a very accurate solution of the convenient linear system, or the best (in the least-squares terms) pseudo-solution of an overdetermined linear system.
.. note:: Explicit SVD with the further back substitution only makes sense if you need to solve many linear systems with the same left-hand side (for example, ``src`` ). If all you need is to solve a single system (possibly with multiple ``rhs`` immediately available), simply call :ocv:func:`solve` add pass ``DECOMP_SVD`` there. It does absolutely the same thing. .. note:: Explicit SVD with the further back substitution only makes sense if you need to solve many linear systems with the same left-hand side (for example, ``src`` ). If all you need is to solve a single system (possibly with multiple ``rhs`` immediately available), simply call :ocv:func:`solve` add pass ``DECOMP_SVD`` there. It does absolutely the same thing.
@ -3306,10 +3305,10 @@ Calculates the sum of array elements.
.. ocv:function:: Scalar sum(InputArray arr) .. ocv:function:: Scalar sum(InputArray arr)
.. ocv:pyfunction:: cv2.sumElems(arr) -> retval .. ocv:pyfunction:: cv2.sumElems(src) -> retval
.. ocv:cfunction:: CvScalar cvSum(const CvArr* arr) .. ocv:cfunction:: CvScalar cvSum(const CvArr* arr)
.. ocv:pyoldfunction:: cv.Sum(arr)-> CvScalar .. ocv:pyoldfunction:: cv.Sum(arr) -> scalar
:param arr: Source array that must have from 1 to 4 channels. :param arr: Source array that must have from 1 to 4 channels.
@ -3350,10 +3349,10 @@ Returns the trace of a matrix.
.. ocv:function:: Scalar trace(InputArray mat) .. ocv:function:: Scalar trace(InputArray mat)
.. ocv:pyfunction:: cv2.trace(mat) -> retval .. ocv:pyfunction:: cv2.trace(mtx) -> retval
.. ocv:cfunction:: CvScalar cvTrace(const CvArr* mat) .. ocv:cfunction:: CvScalar cvTrace(const CvArr* mat)
.. ocv:pyoldfunction:: cv.Trace(mat)-> CvScalar .. ocv:pyoldfunction:: cv.Trace(mat) -> scalar
:param mat: Source matrix. :param mat: Source matrix.
@ -3371,17 +3370,17 @@ Performs the matrix transformation of every array element.
.. ocv:function:: void transform(InputArray src, OutputArray dst, InputArray mtx ) .. ocv:function:: void transform(InputArray src, OutputArray dst, InputArray mtx )
.. ocv:pyfunction:: cv2.transform(src, mtx [, dst]) -> dst .. ocv:pyfunction:: cv2.transform(src, m[, dst]) -> dst
.. ocv:cfunction:: void cvTransform(const CvArr* src, CvArr* dst, const CvMat* mtx, const CvMat* shiftvec=NULL) .. ocv:cfunction:: void cvTransform(const CvArr* src, CvArr* dst, const CvMat* mtx, const CvMat* shiftvec=NULL)
.. ocv:pyoldfunction:: cv.Transform(src, dst, mtx, shiftvec=None)-> None .. 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 ``mtx.cols`` or ``mtx.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 ``mtx.rows`` .
:param mtx: Transformation ``2x2`` or ``2x3`` floating-point matrix. :param mtx: Transformation ``2x2`` or ``2x3`` floating-point matrix.
:param shiftvec: Optional translation vector (when ``mtx`` is ``2x2``) :param shiftvec: Optional translation vector (when ``mtx`` is ``2x2``)
The function ``transform`` performs the matrix transformation of every element of the array ``src`` and stores the results in ``dst`` : The function ``transform`` performs the matrix transformation of every element of the array ``src`` and stores the results in ``dst`` :
@ -3430,7 +3429,7 @@ Transposes a matrix.
:param src: Source array. :param src: Source array.
:param dst: Destination array of the same type as ``src`` . :param dst: Destination array of the same type as ``src`` .
The function :ocv:func:`transpose` transposes the matrix ``src`` : The function :ocv:func:`transpose` transposes the matrix ``src`` :
.. math:: .. math::

View File

@ -95,7 +95,7 @@ Computes the cube root of an argument.
.. ocv:cfunction:: float cvCbrt(float val) .. ocv:cfunction:: float cvCbrt(float val)
.. ocv:pyoldfunction:: cv.Cbrt(val)-> float .. ocv:pyoldfunction:: cv.Cbrt(value)-> float
:param val: A function argument. :param val: A function argument.
@ -151,7 +151,7 @@ Determines if the argument is Infinity.
.. ocv:cfunction:: int cvIsInf(double value) .. ocv:cfunction:: int cvIsInf(double value)
.. ocv:pyoldfunction:: cv.IsInf(value)-> int .. ocv:pyoldfunction:: cv.IsInf(value)-> int
:param value: The input floating-point value :param value: The input floating-point value
The function returns 1 if the argument is a plus or minus infinity (as defined by IEEE754 standard) and 0 otherwise. The function returns 1 if the argument is a plus or minus infinity (as defined by IEEE754 standard) and 0 otherwise.
@ -162,7 +162,7 @@ Determines if the argument is Not A Number.
.. ocv:cfunction:: int cvIsNaN(double value) .. ocv:cfunction:: int cvIsNaN(double value)
.. ocv:pyoldfunction:: cv.IsNaN(value)-> int .. ocv:pyoldfunction:: cv.IsNaN(value)-> int
:param value: The input floating-point value :param value: The input floating-point value
The function returns 1 if the argument is Not A Number (as defined by IEEE754 standard), 0 otherwise. The function returns 1 if the argument is Not A Number (as defined by IEEE754 standard), 0 otherwise.
@ -186,8 +186,8 @@ Signals an error and raises an exception.
:param exc: Exception to throw. :param exc: Exception to throw.
:param status: Error code. Normally, it is a negative value. The list of pre-defined error codes can be found in ``cxerror.h`` . :param status: Error code. Normally, it is a negative value. The list of pre-defined error codes can be found in ``cxerror.h`` .
:param err_msg: Text of the error message. :param err_msg: Text of the error message.
:param args: ``printf`` -like formatted error message in parentheses. :param args: ``printf`` -like formatted error message in parentheses.
@ -209,7 +209,7 @@ The macro ``CV_Error_`` can be used to construct an error message on-fly to incl
Exception Exception
--------- ---------
.. ocv:class:: Exception .. ocv:class:: Exception : public std::exception
Exception class passed to an error. :: Exception class passed to an error. ::
@ -261,7 +261,7 @@ Deallocates a memory buffer.
.. ocv:cfunction:: void cvFree( void** pptr ) .. ocv:cfunction:: void cvFree( void** pptr )
:param ptr: Pointer to the allocated buffer. :param ptr: Pointer to the allocated buffer.
:param pptr: Double pointer to the allocated buffer :param pptr: Double pointer to the allocated buffer
The function deallocates the buffer allocated with :ocv:func:`fastMalloc` . If NULL pointer is passed, the function does nothing. C version of the function clears the pointer ``*pptr`` to avoid problems with double memory deallocation. The function deallocates the buffer allocated with :ocv:func:`fastMalloc` . If NULL pointer is passed, the function does nothing. C version of the function clears the pointer ``*pptr`` to avoid problems with double memory deallocation.
@ -286,10 +286,10 @@ Returns true if the specified feature is supported by the host hardware.
.. ocv:function:: bool checkHardwareSupport(int feature) .. ocv:function:: bool checkHardwareSupport(int feature)
.. ocv:cfunction:: int cvCheckHardwareSupport(int feature) .. ocv:cfunction:: int cvCheckHardwareSupport(int feature)
.. ocv:pyfunction:: checkHardwareSupport(feature) -> Bool .. ocv:pyfunction:: cv2.checkHardwareSupport(feature) -> retval
:param feature: The feature of interest, one of: :param feature: The feature of interest, one of:
* ``CV_CPU_MMX`` - MMX * ``CV_CPU_MMX`` - MMX
* ``CV_CPU_SSE`` - SSE * ``CV_CPU_SSE`` - SSE
* ``CV_CPU_SSE2`` - SSE 2 * ``CV_CPU_SSE2`` - SSE 2
@ -312,7 +312,7 @@ The function returns the number of threads that is used by OpenCV.
.. seealso:: .. seealso::
:ocv:func:`setNumThreads`, :ocv:func:`setNumThreads`,
:ocv:func:`getThreadNum` :ocv:func:`getThreadNum`
@ -411,7 +411,7 @@ The function sets the number of threads used by OpenCV in parallel OpenMP region
.. seealso:: .. seealso::
:ocv:func:`getNumThreads`, :ocv:func:`getNumThreads`,
:ocv:func:`getThreadNum` :ocv:func:`getThreadNum`

View File

@ -13,7 +13,7 @@ descriptor extractors inherit the
DescriptorExtractor DescriptorExtractor
------------------- -------------------
.. ocv:class:: DescriptorExtractor .. ocv:class:: DescriptorExtractor : public Algorithm
Abstract base class for computing descriptors for image keypoints. :: Abstract base class for computing descriptors for image keypoints. ::
@ -107,7 +107,7 @@ for example: ``"OpponentSIFT"`` .
OpponentColorDescriptorExtractor OpponentColorDescriptorExtractor
-------------------------------- --------------------------------
.. ocv:class:: OpponentColorDescriptorExtractor .. ocv:class:: OpponentColorDescriptorExtractor : public DescriptorExtractor
Class adapting a descriptor extractor to compute descriptors in the Opponent Color Space Class adapting a descriptor extractor to compute descriptors in the Opponent Color Space
(refer to Van de Sande et al., CGIV 2008 *Color Descriptors for Object Category Recognition*). (refer to Van de Sande et al., CGIV 2008 *Color Descriptors for Object Category Recognition*).
@ -132,7 +132,7 @@ them into a single color descriptor. ::
BriefDescriptorExtractor BriefDescriptorExtractor
------------------------ ------------------------
.. ocv:class:: BriefDescriptorExtractor .. ocv:class:: BriefDescriptorExtractor : public DescriptorExtractor
Class for computing BRIEF descriptors described in a paper of Calonder M., Lepetit V., Class for computing BRIEF descriptors described in a paper of Calonder M., Lepetit V.,
Strecha C., Fua P. *BRIEF: Binary Robust Independent Elementary Features* , Strecha C., Fua P. *BRIEF: Binary Robust Independent Elementary Features* ,

View File

@ -11,7 +11,7 @@ descriptor matchers inherit the
DMatch DMatch
------ ------
.. ocv:class:: DMatch .. ocv:struct:: DMatch
Class for matching keypoint descriptors: query descriptor index, Class for matching keypoint descriptors: query descriptor index,
train descriptor index, train image index, and distance between descriptors. :: train descriptor index, train image index, and distance between descriptors. ::
@ -40,7 +40,7 @@ train descriptor index, train image index, and distance between descriptors. ::
DescriptorMatcher DescriptorMatcher
----------------- -----------------
.. ocv:class:: DescriptorMatcher .. ocv:class:: DescriptorMatcher : public Algorithm
Abstract base class for matching keypoint descriptors. It has two groups Abstract base class for matching keypoint descriptors. It has two groups
of match methods: for matching descriptors of an image with another image or of match methods: for matching descriptors of an image with another image or
@ -111,7 +111,7 @@ Returns a constant link to the train descriptor collection ``trainDescCollection
.. ocv:function:: const vector<Mat>& DescriptorMatcher::getTrainDescriptors() const .. ocv:function:: const vector<Mat>& DescriptorMatcher::getTrainDescriptors() const
@ -167,7 +167,7 @@ Finds the best match for each descriptor from a query set.
:param masks: Set of masks. Each ``masks[i]`` specifies permissible matches between the input query descriptors and stored train descriptors from the i-th image ``trainDescCollection[i]``. :param masks: Set of masks. Each ``masks[i]`` specifies permissible matches between the input query descriptors and stored train descriptors from the i-th image ``trainDescCollection[i]``.
In the first variant of this method, the train descriptors are passed as an input argument. In the second variant of the method, train descriptors collection that was set by ``DescriptorMatcher::add`` is used. Optional mask (or masks) can be passed to specify which query and training descriptors can be matched. Namely, ``queryDescriptors[i]`` can be matched with ``trainDescriptors[j]`` only if ``mask.at<uchar>(i,j)`` is non-zero. In the first variant of this method, the train descriptors are passed as an input argument. In the second variant of the method, train descriptors collection that was set by ``DescriptorMatcher::add`` is used. Optional mask (or masks) can be passed to specify which query and training descriptors can be matched. Namely, ``queryDescriptors[i]`` can be matched with ``trainDescriptors[j]`` only if ``mask.at<uchar>(i,j)`` is non-zero.
@ -193,7 +193,7 @@ Finds the k best matches for each descriptor from a query set.
:param compactResult: Parameter used when the mask (or masks) is not empty. If ``compactResult`` is false, the ``matches`` vector has the same size as ``queryDescriptors`` rows. If ``compactResult`` is true, the ``matches`` vector does not contain matches for fully masked-out query descriptors. :param compactResult: Parameter used when the mask (or masks) is not empty. If ``compactResult`` is false, the ``matches`` vector has the same size as ``queryDescriptors`` rows. If ``compactResult`` is true, the ``matches`` vector does not contain matches for fully masked-out query descriptors.
These extended variants of :ocv:func:`DescriptorMatcher::match` methods find several best matches for each query descriptor. The matches are returned in the distance increasing order. See :ocv:func:`DescriptorMatcher::match` for the details about query and train descriptors. These extended variants of :ocv:func:`DescriptorMatcher::match` methods find several best matches for each query descriptor. The matches are returned in the distance increasing order. See :ocv:func:`DescriptorMatcher::match` for the details about query and train descriptors.
@ -218,7 +218,7 @@ For each query descriptor, finds the training descriptors not farther than the s
:param compactResult: Parameter used when the mask (or masks) is not empty. If ``compactResult`` is false, the ``matches`` vector has the same size as ``queryDescriptors`` rows. If ``compactResult`` is true, the ``matches`` vector does not contain matches for fully masked-out query descriptors. :param compactResult: Parameter used when the mask (or masks) is not empty. If ``compactResult`` is false, the ``matches`` vector has the same size as ``queryDescriptors`` rows. If ``compactResult`` is true, the ``matches`` vector does not contain matches for fully masked-out query descriptors.
:param maxDistance: Threshold for the distance between matched descriptors. :param maxDistance: Threshold for the distance between matched descriptors.
For each query descriptor, the methods find such training descriptors that the distance between the query descriptor and the training descriptor is equal or smaller than ``maxDistance``. Found matches are returned in the distance increasing order. For each query descriptor, the methods find such training descriptors that the distance between the query descriptor and the training descriptor is equal or smaller than ``maxDistance``. Found matches are returned in the distance increasing order.
@ -227,7 +227,7 @@ DescriptorMatcher::clone
---------------------------- ----------------------------
Clones the matcher. Clones the matcher.
.. ocv:function:: Ptr<DescriptorMatcher> DescriptorMatcher::clone( bool emptyTrainData ) const .. ocv:function:: Ptr<DescriptorMatcher> DescriptorMatcher::clone( bool emptyTrainData=false )
:param emptyTrainData: If ``emptyTrainData`` is false, the method creates a deep copy of the object, that is, copies both parameters and train data. If ``emptyTrainData`` is true, the method creates an object copy with the current parameters but with empty train data. :param emptyTrainData: If ``emptyTrainData`` is false, the method creates a deep copy of the object, that is, copies both parameters and train data. If ``emptyTrainData`` is true, the method creates an object copy with the current parameters but with empty train data.
@ -241,15 +241,15 @@ Creates a descriptor matcher of a given type with the default parameters (using
:param descriptorMatcherType: Descriptor matcher type. Now the following matcher types are supported: :param descriptorMatcherType: Descriptor matcher type. Now the following matcher types are supported:
* *
``BruteForce`` (it uses ``L2`` ) ``BruteForce`` (it uses ``L2`` )
* *
``BruteForce-L1`` ``BruteForce-L1``
* *
``BruteForce-Hamming`` ``BruteForce-Hamming``
* *
``BruteForce-Hamming(2)`` ``BruteForce-Hamming(2)``
* *
``FlannBased`` ``FlannBased``
@ -258,7 +258,7 @@ Creates a descriptor matcher of a given type with the default parameters (using
BFMatcher BFMatcher
----------------- -----------------
.. ocv:class::BFMatcher .. ocv:class::BFMatcher : public DescriptorMatcher
Brute-force descriptor matcher. For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. This descriptor matcher supports masking permissible matches of descriptor sets. :: Brute-force descriptor matcher. For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. This descriptor matcher supports masking permissible matches of descriptor sets. ::
@ -267,16 +267,16 @@ BFMatcher::BFMatcher
-------------------- --------------------
Brute-force matcher constructor. Brute-force matcher constructor.
.. ocv:function:: BFMatcher::BFMatcher( int distanceType, bool crossCheck=false ) .. 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 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 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. :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.
FlannBasedMatcher FlannBasedMatcher
----------------- -----------------
.. ocv:class:: FlannBasedMatcher .. ocv:class:: FlannBasedMatcher : public DescriptorMatcher
Flann-based descriptor matcher. This matcher trains :ocv:class:`flann::Index_` on a train descriptor collection and calls its nearest search methods to find the best matches. So, this matcher may be faster when matching a large train collection than the brute force matcher. ``FlannBasedMatcher`` does not support masking permissible matches of descriptor sets because ``flann::Index`` does not support this. :: Flann-based descriptor matcher. This matcher trains :ocv:class:`flann::Index_` on a train descriptor collection and calls its nearest search methods to find the best matches. So, this matcher may be faster when matching a large train collection than the brute force matcher. ``FlannBasedMatcher`` does not support masking permissible matches of descriptor sets because ``flann::Index`` does not support this. ::

View File

@ -48,7 +48,7 @@ The keypoint constructors
.. ocv:function:: KeyPoint::KeyPoint(float x, float y, float _size, float _angle=-1, float _response=0, int _octave=0, int _class_id=-1) .. ocv:function:: KeyPoint::KeyPoint(float x, float y, float _size, float _angle=-1, float _response=0, int _octave=0, int _class_id=-1)
.. ocv:pyfunction:: cv2.KeyPoint(x, y, _size[, _angle[, _response[, _octave[, _class_id]]]]) -> <KeyPoint object> .. ocv:pyfunction:: cv2.KeyPoint([x, y, _size[, _angle[, _response[, _octave[, _class_id]]]]]) -> <KeyPoint object>
:param x: x-coordinate of the keypoint :param x: x-coordinate of the keypoint
@ -69,7 +69,7 @@ The keypoint constructors
FeatureDetector FeatureDetector
--------------- ---------------
.. ocv:class:: FeatureDetector .. ocv:class:: FeatureDetector : public Algorithm
Abstract base class for 2D image feature detectors. :: Abstract base class for 2D image feature detectors. ::
@ -156,7 +156,7 @@ for example: ``"GridFAST"``, ``"PyramidSTAR"`` .
FastFeatureDetector FastFeatureDetector
------------------- -------------------
.. ocv:class:: FastFeatureDetector .. ocv:class:: FastFeatureDetector : public FeatureDetector
Wrapping class for feature detection using the Wrapping class for feature detection using the
:ocv:func:`FAST` method. :: :ocv:func:`FAST` method. ::
@ -252,7 +252,7 @@ Wrapping class for feature detection using the
DenseFeatureDetector DenseFeatureDetector
-------------------- --------------------
.. ocv:class:: DenseFeatureDetector .. ocv:class:: DenseFeatureDetector : public FeatureDetector
Class for generation of image features which are distributed densely and regularly over the image. :: Class for generation of image features which are distributed densely and regularly over the image. ::
@ -279,7 +279,7 @@ The detector generates several levels (in the amount of ``featureScaleLevels``)
SimpleBlobDetector SimpleBlobDetector
------------------- -------------------
.. ocv:class:: SimpleBlobDetector .. ocv:class:: SimpleBlobDetector : public FeatureDetector
Class for extracting blobs from an image. :: Class for extracting blobs from an image. ::
@ -344,7 +344,7 @@ Default values of parameters are tuned to extract dark circular blobs.
GridAdaptedFeatureDetector GridAdaptedFeatureDetector
-------------------------- --------------------------
.. ocv:class:: GridAdaptedFeatureDetector .. ocv:class:: GridAdaptedFeatureDetector : public FeatureDetector
Class adapting a detector to partition the source image into a grid and detect points in each cell. :: Class adapting a detector to partition the source image into a grid and detect points in each cell. ::
@ -369,7 +369,7 @@ Class adapting a detector to partition the source image into a grid and detect p
PyramidAdaptedFeatureDetector PyramidAdaptedFeatureDetector
----------------------------- -----------------------------
.. ocv:class:: PyramidAdaptedFeatureDetector .. ocv:class:: PyramidAdaptedFeatureDetector : public FeatureDetector
Class adapting a detector to detect points over multiple levels of a Gaussian pyramid. Consider using this class for detectors that are not inherently scaled. :: Class adapting a detector to detect points over multiple levels of a Gaussian pyramid. Consider using this class for detectors that are not inherently scaled. ::
@ -387,7 +387,7 @@ Class adapting a detector to detect points over multiple levels of a Gaussian py
DynamicAdaptedFeatureDetector DynamicAdaptedFeatureDetector
----------------------------- -----------------------------
.. ocv:class:: DynamicAdaptedFeatureDetector .. ocv:class:: DynamicAdaptedFeatureDetector : public FeatureDetector
Adaptively adjusting detector that iteratively detects features until the desired number is found. :: Adaptively adjusting detector that iteratively detects features until the desired number is found. ::
@ -431,7 +431,7 @@ DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector
---------------------------------------------------------------- ----------------------------------------------------------------
The constructor The constructor
.. ocv:function:: DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector( const Ptr<AdjusterAdapter>& adjuster, int min_features, int max_features, int max_iters ) .. ocv:function:: DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector( const Ptr<AdjusterAdapter>& adjaster, int min_features=400, int max_features=500, int max_iters=5 )
:param adjuster: :ocv:class:`AdjusterAdapter` that detects features and adjusts parameters. :param adjuster: :ocv:class:`AdjusterAdapter` that detects features and adjusts parameters.
@ -443,7 +443,7 @@ The constructor
AdjusterAdapter AdjusterAdapter
--------------- ---------------
.. ocv:class:: AdjusterAdapter .. ocv:class:: AdjusterAdapter : public FeatureDetector
Class providing an interface for adjusting parameters of a feature detector. This interface is used by :ocv:class:`DynamicAdaptedFeatureDetector` . It is a wrapper for :ocv:class:`FeatureDetector` that enables adjusting parameters after feature detection. :: Class providing an interface for adjusting parameters of a feature detector. This interface is used by :ocv:class:`DynamicAdaptedFeatureDetector` . It is a wrapper for :ocv:class:`FeatureDetector` that enables adjusting parameters after feature detection. ::
@ -522,7 +522,7 @@ Creates an adjuster adapter by name
FastAdjuster FastAdjuster
------------ ------------
.. ocv:class:: FastAdjuster .. ocv:class:: FastAdjuster : public AdjusterAdapter
:ocv:class:`AdjusterAdapter` for :ocv:class:`FastFeatureDetector`. This class decreases or increases the threshold value by 1. :: :ocv:class:`AdjusterAdapter` for :ocv:class:`FastFeatureDetector`. This class decreases or increases the threshold value by 1. ::
@ -535,7 +535,7 @@ FastAdjuster
StarAdjuster StarAdjuster
------------ ------------
.. ocv:class:: StarAdjuster .. ocv:class:: StarAdjuster : public AdjusterAdapter
:ocv:class:`AdjusterAdapter` for :ocv:class:`StarFeatureDetector`. This class adjusts the ``responseThreshhold`` of ``StarFeatureDetector``. :: :ocv:class:`AdjusterAdapter` for :ocv:class:`StarFeatureDetector`. This class adjusts the ``responseThreshhold`` of ``StarFeatureDetector``. ::

View File

@ -3,7 +3,7 @@ Common Interfaces of Generic Descriptor Matchers
.. highlight:: cpp .. highlight:: cpp
Matchers of keypoint descriptors in OpenCV have wrappers with a common interface that enables you to easily switch Matchers of keypoint descriptors in OpenCV have wrappers with a common interface that enables you to easily switch
between different algorithms solving the same problem. This section is devoted to matching descriptors between different algorithms solving the same problem. This section is devoted to matching descriptors
that cannot be represented as vectors in a multidimensional space. ``GenericDescriptorMatcher`` is a more generic interface for descriptors. It does not make any assumptions about descriptor representation. that cannot be represented as vectors in a multidimensional space. ``GenericDescriptorMatcher`` is a more generic interface for descriptors. It does not make any assumptions about descriptor representation.
Every descriptor with the Every descriptor with the
@ -130,7 +130,7 @@ GenericDescriptorMatcher::isMaskSupported
--------------------------------------------- ---------------------------------------------
Returns ``true`` if a generic descriptor matcher supports masking permissible matches. Returns ``true`` if a generic descriptor matcher supports masking permissible matches.
.. ocv:function:: void GenericDescriptorMatcher::isMaskSupported() .. ocv:function:: bool GenericDescriptorMatcher::isMaskSupported()
@ -151,12 +151,12 @@ Classifies keypoints from a query set.
:param trainKeypoints: Keypoints from a train image. :param trainKeypoints: Keypoints from a train image.
The method classifies each keypoint from a query set. The first variant of the method takes a train image and its keypoints as an input argument. The second variant uses the internally stored training collection that can be built using the ``GenericDescriptorMatcher::add`` method. The method classifies each keypoint from a query set. The first variant of the method takes a train image and its keypoints as an input argument. The second variant uses the internally stored training collection that can be built using the ``GenericDescriptorMatcher::add`` method.
The methods do the following: The methods do the following:
#. #.
Call the ``GenericDescriptorMatcher::match`` method to find correspondence between the query set and the training set. Call the ``GenericDescriptorMatcher::match`` method to find correspondence between the query set and the training set.
#. #.
Set the ``class_id`` field of each keypoint from the query set to ``class_id`` of the corresponding keypoint from the training set. Set the ``class_id`` field of each keypoint from the query set to ``class_id`` of the corresponding keypoint from the training set.
@ -195,7 +195,7 @@ Finds the ``k`` best matches for each query keypoint.
.. ocv:function:: void GenericDescriptorMatcher::knnMatch( const Mat& queryImage, vector<KeyPoint>& queryKeypoints, const Mat& trainImage, vector<KeyPoint>& trainKeypoints, vector<vector<DMatch> >& matches, int k, const Mat& mask=Mat(), bool compactResult=false ) const .. ocv:function:: void GenericDescriptorMatcher::knnMatch( const Mat& queryImage, vector<KeyPoint>& queryKeypoints, const Mat& trainImage, vector<KeyPoint>& trainKeypoints, vector<vector<DMatch> >& matches, int k, const Mat& mask=Mat(), bool compactResult=false ) const
.. ocv:function:: void GenericDescriptorMatcher::knnMatch( const Mat& queryImage, vector<KeyPoint>& queryKeypoints, vector<vector<DMatch> >& matches, int k, const vector<Mat>& masks=vector<Mat>(), bool compactResult=false ) .. ocv:function:: void GenericDescriptorMatcher::knnMatch( const Mat& queryImage, vector<KeyPoint>& queryKeypoints, vector<vector<DMatch> >& matches, int k, const vector<Mat>& masks=vector<Mat>(), bool compactResult=false )
The methods are extended variants of ``GenericDescriptorMatch::match``. The parameters are similar, and the semantics is similar to ``DescriptorMatcher::knnMatch``. But this class does not require explicitly computed keypoint descriptors. The methods are extended variants of ``GenericDescriptorMatch::match``. The parameters are similar, and the semantics is similar to ``DescriptorMatcher::knnMatch``. But this class does not require explicitly computed keypoint descriptors.
@ -231,7 +231,7 @@ GenericDescriptorMatcher::clone
----------------------------------- -----------------------------------
Clones the matcher. Clones the matcher.
.. ocv:function:: Ptr<GenericDescriptorMatcher> GenericDescriptorMatcher::clone( bool emptyTrainData ) const .. ocv:function:: Ptr<GenericDescriptorMatcher> GenericDescriptorMatcher::clone( bool emptyTrainData=false ) const
:param emptyTrainData: If ``emptyTrainData`` is false, the method creates a deep copy of the object, that is, copies :param emptyTrainData: If ``emptyTrainData`` is false, the method creates a deep copy of the object, that is, copies
both parameters and train data. If ``emptyTrainData`` is true, the method creates an object copy with the current parameters both parameters and train data. If ``emptyTrainData`` is true, the method creates an object copy with the current parameters
@ -240,7 +240,7 @@ Clones the matcher.
VectorDescriptorMatcher VectorDescriptorMatcher
----------------------- -----------------------
.. ocv:class:: VectorDescriptorMatcher .. ocv:class:: VectorDescriptorMatcher : public GenericDescriptorMatcher
Class used for matching descriptors that can be described as vectors in a finite-dimensional space. :: Class used for matching descriptors that can be described as vectors in a finite-dimensional space. ::

View File

@ -7,9 +7,9 @@ drawMatches
--------------- ---------------
Draws the found matches of keypoints from two images. Draws the found matches of keypoints from two images.
.. ocv:function:: void drawMatches( const Mat& img1, const vector<KeyPoint>& keypoints1, const Mat& img2, const vector<KeyPoint>& keypoints2, const vector<DMatch>& matches1to2, Mat& outImg, const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1), const vector<char>& matchesMask=vector<char>(), int flags=DrawMatchesFlags::DEFAULT ) .. ocv:function:: void drawMatches( const Mat& img1, const vector<KeyPoint>& keypoints1, const Mat& img2, const vector<KeyPoint>& keypoints2, const vector<DMatch>& matches1to2, Mat& outImg, const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1), const vector<char>& matchesMask=vector<char>(), int flags=DrawMatchesFlags::DEFAULT )
.. ocv:function:: void drawMatches( const Mat& img1, const vector<KeyPoint>& keypoints1, const Mat& img2, const vector<KeyPoint>& keypoints2, const vector<vector<DMatch> >& matches1to2, Mat& outImg, const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1), const vector<vector<char>>& matchesMask= vector<vector<char> >(), int flags=DrawMatchesFlags::DEFAULT ) .. ocv:function:: void drawMatches( const Mat& img1, const vector<KeyPoint>& keypoints1, const Mat& img2, const vector<KeyPoint>& keypoints2, const vector<vector<DMatch> >& matches1to2, Mat& outImg, const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1), const vector<vector<char> >& matchesMask=vector<vector<char> >(), int flags=DrawMatchesFlags::DEFAULT )
:param img1: First source image. :param img1: First source image.
@ -31,7 +31,7 @@ Draws the found matches of keypoints from two images.
:param matchesMask: Mask determining which matches are drawn. If the mask is empty, all matches are drawn. :param matchesMask: Mask determining which matches are drawn. If the mask is empty, all matches are drawn.
:param flags: Flags setting drawing features. Possible ``flags`` bit values are defined by ``DrawMatchesFlags``. :param flags: Flags setting drawing features. Possible ``flags`` bit values are defined by ``DrawMatchesFlags``.
This function draws matches of keypoints from two images in the output image. Match is a line connecting two keypoints (circles). The structure ``DrawMatchesFlags`` is defined as follows: This function draws matches of keypoints from two images in the output image. Match is a line connecting two keypoints (circles). The structure ``DrawMatchesFlags`` is defined as follows:
.. code-block:: cpp .. code-block:: cpp
@ -65,7 +65,7 @@ drawKeypoints
----------------- -----------------
Draws keypoints. Draws keypoints.
.. ocv:function:: void drawKeypoints( const Mat& image, const vector<KeyPoint>& keypoints, Mat& outImg, const Scalar& color=Scalar::all(-1), int flags=DrawMatchesFlags::DEFAULT ) .. ocv:function:: void drawKeypoints( const Mat& image, const vector<KeyPoint>& keypoints, Mat& outImage, const Scalar& color=Scalar::all(-1), int flags=DrawMatchesFlags::DEFAULT )
:param image: Source image. :param image: Source image.

View File

@ -24,7 +24,7 @@ Detects corners using the FAST algorithm by [Rosten06]_.
MSER MSER
---- ----
.. ocv:class:: MSER .. ocv:class:: MSER : public FeatureDetector
Maximally stable extremal region extractor. :: Maximally stable extremal region extractor. ::
@ -50,7 +50,7 @@ http://en.wikipedia.org/wiki/Maximally_stable_extremal_regions). Also see http:/
ORB ORB
--- ---
.. ocv:class:: ORB .. ocv:class:: ORB : public Feature2D
Class implementing the ORB (*oriented BRIEF*) keypoint detector and descriptor extractor, described in [RRKB11]_. The algorithm uses FAST in pyramids to detect stable keypoints, selects the strongest features using FAST or Harris response, finds their orientation using first-order moments and computes the descriptors using BRIEF (where the coordinates of random point pairs (or k-tuples) are rotated according to the measured orientation). Class implementing the ORB (*oriented BRIEF*) keypoint detector and descriptor extractor, described in [RRKB11]_. The algorithm uses FAST in pyramids to detect stable keypoints, selects the strongest features using FAST or Harris response, finds their orientation using first-order moments and computes the descriptors using BRIEF (where the coordinates of random point pairs (or k-tuples) are rotated according to the measured orientation).
@ -60,39 +60,37 @@ ORB::ORB
-------- --------
The ORB constructor The ORB constructor
.. ocv:function:: ORB::ORB()
.. ocv:function:: ORB::ORB(int nfeatures = 500, float scaleFactor = 1.2f, int nlevels = 8, int edgeThreshold = 31, int firstLevel = 0, int WTA_K=2, int scoreType=HARRIS_SCORE, int patchSize=31) .. ocv:function:: ORB::ORB(int nfeatures = 500, float scaleFactor = 1.2f, int nlevels = 8, int edgeThreshold = 31, int firstLevel = 0, int WTA_K=2, int scoreType=HARRIS_SCORE, int patchSize=31)
:param nfeatures: The maximum number of features to retain. :param nfeatures: The maximum number of features to retain.
:param scaleFactor: Pyramid decimation ratio, greater than 1. ``scaleFactor==2`` means the classical pyramid, where each next level has 4x less pixels than the previous, but such a big scale factor will degrade feature matching scores dramatically. On the other hand, too close to 1 scale factor will mean that to cover certain scale range you will need more pyramid levels and so the speed will suffer. :param scaleFactor: Pyramid decimation ratio, greater than 1. ``scaleFactor==2`` means the classical pyramid, where each next level has 4x less pixels than the previous, but such a big scale factor will degrade feature matching scores dramatically. On the other hand, too close to 1 scale factor will mean that to cover certain scale range you will need more pyramid levels and so the speed will suffer.
:param nlevels: The number of pyramid levels. The smallest level will have linear size equal to ``input_image_linear_size/pow(scaleFactor, nlevels)``. :param nlevels: The number of pyramid levels. The smallest level will have linear size equal to ``input_image_linear_size/pow(scaleFactor, nlevels)``.
:param edgeThreshold: This is size of the border where the features are not detected. It should roughly match the ``patchSize`` parameter. :param edgeThreshold: This is size of the border where the features are not detected. It should roughly match the ``patchSize`` parameter.
:param firstLevel: It should be 0 in the current implementation. :param firstLevel: It should be 0 in the current implementation.
:param WTA_K: The number of points that produce each element of the oriented BRIEF descriptor. The default value 2 means the BRIEF where we take a random point pair and compare their brightnesses, so we get 0/1 response. Other possible values are 3 and 4. For example, 3 means that we take 3 random points (of course, those point coordinates are random, but they are generated from the pre-defined seed, so each element of BRIEF descriptor is computed deterministically from the pixel rectangle), find point of maximum brightness and output index of the winner (0, 1 or 2). Such output will occupy 2 bits, and therefore it will need a special variant of Hamming distance, denoted as ``NORM_HAMMING2`` (2 bits per bin). When ``WTA_K=4``, we take 4 random points to compute each bin (that will also occupy 2 bits with possible values 0, 1, 2 or 3). :param WTA_K: The number of points that produce each element of the oriented BRIEF descriptor. The default value 2 means the BRIEF where we take a random point pair and compare their brightnesses, so we get 0/1 response. Other possible values are 3 and 4. For example, 3 means that we take 3 random points (of course, those point coordinates are random, but they are generated from the pre-defined seed, so each element of BRIEF descriptor is computed deterministically from the pixel rectangle), find point of maximum brightness and output index of the winner (0, 1 or 2). Such output will occupy 2 bits, and therefore it will need a special variant of Hamming distance, denoted as ``NORM_HAMMING2`` (2 bits per bin). When ``WTA_K=4``, we take 4 random points to compute each bin (that will also occupy 2 bits with possible values 0, 1, 2 or 3).
:param scoreType: The default HARRIS_SCORE means that Harris algorithm is used to rank features (the score is written to ``KeyPoint::score`` and is used to retain best ``nfeatures`` features); FAST_SCORE is alternative value of the parameter that produces slightly less stable keypoints, but it is a little faster to compute. :param scoreType: The default HARRIS_SCORE means that Harris algorithm is used to rank features (the score is written to ``KeyPoint::score`` and is used to retain best ``nfeatures`` features); FAST_SCORE is alternative value of the parameter that produces slightly less stable keypoints, but it is a little faster to compute.
:param patchSize: size of the patch used by the oriented BRIEF descriptor. Of course, on smaller pyramid layers the perceived image area covered by a feature will be larger. :param patchSize: size of the patch used by the oriented BRIEF descriptor. Of course, on smaller pyramid layers the perceived image area covered by a feature will be larger.
ORB::operator() ORB::operator()
--------------- ---------------
Finds keypoints in an image and computes their descriptors Finds keypoints in an image and computes their descriptors
.. ocv:function:: void ORB::operator()(InputArray image, InputArray mask, vector<KeyPoint>& keypoints, OutputArray descriptors, bool useProvidedKeypoints=false ) const .. ocv:function:: void ORB::operator()(InputArray image, InputArray mask, vector<KeyPoint>& keypoints, OutputArray descriptors, bool useProvidedKeypoints=false ) const
:param image: The input 8-bit grayscale image. :param image: The input 8-bit grayscale image.
:param mask: The operation mask. :param mask: The operation mask.
:param keypoints: The output vector of keypoints. :param keypoints: The output vector of keypoints.
:param descriptors: The output descriptors. Pass ``cv::noArray()`` if you do not need it. :param descriptors: The output descriptors. Pass ``cv::noArray()`` if you do not need it.
:param useProvidedKeypoints: If it is true, then the method will use the provided vector of keypoints instead of detecting them. :param useProvidedKeypoints: If it is true, then the method will use the provided vector of keypoints instead of detecting them.

View File

@ -54,7 +54,7 @@ BOWTrainer::descripotorsCount
--------------------------------- ---------------------------------
Returns the count of all descriptors stored in the training set. Returns the count of all descriptors stored in the training set.
.. ocv:function:: const vector<Mat>& BOWTrainer::descripotorsCount() const .. ocv:function:: int BOWTrainer::descripotorsCount() const
@ -72,7 +72,7 @@ The vocabulary consists of cluster centers. So, this method returns the vocabula
BOWKMeansTrainer BOWKMeansTrainer
---------------- ----------------
.. ocv:class:: BOWKMeansTrainer .. ocv:class:: BOWKMeansTrainer : public BOWTrainer
:ocv:func:`kmeans` -based class to train visual vocabulary using the *bag of visual words* approach. :ocv:func:`kmeans` -based class to train visual vocabulary using the *bag of visual words* approach.
:: ::

View File

@ -276,7 +276,7 @@ public:
enum { kBytes = 32, HARRIS_SCORE=0, FAST_SCORE=1 }; enum { kBytes = 32, HARRIS_SCORE=0, FAST_SCORE=1 };
explicit ORB(int nfeatures = 500, float scaleFactor = 1.2f, int nlevels = 8, int edgeThreshold = 31, explicit ORB(int nfeatures = 500, float scaleFactor = 1.2f, int nlevels = 8, int edgeThreshold = 31,
int firstLevel = 0, int WTA_K=2, int scoreType=0, int patchSize=31 ); int firstLevel = 0, int WTA_K=2, int scoreType=HARRIS_SCORE, int patchSize=31 );
// returns the descriptor size in bytes // returns the descriptor size in bytes
int descriptorSize() const; int descriptorSize() const;
@ -1158,9 +1158,9 @@ public:
const vector<Mat>& masks=vector<Mat>(), bool compactResult=false ); const vector<Mat>& masks=vector<Mat>(), bool compactResult=false );
// Reads matcher object from a file node // Reads matcher object from a file node
virtual void read( const FileNode& ); virtual void read( const FileNode& fn );
// Writes matcher object to a file storage // Writes matcher object to a file storage
virtual void write( FileStorage& ) const; virtual void write( FileStorage& fs ) const;
// Return true if matching object is empty (e.g. feature detector or descriptor matcher are empty) // Return true if matching object is empty (e.g. feature detector or descriptor matcher are empty)
virtual bool empty() const; virtual bool empty() const;

View File

@ -338,7 +338,7 @@ Blocks the current CPU thread until all operations in the stream are complete.
gpu::StreamAccessor gpu::StreamAccessor
------------------- -------------------
.. ocv:class:: gpu::StreamAccessor .. ocv:struct:: gpu::StreamAccessor
Class that enables getting ``cudaStream_t`` from :ocv:class:`gpu::Stream` and is declared in ``stream_accessor.hpp`` because it is the only public header that depends on the CUDA Runtime API. Including it brings a dependency to your code. :: Class that enables getting ``cudaStream_t`` from :ocv:class:`gpu::Stream` and is declared in ``stream_accessor.hpp`` because it is the only public header that depends on the CUDA Runtime API. Including it brings a dependency to your code. ::

View File

@ -238,7 +238,7 @@ The source matrix should be continuous, otherwise reallocation and data copying
gpu::ConvolveBuf gpu::ConvolveBuf
---------------- ----------------
.. ocv:class:: gpu::ConvolveBuf .. ocv:struct:: gpu::ConvolveBuf
Class providing a memory buffer for :ocv:func:`gpu::convolve` function, plus it allows to adjust some specific parameters. :: Class providing a memory buffer for :ocv:func:`gpu::convolve` function, plus it allows to adjust some specific parameters. ::
@ -290,7 +290,7 @@ Computes a convolution (or cross-correlation) of two images.
gpu::MatchTemplateBuf gpu::MatchTemplateBuf
--------------------- ---------------------
.. ocv:class:: gpu::MatchTemplateBuf .. ocv:struct:: gpu::MatchTemplateBuf
Class providing memory buffers for :ocv:func:`gpu::matchTemplate` function, plus it allows to adjust some specific parameters. :: Class providing memory buffers for :ocv:func:`gpu::matchTemplate` function, plus it allows to adjust some specific parameters. ::

View File

@ -7,7 +7,7 @@ Object Detection
gpu::HOGDescriptor gpu::HOGDescriptor
------------------ ------------------
.. ocv:class:: gpu::HOGDescriptor .. ocv:struct:: gpu::HOGDescriptor
The class implements Histogram of Oriented Gradients ([Dalal2005]_) object detector. :: The class implements Histogram of Oriented Gradients ([Dalal2005]_) object detector. ::

View File

@ -377,7 +377,7 @@ The method write the specified image to video file. The image must have the same
gpu::VideoWriter_GPU::EncoderParams gpu::VideoWriter_GPU::EncoderParams
----------------------------------- -----------------------------------
.. ocv:class:: gpu::VideoWriter_GPU::EncoderParams .. ocv:struct:: gpu::VideoWriter_GPU::EncoderParams
Different parameters for CUDA video encoder. :: Different parameters for CUDA video encoder. ::
@ -561,7 +561,7 @@ Chroma formats supported by ocv:class:`gpu::VideoReader_GPU` . ::
gpu::VideoReader_GPU::FormatInfo gpu::VideoReader_GPU::FormatInfo
-------------------------------- --------------------------------
.. ocv:class:: gpu::VideoReader_GPU::FormatInfo .. ocv:struct:: gpu::VideoReader_GPU::FormatInfo
Struct providing information about video file format. :: Struct providing information about video file format. ::

View File

@ -61,35 +61,35 @@ setWindowProperty
--------------------- ---------------------
Changes parameters of a window dynamically. Changes parameters of a window dynamically.
.. ocv:function:: void setWindowProperty(const string& name, int prop_id, double prop_value) .. ocv:function:: void setWindowProperty( const string& winname, int prop_id, double prop_value )
.. ocv:pyfunction:: cv2.setWindowProperty(winname, prop_id, prop_value) -> None .. ocv:pyfunction:: cv2.setWindowProperty(winname, prop_id, prop_value) -> None
.. ocv:cfunction:: void cvSetWindowProperty(const char* name, int propId, double propValue) .. ocv:cfunction:: void cvSetWindowProperty( const char* name, int prop_id, double prop_value )
:param name: Name of the window. :param name: Name of the window.
:param prop_id: Window property to edit. The following operation flags are available: :param prop_id: Window property to edit. The following operation flags are available:
* **CV_WND_PROP_FULLSCREEN** Change if the window is fullscreen ( ``CV_WINDOW_NORMAL`` or ``CV_WINDOW_FULLSCREEN`` ). * **CV_WND_PROP_FULLSCREEN** Change if the window is fullscreen ( ``CV_WINDOW_NORMAL`` or ``CV_WINDOW_FULLSCREEN`` ).
* **CV_WND_PROP_AUTOSIZE** Change if the window is resizable (``CV_WINDOW_NORMAL`` or ``CV_WINDOW_AUTOSIZE`` ). * **CV_WND_PROP_AUTOSIZE** Change if the window is resizable (``CV_WINDOW_NORMAL`` or ``CV_WINDOW_AUTOSIZE`` ).
* **CV_WND_PROP_ASPECTRATIO** Change if the aspect ratio of the image is preserved ( ``CV_WINDOW_FREERATIO`` or ``CV_WINDOW_KEEPRATIO`` ). * **CV_WND_PROP_ASPECTRATIO** Change if the aspect ratio of the image is preserved ( ``CV_WINDOW_FREERATIO`` or ``CV_WINDOW_KEEPRATIO`` ).
:param prop_value: New value of the window property. The following operation flags are available: :param prop_value: New value of the window property. The following operation flags are available:
* **CV_WINDOW_NORMAL** Change the window to normal size or make the window resizable. * **CV_WINDOW_NORMAL** Change the window to normal size or make the window resizable.
* **CV_WINDOW_AUTOSIZE** Constrain the size by the displayed image. The window is not resizable. * **CV_WINDOW_AUTOSIZE** Constrain the size by the displayed image. The window is not resizable.
* **CV_WINDOW_FULLSCREEN** Change the window to fullscreen. * **CV_WINDOW_FULLSCREEN** Change the window to fullscreen.
* **CV_WINDOW_FREERATIO** Make the window resizable without any ratio constraints. * **CV_WINDOW_FREERATIO** Make the window resizable without any ratio constraints.
* **CV_WINDOW_KEEPRATIO** Make the window resizable, but preserve the proportions of the displayed image. * **CV_WINDOW_KEEPRATIO** Make the window resizable, but preserve the proportions of the displayed image.
The function ``setWindowProperty`` enables changing properties of a window. The function ``setWindowProperty`` enables changing properties of a window.
@ -97,22 +97,22 @@ getWindowProperty
--------------------- ---------------------
Provides parameters of a window. Provides parameters of a window.
.. ocv:function:: void getWindowProperty(const string& name, int prop_id) .. ocv:function:: double getWindowProperty( const string& winname, int prop_id )
.. ocv:pyfunction:: cv2.getWindowProperty(winname, prop_id) -> retval .. ocv:pyfunction:: cv2.getWindowProperty(winname, prop_id) -> retval
.. ocv:cfunction:: void cvGetWindowProperty(const char* name, int propId) .. ocv:cfunction:: double cvGetWindowProperty( const char* name, int prop_id )
:param name: Name of the window. :param name: Name of the window.
:param prop_id: Window property to retrieve. The following operation flags are available: :param prop_id: Window property to retrieve. The following operation flags are available:
* **CV_WND_PROP_FULLSCREEN** Change if the window is fullscreen ( ``CV_WINDOW_NORMAL`` or ``CV_WINDOW_FULLSCREEN`` ). * **CV_WND_PROP_FULLSCREEN** Change if the window is fullscreen ( ``CV_WINDOW_NORMAL`` or ``CV_WINDOW_FULLSCREEN`` ).
* **CV_WND_PROP_AUTOSIZE** Change if the window is resizable (``CV_WINDOW_NORMAL`` or ``CV_WINDOW_AUTOSIZE`` ). * **CV_WND_PROP_AUTOSIZE** Change if the window is resizable (``CV_WINDOW_NORMAL`` or ``CV_WINDOW_AUTOSIZE`` ).
* **CV_WND_PROP_ASPECTRATIO** Change if the aspect ratio of the image is preserved (``CV_WINDOW_FREERATIO`` or ``CV_WINDOW_KEEPRATIO`` ). * **CV_WND_PROP_ASPECTRATIO** Change if the aspect ratio of the image is preserved (``CV_WINDOW_FREERATIO`` or ``CV_WINDOW_KEEPRATIO`` ).
See See
:ocv:func:`setWindowProperty` to know the meaning of the returned values. :ocv:func:`setWindowProperty` to know the meaning of the returned values.
@ -134,27 +134,27 @@ Creates the font to draw a text on an image.
:param color: Color of the font in BGRA where A = 255 is fully transparent. Use the macro ``CV _ RGB`` for simplicity. :param color: Color of the font in BGRA where A = 255 is fully transparent. Use the macro ``CV _ RGB`` for simplicity.
:param weight: Font weight. The following operation flags are available: :param weight: Font weight. The following operation flags are available:
* **CV_FONT_LIGHT** Weight of 25 * **CV_FONT_LIGHT** Weight of 25
* **CV_FONT_NORMAL** Weight of 50 * **CV_FONT_NORMAL** Weight of 50
* **CV_FONT_DEMIBOLD** Weight of 63 * **CV_FONT_DEMIBOLD** Weight of 63
* **CV_FONT_BOLD** Weight of 75 * **CV_FONT_BOLD** Weight of 75
* **CV_FONT_BLACK** Weight of 87 * **CV_FONT_BLACK** Weight of 87
You can also specify a positive integer for better control. You can also specify a positive integer for better control.
:param style: Font style. The following operation flags are available: :param style: Font style. The following operation flags are available:
* **CV_STYLE_NORMAL** Normal font * **CV_STYLE_NORMAL** Normal font
* **CV_STYLE_ITALIC** Italic font * **CV_STYLE_ITALIC** Italic font
* **CV_STYLE_OBLIQUE** Oblique font * **CV_STYLE_OBLIQUE** Oblique font
:param spacing: Spacing between characters. It can be negative or positive. :param spacing: Spacing between characters. It can be negative or positive.
The function ``fontQt`` creates a ``CvFont`` object. This ``CvFont`` is not compatible with ``putText`` . The function ``fontQt`` creates a ``CvFont`` object. This ``CvFont`` is not compatible with ``putText`` .
@ -169,9 +169,9 @@ addText
----------- -----------
Creates the font to draw a text on an image. Creates the font to draw a text on an image.
.. ocv:function:: void addText(const Mat& img, const string& text, Point location, CvFont *font) .. ocv:function:: void addText( const Mat& img, const string& text, Point org, CvFont font )
.. ocv:cfunction:: void cvAddText(const CvArr* img, const char* text, CvPoint location, CvFont *font) .. ocv:cfunction:: void cvAddText( const CvArr* img, const char* text, CvPoint org, CvFont * arg2 )
:param img: 8-bit 3-channel image where the text should be drawn. :param img: 8-bit 3-channel image where the text should be drawn.
@ -193,9 +193,9 @@ using a specific font
displayOverlay displayOverlay
------------------ ------------------
Displays a text on a window image as an overlay for a specified duration. Displays a text on a window image as an overlay for a specified duration.
.. ocv:function:: void displayOverlay(const string& name, const string& text, int delayms = 0) .. ocv:function:: void displayOverlay( const string& winname, const string& text, int delayms=0 )
.. ocv:cfunction:: void cvDisplayOverlay(const char* name, const char* text, int delayms = 0) .. ocv:cfunction:: void cvDisplayOverlay(const char* name, const char* text, int delayms = 0)
@ -212,7 +212,7 @@ displayStatusBar
-------------------- --------------------
Displays a text on the window statusbar during the specified period of time. Displays a text on the window statusbar during the specified period of time.
.. ocv:function:: void displayStatusBar(const string& name, const string& text, int delayms = 0) .. ocv:function:: void displayStatusBar( const string& winname, const string& text, int delayms=0 )
.. ocv:cfunction:: void cvDisplayStatusBar(const char* name, const char* text, int delayms = 0) .. ocv:cfunction:: void cvDisplayStatusBar(const char* name, const char* text, int delayms = 0)
@ -282,7 +282,7 @@ saveWindowParameters
------------------------ ------------------------
Saves parameters of the specified window. Saves parameters of the specified window.
.. ocv:function:: void saveWindowParameters(const string& name) .. ocv:function:: void saveWindowParameters( const string& windowName )
.. ocv:cfunction:: void cvSaveWindowParameters(const char* name) .. ocv:cfunction:: void cvSaveWindowParameters(const char* name)
@ -295,7 +295,7 @@ loadWindowParameters
------------------------ ------------------------
Loads parameters of the specified window. Loads parameters of the specified window.
.. ocv:function:: void loadWindowParameters(const string& name) .. ocv:function:: void loadWindowParameters( const string& windowName )
.. ocv:cfunction:: void cvLoadWindowParameters(const char* name) .. ocv:cfunction:: void cvLoadWindowParameters(const char* name)
@ -308,9 +308,9 @@ createButton
---------------- ----------------
Attaches a button to the control panel. Attaches a button to the control panel.
.. ocv:function:: createButton( const string& button_name=NULL, ButtonCallback on_change=NULL, void* userdata=NULL, int button_type=CV_PUSH_BUTTON, int initial_button_state=0 ) .. ocv:function:: int createButton( const string& bar_name, ButtonCallback on_change, void* userdata=NULL, int type=CV_PUSH_BUTTON, bool initial_button_state=0 )
.. ocv:cfunction:: cvCreateButton( const char* buttonName=NULL, CvButtonCallback onChange=NULL, void* userdata=NULL, int buttonType=CV_PUSH_BUTTON, int initialButtonState=0 ) .. ocv:cfunction:: int cvCreateButton( const char* button_name=NULL, CvButtonCallback on_change=NULL, void* userdata=NULL, int button_type=CV_PUSH_BUTTON, int initial_button_state=0 )
:param button_name: Name of the button. :param button_name: Name of the button.

View File

@ -18,7 +18,7 @@ Reads an image from a buffer in memory.
:param buf: Input array or vector of bytes. :param buf: Input array or vector of bytes.
:param flags: The same flags as in :ocv:func:`imread` . :param flags: The same flags as in :ocv:func:`imread` .
The function reads an image from the specified buffer in the memory. The function reads an image from the specified buffer in the memory.
If the buffer is too short or contains invalid data, the empty matrix/image is returned. If the buffer is too short or contains invalid data, the empty matrix/image is returned.
@ -31,9 +31,9 @@ Encodes an image into a memory buffer.
.. ocv:function:: bool imencode( const string& ext, InputArray img, vector<uchar>& buf, const vector<int>& params=vector<int>()) .. ocv:function:: bool imencode( const string& ext, InputArray img, vector<uchar>& buf, const vector<int>& params=vector<int>())
.. ocv:cfunction:: CvMat* cvEncodeImage(const char* ext, const CvArr* image, const int* params=NULL ) .. ocv:cfunction:: CvMat* cvEncodeImage( const char* ext, const CvArr* image, const int* params=0 )
.. ocv:pyfunction:: cv2.imencode(ext, img, buf[, params]) -> retval .. ocv:pyfunction:: cv2.imencode(ext, img[, params]) -> retval, buf
:param ext: File extension that defines the output format. :param ext: File extension that defines the output format.
@ -57,13 +57,13 @@ Loads an image from a file.
.. ocv:pyfunction:: cv2.imread(filename[, flags]) -> retval .. ocv:pyfunction:: cv2.imread(filename[, flags]) -> retval
.. ocv:cfunction:: IplImage* cvLoadImage( const char* filename, int flags=CV_LOAD_IMAGE_COLOR ) .. ocv:cfunction:: IplImage* cvLoadImage( const char* filename, int iscolor=CV_LOAD_IMAGE_COLOR )
.. ocv:cfunction:: CvMat* cvLoadImageM( const char* filename, int flags=CV_LOAD_IMAGE_COLOR ) .. ocv:cfunction:: CvMat* cvLoadImageM( const char* filename, int iscolor=CV_LOAD_IMAGE_COLOR )
.. ocv:pyoldfunction:: cv.LoadImage(filename, flags=CV_LOAD_IMAGE_COLOR)->None .. ocv:pyoldfunction:: cv.LoadImage(filename, iscolor=CV_LOAD_IMAGE_COLOR) -> None
.. ocv:pyoldfunction:: cv.LoadImageM(filename, flags=CV_LOAD_IMAGE_COLOR)->None .. ocv:pyoldfunction:: cv.LoadImageM(filename, iscolor=CV_LOAD_IMAGE_COLOR) -> None
:param filename: Name of file to be loaded. :param filename: Name of file to be loaded.
@ -103,11 +103,11 @@ imwrite
----------- -----------
Saves an image to a specified file. Saves an image to a specified file.
.. ocv:function:: bool imwrite( const string& filename, InputArray image, const vector<int>& params=vector<int>()) .. ocv:function:: bool imwrite( const string& filename, InputArray img, const vector<int>& params=vector<int>() )
.. ocv:pyfunction:: cv2.imwrite(filename, image[, params]) -> retval .. ocv:pyfunction:: cv2.imwrite(filename, img[, params]) -> retval
.. ocv:cfunction:: int cvSaveImage( const char* filename, const CvArr* image ) .. ocv:cfunction:: int cvSaveImage( const char* filename, const CvArr* image, const int* params=0 )
.. ocv:pyoldfunction:: cv.SaveImage(filename, image)-> None .. ocv:pyoldfunction:: cv.SaveImage(filename, image)-> None
@ -129,11 +129,11 @@ The function ``imwrite`` saves the image to the specified file. The image format
:ocv:func:`cvtColor` to convert it before saving. Or, use the universal XML I/O functions to save the image to XML or YAML format. :ocv:func:`cvtColor` to convert it before saving. Or, use the universal XML I/O functions to save the image to XML or YAML format.
It is possible to store PNG images with an alpha channel using this function. To do this, create 8-bit (or 16-bit) 4-channel image BGRA, where the alpha channel goes last. Fully transparent pixels should have alpha set to 0, fully opaque pixels should have alpha set to 255/65535. The sample below shows how to create such a BGRA image and store to PNG file. It also demonstrates how to set custom compression parameters :: It is possible to store PNG images with an alpha channel using this function. To do this, create 8-bit (or 16-bit) 4-channel image BGRA, where the alpha channel goes last. Fully transparent pixels should have alpha set to 0, fully opaque pixels should have alpha set to 255/65535. The sample below shows how to create such a BGRA image and store to PNG file. It also demonstrates how to set custom compression parameters ::
#include <vector> #include <vector>
#include <stdio.h> #include <stdio.h>
#include <opencv2/opencv.hpp> #include <opencv2/opencv.hpp>
using namespace cv; using namespace cv;
using namespace std; using namespace std;
@ -225,7 +225,7 @@ VideoCapture constructors.
.. ocv:pyfunction:: cv2.VideoCapture(device) -> <VideoCapture object> .. ocv:pyfunction:: cv2.VideoCapture(device) -> <VideoCapture object>
.. ocv:cfunction:: CvCapture* cvCaptureFromCAM( int device ) .. ocv:cfunction:: CvCapture* cvCaptureFromCAM( int device )
.. ocv:pyoldfunction:: cv.CaptureFromCAM(device) -> CvCapture .. ocv:pyoldfunction:: cv.CaptureFromCAM(index) -> CvCapture
.. ocv:cfunction:: CvCapture* cvCaptureFromFile( const char* filename ) .. ocv:cfunction:: CvCapture* cvCaptureFromFile( const char* filename )
.. ocv:pyoldfunction:: cv.CaptureFromFile(filename) -> CvCapture .. ocv:pyoldfunction:: cv.CaptureFromFile(filename) -> CvCapture
@ -243,14 +243,14 @@ Open video file or a capturing device for video capturing
.. ocv:function:: bool VideoCapture::open(const string& filename) .. ocv:function:: bool VideoCapture::open(const string& filename)
.. ocv:function:: bool VideoCapture::open(int device) .. ocv:function:: bool VideoCapture::open(int device)
.. ocv:pyfunction:: cv2.VideoCapture.open(filename) -> successFlag .. ocv:pyfunction:: cv2.VideoCapture.open(filename) -> retval
.. ocv:pyfunction:: cv2.VideoCapture.open(device) -> successFlag .. ocv:pyfunction:: cv2.VideoCapture.open(device) -> retval
:param filename: name of the opened video file :param filename: name of the opened video file
:param device: id of the opened video capturing device (i.e. a camera index). :param device: id of the opened video capturing device (i.e. a camera index).
The methods first call :ocv:func:`VideoCapture::release` to close the already opened file or camera. The methods first call :ocv:func:`VideoCapture::release` to close the already opened file or camera.
VideoCapture::isOpened VideoCapture::isOpened
@ -259,7 +259,7 @@ Returns true if video capturing has been initialized already.
.. ocv:function:: bool VideoCapture::isOpened() .. ocv:function:: bool VideoCapture::isOpened()
.. ocv:pyfunction:: cv2.VideoCapture.isOpened() -> flag .. ocv:pyfunction:: cv2.VideoCapture.isOpened() -> retval
If the previous call to ``VideoCapture`` constructor or ``VideoCapture::open`` succeeded, the method returns true. If the previous call to ``VideoCapture`` constructor or ``VideoCapture::open`` succeeded, the method returns true.
@ -269,7 +269,7 @@ Closes video file or capturing device.
.. ocv:function:: void VideoCapture::release() .. ocv:function:: void VideoCapture::release()
.. ocv:pyfunction:: cv2.VideoCapture.release() .. ocv:pyfunction:: cv2.VideoCapture.release() -> None
.. ocv:cfunction:: void cvReleaseCapture(CvCapture** capture) .. ocv:cfunction:: void cvReleaseCapture(CvCapture** capture)
@ -284,7 +284,7 @@ Grabs the next frame from video file or capturing device.
.. ocv:function:: bool VideoCapture::grab() .. ocv:function:: bool VideoCapture::grab()
.. ocv:pyfunction:: cv2.VideoCapture.grab() -> successFlag .. ocv:pyfunction:: cv2.VideoCapture.grab() -> retval
.. ocv:cfunction:: int cvGrabFrame(CvCapture* capture) .. ocv:cfunction:: int cvGrabFrame(CvCapture* capture)
@ -303,11 +303,11 @@ Decodes and returns the grabbed video frame.
.. ocv:function:: bool VideoCapture::retrieve(Mat& image, int channel=0) .. ocv:function:: bool VideoCapture::retrieve(Mat& image, int channel=0)
.. ocv:pyfunction:: cv2.VideoCapture.retrieve([image[, channel]]) -> successFlag, image .. ocv:pyfunction:: cv2.VideoCapture.retrieve([image[, channel]]) -> retval, image
.. ocv:cfunction:: IplImage* cvRetrieveFrame(CvCapture* capture) .. ocv:cfunction:: IplImage* cvRetrieveFrame( CvCapture* capture, int streamIdx=0 )
.. ocv:pyoldfunction:: cv.RetrieveFrame(capture) -> iplimage .. ocv:pyoldfunction:: cv.RetrieveFrame(capture) -> image
The methods/functions decode and return the just grabbed frame. If no frames has been grabbed (camera has been disconnected, or there are no more frames in video file), the methods return false and the functions return NULL pointer. The methods/functions decode and return the just grabbed frame. If no frames has been grabbed (camera has been disconnected, or there are no more frames in video file), the methods return false and the functions return NULL pointer.
@ -322,11 +322,11 @@ Grabs, decodes and returns the next video frame.
.. ocv:function:: bool VideoCapture::read(Mat& image) .. ocv:function:: bool VideoCapture::read(Mat& image)
.. ocv:pyfunction:: cv2.VideoCapture.read([image]) -> successFlag, image .. ocv:pyfunction:: cv2.VideoCapture.read([image]) -> retval, image
.. ocv:cfunction:: IplImage* cvQueryFrame(CvCapture* capture) .. ocv:cfunction:: IplImage* cvQueryFrame(CvCapture* capture)
.. ocv:pyoldfunction:: cv.QueryFrame(capture) -> iplimage .. ocv:pyoldfunction:: cv.QueryFrame(capture) -> image
The methods/functions combine :ocv:func:`VideoCapture::grab` and :ocv:func:`VideoCapture::retrieve` in one call. This is the most convenient method for reading video files or capturing data from decode and return the just grabbed frame. If no frames has been grabbed (camera has been disconnected, or there are no more frames in video file), the methods return false and the functions return NULL pointer. The methods/functions combine :ocv:func:`VideoCapture::grab` and :ocv:func:`VideoCapture::retrieve` in one call. This is the most convenient method for reading video files or capturing data from decode and return the just grabbed frame. If no frames has been grabbed (camera has been disconnected, or there are no more frames in video file), the methods return false and the functions return NULL pointer.
@ -335,15 +335,15 @@ The methods/functions combine :ocv:func:`VideoCapture::grab` and :ocv:func:`Vide
VideoCapture::get VideoCapture::get
--------------------- ---------------------
Returns the specified ``VideoCapture`` property Returns the specified ``VideoCapture`` property
.. ocv:function:: double VideoCapture::get(int propId) .. ocv:function:: double VideoCapture::get(int propId)
.. ocv:pyfunction:: cv2.VideoCapture.get(propId) -> retval .. ocv:pyfunction:: cv2.VideoCapture.get(propId) -> retval
.. ocv:cfunction:: double cvGetCaptureProperty( CvCapture* capture, int propId ) .. ocv:cfunction:: double cvGetCaptureProperty( CvCapture* capture, int property_id )
.. ocv:pyoldfunction:: cv.GetCaptureProperty(capture, propId)->double .. ocv:pyoldfunction:: cv.GetCaptureProperty(capture, property_id) -> float
:param propId: Property identifier. It can be one of the following: :param propId: Property identifier. It can be one of the following:
@ -393,13 +393,13 @@ VideoCapture::set
--------------------- ---------------------
Sets a property in the ``VideoCapture``. Sets a property in the ``VideoCapture``.
.. ocv:function:: bool VideoCapture::set(int propertyId, double value) .. ocv:function:: bool VideoCapture::set( int propId, double value )
.. ocv:pyfunction:: cv2.VideoCapture.set(propId, value) -> retval .. ocv:pyfunction:: cv2.VideoCapture.set(propId, value) -> retval
.. ocv:cfunction:: int cvSetCaptureProperty( CvCapture* capture, int propId, double value ) .. ocv:cfunction:: int cvSetCaptureProperty( CvCapture* capture, int property_id, double value )
.. ocv:pyoldfunction:: cv.SetCaptureProperty(capture, propId, value)->None .. ocv:pyoldfunction:: cv.SetCaptureProperty(capture, property_id, value) -> retval
:param propId: Property identifier. It can be one of the following: :param propId: Property identifier. It can be one of the following:
@ -463,22 +463,22 @@ VideoWriter constructors
.. ocv:pyfunction:: cv2.VideoWriter([filename, fourcc, fps, frameSize[, isColor]]) -> <VideoWriter object> .. ocv:pyfunction:: cv2.VideoWriter([filename, fourcc, fps, frameSize[, isColor]]) -> <VideoWriter object>
.. ocv:cfunction:: CvVideoWriter* cvCreateVideoWriter( const char* filename, int fourcc, double fps, CvSize frameSize, int isColor=1 ) .. ocv:cfunction:: CvVideoWriter* cvCreateVideoWriter( const char* filename, int fourcc, double fps, CvSize frame_size, int is_color=1 )
.. ocv:pyoldfunction:: cv.CreateVideoWriter(filename, fourcc, fps, frameSize, isColor) -> CvVideoWriter .. ocv:pyoldfunction:: cv.CreateVideoWriter(filename, fourcc, fps, frame_size, is_color=true) -> CvVideoWriter
.. ocv:pyfunction:: cv2.VideoWriter.isOpened() -> retval .. ocv:pyfunction:: cv2.VideoWriter.isOpened() -> retval
.. ocv:pyfunction:: cv2.VideoWriter.open(filename, fourcc, fps, frameSize[, isColor]) -> retval .. ocv:pyfunction:: cv2.VideoWriter.open(filename, fourcc, fps, frameSize[, isColor]) -> retval
.. ocv:pyfunction:: cv2.VideoWriter.write(image) -> None .. ocv:pyfunction:: cv2.VideoWriter.write(image) -> None
:param filename: Name of the output video file. :param filename: Name of the output video file.
:param fourcc: 4-character code of codec used to compress the frames. For example, ``CV_FOURCC('P','I','M,'1')`` is a MPEG-1 codec, ``CV_FOURCC('M','J','P','G')`` is a motion-jpeg codec etc. :param fourcc: 4-character code of codec used to compress the frames. For example, ``CV_FOURCC('P','I','M,'1')`` is a MPEG-1 codec, ``CV_FOURCC('M','J','P','G')`` is a motion-jpeg codec etc.
:param fps: Framerate of the created video stream. :param fps: Framerate of the created video stream.
:param frameSize: Size of the video frames. :param frameSize: Size of the video frames.
:param isColor: If it is not zero, the encoder will expect and encode color frames, otherwise it will work with grayscale frames (the flag is currently supported on Windows only). :param isColor: If it is not zero, the encoder will expect and encode color frames, otherwise it will work with grayscale frames (the flag is currently supported on Windows only).
The constructors/functions initialize video writers. On Linux FFMPEG is used to write videos; on Windows FFMPEG or VFW is used; on MacOSX QTKit is used. The constructors/functions initialize video writers. On Linux FFMPEG is used to write videos; on Windows FFMPEG or VFW is used; on MacOSX QTKit is used.
@ -526,9 +526,9 @@ Writes the next video frame
.. ocv:cfunction:: int cvWriteFrame( CvVideoWriter* writer, const IplImage* image ) .. ocv:cfunction:: int cvWriteFrame( CvVideoWriter* writer, const IplImage* image )
.. ocv:pyoldfunction:: cv.WriteFrame(writer, image)->int .. ocv:pyoldfunction:: cv.WriteFrame(writer, image)->int
:param writer: Video writer structure (OpenCV 1.x API) :param writer: Video writer structure (OpenCV 1.x API)
:param image: The written frame :param image: The written frame
The functions/methods write the specified image to video file. It must have the same size as has been specified when opening the video writer. The functions/methods write the specified image to video file. It must have the same size as has been specified when opening the video writer.

View File

@ -9,7 +9,7 @@ Creates a trackbar and attaches it to the specified window.
.. ocv:function:: int createTrackbar( const string& trackbarname, const string& winname, int* value, int count, TrackbarCallback onChange=0, void* userdata=0) .. ocv:function:: int createTrackbar( const string& trackbarname, const string& winname, int* value, int count, TrackbarCallback onChange=0, void* userdata=0)
.. ocv:cfunction:: int cvCreateTrackbar( const char* trackbarName, const char* windowName, int* value, int count, CvTrackbarCallback onChange ) .. ocv:cfunction:: int cvCreateTrackbar( const char* trackbar_name, const char* window_name, int* value, int count, CvTrackbarCallback on_change=NULL )
.. ocv:pyoldfunction:: cv.CreateTrackbar(trackbarName, windowName, value, count, onChange) -> None .. ocv:pyoldfunction:: cv.CreateTrackbar(trackbarName, windowName, value, count, onChange) -> None
:param trackbarname: Name of the created trackbar. :param trackbarname: Name of the created trackbar.
@ -27,7 +27,7 @@ Creates a trackbar and attaches it to the specified window.
The function ``createTrackbar`` creates a trackbar (a slider or range control) with the specified name and range, assigns a variable ``value`` to be a position synchronized with the trackbar and specifies the callback function ``onChange`` to be called on the trackbar position change. The created trackbar is displayed in the specified window ``winname``. The function ``createTrackbar`` creates a trackbar (a slider or range control) with the specified name and range, assigns a variable ``value`` to be a position synchronized with the trackbar and specifies the callback function ``onChange`` to be called on the trackbar position change. The created trackbar is displayed in the specified window ``winname``.
.. note:: .. note::
**[Qt Backend Only]** ``winname`` can be empty (or NULL) if the trackbar should be attached to the control panel. **[Qt Backend Only]** ``winname`` can be empty (or NULL) if the trackbar should be attached to the control panel.
Clicking the label of each trackbar enables editing the trackbar values manually. Clicking the label of each trackbar enables editing the trackbar values manually.
@ -40,8 +40,8 @@ Returns the trackbar position.
.. ocv:pyfunction:: cv2.getTrackbarPos(trackbarname, winname) -> retval .. ocv:pyfunction:: cv2.getTrackbarPos(trackbarname, winname) -> retval
.. ocv:cfunction:: int cvGetTrackbarPos( const char* trackbarName, const char* windowName ) .. ocv:cfunction:: int cvGetTrackbarPos( const char* trackbar_name, const char* window_name )
.. ocv:pyoldfunction:: cv.GetTrackbarPos(trackbarName, windowName)-> None .. ocv:pyoldfunction:: cv.GetTrackbarPos(trackbarName, windowName) -> retval
:param trackbarname: Name of the trackbar. :param trackbarname: Name of the trackbar.
@ -57,12 +57,12 @@ imshow
---------- ----------
Displays an image in the specified window. Displays an image in the specified window.
.. ocv:function:: void imshow( const string& winname, InputArray image ) .. ocv:function:: void imshow( const string& winname, InputArray mat )
.. ocv:pyfunction:: cv2.imshow(winname, image) -> None .. ocv:pyfunction:: cv2.imshow(winname, mat) -> None
.. ocv:cfunction:: void cvShowImage( const char* winname, const CvArr* image ) .. ocv:cfunction:: void cvShowImage( const char* name, const CvArr* image )
.. ocv:pyoldfunction:: cv.ShowImage(winname, image)-> None .. ocv:pyoldfunction:: cv.ShowImage(name, image) -> None
:param winname: Name of the window. :param winname: Name of the window.
@ -81,11 +81,11 @@ namedWindow
--------------- ---------------
Creates a window. Creates a window.
.. ocv:function:: void namedWindow( const string& winname, int flags ) .. ocv:function:: void namedWindow( const string& winname, int flags=WINDOW_AUTOSIZE )
.. ocv:pyfunction:: cv2.namedWindow(winname[, flags]) -> None .. ocv:pyfunction:: cv2.namedWindow(winname[, flags]) -> None
.. ocv:cfunction:: int cvNamedWindow( const char* name, int flags ) .. ocv:cfunction:: int cvNamedWindow( const char* name, int flags=CV_WINDOW_AUTOSIZE )
.. ocv:pyoldfunction:: cv.NamedWindow(name, flags=CV_WINDOW_AUTOSIZE)-> None .. ocv:pyoldfunction:: cv.NamedWindow(name, flags=CV_WINDOW_AUTOSIZE)-> None
:param name: Name of the window in the window caption that may be used as a window identifier. :param name: Name of the window in the window caption that may be used as a window identifier.
@ -115,15 +115,15 @@ destroyWindow
------------- -------------
Destroys a window. Destroys a window.
.. ocv:function:: void destroyWindow( const string &winname ) .. ocv:function:: void destroyWindow( const string& winname )
.. ocv:pyfunction:: cv2.destroyWindow(winname) -> None .. ocv:pyfunction:: cv2.destroyWindow(winname) -> None
.. ocv:cfunction:: void cvDestroyWindow( const char* name ) .. ocv:cfunction:: void cvDestroyWindow( const char* name )
.. ocv:pyoldfunction:: cv.DestroyWindow(name)-> None .. ocv:pyoldfunction:: cv.DestroyWindow(name)-> None
:param winname: Name of the window to be destroyed. :param winname: Name of the window to be destroyed.
The function ``destroyWindow`` destroys the window with the given name. The function ``destroyWindow`` destroys the window with the given name.
@ -149,9 +149,9 @@ Moves window to the specified position
.. ocv:pyoldfunction:: cv.MoveWindow(name, x, y)-> None .. ocv:pyoldfunction:: cv.MoveWindow(name, x, y)-> None
:param name: Window name :param name: Window name
:param x: The new x-coordinate of the window :param x: The new x-coordinate of the window
:param y: The new y-coordinate of the window :param y: The new y-coordinate of the window
@ -171,7 +171,7 @@ Resizes window to the specified size
.. note:: .. note::
* The specified window size is for the image area. Toolbars are not counted. * The specified window size is for the image area. Toolbars are not counted.
* Only windows created without CV_WINDOW_AUTOSIZE flag can be resized. * Only windows created without CV_WINDOW_AUTOSIZE flag can be resized.
@ -179,13 +179,13 @@ SetMouseCallback
---------------- ----------------
Sets mouse handler for the specified window Sets mouse handler for the specified window
.. ocv:cfunction:: void cvSetMouseCallback( const char* name, CvMouseCallback onMouse, void* param=NULL ) .. ocv:cfunction:: void cvSetMouseCallback( const char* window_name, CvMouseCallback on_mouse, void* param=NULL )
.. ocv:pyoldfunction:: cv.SetMouseCallback(name, onMouse, param) -> None .. ocv:pyoldfunction:: cv.SetMouseCallback(windowName, onMouse, param=None) -> None
:param name: Window name :param 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 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 param: The optional parameter passed to the callback. :param param: The optional parameter passed to the callback.
@ -197,7 +197,7 @@ Sets the trackbar position.
.. ocv:pyfunction:: cv2.setTrackbarPos(trackbarname, winname, pos) -> None .. ocv:pyfunction:: cv2.setTrackbarPos(trackbarname, winname, pos) -> None
.. ocv:cfunction:: void cvSetTrackbarPos( const char* trackbarName, const char* windowName, int pos ) .. ocv:cfunction:: void cvSetTrackbarPos( const char* trackbar_name, const char* window_name, int pos )
.. ocv:pyoldfunction:: cv.SetTrackbarPos(trackbarName, windowName, pos)-> None .. ocv:pyoldfunction:: cv.SetTrackbarPos(trackbarName, windowName, pos)-> None
:param trackbarname: Name of the trackbar. :param trackbarname: Name of the trackbar.
@ -209,7 +209,7 @@ Sets the trackbar position.
The function sets the position of the specified trackbar in the specified window. The function sets the position of the specified trackbar in the specified window.
.. note:: .. note::
**[Qt Backend Only]** ``winname`` can be empty (or NULL) if the trackbar is attached to the control panel. **[Qt Backend Only]** ``winname`` can be empty (or NULL) if the trackbar is attached to the control panel.
waitKey waitKey
@ -218,7 +218,7 @@ Waits for a pressed key.
.. ocv:function:: int waitKey(int delay=0) .. ocv:function:: int waitKey(int delay=0)
.. ocv:pyfunction:: cv2.waitKey([, delay]) -> retval .. ocv:pyfunction:: cv2.waitKey([delay]) -> retval
.. ocv:cfunction:: int cvWaitKey( int delay=0 ) .. ocv:cfunction:: int cvWaitKey( int delay=0 )
.. ocv:pyoldfunction:: cv.WaitKey(delay=0)-> int .. ocv:pyoldfunction:: cv.WaitKey(delay=0)-> int
@ -233,5 +233,5 @@ The function ``waitKey`` waits for a key event infinitely (when
This function is the only method in HighGUI that can fetch and handle events, so it needs to be called periodically for normal event processing unless HighGUI is used within an environment that takes care of event processing. This function is the only method in HighGUI that can fetch and handle events, so it needs to be called periodically for normal event processing unless HighGUI is used within an environment that takes care of event processing.
.. note:: .. note::
The function only works if there is at least one HighGUI window created and the window is active. If there are several HighGUI windows, any of them can be active. The function only works if there is at least one HighGUI window created and the window is active. If there are several HighGUI windows, any of them can be active.

View File

@ -13,8 +13,9 @@ Finds edges in an image using the [Canny86]_ algorithm.
.. ocv:pyfunction:: cv2.Canny(image, threshold1, threshold2[, edges[, apertureSize[, L2gradient]]]) -> edges .. ocv:pyfunction:: cv2.Canny(image, threshold1, threshold2[, edges[, apertureSize[, L2gradient]]]) -> edges
.. ocv:cfunction:: void cvCanny( const CvArr* image, CvArr* edges, double threshold1, double threshold2, int apertureSize=3 ) .. ocv:cfunction:: void cvCanny( const CvArr* image, CvArr* edges, double threshold1, double threshold2, int aperture_size=3 )
.. ocv:pyoldfunction:: cv.Canny(image, edges, threshold1, threshold2, apertureSize=3)-> None
.. ocv:pyoldfunction:: cv.Canny(image, edges, threshold1, threshold2, aperture_size=3) -> None
:param image: Single-channel 8-bit input image. :param image: Single-channel 8-bit input image.
@ -37,17 +38,18 @@ cornerEigenValsAndVecs
---------------------- ----------------------
Calculates eigenvalues and eigenvectors of image blocks for corner detection. Calculates eigenvalues and eigenvectors of image blocks for corner detection.
.. ocv:function:: void cornerEigenValsAndVecs( InputArray src, OutputArray dst, int blockSize, int apertureSize, int borderType=BORDER_DEFAULT ) .. ocv:function:: void cornerEigenValsAndVecs( InputArray src, OutputArray dst, int blockSize, int ksize, int borderType=BORDER_DEFAULT )
.. ocv:pyfunction:: cv2.cornerEigenValsAndVecs(src, blockSize, ksize[, dst[, borderType]]) -> dst .. ocv:pyfunction:: cv2.cornerEigenValsAndVecs(src, blockSize, ksize[, dst[, borderType]]) -> dst
.. ocv:cfunction:: void cvCornerEigenValsAndVecs( const CvArr* image, CvArr* eigenvv, int blockSize, int apertureSize=3 ) .. ocv:cfunction:: void cvCornerEigenValsAndVecs( const CvArr* image, CvArr* eigenvv, int block_size, int aperture_size=3 )
.. ocv:pyoldfunction:: cv.CornerEigenValsAndVecs(image, eigenvv, blockSize, apertureSize=3)-> None
.. ocv:pyoldfunction:: cv.CornerEigenValsAndVecs(image, eigenvv, blockSize, aperture_size=3) -> None
:param src: Input single-channel 8-bit or floating-point image. :param src: Input single-channel 8-bit or floating-point image.
:param dst: Image to store the results. It has the same size as ``src`` and the type ``CV_32FC(6)`` . :param dst: Image to store the results. It has the same size as ``src`` and the type ``CV_32FC(6)`` .
:param blockSize: Neighborhood size (see details below). :param blockSize: Neighborhood size (see details below).
:param apertureSize: Aperture parameter for the :ocv:func:`Sobel` operator. :param apertureSize: Aperture parameter for the :ocv:func:`Sobel` operator.
@ -72,7 +74,7 @@ After that, it finds eigenvectors and eigenvalues of
* :math:`\lambda_1, \lambda_2` are the non-sorted eigenvalues of :math:`M` * :math:`\lambda_1, \lambda_2` are the non-sorted eigenvalues of :math:`M`
* :math:`x_1, y_1` are the eigenvectors corresponding to :math:`\lambda_1` * :math:`x_1, y_1` are the eigenvectors corresponding to :math:`\lambda_1`
* :math:`x_2, y_2` are the eigenvectors corresponding to :math:`\lambda_2` * :math:`x_2, y_2` are the eigenvectors corresponding to :math:`\lambda_2`
The output of the function can be used for robust edge or corner detection. The output of the function can be used for robust edge or corner detection.
@ -89,17 +91,18 @@ cornerHarris
------------ ------------
Harris edge detector. Harris edge detector.
.. ocv:function:: void cornerHarris( InputArray src, OutputArray dst, int blockSize, int apertureSize, double k, int borderType=BORDER_DEFAULT ) .. ocv:function:: void cornerHarris( InputArray src, OutputArray dst, int blockSize, int ksize, double k, int borderType=BORDER_DEFAULT )
.. ocv:pyfunction:: cv2.cornerHarris(src, blockSize, ksize, k[, dst[, borderType]]) -> dst .. ocv:pyfunction:: cv2.cornerHarris(src, blockSize, ksize, k[, dst[, borderType]]) -> dst
.. ocv:cfunction:: void cvCornerHarris( const CvArr* image, CvArr* harrisDst, int blockSize, int apertureSize=3, double k=0.04 ) .. ocv:cfunction:: void cvCornerHarris( const CvArr* image, CvArr* harris_responce, int block_size, int aperture_size=3, double k=0.04 )
.. ocv:pyoldfunction:: cv.CornerHarris(image, harrisDst, blockSize, apertureSize=3, k=0.04)-> None
.. ocv:pyoldfunction:: cv.CornerHarris(image, harris_dst, blockSize, aperture_size=3, k=0.04) -> None
:param src: Input single-channel 8-bit or floating-point image. :param src: Input single-channel 8-bit or floating-point image.
:param dst: Image to store the Harris detector responses. It has the type ``CV_32FC1`` and the same size as ``src`` . :param dst: Image to store the Harris detector responses. It has the type ``CV_32FC1`` and the same size as ``src`` .
:param blockSize: Neighborhood size (see the details on :ocv:func:`cornerEigenValsAndVecs` ). :param blockSize: Neighborhood size (see the details on :ocv:func:`cornerEigenValsAndVecs` ).
:param apertureSize: Aperture parameter for the :ocv:func:`Sobel` operator. :param apertureSize: Aperture parameter for the :ocv:func:`Sobel` operator.
@ -128,18 +131,18 @@ cornerMinEigenVal
----------------- -----------------
Calculates the minimal eigenvalue of gradient matrices for corner detection. Calculates the minimal eigenvalue of gradient matrices for corner detection.
.. ocv:function:: void cornerMinEigenVal( InputArray src, OutputArray dst, int blockSize, int apertureSize=3, int borderType=BORDER_DEFAULT ) .. ocv:function:: void cornerMinEigenVal( InputArray src, OutputArray dst, int blockSize, int ksize=3, int borderType=BORDER_DEFAULT )
.. ocv:pyfunction:: cv2.cornerMinEigenVal(src, blockSize[, dst[, ksize[, borderType]]]) -> dst .. ocv:pyfunction:: cv2.cornerMinEigenVal(src, blockSize[, dst[, ksize[, borderType]]]) -> dst
.. ocv:cfunction:: void cvCornerMinEigenVal( const CvArr* image, CvArr* eigenval, int blockSize, int apertureSize=3 ) .. ocv:cfunction:: void cvCornerMinEigenVal( const CvArr* image, CvArr* eigenval, int block_size, int aperture_size=3 )
.. ocv:pyoldfunction:: cv.CornerMinEigenVal(image, eigenval, blockSize, apertureSize=3)-> None .. ocv:pyoldfunction:: cv.CornerMinEigenVal(image, eigenval, blockSize, aperture_size=3) -> None
:param src: Input single-channel 8-bit or floating-point image. :param src: Input single-channel 8-bit or floating-point image.
:param dst: Image to store the minimal eigenvalues. It has the type ``CV_32FC1`` and the same size as ``src`` . :param dst: Image to store the minimal eigenvalues. It has the type ``CV_32FC1`` and the same size as ``src`` .
:param blockSize: Neighborhood size (see the details on :ocv:func:`cornerEigenValsAndVecs` ). :param blockSize: Neighborhood size (see the details on :ocv:func:`cornerEigenValsAndVecs` ).
:param apertureSize: Aperture parameter for the :ocv:func:`Sobel` operator. :param apertureSize: Aperture parameter for the :ocv:func:`Sobel` operator.
@ -161,9 +164,9 @@ Refines the corner locations.
.. ocv:pyfunction:: cv2.cornerSubPix(image, corners, winSize, zeroZone, criteria) -> None .. ocv:pyfunction:: cv2.cornerSubPix(image, corners, winSize, zeroZone, criteria) -> None
.. ocv:cfunction:: void cvFindCornerSubPix( const CvArr* image, CvPoint2D32f* corners, int count, CvSize winSize, CvSize zeroZone, CvTermCriteria criteria ) .. ocv:cfunction:: void cvFindCornerSubPix( const CvArr* image, CvPoint2D32f* corners, int count, CvSize win, CvSize zero_zone, CvTermCriteria criteria )
.. ocv:pyoldfunction:: cv.FindCornerSubPix(image, corners, winSize, zeroZone, criteria)-> corners .. ocv:pyoldfunction:: cv.FindCornerSubPix(image, corners, win, zero_zone, criteria) -> corners
:param image: Input image. :param image: Input image.
@ -223,14 +226,14 @@ Determines strong corners on an image.
.. ocv:pyfunction:: cv2.goodFeaturesToTrack(image, maxCorners, qualityLevel, minDistance[, corners[, mask[, blockSize[, useHarrisDetector[, k]]]]]) -> corners .. ocv:pyfunction:: cv2.goodFeaturesToTrack(image, maxCorners, qualityLevel, minDistance[, corners[, mask[, blockSize[, useHarrisDetector[, k]]]]]) -> corners
.. ocv:cfunction:: void cvGoodFeaturesToTrack( const CvArr* image, CvArr* eigImage, CvArr* tempImage, CvPoint2D32f* corners, int* cornerCount, double qualityLevel, double minDistance, const CvArr* mask=NULL, int blockSize=3, int useHarris=0, double k=0.04 ) .. ocv:cfunction:: void cvGoodFeaturesToTrack( const CvArr* image, CvArr* eig_image, CvArr* temp_image, CvPoint2D32f* corners, int* corner_count, double quality_level, double min_distance, const CvArr* mask=NULL, int block_size=3, int use_harris=0, double k=0.04 )
.. ocv:pyoldfunction:: cv.GoodFeaturesToTrack(image, eigImage, tempImage, cornerCount, qualityLevel, minDistance, mask=None, blockSize=3, useHarris=0, k=0.04)-> corners .. ocv:pyoldfunction:: cv.GoodFeaturesToTrack(image, eigImage, tempImage, cornerCount, qualityLevel, minDistance, mask=None, blockSize=3, useHarris=0, k=0.04) -> cornerCount
:param image: Input 8-bit or floating-point 32-bit, single-channel image. :param image: Input 8-bit or floating-point 32-bit, single-channel image.
:param eigImage: The parameter is ignored. :param eigImage: The parameter is ignored.
:param tempImage: The parameter is ignored. :param tempImage: The parameter is ignored.
:param corners: Output vector of detected corners. :param corners: Output vector of detected corners.
@ -244,9 +247,9 @@ Determines strong corners on an image.
:param mask: Optional region of interest. If the image is not empty (it needs to have the type ``CV_8UC1`` and the same size as ``image`` ), it specifies the region in which the corners are detected. :param mask: Optional region of interest. If the image is not empty (it needs to have the type ``CV_8UC1`` and the same size as ``image`` ), it specifies the region in which the corners are detected.
:param blockSize: Size of an average block for computing a derivative covariation matrix over each pixel neighborhood. See :ocv:func:`cornerEigenValsAndVecs` . :param blockSize: Size of an average block for computing a derivative covariation matrix over each pixel neighborhood. See :ocv:func:`cornerEigenValsAndVecs` .
:param useHarrisDetector: Parameter indicating whether to use a Harris detector (see :ocv:func:`cornerHarris`) or :ocv:func:`cornerMinEigenVal`. :param useHarrisDetector: Parameter indicating whether to use a Harris detector (see :ocv:func:`cornerHarris`) or :ocv:func:`cornerMinEigenVal`.
:param k: Free parameter of the Harris detector. :param k: Free parameter of the Harris detector.
The function finds the most prominent corners in the image or in the specified image region, as described in [Shi94]_: The function finds the most prominent corners in the image or in the specified image region, as described in [Shi94]_:
@ -255,7 +258,7 @@ The function finds the most prominent corners in the image or in the specified i
Function calculates the corner quality measure at every source image pixel using the Function calculates the corner quality measure at every source image pixel using the
:ocv:func:`cornerMinEigenVal` or :ocv:func:`cornerMinEigenVal` or
:ocv:func:`cornerHarris` . :ocv:func:`cornerHarris` .
#. #.
Function performs a non-maximum suppression (the local maximums in *3 x 3* neighborhood are retained). Function performs a non-maximum suppression (the local maximums in *3 x 3* neighborhood are retained).
@ -268,16 +271,16 @@ The function finds the most prominent corners in the image or in the specified i
#. #.
Function throws away each corner for which there is a stronger corner at a distance less than ``maxDistance``. Function throws away each corner for which there is a stronger corner at a distance less than ``maxDistance``.
The function can be used to initialize a point-based tracker of an object. The function can be used to initialize a point-based tracker of an object.
.. note:: If the function is called with different values ``A`` and ``B`` of the parameter ``qualityLevel`` , and ``A`` > {B}, the vector of returned corners with ``qualityLevel=A`` will be the prefix of the output vector with ``qualityLevel=B`` . .. note:: If the function is called with different values ``A`` and ``B`` of the parameter ``qualityLevel`` , and ``A`` > {B}, the vector of returned corners with ``qualityLevel=A`` will be the prefix of the output vector with ``qualityLevel=B`` .
.. seealso:: .. seealso::
:ocv:func:`cornerMinEigenVal`, :ocv:func:`cornerMinEigenVal`,
:ocv:func:`cornerHarris`, :ocv:func:`cornerHarris`,
:ocv:func:`calcOpticalFlowPyrLK`, :ocv:func:`calcOpticalFlowPyrLK`,
:ocv:func:`estimateRigidTransform`, :ocv:func:`estimateRigidTransform`,
@ -287,16 +290,16 @@ Finds circles in a grayscale image using the Hough transform.
.. ocv:function:: void HoughCircles( InputArray image, OutputArray circles, int method, double dp, double minDist, double param1=100, double param2=100, int minRadius=0, int maxRadius=0 ) .. ocv:function:: void HoughCircles( InputArray image, OutputArray circles, int method, double dp, double minDist, double param1=100, double param2=100, int minRadius=0, int maxRadius=0 )
.. ocv:cfunction:: CvSeq* cvHoughCircles( CvArr* image, CvMemStorage* circleStorage, int method, double dp, double minDist, double param1=100, double param2=100, int minRadius=0, int maxRadius=0 ) .. ocv:cfunction:: CvSeq* cvHoughCircles( CvArr* image, void* circle_storage, int method, double dp, double min_dist, double param1=100, double param2=100, int min_radius=0, int max_radius=0 )
.. ocv:pyfunction:: cv2.HoughCircles(image, method, dp, minDist[, circles[, param1[, param2[, minRadius[, maxRadius]]]]]) -> circles .. ocv:pyfunction:: cv2.HoughCircles(image, method, dp, minDist[, circles[, param1[, param2[, minRadius[, maxRadius]]]]]) -> circles
:param image: 8-bit, single-channel, grayscale input image. :param image: 8-bit, single-channel, grayscale input image.
:param circles: Output vector of found circles. Each vector is encoded as a 3-element floating-point vector :math:`(x, y, radius)` . :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 circleStorage: 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 method: Detection method to use. Currently, the only implemented method is ``CV_HOUGH_GRADIENT`` , which is basically *21HT* , described in [Yuen90]_.
:param dp: Inverse ratio of the accumulator resolution to the image resolution. For example, if ``dp=1`` , the accumulator has the same resolution as the input image. If ``dp=2`` , the accumulator has half as big width and height. :param dp: Inverse ratio of the accumulator resolution to the image resolution. For example, if ``dp=1`` , the accumulator has the same resolution as the input image. If ``dp=2`` , the accumulator has half as big width and height.
@ -311,7 +314,7 @@ Finds circles in a grayscale image using the Hough transform.
:param maxRadius: Maximum circle radius. :param maxRadius: Maximum circle radius.
The function finds circles in a grayscale image using a modification of the Hough transform. The function finds circles in a grayscale image using a modification of the Hough transform.
Example: :: Example: ::
@ -362,7 +365,7 @@ Finds lines in a binary image using the standard Hough transform.
.. ocv:pyfunction:: cv2.HoughLines(image, rho, theta, threshold[, lines[, srn[, stn]]]) -> lines .. ocv:pyfunction:: cv2.HoughLines(image, rho, theta, threshold[, lines[, srn[, stn]]]) -> lines
.. ocv:cfunction:: CvSeq* cvHoughLines2( CvArr* image, void* storage, int method, double rho, double theta, int threshold, double param1=0, double param2=0 ) .. ocv:cfunction:: CvSeq* cvHoughLines2( CvArr* image, void* line_storage, int method, double rho, double theta, int threshold, double param1=0, double param2=0 )
.. ocv:pyoldfunction:: cv.HoughLines2(image, storage, method, rho, theta, threshold, param1=0, param2=0)-> lines .. ocv:pyoldfunction:: cv.HoughLines2(image, storage, method, rho, theta, threshold, param1=0, param2=0)-> lines
@ -379,31 +382,31 @@ Finds lines in a binary image using the standard Hough transform.
:param srn: For the multi-scale Hough transform, it is a divisor for the distance resolution ``rho`` . The coarse accumulator distance resolution is ``rho`` and the accurate accumulator resolution is ``rho/srn`` . If both ``srn=0`` and ``stn=0`` , the classical Hough transform is used. Otherwise, both these parameters should be positive. :param srn: For the multi-scale Hough transform, it is a divisor for the distance resolution ``rho`` . The coarse accumulator distance resolution is ``rho`` and the accurate accumulator resolution is ``rho/srn`` . If both ``srn=0`` and ``stn=0`` , the classical Hough transform is used. Otherwise, both these parameters should be positive.
:param stn: For the multi-scale Hough transform, it is a divisor for the distance resolution ``theta``. :param stn: For the multi-scale Hough transform, it is a divisor for the distance resolution ``theta``.
:param method: One of the following Hough transform variants: :param method: One of the following Hough transform variants:
* **CV_HOUGH_STANDARD** classical or standard Hough transform. Every line is represented by two floating-point numbers :math:`(\rho, \theta)` , where :math:`\rho` is a distance between (0,0) point and the line, and :math:`\theta` is the angle between x-axis and the normal to the line. Thus, the matrix must be (the created sequence will be) of ``CV_32FC2`` type * **CV_HOUGH_STANDARD** classical or standard Hough transform. Every line is represented by two floating-point numbers :math:`(\rho, \theta)` , where :math:`\rho` is a distance between (0,0) point and the line, and :math:`\theta` is the angle between x-axis and the normal to the line. Thus, the matrix must be (the created sequence will be) of ``CV_32FC2`` type
* **CV_HOUGH_PROBABILISTIC** probabilistic Hough transform (more efficient in case if the picture contains a few long linear segments). It returns line segments rather than the whole line. Each segment is represented by starting and ending points, and the matrix must be (the created sequence will be) of the ``CV_32SC4`` type. * **CV_HOUGH_PROBABILISTIC** probabilistic Hough transform (more efficient in case if the picture contains a few long linear segments). It returns line segments rather than the whole line. Each segment is represented by starting and ending points, and the matrix must be (the created sequence will be) of the ``CV_32SC4`` type.
* **CV_HOUGH_MULTI_SCALE** multi-scale variant of the classical Hough transform. The lines are encoded the same way as ``CV_HOUGH_STANDARD``. * **CV_HOUGH_MULTI_SCALE** multi-scale variant of the classical Hough transform. The lines are encoded the same way as ``CV_HOUGH_STANDARD``.
:param param1: First method-dependent parameter: :param param1: First method-dependent parameter:
* For the classical Hough transform, it is not used (0).
* For the probabilistic Hough transform, it is the minimum line length.
* For the multi-scale Hough transform, it is ``srn``.
:param param2: Second method-dependent parameter:
* For the classical Hough transform, it is not used (0). * For the classical Hough transform, it is not used (0).
* For the probabilistic Hough transform, it is the minimum line length.
* For the multi-scale Hough transform, it is ``srn``.
:param param2: Second method-dependent parameter:
* For the classical Hough transform, it is not used (0).
* For the probabilistic Hough transform, it is the maximum gap between line segments lying on the same line to treat them as a single line segment (that is, to join them). * For the probabilistic Hough transform, it is the maximum gap between line segments lying on the same line to treat them as a single line segment (that is, to join them).
* For the multi-scale Hough transform, it is ``stn``. * For the multi-scale Hough transform, it is ``stn``.
The function implements the standard or standard multi-scale Hough transform algorithm for line detection. See http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm for a good explanation of Hough transform. The function implements the standard or standard multi-scale Hough transform algorithm for line detection. See http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm for a good explanation of Hough transform.
@ -501,21 +504,22 @@ preCornerDetect
--------------- ---------------
Calculates a feature map for corner detection. Calculates a feature map for corner detection.
.. ocv:function:: void preCornerDetect( InputArray src, OutputArray dst, int apertureSize, int borderType=BORDER_DEFAULT ) .. ocv:function:: void preCornerDetect( InputArray src, OutputArray dst, int ksize, int borderType=BORDER_DEFAULT )
.. ocv:pyfunction:: cv2.preCornerDetect(src, ksize[, dst[, borderType]]) -> dst .. ocv:pyfunction:: cv2.preCornerDetect(src, ksize[, dst[, borderType]]) -> dst
.. ocv:cfunction:: void cvPreCornerDetect( const CvArr* image, CvArr* corners, int apertureSize=3 ) .. ocv:cfunction:: void cvPreCornerDetect( const CvArr* image, CvArr* corners, int aperture_size=3 )
.. ocv:pyoldfunction:: cv.PreCornerDetect(image, corners, apertureSize=3)-> None .. ocv:pyoldfunction:: cv.PreCornerDetect(image, corners, apertureSize=3)-> None
:param src: Source single-channel 8-bit of floating-point image. :param src: Source single-channel 8-bit of floating-point image.
:param dst: Output image that has the type ``CV_32F`` and the same size as ``src`` . :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 apertureSize: Aperture size of the :ocv:func:`Sobel` .
:param borderType: Pixel extrapolation method. See :ocv:func:`borderInterpolate` . :param borderType: Pixel extrapolation method. See :ocv:func:`borderInterpolate` .
The function calculates the complex spatial derivative-based function of the source image The function calculates the complex spatial derivative-based function of the source image
.. math:: .. math::

View File

@ -14,11 +14,11 @@ OpenCV enables you to specify the extrapolation method. For details, see the fun
/* /*
Various border types, image boundaries are denoted with '|' Various border types, image boundaries are denoted with '|'
* BORDER_REPLICATE: aaaaaa|abcdefgh|hhhhhhh * BORDER_REPLICATE: aaaaaa|abcdefgh|hhhhhhh
* BORDER_REFLECT: fedcba|abcdefgh|hgfedcb * BORDER_REFLECT: fedcba|abcdefgh|hgfedcb
* BORDER_REFLECT_101: gfedcb|abcdefgh|gfedcba * BORDER_REFLECT_101: gfedcb|abcdefgh|gfedcba
* BORDER_WRAP: cdefgh|abcdefgh|abcdefg * BORDER_WRAP: cdefgh|abcdefgh|abcdefg
* BORDER_CONSTANT: iiiiii|abcdefgh|iiiiiii with some specified 'i' * BORDER_CONSTANT: iiiiii|abcdefgh|iiiiiii with some specified 'i'
*/ */
@ -390,9 +390,9 @@ Applies the bilateral filter to an image.
:param src: Source 8-bit or floating-point, 1-channel or 3-channel image. :param src: Source 8-bit or floating-point, 1-channel or 3-channel image.
:param dst: Destination image of the same size and type as ``src`` . :param dst: Destination image of the same size and type as ``src`` .
:param d: Diameter of each pixel neighborhood that is used during filtering. If it is non-positive, it is computed from ``sigmaSpace`` . :param d: Diameter of each pixel neighborhood that is used during filtering. If it is non-positive, it is computed from ``sigmaSpace`` .
:param sigmaColor: Filter sigma in the color space. A larger value of the parameter means that farther colors within the pixel neighborhood (see ``sigmaSpace`` ) will be mixed together, resulting in larger areas of semi-equal color. :param sigmaColor: Filter sigma in the color space. A larger value of the parameter means that farther colors within the pixel neighborhood (see ``sigmaSpace`` ) will be mixed together, resulting in larger areas of semi-equal color.
:param sigmaSpace: Filter sigma in the coordinate space. A larger value of the parameter means that farther pixels will influence each other as long as their colors are close enough (see ``sigmaColor`` ). When ``d>0`` , it specifies the neighborhood size regardless of ``sigmaSpace`` . Otherwise, ``d`` is proportional to ``sigmaSpace`` . :param sigmaSpace: Filter sigma in the coordinate space. A larger value of the parameter means that farther pixels will influence each other as long as their colors are close enough (see ``sigmaColor`` ). When ``d>0`` , it specifies the neighborhood size regardless of ``sigmaSpace`` . Otherwise, ``d`` is proportional to ``sigmaSpace`` .
@ -421,7 +421,7 @@ Smoothes an image using the normalized box filter.
:param src: Source image. The image can have any number of channels, which are processed independently. The depth should be ``CV_8U``, ``CV_16U``, ``CV_16S``, ``CV_32F`` or ``CV_64F``. :param src: Source image. The image can have any number of channels, which are processed independently. The depth should be ``CV_8U``, ``CV_16U``, ``CV_16S``, ``CV_32F`` or ``CV_64F``.
:param dst: Destination image of the same size and type as ``src`` . :param dst: Destination image of the same size and type as ``src`` .
:param ksize: Smoothing kernel size. :param ksize: Smoothing kernel size.
:param anchor: Anchor point. The default value ``Point(-1,-1)`` means that the anchor is at the kernel center. :param anchor: Anchor point. The default value ``Point(-1,-1)`` means that the anchor is at the kernel center.
@ -441,7 +441,7 @@ The call ``blur(src, dst, ksize, anchor, borderType)`` is equivalent to ``boxFil
:ocv:func:`boxFilter`, :ocv:func:`boxFilter`,
:ocv:func:`bilateralFilter`, :ocv:func:`bilateralFilter`,
:ocv:func:`GaussianBlur`, :ocv:func:`GaussianBlur`,
:ocv:func:`medianBlur` :ocv:func:`medianBlur`
borderInterpolate borderInterpolate
@ -453,7 +453,7 @@ Computes the source location of an extrapolated pixel.
.. ocv:pyfunction:: cv2.borderInterpolate(p, len, borderType) -> retval .. ocv:pyfunction:: cv2.borderInterpolate(p, len, borderType) -> retval
:param p: 0-based coordinate of the extrapolated pixel along one of the axes, likely <0 or >= ``len`` . :param p: 0-based coordinate of the extrapolated pixel along one of the axes, likely <0 or >= ``len`` .
:param len: Length of the array along the corresponding axis. :param len: Length of the array along the corresponding axis.
:param borderType: Border type, one of the ``BORDER_*`` , except for ``BORDER_TRANSPARENT`` and ``BORDER_ISOLATED`` . When ``borderType==BORDER_CONSTANT`` , the function always returns -1, regardless of ``p`` and ``len`` . :param borderType: Border type, one of the ``BORDER_*`` , except for ``BORDER_TRANSPARENT`` and ``BORDER_ISOLATED`` . When ``borderType==BORDER_CONSTANT`` , the function always returns -1, regardless of ``p`` and ``len`` .
@ -486,7 +486,7 @@ Smoothes an image using the box filter.
:param src: Source image. :param src: Source image.
:param dst: Destination image of the same size and type as ``src`` . :param dst: Destination image of the same size and type as ``src`` .
:param ksize: Smoothing kernel size. :param ksize: Smoothing kernel size.
:param anchor: Anchor point. The default value ``Point(-1,-1)`` means that the anchor is at the kernel center. :param anchor: Anchor point. The default value ``Point(-1,-1)`` means that the anchor is at the kernel center.
@ -515,7 +515,7 @@ Unnormalized box filter is useful for computing various integral characteristics
:ocv:func:`bilateralFilter`, :ocv:func:`bilateralFilter`,
:ocv:func:`GaussianBlur`, :ocv:func:`GaussianBlur`,
:ocv:func:`medianBlur`, :ocv:func:`medianBlur`,
:ocv:func:`integral` :ocv:func:`integral`
@ -523,7 +523,7 @@ buildPyramid
---------------- ----------------
Constructs the Gaussian pyramid for an image. Constructs the Gaussian pyramid for an image.
.. ocv:function:: void buildPyramid( InputArray src, OutputArrayOfArrays dst, int maxlevel ) .. ocv:function:: void buildPyramid( InputArray src, OutputArrayOfArrays dst, int maxlevel, int borderType=BORDER_DEFAULT )
:param src: Source image. Check :ocv:func:`pyrDown` for the list of supported types. :param src: Source image. Check :ocv:func:`pyrDown` for the list of supported types.
@ -550,19 +550,19 @@ Forms a border around an image.
:param src: Source image. :param src: Source image.
:param dst: Destination image of the same type as ``src`` and the size ``Size(src.cols+left+right, src.rows+top+bottom)`` . :param dst: Destination image of the same type as ``src`` and the size ``Size(src.cols+left+right, src.rows+top+bottom)`` .
:param top: :param top:
:param bottom: :param bottom:
:param left: :param left:
:param right: Parameter specifying how many pixels in each direction from the source image rectangle to extrapolate. For example, ``top=1, bottom=1, left=1, right=1`` mean that 1 pixel-wide border needs to be built. :param right: Parameter specifying how many pixels in each direction from the source image rectangle to extrapolate. For example, ``top=1, bottom=1, left=1, right=1`` mean that 1 pixel-wide border needs to be built.
:param borderType: Border type. See :ocv:func:`borderInterpolate` for details. :param borderType: Border type. See :ocv:func:`borderInterpolate` for details.
:param value: Border value if ``borderType==BORDER_CONSTANT`` . :param value: Border value if ``borderType==BORDER_CONSTANT`` .
The function copies the source image into the middle of the destination image. The areas to the left, to the right, above and below the copied source image will be filled with extrapolated pixels. This is not what The function copies the source image into the middle of the destination image. The areas to the left, to the right, above and below the copied source image will be filled with extrapolated pixels. This is not what
:ocv:class:`FilterEngine` or filtering functions based on it do (they extrapolate pixels on-fly), but what other more complex functions, including your own, may do to simplify image boundary handling. :ocv:class:`FilterEngine` or filtering functions based on it do (they extrapolate pixels on-fly), but what other more complex functions, including your own, may do to simplify image boundary handling.
@ -605,17 +605,17 @@ Returns a box filter engine.
:param srcType: Source image type. :param srcType: Source image type.
:param sumType: Intermediate horizontal sum type that must have as many channels as ``srcType`` . :param sumType: Intermediate horizontal sum type that must have as many channels as ``srcType`` .
:param dstType: Destination image type that must have as many channels as ``srcType`` . :param dstType: Destination image type that must have as many channels as ``srcType`` .
:param ksize: Aperture size. :param ksize: Aperture size.
:param anchor: Anchor position with the kernel. Negative values mean that the anchor is at the kernel center. :param anchor: Anchor position with the kernel. Negative values mean that the anchor is at the kernel center.
:param normalize: Flag specifying whether the sums are normalized or not. See :ocv:func:`boxFilter` for details. :param normalize: Flag specifying whether the sums are normalized or not. See :ocv:func:`boxFilter` for details.
:param scale: Another way to specify normalization in lower-level ``getColumnSumFilter`` . :param scale: Another way to specify normalization in lower-level ``getColumnSumFilter`` .
:param borderType: Border type to use. See :ocv:func:`borderInterpolate` . :param borderType: Border type to use. See :ocv:func:`borderInterpolate` .
The function is a convenience function that retrieves the horizontal sum primitive filter with The function is a convenience function that retrieves the horizontal sum primitive filter with
@ -631,7 +631,7 @@ The function itself is used by
:ocv:class:`FilterEngine`, :ocv:class:`FilterEngine`,
:ocv:func:`blur`, :ocv:func:`blur`,
:ocv:func:`boxFilter` :ocv:func:`boxFilter`
@ -644,13 +644,13 @@ Returns an engine for computing image derivatives.
:param srcType: Source image type. :param srcType: Source image type.
:param dstType: Destination image type that must have as many channels as ``srcType`` . :param dstType: Destination image type that must have as many channels as ``srcType`` .
:param dx: Derivative order in respect of x. :param dx: Derivative order in respect of x.
:param dy: Derivative order in respect of y. :param dy: Derivative order in respect of y.
:param ksize: Aperture size See :ocv:func:`getDerivKernels` . :param ksize: Aperture size See :ocv:func:`getDerivKernels` .
:param borderType: Border type to use. See :ocv:func:`borderInterpolate` . :param borderType: Border type to use. See :ocv:func:`borderInterpolate` .
The function :ocv:func:`createDerivFilter` is a small convenience function that retrieves linear filter coefficients for computing image derivatives using The function :ocv:func:`createDerivFilter` is a small convenience function that retrieves linear filter coefficients for computing image derivatives using
@ -664,7 +664,7 @@ The function :ocv:func:`createDerivFilter` is a small convenience function that
:ocv:func:`createSeparableLinearFilter`, :ocv:func:`createSeparableLinearFilter`,
:ocv:func:`getDerivKernels`, :ocv:func:`getDerivKernels`,
:ocv:func:`Scharr`, :ocv:func:`Scharr`,
:ocv:func:`Sobel` :ocv:func:`Sobel`
@ -672,16 +672,16 @@ createGaussianFilter
------------------------ ------------------------
Returns an engine for smoothing images with the Gaussian filter. Returns an engine for smoothing images with the Gaussian filter.
.. ocv:function:: Ptr<FilterEngine> createGaussianFilter( int type, Size ksize, double sigmaX, double sigmaY=0, int borderType=BORDER_DEFAULT) .. ocv:function:: Ptr<FilterEngine> createGaussianFilter( int type, Size ksize, double sigma1, double sigma2=0, int borderType=BORDER_DEFAULT )
:param type: Source and destination image type. :param type: Source and destination image type.
:param ksize: Aperture size. See :ocv:func:`getGaussianKernel` . :param ksize: Aperture size. See :ocv:func:`getGaussianKernel` .
:param sigmaX: Gaussian sigma in the horizontal direction. See :ocv:func:`getGaussianKernel` . :param sigmaX: 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 sigmaY: Gaussian sigma in the vertical direction. If 0, then :math:`\texttt{sigmaY}\leftarrow\texttt{sigmaX}` .
:param borderType: Border type to use. See :ocv:func:`borderInterpolate` . :param borderType: Border type to use. See :ocv:func:`borderInterpolate` .
The function :ocv:func:`createGaussianFilter` computes Gaussian kernel coefficients and then returns a separable linear filter for that kernel. The function is used by The function :ocv:func:`createGaussianFilter` computes Gaussian kernel coefficients and then returns a separable linear filter for that kernel. The function is used by
@ -693,7 +693,7 @@ The function :ocv:func:`createGaussianFilter` computes Gaussian kernel coefficie
:ocv:func:`createSeparableLinearFilter`, :ocv:func:`createSeparableLinearFilter`,
:ocv:func:`getGaussianKernel`, :ocv:func:`getGaussianKernel`,
:ocv:func:`GaussianBlur` :ocv:func:`GaussianBlur`
@ -701,14 +701,14 @@ createLinearFilter
---------------------- ----------------------
Creates a non-separable linear filter engine. 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) .. ocv:function:: Ptr<BaseFilter> getLinearFilter(int srcType, int dstType, InputArray kernel, Point anchor=Point(-1,-1), double delta=0, int bits=0)
:param srcType: Source image type. :param srcType: Source image type.
:param dstType: Destination image type that must have as many channels as ``srcType`` . :param dstType: Destination image type that must have as many channels as ``srcType`` .
:param kernel: 2D array of filter coefficients. :param kernel: 2D array of filter coefficients.
:param anchor: Anchor point within the kernel. Special value ``Point(-1,-1)`` means that the anchor is at the kernel center. :param anchor: Anchor point within the kernel. Special value ``Point(-1,-1)`` means that the anchor is at the kernel center.
@ -718,9 +718,9 @@ Creates a non-separable linear filter engine.
:param bits: Number of the fractional bits. The parameter is used when the kernel is an integer matrix representing fixed-point filter coefficients. :param bits: Number of the fractional bits. The parameter is used when the kernel is an integer matrix representing fixed-point filter coefficients.
:param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see :ocv:func:`borderInterpolate`. :param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see :ocv:func:`borderInterpolate`.
:param columnBorderType: Pixel extrapolation method in the horizontal direction. :param columnBorderType: Pixel extrapolation method in the horizontal direction.
:param borderValue: Border value used in case of a constant border. :param borderValue: Border value used in case of a constant border.
The function returns a pointer to a 2D linear filter for the specified kernel, the source array type, and the destination array type. The function is a higher-level function that calls ``getLinearFilter`` and passes the retrieved 2D filter to the The function returns a pointer to a 2D linear filter for the specified kernel, the source array type, and the destination array type. The function is a higher-level function that calls ``getLinearFilter`` and passes the retrieved 2D filter to the
@ -737,13 +737,13 @@ createMorphologyFilter
-------------------------- --------------------------
Creates an engine for non-separable morphological operations. Creates an engine for non-separable morphological operations.
.. ocv:function:: Ptr<FilterEngine> createMorphologyFilter(int op, int type, InputArray element, 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 element, Point anchor=Point(-1,-1)) .. ocv:function:: Ptr<BaseFilter> getMorphologyFilter( int op, int type, InputArray kernel, Point anchor=Point(-1,-1) )
.. ocv:function:: Ptr<BaseRowFilter> getMorphologyRowFilter(int op, int type, int esize, int anchor=-1) .. ocv:function:: Ptr<BaseRowFilter> getMorphologyRowFilter( int op, int type, int ksize, int anchor=-1 )
.. ocv:function:: Ptr<BaseColumnFilter> getMorphologyColumnFilter(int op, int type, int esize, int anchor=-1) .. ocv:function:: Ptr<BaseColumnFilter> getMorphologyColumnFilter( int op, int type, int ksize, int anchor=-1 )
.. ocv:function:: Scalar morphologyDefaultBorderValue() .. ocv:function:: Scalar morphologyDefaultBorderValue()
@ -758,9 +758,9 @@ Creates an engine for non-separable morphological operations.
:param anchor: Anchor position within the structuring element. Negative values mean that the anchor is at the kernel center. :param anchor: Anchor position within the structuring element. Negative values mean that the anchor is at the kernel center.
:param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see :ocv:func:`borderInterpolate`. :param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see :ocv:func:`borderInterpolate`.
:param columnBorderType: Pixel extrapolation method in the horizontal direction. :param columnBorderType: Pixel extrapolation method in the horizontal direction.
:param borderValue: Border value in case of a constant border. The default value, \ ``morphologyDefaultBorderValue`` , has a special meaning. It is transformed :math:`+\inf` for the erosion and to :math:`-\inf` for the dilation, which means that the minimum (maximum) is effectively computed only over the pixels that are inside the image. :param borderValue: Border value in case of a constant border. The default value, \ ``morphologyDefaultBorderValue`` , has a special meaning. It is transformed :math:`+\inf` for the erosion and to :math:`-\inf` for the dilation, which means that the minimum (maximum) is effectively computed only over the pixels that are inside the image.
The functions construct primitive morphological filtering operations or a filter engine based on them. Normally it is enough to use The functions construct primitive morphological filtering operations or a filter engine based on them. Normally it is enough to use
@ -783,18 +783,18 @@ createSeparableLinearFilter
------------------------------- -------------------------------
Creates an engine for a separable linear filter. 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 columnKernel, int anchor, int symmetryType, double delta=0, int bits=0) .. ocv:function:: Ptr<BaseColumnFilter> getLinearColumnFilter( int bufType, int dstType, InputArray kernel, int anchor, int symmetryType, double delta=0, int bits=0 )
.. ocv:function:: Ptr<BaseRowFilter> getLinearRowFilter(int srcType, int bufType, InputArray rowKernel, int anchor, int symmetryType) .. ocv:function:: Ptr<BaseRowFilter> getLinearRowFilter( int srcType, int bufType, InputArray kernel, int anchor, int symmetryType )
:param srcType: Source array type. :param srcType: Source array type.
:param dstType: Destination image type that must have as many channels as ``srcType`` . :param dstType: Destination image type that must have as many channels as ``srcType`` .
:param bufType: Intermediate buffer type that must have as many channels as ``srcType`` . :param bufType: Intermediate buffer type that must have as many channels as ``srcType`` .
:param rowKernel: Coefficients for filtering each row. :param rowKernel: Coefficients for filtering each row.
:param columnKernel: Coefficients for filtering each column. :param columnKernel: Coefficients for filtering each column.
@ -806,12 +806,12 @@ Creates an engine for a separable linear filter.
:param bits: Number of the fractional bits. The parameter is used when the kernel is an integer matrix representing fixed-point filter coefficients. :param bits: Number of the fractional bits. The parameter is used when the kernel is an integer matrix representing fixed-point filter coefficients.
:param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see :ocv:func:`borderInterpolate`. :param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see :ocv:func:`borderInterpolate`.
:param columnBorderType: Pixel extrapolation method in the horizontal direction. :param columnBorderType: Pixel extrapolation method in the horizontal direction.
:param borderValue: Border value used in case of a constant border. :param borderValue: Border value used in case of a constant border.
:param symmetryType: Type of each row and column kernel. See :ocv:func:`getKernelType` . :param symmetryType: Type of each row and column kernel. See :ocv:func:`getKernelType` .
The functions construct primitive separable linear filtering operations or a filter engine based on them. Normally it is enough to use The functions construct primitive separable linear filtering operations or a filter engine based on them. Normally it is enough to use
:ocv:func:`createSeparableLinearFilter` or even higher-level :ocv:func:`createSeparableLinearFilter` or even higher-level
@ -831,7 +831,7 @@ dilate
---------- ----------
Dilates an image by using a specific structuring element. Dilates an image by using a specific structuring element.
.. ocv:function:: void dilate( InputArray src, OutputArray dst, InputArray element, Point anchor=Point(-1,-1), int iterations=1, int borderType=BORDER_CONSTANT, const Scalar& borderValue=morphologyDefaultBorderValue() ) .. ocv:function:: void dilate( InputArray src, OutputArray dst, InputArray kernel, Point anchor=Point(-1,-1), int iterations=1, int borderType=BORDER_CONSTANT, const Scalar& borderValue=morphologyDefaultBorderValue() )
.. ocv:pyfunction:: cv2.dilate(src, kernel[, dst[, anchor[, iterations[, borderType[, borderValue]]]]]) -> dst .. ocv:pyfunction:: cv2.dilate(src, kernel[, dst[, anchor[, iterations[, borderType[, borderValue]]]]]) -> dst
@ -841,7 +841,7 @@ Dilates an image by using a specific structuring element.
:param src: Source image. 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 src: Source image. 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 dst: Destination image of the same size and type as ``src`` . :param dst: Destination image of the same size and type as ``src`` .
:param element: Structuring element used for dilation. If ``element=Mat()`` , a ``3 x 3`` rectangular structuring element is used. :param element: Structuring element used for dilation. If ``element=Mat()`` , a ``3 x 3`` rectangular structuring element is used.
:param anchor: Position of the anchor within the element. The default value ``(-1, -1)`` means that the anchor is at the element center. :param anchor: Position of the anchor within the element. The default value ``(-1, -1)`` means that the anchor is at the element center.
@ -849,9 +849,9 @@ Dilates an image by using a specific structuring element.
:param iterations: Number of times dilation is applied. :param iterations: Number of times dilation is applied.
:param borderType: Pixel extrapolation method. See :ocv:func:`borderInterpolate` for details. :param borderType: Pixel extrapolation method. See :ocv:func:`borderInterpolate` for details.
:param borderValue: Border value in case of a constant border. The default value has a special meaning. See :ocv:func:`createMorphologyFilter` for details. :param borderValue: Border value in case of a constant border. The default value has a special meaning. See :ocv:func:`createMorphologyFilter` for details.
The function dilates the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the maximum is taken: The function dilates the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the maximum is taken:
.. math:: .. math::
@ -871,7 +871,7 @@ erode
--------- ---------
Erodes an image by using a specific structuring element. Erodes an image by using a specific structuring element.
.. ocv:function:: void erode( InputArray src, OutputArray dst, InputArray element, Point anchor=Point(-1,-1), int iterations=1, int borderType=BORDER_CONSTANT, const Scalar& borderValue=morphologyDefaultBorderValue() ) .. ocv:function:: void erode( InputArray src, OutputArray dst, InputArray kernel, Point anchor=Point(-1,-1), int iterations=1, int borderType=BORDER_CONSTANT, const Scalar& borderValue=morphologyDefaultBorderValue() )
.. ocv:pyfunction:: cv2.erode(src, kernel[, dst[, anchor[, iterations[, borderType[, borderValue]]]]]) -> dst .. ocv:pyfunction:: cv2.erode(src, kernel[, dst[, anchor[, iterations[, borderType[, borderValue]]]]]) -> dst
@ -881,7 +881,7 @@ Erodes an image by using a specific structuring element.
:param src: Source image. 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 src: Source image. 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 dst: Destination image of the same size and type as ``src``. :param dst: Destination image of the same size and type as ``src``.
:param element: Structuring element used for erosion. If ``element=Mat()`` , a ``3 x 3`` rectangular structuring element is used. :param element: Structuring element used for erosion. If ``element=Mat()`` , a ``3 x 3`` rectangular structuring element is used.
:param anchor: Position of the anchor within the element. The default value ``(-1, -1)`` means that the anchor is at the element center. :param anchor: Position of the anchor within the element. The default value ``(-1, -1)`` means that the anchor is at the element center.
@ -889,9 +889,9 @@ Erodes an image by using a specific structuring element.
:param iterations: Number of times erosion is applied. :param iterations: Number of times erosion is applied.
:param borderType: Pixel extrapolation method. See :ocv:func:`borderInterpolate` for details. :param borderType: Pixel extrapolation method. See :ocv:func:`borderInterpolate` for details.
:param borderValue: Border value in case of a constant border. The default value has a special meaning. See :ocv:func:`createMorphologyFilter` for details. :param borderValue: Border value in case of a constant border. The default value has a special meaning. See :ocv:func:`createMorphologyFilter` for details.
The function erodes the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the minimum is taken: The function erodes the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the minimum is taken:
.. math:: .. math::
@ -916,27 +916,28 @@ Convolves an image with the kernel.
.. ocv:pyfunction:: cv2.filter2D(src, ddepth, kernel[, dst[, anchor[, delta[, borderType]]]]) -> dst .. ocv:pyfunction:: cv2.filter2D(src, ddepth, kernel[, dst[, anchor[, delta[, borderType]]]]) -> dst
.. ocv:cfunction:: void cvFilter2D( const CvArr* src, CvArr* dst, const CvMat* kernel, CvPoint anchor=cvPoint(-1, -1)) .. ocv:cfunction:: void cvFilter2D( const CvArr* src, CvArr* dst, const CvMat* kernel, CvPoint anchor=cvPoint(-1,-1) )
.. ocv:pyoldfunction:: cv.Filter2D(src, dst, kernel, anchor=(-1, -1))-> None .. ocv:pyoldfunction:: cv.Filter2D(src, dst, kernel, anchor=(-1, -1))-> None
:param src: Source image. :param src: Source image.
:param dst: Destination image of the same size and the same number of channels as ``src`` . :param dst: Destination image of the same size and the same number of channels as ``src`` .
:param ddepth: Desired depth of the destination image. If it is negative, it will be the same as ``src.depth()`` . The following combination of ``src.depth()`` and ``ddepth`` are supported: :param ddepth: Desired depth of the destination image. If it is negative, it will be the same as ``src.depth()`` . The following combination of ``src.depth()`` and ``ddepth`` are supported:
* ``src.depth()`` = ``CV_8U``, ``ddepth`` = -1/``CV_16S``/``CV_32F``/``CV_64F`` * ``src.depth()`` = ``CV_8U``, ``ddepth`` = -1/``CV_16S``/``CV_32F``/``CV_64F``
* ``src.depth()`` = ``CV_16U``/``CV_16S``, ``ddepth`` = -1/``CV_32F``/``CV_64F`` * ``src.depth()`` = ``CV_16U``/``CV_16S``, ``ddepth`` = -1/``CV_32F``/``CV_64F``
* ``src.depth()`` = ``CV_32F``, ``ddepth`` = -1/``CV_32F``/``CV_64F`` * ``src.depth()`` = ``CV_32F``, ``ddepth`` = -1/``CV_32F``/``CV_64F``
* ``src.depth()`` = ``CV_64F``, ``ddepth`` = -1/``CV_64F`` * ``src.depth()`` = ``CV_64F``, ``ddepth`` = -1/``CV_64F``
when ``ddepth=-1``, the destination image will have the same depth as the source. when ``ddepth=-1``, the destination image will have the same depth as the source.
:param kernel: Convolution kernel (or rather a correlation kernel), a single-channel floating point matrix. If you want to apply different kernels to different channels, split the image into separate color planes using :ocv:func:`split` and process them individually. :param kernel: Convolution kernel (or rather a correlation kernel), a single-channel floating point matrix. If you want to apply different kernels to different channels, split the image into separate color planes using :ocv:func:`split` and process them individually.
:param anchor: Anchor of the kernel that indicates the relative position of a filtered point within the kernel. The anchor should lie within the kernel. The special default value (-1,-1) means that the anchor is at the kernel center. :param anchor: Anchor of the kernel that indicates the relative position of a filtered point within the kernel. The anchor should lie within the kernel. The special default value (-1,-1) means that the anchor is at the kernel center.
:param delta: Optional value added to the filtered pixels before storing them in ``dst`` . :param delta: Optional value added to the filtered pixels before storing them in ``dst`` .
:param borderType: Pixel extrapolation method. See :ocv:func:`borderInterpolate` for details. :param borderType: Pixel extrapolation method. See :ocv:func:`borderInterpolate` for details.
The function applies an arbitrary linear filter to an image. In-place operation is supported. When the aperture is partially outside the image, the function interpolates outlier pixel values according to the specified border mode. The function applies an arbitrary linear filter to an image. In-place operation is supported. When the aperture is partially outside the image, the function interpolates outlier pixel values according to the specified border mode.
@ -972,13 +973,13 @@ Smoothes an image using a Gaussian filter.
:param src: Source image. The image can have any number of channels, which are processed independently. The depth should be ``CV_8U``, ``CV_16U``, ``CV_16S``, ``CV_32F`` or ``CV_64F``. :param src: Source image. The image can have any number of channels, which are processed independently. The depth should be ``CV_8U``, ``CV_16U``, ``CV_16S``, ``CV_32F`` or ``CV_64F``.
:param dst: Destination image of the same size and type as ``src`` . :param dst: Destination image of 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. Or, they can be zero's and then they are computed from ``sigma*`` . :param ksize: Gaussian kernel size. ``ksize.width`` and ``ksize.height`` can differ but they both must be positive and odd. Or, they can be zero's and then they are computed from ``sigma*`` .
:param sigmaX: Gaussian kernel standard deviation in X direction. :param sigmaX: 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 both sigmas are 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 modifications of all this semantics, it is recommended to specify all of ``ksize`` , ``sigmaX`` , and ``sigmaY`` . :param sigmaY: Gaussian kernel standard deviation in Y direction. If ``sigmaY`` is zero, it is set to be equal to ``sigmaX`` . If both sigmas are 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 modifications of all this semantics, it is recommended to specify all of ``ksize`` , ``sigmaX`` , and ``sigmaY`` .
:param borderType: Pixel extrapolation method. See :ocv:func:`borderInterpolate` for details. :param borderType: Pixel extrapolation method. See :ocv:func:`borderInterpolate` for details.
The function convolves the source image with the specified Gaussian kernel. In-place filtering is supported. The function convolves the source image with the specified Gaussian kernel. In-place filtering is supported.
@ -1002,9 +1003,9 @@ Returns filter coefficients for computing spatial image derivatives.
.. ocv:pyfunction:: cv2.getDerivKernels(dx, dy, ksize[, kx[, ky[, normalize[, ktype]]]]) -> kx, ky .. ocv:pyfunction:: cv2.getDerivKernels(dx, dy, ksize[, kx[, ky[, normalize[, ktype]]]]) -> kx, ky
:param kx: Output matrix of row filter coefficients. It has the type ``ktype`` . :param kx: Output matrix of row filter coefficients. It has the type ``ktype`` .
:param ky: Output matrix of column filter coefficients. It has the type ``ktype`` . :param ky: Output matrix of column filter coefficients. It has the type ``ktype`` .
:param dx: Derivative order in respect of x. :param dx: Derivative order in respect of x.
:param dy: Derivative order in respect of y. :param dy: Derivative order in respect of y.
@ -1060,7 +1061,7 @@ Two of such generated kernels can be passed to
:ocv:func:`createSeparableLinearFilter`, :ocv:func:`createSeparableLinearFilter`,
:ocv:func:`getDerivKernels`, :ocv:func:`getDerivKernels`,
:ocv:func:`getStructuringElement`, :ocv:func:`getStructuringElement`,
:ocv:func:`GaussianBlur` :ocv:func:`GaussianBlur`
@ -1084,7 +1085,7 @@ The function analyzes the kernel coefficients and returns the corresponding kern
* **KERNEL_SMOOTH** All the kernel elements are non-negative and summed to 1. For example, the Gaussian kernel is both smooth kernel and symmetrical, so the function returns ``KERNEL_SMOOTH | KERNEL_SYMMETRICAL`` . * **KERNEL_SMOOTH** All the kernel elements are non-negative and summed to 1. For example, the Gaussian kernel is both smooth kernel and symmetrical, so the function returns ``KERNEL_SMOOTH | KERNEL_SYMMETRICAL`` .
* **KERNEL_INTEGER** All the kernel coefficients are integer numbers. This flag can be combined with ``KERNEL_SYMMETRICAL`` or ``KERNEL_ASYMMETRICAL`` . * **KERNEL_INTEGER** All the kernel coefficients are integer numbers. This flag can be combined with ``KERNEL_SYMMETRICAL`` or ``KERNEL_ASYMMETRICAL`` .
getStructuringElement getStructuringElement
@ -1095,7 +1096,7 @@ Returns a structuring element of the specified size and shape for morphological
.. ocv:pyfunction:: cv2.getStructuringElement(shape, ksize[, anchor]) -> retval .. ocv:pyfunction:: cv2.getStructuringElement(shape, ksize[, anchor]) -> retval
.. ocv:cfunction:: IplConvKernel* cvCreateStructuringElementEx( int cols, int rows, int anchorX, int anchorY, int shape, int* values=NULL ) .. ocv:cfunction:: IplConvKernel* cvCreateStructuringElementEx( int cols, int rows, int anchor_x, int anchor_y, int shape, int* values=NULL )
.. ocv:pyoldfunction:: cv.CreateStructuringElementEx(cols, rows, anchorX, anchorY, shape, values=None)-> kernel .. ocv:pyoldfunction:: cv.CreateStructuringElementEx(cols, rows, anchorX, anchorY, shape, values=None)-> kernel
@ -1108,27 +1109,27 @@ Returns a structuring element of the specified size and shape for morphological
E_{ij}=1 E_{ij}=1
* **MORPH_ELLIPSE** - an elliptic structuring element, that is, a filled ellipse inscribed into the rectangle ``Rect(0, 0, esize.width, 0.esize.height)`` * **MORPH_ELLIPSE** - an elliptic structuring element, that is, a filled ellipse inscribed into the rectangle ``Rect(0, 0, esize.width, 0.esize.height)``
* **MORPH_CROSS** - a cross-shaped structuring element: * **MORPH_CROSS** - a cross-shaped structuring element:
.. math:: .. math::
E_{ij} = \fork{1}{if i=\texttt{anchor.y} or j=\texttt{anchor.x}}{0}{otherwise} E_{ij} = \fork{1}{if i=\texttt{anchor.y} or j=\texttt{anchor.x}}{0}{otherwise}
* **CV_SHAPE_CUSTOM** - custom structuring element (OpenCV 1.x API) * **CV_SHAPE_CUSTOM** - custom structuring element (OpenCV 1.x API)
:param ksize: Size of the structuring element. :param ksize: Size of the structuring element.
:param cols: Width of the structuring element :param cols: Width of the structuring element
:param rows: Height of the structuring element :param rows: Height of the structuring element
: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 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 anchorX: x-coordinate of the anchor
:param anchorY: y-coordinate of the anchor :param anchorY: 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``. :param values: integer array of ``cols``*``rows`` elements that specifies the custom shape of the structuring element, when ``shape=CV_SHAPE_CUSTOM``.
The function constructs and returns the structuring element that can be further passed to The function constructs and returns the structuring element that can be further passed to
@ -1149,9 +1150,9 @@ Smoothes an image using the median filter.
.. ocv:pyfunction:: cv2.medianBlur(src, ksize[, dst]) -> dst .. ocv:pyfunction:: cv2.medianBlur(src, ksize[, dst]) -> dst
:param src: Source 1-, 3-, or 4-channel image. When ``ksize`` is 3 or 5, the image depth should be ``CV_8U`` , ``CV_16U`` , or ``CV_32F`` . For larger aperture sizes, it can only be ``CV_8U`` . :param src: Source 1-, 3-, or 4-channel image. When ``ksize`` is 3 or 5, the image depth should be ``CV_8U`` , ``CV_16U`` , or ``CV_32F`` . For larger aperture sizes, it can only be ``CV_8U`` .
:param dst: Destination array of the same size and type as ``src`` . :param dst: Destination array of the same size and type as ``src`` .
:param ksize: Aperture linear size. It must be odd and greater than 1, for example: 3, 5, 7 ... :param ksize: Aperture linear size. It must be odd and greater than 1, for example: 3, 5, 7 ...
The function smoothes an image using the median filter with the The function smoothes an image using the median filter with the
@ -1170,7 +1171,7 @@ morphologyEx
---------------- ----------------
Performs advanced morphological transformations. Performs advanced morphological transformations.
.. ocv:function:: void morphologyEx( InputArray src, OutputArray dst, int op, InputArray element, Point anchor=Point(-1,-1), int iterations=1, int borderType=BORDER_CONSTANT, const Scalar& borderValue=morphologyDefaultBorderValue() ) .. ocv:function:: void morphologyEx( InputArray src, OutputArray dst, int op, InputArray kernel, Point anchor=Point(-1,-1), int iterations=1, int borderType=BORDER_CONSTANT, const Scalar& borderValue=morphologyDefaultBorderValue() )
.. ocv:pyfunction:: cv2.morphologyEx(src, op, kernel[, dst[, anchor[, iterations[, borderType[, borderValue]]]]]) -> dst .. ocv:pyfunction:: cv2.morphologyEx(src, op, kernel[, dst[, anchor[, iterations[, borderType[, borderValue]]]]]) -> dst
@ -1180,7 +1181,7 @@ Performs advanced morphological transformations.
:param src: Source image. 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 src: Source image. 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 dst: Destination image of the same size and type as ``src`` . :param dst: Destination image of the same size and type as ``src`` .
:param element: Structuring element. :param element: Structuring element.
:param op: Type of a morphological operation that can be one of the following: :param op: Type of a morphological operation that can be one of the following:
@ -1198,7 +1199,7 @@ Performs advanced morphological transformations.
:param iterations: Number of times erosion and dilation are applied. :param iterations: Number of times erosion and dilation are applied.
:param borderType: Pixel extrapolation method. See :ocv:func:`borderInterpolate` for details. :param borderType: Pixel extrapolation method. See :ocv:func:`borderInterpolate` for details.
:param borderValue: Border value in case of a constant border. The default value has a special meaning. See :ocv:func:`createMorphologyFilter` for details. :param borderValue: Border value in case of a constant border. The default value has a special meaning. See :ocv:func:`createMorphologyFilter` for details.
The function can perform advanced morphological transformations using an erosion and dilation as basic operations. The function can perform advanced morphological transformations using an erosion and dilation as basic operations.
@ -1242,7 +1243,6 @@ Any of the operations can be done in-place. In case of multi-channel images, eac
:ocv:func:`createMorphologyFilter` :ocv:func:`createMorphologyFilter`
Laplacian Laplacian
------------- -------------
Calculates the Laplacian of an image. Calculates the Laplacian of an image.
@ -1251,14 +1251,14 @@ Calculates the Laplacian of an image.
.. ocv:pyfunction:: cv2.Laplacian(src, ddepth[, dst[, ksize[, scale[, delta[, borderType]]]]]) -> dst .. ocv:pyfunction:: cv2.Laplacian(src, ddepth[, dst[, ksize[, scale[, delta[, borderType]]]]]) -> dst
.. ocv:cfunction:: void cvLaplace( const CvArr* src, CvArr* dst, int ksize=3) .. ocv:cfunction:: void cvLaplace( const CvArr* src, CvArr* dst, int aperture_size=3 )
.. ocv:pyoldfunction:: cv.Laplace(src, dst, ksize=3)-> None .. ocv:pyoldfunction:: cv.Laplace(src, dst, apertureSize=3) -> None
:param src: Source image. :param src: Source image.
:param dst: Destination image of the same size and the same number of channels as ``src`` . :param dst: Destination image of the same size and the same number of channels as ``src`` .
:param ddepth: Desired depth of the destination image. :param ddepth: Desired depth of the destination image.
:param ksize: Aperture size used to compute the second-derivative filters. See :ocv:func:`getDerivKernels` for details. The size must be positive and odd. :param ksize: Aperture size used to compute the second-derivative filters. See :ocv:func:`getDerivKernels` for details. The size must be positive and odd.
@ -1266,7 +1266,7 @@ Calculates the Laplacian of an image.
:param scale: Optional scale factor for the computed Laplacian values. By default, no scaling is applied. See :ocv:func:`getDerivKernels` for details. :param scale: Optional scale factor for the computed Laplacian values. By default, no scaling is applied. See :ocv:func:`getDerivKernels` for details.
:param delta: Optional delta value that is added to the results prior to storing them in ``dst`` . :param delta: Optional delta value that is added to the results prior to storing them in ``dst`` .
:param borderType: Pixel extrapolation method. See :ocv:func:`borderInterpolate` for details. :param borderType: Pixel extrapolation method. See :ocv:func:`borderInterpolate` for details.
The function calculates the Laplacian of the source image by adding up the second x and y derivatives calculated using the Sobel operator: The function calculates the Laplacian of the source image by adding up the second x and y derivatives calculated using the Sobel operator:
@ -1293,9 +1293,9 @@ pyrDown
----------- -----------
Smoothes an image and downsamples it. Smoothes an image and downsamples it.
.. ocv:function:: void pyrDown( InputArray src, OutputArray dst, const Size& dstsize=Size()) .. ocv:function:: void pyrDown( InputArray src, OutputArray dst, const Size& dstsize=Size(), int borderType=BORDER_DEFAULT )
.. ocv:pyfunction:: cv2.pyrDown(src[, dst[, dstsize]]) -> dst .. ocv:pyfunction:: cv2.pyrDown(src[, dst[, dstsize[, borderType]]]) -> dst
.. ocv:cfunction:: void cvPyrDown( const CvArr* src, CvArr* dst, int filter=CV_GAUSSIAN_5x5 ) .. ocv:cfunction:: void cvPyrDown( const CvArr* src, CvArr* dst, int filter=CV_GAUSSIAN_5x5 )
@ -1304,7 +1304,7 @@ Smoothes an image and downsamples it.
:param src: Source image. :param src: Source image.
:param dst: Destination image. It has the specified size and the same type as ``src`` . :param dst: Destination image. It has the specified size and the same type as ``src`` .
:param dstsize: Size of the destination image. By default, it is computed as ``Size((src.cols+1)/2, (src.rows+1)/2)`` . But in any case, the following conditions should be satisfied: :param dstsize: Size of the destination image. By default, it is computed as ``Size((src.cols+1)/2, (src.rows+1)/2)`` . But in any case, the following conditions should be satisfied:
.. math:: .. math::
@ -1326,9 +1326,9 @@ pyrUp
--------- ---------
Upsamples an image and then smoothes it. Upsamples an image and then smoothes it.
.. ocv:function:: void pyrUp( InputArray src, OutputArray dst, const Size& dstsize=Size()) .. ocv:function:: void pyrUp( InputArray src, OutputArray dst, const Size& dstsize=Size(), int borderType=BORDER_DEFAULT )
.. ocv:pyfunction:: cv2.pyrUp(src[, dst[, dstsize]]) -> dst .. ocv:pyfunction:: cv2.pyrUp(src[, dst[, dstsize[, borderType]]]) -> dst
.. ocv:cfunction:: cvPyrUp( const CvArr* src, CvArr* dst, int filter=CV_GAUSSIAN_5x5 ) .. ocv:cfunction:: cvPyrUp( const CvArr* src, CvArr* dst, int filter=CV_GAUSSIAN_5x5 )
@ -1337,7 +1337,7 @@ Upsamples an image and then smoothes it.
:param src: Source image. :param src: Source image.
:param dst: Destination image. It has the specified size and the same type as ``src`` . :param dst: Destination image. It has the specified size and the same type as ``src`` .
:param dstsize: Size of the destination image. By default, it is computed as ``Size(src.cols*2, (src.rows*2)`` . But in any case, the following conditions should be satisfied: :param dstsize: Size of the destination image. By default, it is computed as ``Size(src.cols*2, (src.rows*2)`` . But in any case, the following conditions should be satisfied:
.. math:: .. math::
@ -1353,46 +1353,46 @@ pyrMeanShiftFiltering
--------------------- ---------------------
Performs initial step of meanshift segmentation of an image. Performs initial step of meanshift segmentation of an image.
.. ocv:function:: void pyrMeanShiftFiltering( InputArray src, OutputArray dst, double sp, double sr, int maxLevel=1, TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5,1) ) .. ocv:function:: void pyrMeanShiftFiltering( InputArray src, OutputArray dst, double sp, double sr, int maxLevel=1, TermCriteria termcrit=TermCriteria( TermCriteria::MAX_ITER+TermCriteria::EPS,5,1) )
.. ocv:pyfunction:: cv2.pyrMeanShiftFiltering(src, sp, sr[, dst[, maxLevel[, termcrit]]]) -> dst .. ocv:pyfunction:: cv2.pyrMeanShiftFiltering(src, sp, sr[, dst[, maxLevel[, termcrit]]]) -> dst
.. ocv:cfunction:: void cvPyrMeanShiftFiltering( const CvArr* src, CvArr* dst, double sp, double sr, int max_level=1, CvTermCriteria termcrit= cvTermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,5,1)) .. ocv:cfunction:: void cvPyrMeanShiftFiltering( const CvArr* src, CvArr* dst, double sp, double sr, int max_level=1, CvTermCriteria termcrit= cvTermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,5,1))
.. ocv:pyoldfunction:: cv.PyrMeanShiftFiltering(src, dst, sp, sr, maxLevel=1, termcrit=(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS, 5, 1))-> None .. ocv:pyoldfunction:: cv.PyrMeanShiftFiltering(src, dst, sp, sr, max_level=1, termcrit=(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS, 5, 1)) -> None
:param src: The source 8-bit, 3-channel image. :param src: The source 8-bit, 3-channel image.
:param dst: The destination image of the same format and the same size as the source. :param dst: The destination image of the same format and the same size as the source.
:param sp: The spatial window radius. :param sp: The spatial window radius.
:param sr: The color window radius. :param sr: The color window radius.
:param maxLevel: Maximum level of the pyramid for the segmentation. :param maxLevel: Maximum level of the pyramid for the segmentation.
:param termcrit: Termination criteria: when to stop meanshift iterations. :param termcrit: Termination criteria: when to stop meanshift iterations.
The function implements the filtering stage of meanshift segmentation, that is, the output of the function is the filtered "posterized" image with color gradients and fine-grain texture flattened. At every pixel The function implements the filtering stage of meanshift segmentation, that is, the output of the function is the filtered "posterized" image with color gradients and fine-grain texture flattened. At every pixel
``(X,Y)`` of the input image (or down-sized input image, see below) the function executes meanshift ``(X,Y)`` of the input image (or down-sized input image, see below) the function executes meanshift
iterations, that is, the pixel ``(X,Y)`` neighborhood in the joint space-color hyperspace is considered: iterations, that is, the pixel ``(X,Y)`` neighborhood in the joint space-color hyperspace is considered:
.. math:: .. math::
(x,y): X- \texttt{sp} \le x \le X+ \texttt{sp} , Y- \texttt{sp} \le y \le Y+ \texttt{sp} , ||(R,G,B)-(r,g,b)|| \le \texttt{sr} (x,y): X- \texttt{sp} \le x \le X+ \texttt{sp} , Y- \texttt{sp} \le y \le Y+ \texttt{sp} , ||(R,G,B)-(r,g,b)|| \le \texttt{sr}
where ``(R,G,B)`` and ``(r,g,b)`` are the vectors of color components at ``(X,Y)`` and ``(x,y)``, respectively (though, the algorithm does not depend on the color space used, so any 3-component color space can be used instead). Over the neighborhood the average spatial value ``(X',Y')`` and average color vector ``(R',G',B')`` are found and they act as the neighborhood center on the next iteration: where ``(R,G,B)`` and ``(r,g,b)`` are the vectors of color components at ``(X,Y)`` and ``(x,y)``, respectively (though, the algorithm does not depend on the color space used, so any 3-component color space can be used instead). Over the neighborhood the average spatial value ``(X',Y')`` and average color vector ``(R',G',B')`` are found and they act as the neighborhood center on the next iteration:
.. math:: .. math::
(X,Y)~(X',Y'), (R,G,B)~(R',G',B'). (X,Y)~(X',Y'), (R,G,B)~(R',G',B').
After the iterations over, the color components of the initial pixel (that is, the pixel from where the iterations started) are set to the final value (average color at the last iteration): After the iterations over, the color components of the initial pixel (that is, the pixel from where the iterations started) are set to the final value (average color at the last iteration):
.. math:: .. math::
I(X,Y) <- (R*,G*,B*) I(X,Y) <- (R*,G*,B*)
When ``maxLevel > 0``, the gaussian pyramid of ``maxLevel+1`` levels is built, and the above procedure is run on the smallest layer first. After that, the results are propagated to the larger layer and the iterations are run again only on those pixels where the layer colors differ by more than ``sr`` from the lower-resolution layer of the pyramid. That makes boundaries of color regions sharper. Note that the results will be actually different from the ones obtained by running the meanshift procedure on the whole original image (i.e. when ``maxLevel==0``). When ``maxLevel > 0``, the gaussian pyramid of ``maxLevel+1`` levels is built, and the above procedure is run on the smallest layer first. After that, the results are propagated to the larger layer and the iterations are run again only on those pixels where the layer colors differ by more than ``sr`` from the lower-resolution layer of the pyramid. That makes boundaries of color regions sharper. Note that the results will be actually different from the ones obtained by running the meanshift procedure on the whole original image (i.e. when ``maxLevel==0``).
@ -1402,20 +1402,20 @@ sepFilter2D
--------------- ---------------
Applies a separable linear filter to an image. Applies a separable linear filter to an image.
.. ocv:function:: void sepFilter2D( InputArray src, OutputArray dst, int ddepth, InputArray rowKernel, InputArray columnKernel, Point anchor=Point(-1,-1), double delta=0, int borderType=BORDER_DEFAULT ) .. ocv:function:: void sepFilter2D( InputArray src, OutputArray dst, int ddepth, InputArray kernelX, InputArray kernelY, Point anchor=Point(-1,-1), double delta=0, int borderType=BORDER_DEFAULT )
.. ocv:pyfunction:: cv2.sepFilter2D(src, ddepth, kernelX, kernelY[, dst[, anchor[, delta[, borderType]]]]) -> dst .. ocv:pyfunction:: cv2.sepFilter2D(src, ddepth, kernelX, kernelY[, dst[, anchor[, delta[, borderType]]]]) -> dst
:param src: Source image. :param src: Source image.
:param dst: Destination image of the same size and the same number of channels as ``src`` . :param dst: Destination image of the same size and the same number of channels as ``src`` .
:param ddepth: Destination image depth. The following combination of ``src.depth()`` and ``ddepth`` are supported: :param ddepth: Destination image depth. The following combination of ``src.depth()`` and ``ddepth`` are supported:
* ``src.depth()`` = ``CV_8U``, ``ddepth`` = -1/``CV_16S``/``CV_32F``/``CV_64F`` * ``src.depth()`` = ``CV_8U``, ``ddepth`` = -1/``CV_16S``/``CV_32F``/``CV_64F``
* ``src.depth()`` = ``CV_16U``/``CV_16S``, ``ddepth`` = -1/``CV_32F``/``CV_64F`` * ``src.depth()`` = ``CV_16U``/``CV_16S``, ``ddepth`` = -1/``CV_32F``/``CV_64F``
* ``src.depth()`` = ``CV_32F``, ``ddepth`` = -1/``CV_32F``/``CV_64F`` * ``src.depth()`` = ``CV_32F``, ``ddepth`` = -1/``CV_32F``/``CV_64F``
* ``src.depth()`` = ``CV_64F``, ``ddepth`` = -1/``CV_64F`` * ``src.depth()`` = ``CV_64F``, ``ddepth`` = -1/``CV_64F``
when ``ddepth=-1``, the destination image will have the same depth as the source. when ``ddepth=-1``, the destination image will have the same depth as the source.
:param rowKernel: Coefficients for filtering each row. :param rowKernel: Coefficients for filtering each row.
@ -1437,50 +1437,50 @@ The function applies a separable linear filter to the image. That is, first, eve
:ocv:func:`Sobel`, :ocv:func:`Sobel`,
:ocv:func:`GaussianBlur`, :ocv:func:`GaussianBlur`,
:ocv:func:`boxFilter`, :ocv:func:`boxFilter`,
:ocv:func:`blur` :ocv:func:`blur`
Smooth Smooth
------ ------
Smooths the image in one of several ways. Smooths the image in one of several ways.
.. ocv:cfunction:: void cvSmooth( const CvArr* src, CvArr* dst, int smoothtype=CV_GAUSSIAN, int param1=3, int param2=0, double param3=0, double param4=0) .. ocv:cfunction:: void cvSmooth( const CvArr* src, CvArr* dst, int smoothtype=CV_GAUSSIAN, int size1=3, int size2=0, double sigma1=0, double sigma2=0 )
.. ocv:pyoldfunction:: cv.Smooth(src, dst, smoothtype=CV_GAUSSIAN, param1=3, param2=0, param3=0, param4=0)-> None .. ocv:pyoldfunction:: cv.Smooth(src, dst, smoothtype=CV_GAUSSIAN, param1=3, param2=0, param3=0, param4=0)-> None
:param src: The source image :param src: The source image
:param dst: The destination image :param dst: The destination image
:param smoothtype: Type of the smoothing: :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{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** 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{param1}\times\texttt{param2}` box kernel (all 1's) with subsequent scaling by :math:`1/(\texttt{param1}\cdot\texttt{param2})`
* **CV_GAUSSIAN** linear convolution with a :math:`\texttt{param1}\times\texttt{param2}` Gaussian kernel * **CV_GAUSSIAN** linear convolution with a :math:`\texttt{param1}\times\texttt{param2}` Gaussian kernel
* **CV_MEDIAN** median filter with a :math:`\texttt{param1}\times\texttt{param1}` square aperture * **CV_MEDIAN** median filter with a :math:`\texttt{param1}\times\texttt{param1}` 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{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
:param param1: The first parameter of the smoothing operation, the aperture width. Must be a positive odd number (1, 3, 5, ...) :param param1: 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 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 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 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:
.. math:: .. 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{param1} for horizontal kernel} \\ \mbox{\texttt{param2} 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 ``param3`` is not zero, while ``param1`` and ``param2`` 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: The function smooths an image using one of several methods. Every of the methods has some features and restrictions listed below:
* Blur with no scaling works with single-channel images only and supports accumulation of 8-bit to 16-bit format (similar to :ocv:func:`Sobel` and :ocv:func:`Laplacian`) and 32-bit floating point to 32-bit floating-point format. * Blur with no scaling works with single-channel images only and supports accumulation of 8-bit to 16-bit format (similar to :ocv:func:`Sobel` and :ocv:func:`Laplacian`) and 32-bit floating point to 32-bit floating-point format.
@ -1496,23 +1496,24 @@ Sobel
--------- ---------
Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator. Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.
.. ocv:function:: void Sobel( InputArray src, OutputArray dst, int ddepth, int xorder, int yorder, int ksize=3, double scale=1, double delta=0, int borderType=BORDER_DEFAULT ) .. ocv:function:: void Sobel( InputArray src, OutputArray dst, int ddepth, int dx, int dy, int ksize=3, double scale=1, double delta=0, int borderType=BORDER_DEFAULT )
.. ocv:pyfunction:: cv2.Sobel(src, ddepth, dx, dy[, dst[, ksize[, scale[, delta[, borderType]]]]]) -> dst .. ocv:pyfunction:: cv2.Sobel(src, ddepth, dx, dy[, dst[, ksize[, scale[, delta[, borderType]]]]]) -> dst
.. ocv:cfunction:: void cvSobel( const CvArr* src, CvArr* dst, int xorder, int yorder, int apertureSize=3 ) .. ocv:cfunction:: void cvSobel( const CvArr* src, CvArr* dst, int xorder, int yorder, int aperture_size=3 )
.. ocv:pyoldfunction:: cv.Sobel(src, dst, xorder, yorder, apertureSize=3)-> None .. ocv:pyoldfunction:: cv.Sobel(src, dst, xorder, yorder, apertureSize=3)-> None
:param src: Source image. :param src: Source image.
:param dst: Destination image of the same size and the same number of channels as ``src`` . :param dst: Destination image of the same size and the same number of channels as ``src`` .
:param ddepth: Destination image depth. The following combination of ``src.depth()`` and ``ddepth`` are supported: :param ddepth: Destination image depth. The following combination of ``src.depth()`` and ``ddepth`` are supported:
* ``src.depth()`` = ``CV_8U``, ``ddepth`` = -1/``CV_16S``/``CV_32F``/``CV_64F`` * ``src.depth()`` = ``CV_8U``, ``ddepth`` = -1/``CV_16S``/``CV_32F``/``CV_64F``
* ``src.depth()`` = ``CV_16U``/``CV_16S``, ``ddepth`` = -1/``CV_32F``/``CV_64F`` * ``src.depth()`` = ``CV_16U``/``CV_16S``, ``ddepth`` = -1/``CV_32F``/``CV_64F``
* ``src.depth()`` = ``CV_32F``, ``ddepth`` = -1/``CV_32F``/``CV_64F`` * ``src.depth()`` = ``CV_32F``, ``ddepth`` = -1/``CV_32F``/``CV_64F``
* ``src.depth()`` = ``CV_64F``, ``ddepth`` = -1/``CV_64F`` * ``src.depth()`` = ``CV_64F``, ``ddepth`` = -1/``CV_64F``
when ``ddepth=-1``, the destination image will have the same depth as the source. In the case of 8-bit input images it will result in truncated derivatives. when ``ddepth=-1``, the destination image will have the same depth as the source. In the case of 8-bit input images it will result in truncated derivatives.
:param xorder: Order of the derivative x. :param xorder: Order of the derivative x.
@ -1524,7 +1525,7 @@ Calculates the first, second, third, or mixed image derivatives using an extende
:param scale: Optional scale factor for the computed derivative values. By default, no scaling is applied. See :ocv:func:`getDerivKernels` for details. :param scale: Optional scale factor for the computed derivative values. By default, no scaling is applied. See :ocv:func:`getDerivKernels` for details.
:param delta: Optional delta value that is added to the results prior to storing them in ``dst`` . :param delta: Optional delta value that is added to the results prior to storing them in ``dst`` .
:param borderType: Pixel extrapolation method. See :ocv:func:`borderInterpolate` for details. :param borderType: Pixel extrapolation method. See :ocv:func:`borderInterpolate` for details.
In all cases except one, the In all cases except one, the
@ -1538,7 +1539,7 @@ derivative. When
There is also the special value ``ksize = CV_SCHARR`` (-1) that corresponds to the There is also the special value ``ksize = CV_SCHARR`` (-1) that corresponds to the
:math:`3\times3` Scharr :math:`3\times3` Scharr
filter that may give more accurate results than the filter that may give more accurate results than the
:math:`3\times3` Sobel. The Scharr aperture is :math:`3\times3` Sobel. The Scharr aperture is
.. math:: .. math::
@ -1582,14 +1583,14 @@ Scharr
---------- ----------
Calculates the first x- or y- image derivative using Scharr operator. Calculates the first x- or y- image derivative using Scharr operator.
.. ocv:function:: void Scharr( InputArray src, OutputArray dst, int ddepth, int xorder, int yorder, double scale=1, double delta=0, int borderType=BORDER_DEFAULT ) .. ocv:function:: void Scharr( InputArray src, OutputArray dst, int ddepth, int dx, int dy, double scale=1, double delta=0, int borderType=BORDER_DEFAULT )
.. ocv:pyfunction:: cv2.Scharr(src, ddepth, dx, dy[, dst[, scale[, delta[, borderType]]]]) -> dst .. ocv:pyfunction:: cv2.Scharr(src, ddepth, dx, dy[, dst[, scale[, delta[, borderType]]]]) -> dst
:param src: Source image. :param src: Source image.
:param dst: Destination image of the same size and the same number of channels as ``src``. :param dst: Destination image of the same size and the same number of channels as ``src``.
:param ddepth: Destination image depth. See :ocv:func:`Sobel` for the list of supported combination of ``src.depth()`` and ``ddepth``. :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 xorder: Order of the derivative x.
@ -1599,9 +1600,9 @@ Calculates the first x- or y- image derivative using Scharr operator.
:param scale: Optional scale factor for the computed derivative values. By default, no scaling is applied. See :ocv:func:`getDerivKernels` for details. :param scale: Optional scale factor for the computed derivative values. By default, no scaling is applied. See :ocv:func:`getDerivKernels` for details.
:param delta: Optional delta value that is added to the results prior to storing them in ``dst``. :param delta: Optional delta value that is added to the results prior to storing them in ``dst``.
:param borderType: Pixel extrapolation method. See :ocv:func:`borderInterpolate` for details. :param borderType: Pixel extrapolation method. See :ocv:func:`borderInterpolate` for details.
The function computes the first x- or y- spatial image derivative using the Scharr operator. The call The function computes the first x- or y- spatial image derivative using the Scharr operator. The call
.. math:: .. math::

View File

@ -41,15 +41,15 @@ Converts image transformation maps from one representation to another.
.. ocv:pyfunction:: cv2.convertMaps(map1, map2, dstmap1type[, dstmap1[, dstmap2[, nninterpolation]]]) -> dstmap1, dstmap2 .. ocv:pyfunction:: cv2.convertMaps(map1, map2, dstmap1type[, dstmap1[, dstmap2[, nninterpolation]]]) -> dstmap1, dstmap2
:param map1: The first input map of type ``CV_16SC2`` , ``CV_32FC1`` , or ``CV_32FC2`` . :param map1: The first input map of type ``CV_16SC2`` , ``CV_32FC1`` , or ``CV_32FC2`` .
:param map2: The second input map of type ``CV_16UC1`` , ``CV_32FC1`` , or none (empty matrix), respectively. :param map2: The second input map of type ``CV_16UC1`` , ``CV_32FC1`` , or none (empty matrix), respectively.
:param dstmap1: The first output map that has the type ``dstmap1type`` and the same size as ``src`` . :param dstmap1: The first output map that has the type ``dstmap1type`` and the same size as ``src`` .
:param dstmap2: The second output map. :param dstmap2: The second output map.
:param dstmap1type: Type of the first output map that should be ``CV_16SC2`` , ``CV_32FC1`` , or ``CV_32FC2`` . :param dstmap1type: Type of the first output map that should be ``CV_16SC2`` , ``CV_32FC1`` , or ``CV_32FC2`` .
:param nninterpolation: Flag indicating whether the fixed-point maps are used for the nearest-neighbor or for a more complex interpolation. :param nninterpolation: Flag indicating whether the fixed-point maps are used for the nearest-neighbor or for a more complex interpolation.
The function converts a pair of maps for The function converts a pair of maps for
@ -77,11 +77,13 @@ getAffineTransform
---------------------- ----------------------
Calculates an affine transform from three pairs of the corresponding points. Calculates an affine transform from three pairs of the corresponding points.
.. ocv:function:: Mat getAffineTransform( const Point2f* src, const Point2f* dst ) .. ocv:function:: Mat getAffineTransform( InputArray src, InputArray dst )
.. ocv:function:: Mat getAffineTransform( const Point2f src[], const Point2f dst[] )
.. ocv:pyfunction:: cv2.getAffineTransform(src, dst) -> retval .. ocv:pyfunction:: cv2.getAffineTransform(src, dst) -> retval
.. ocv:cfunction:: CvMat* cvGetAffineTransform( const CvPoint2D32f* src, const CvPoint2D32f* dst, CvMat* mapMatrix ) .. ocv:cfunction:: CvMat* cvGetAffineTransform( const CvPoint2D32f * src, const CvPoint2D32f * dst, CvMat * map_matrix )
.. ocv:pyoldfunction:: cv.GetAffineTransform(src, dst, mapMatrix)-> None .. ocv:pyoldfunction:: cv.GetAffineTransform(src, dst, mapMatrix)-> None
@ -114,11 +116,13 @@ getPerspectiveTransform
--------------------------- ---------------------------
Calculates a perspective transform from four pairs of the corresponding points. Calculates a perspective transform from four pairs of the corresponding points.
.. ocv:function:: Mat getPerspectiveTransform( const Point2f* src, const Point2f* dst ) .. ocv:function:: Mat getPerspectiveTransform( InputArray src, InputArray dst )
.. ocv:function:: Mat getPerspectiveTransform( const Point2f src[], const Point2f dst[] )
.. ocv:pyfunction:: cv2.getPerspectiveTransform(src, dst) -> retval .. ocv:pyfunction:: cv2.getPerspectiveTransform(src, dst) -> retval
.. ocv:cfunction:: CvMat* cvGetPerspectiveTransform( const CvPoint2D32f* src, const CvPoint2D32f* dst, CvMat* mapMatrix ) .. ocv:cfunction:: CvMat* cvGetPerspectiveTransform( const CvPoint2D32f* src, const CvPoint2D32f* dst, CvMat* map_matrix )
.. ocv:pyoldfunction:: cv.GetPerspectiveTransform(src, dst, mapMatrix)-> None .. ocv:pyoldfunction:: cv.GetPerspectiveTransform(src, dst, mapMatrix)-> None
@ -151,7 +155,7 @@ getRectSubPix
----------------- -----------------
Retrieves a pixel rectangle from an image with sub-pixel accuracy. Retrieves a pixel rectangle from an image with sub-pixel accuracy.
.. ocv:function:: void getRectSubPix( InputArray image, Size patchSize, Point2f center, OutputArray dst, int patchType=-1 ) .. ocv:function:: void getRectSubPix( InputArray image, Size patchSize, Point2f center, OutputArray patch, int patchType=-1 )
.. ocv:pyfunction:: cv2.getRectSubPix(image, patchSize, center[, patch[, patchType]]) -> patch .. ocv:pyfunction:: cv2.getRectSubPix(image, patchSize, center[, patch[, patchType]]) -> patch
@ -165,7 +169,7 @@ Retrieves a pixel rectangle from an image with sub-pixel accuracy.
:param center: Floating point coordinates of the center of the extracted rectangle within the source image. The center must be inside the image. :param center: Floating point coordinates of the center of the extracted rectangle within the source image. The center must be inside the image.
:param dst: Extracted patch that has the size ``patchSize`` and the same number of channels as ``src`` . :param dst: Extracted patch that has the size ``patchSize`` and the same number of channels as ``src`` .
:param patchType: Depth of the extracted pixels. By default, they have the same depth as ``src`` . :param patchType: Depth of the extracted pixels. By default, they have the same depth as ``src`` .
The function ``getRectSubPix`` extracts pixels from ``src`` : The function ``getRectSubPix`` extracts pixels from ``src`` :
@ -196,7 +200,7 @@ Calculates an affine matrix of 2D rotation.
.. ocv:pyfunction:: cv2.getRotationMatrix2D(center, angle, scale) -> retval .. ocv:pyfunction:: cv2.getRotationMatrix2D(center, angle, scale) -> retval
.. ocv:cfunction:: CvMat* cv2DRotationMatrix( CvPoint2D32f center, double angle, double scale, CvMat* mapMatrix ) .. ocv:cfunction:: CvMat* cv2DRotationMatrix( CvPoint2D32f center, double angle, double scale, CvMat* map_matrix )
.. ocv:pyoldfunction:: cv.GetRotationMatrix2D(center, angle, scale, mapMatrix)-> None .. ocv:pyoldfunction:: cv.GetRotationMatrix2D(center, angle, scale, mapMatrix)-> None
@ -262,19 +266,19 @@ Remaps an image to log-polar space.
.. ocv:pyoldfunction:: cv.LogPolar(src, dst, center, M, flags=CV_INNER_LINEAR+CV_WARP_FILL_OUTLIERS)-> None .. ocv:pyoldfunction:: cv.LogPolar(src, dst, center, M, flags=CV_INNER_LINEAR+CV_WARP_FILL_OUTLIERS)-> None
:param src: Source image :param src: Source image
:param dst: Destination image :param dst: Destination image
:param center: The transformation center; where the output precision is maximal :param center: The transformation center; where the output precision is maximal
:param M: Magnitude scale parameter. See below :param M: Magnitude scale parameter. See below
:param flags: A combination of interpolation methods and the following optional flags: :param flags: A combination of interpolation methods and the following optional flags:
* **CV_WARP_FILL_OUTLIERS** fills all of the destination image pixels. If some of them correspond to outliers in the source image, they are set to zero * **CV_WARP_FILL_OUTLIERS** fills all of the destination image pixels. If some of them correspond to outliers in the source image, they are set to zero
* **CV_WARP_INVERSE_MAP** See below * **CV_WARP_INVERSE_MAP** See below
The function ``cvLogPolar`` transforms the source image using the following transformation: The function ``cvLogPolar`` transforms the source image using the following transformation:
@ -283,7 +287,7 @@ The function ``cvLogPolar`` transforms the source image using the following tran
.. math:: .. math::
dst( \phi , \rho ) = src(x,y) dst( \phi , \rho ) = src(x,y)
* *
@ -291,14 +295,14 @@ The function ``cvLogPolar`` transforms the source image using the following tran
.. math:: .. math::
dst(x,y) = src( \phi , \rho ) dst(x,y) = src( \phi , \rho )
where where
.. math:: .. math::
\rho = M \cdot \log{\sqrt{x^2 + y^2}} , \phi =atan(y/x) \rho = M \cdot \log{\sqrt{x^2 + y^2}} , \phi =atan(y/x)
The function emulates the human "foveal" vision and can be used for fast scale and rotation-invariant template matching, for object tracking and so forth. The function can not operate in-place. The function emulates the human "foveal" vision and can be used for fast scale and rotation-invariant template matching, for object tracking and so forth. The function can not operate in-place.
@ -372,7 +376,7 @@ Resizes an image.
\texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))} \texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))}
Either ``dsize`` or both ``fx`` and ``fy`` must be non-zero. Either ``dsize`` or both ``fx`` and ``fy`` must be non-zero.
:param fx: Scale factor along the horizontal axis. When it is 0, it is computed as :param fx: Scale factor along the horizontal axis. When it is 0, it is computed as
@ -417,7 +421,7 @@ To shrink an image, it will generally look best with CV_INTER_AREA interpolation
:ocv:func:`warpAffine`, :ocv:func:`warpAffine`,
:ocv:func:`warpPerspective`, :ocv:func:`warpPerspective`,
:ocv:func:`remap` :ocv:func:`remap`
warpAffine warpAffine
@ -428,16 +432,18 @@ Applies an affine transformation to an image.
.. ocv:pyfunction:: cv2.warpAffine(src, M, dsize[, dst[, flags[, borderMode[, borderValue]]]]) -> dst .. ocv:pyfunction:: cv2.warpAffine(src, M, dsize[, dst[, flags[, borderMode[, borderValue]]]]) -> dst
.. ocv:cfunction:: void cvWarpAffine( const CvArr* src, CvArr* dst, const CvMat* mapMatrix, int flags=CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS, CvScalar fillval=cvScalarAll(0) ) .. ocv:cfunction:: void cvWarpAffine( const CvArr* src, CvArr* dst, const CvMat* map_matrix, int flags=CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS, CvScalar fillval=cvScalarAll(0) )
.. ocv:pyoldfunction:: cv.WarpAffine(src, dst, mapMatrix, flags=CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS, fillval=(0, 0, 0, 0))-> None .. ocv:pyoldfunction:: cv.WarpAffine(src, dst, mapMatrix, flags=CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS, fillval=(0, 0, 0, 0))-> None
.. ocv:cfunction:: void cvGetQuadrangleSubPix( const CvArr* src, CvArr* dst, const CvMat* mapMatrix ) .. ocv:cfunction:: void cvGetQuadrangleSubPix( const CvArr* src, CvArr* dst, const CvMat* map_matrix )
.. ocv:pyoldfunction:: cv.GetQuadrangleSubPix(src, dst, mapMatrix)-> None .. ocv:pyoldfunction:: cv.GetQuadrangleSubPix(src, dst, mapMatrix)-> None
:param src: Source image. :param src: Source image.
:param dst: Destination image that has the size ``dsize`` and the same type as ``src`` . :param dst: Destination image that has the size ``dsize`` and the same type as ``src`` .
:param M: :math:`2\times 3` transformation matrix. :param M: :math:`2\times 3` transformation matrix.
:param dsize: Size of the destination image. :param dsize: Size of the destination image.
@ -477,13 +483,14 @@ Applies a perspective transformation to an image.
.. ocv:pyfunction:: cv2.warpPerspective(src, M, dsize[, dst[, flags[, borderMode[, borderValue]]]]) -> dst .. ocv:pyfunction:: cv2.warpPerspective(src, M, dsize[, dst[, flags[, borderMode[, borderValue]]]]) -> dst
.. ocv:cfunction:: void cvWarpPerspective( const CvArr* src, CvArr* dst, const CvMat* mapMatrix, int flags=CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS, CvScalar fillval=cvScalarAll(0) ) .. ocv:cfunction:: void cvWarpPerspective( const CvArr* src, CvArr* dst, const CvMat* map_matrix, int flags=CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS, CvScalar fillval=cvScalarAll(0) )
.. ocv:pyoldfunction:: cv.WarpPerspective(src, dst, mapMatrix, flags=CV_INNER_LINEAR+CV_WARP_FILL_OUTLIERS, fillval=(0, 0, 0, 0))-> None .. ocv:pyoldfunction:: cv.WarpPerspective(src, dst, mapMatrix, flags=CV_INNER_LINEAR+CV_WARP_FILL_OUTLIERS, fillval=(0, 0, 0, 0))-> None
:param src: Source image. :param src: Source image.
:param dst: Destination image that has the size ``dsize`` and the same type as ``src`` . :param dst: Destination image that has the size ``dsize`` and the same type as ``src`` .
:param M: :math:`3\times 3` transformation matrix. :param M: :math:`3\times 3` transformation matrix.
:param dsize: Size of the destination image. :param dsize: Size of the destination image.
@ -524,24 +531,24 @@ Computes the undistortion and rectification transformation map.
.. ocv:pyfunction:: cv2.initUndistortRectifyMap(cameraMatrix, distCoeffs, R, newCameraMatrix, size, m1type[, map1[, map2]]) -> map1, map2 .. ocv:pyfunction:: cv2.initUndistortRectifyMap(cameraMatrix, distCoeffs, R, newCameraMatrix, size, m1type[, map1[, map2]]) -> map1, map2
.. ocv:cfunction:: void cvInitUndistortRectifyMap( const CvMat* cameraMatrix, const CvMat* distCoeffs, const CvMat* R, const CvMat* newCameraMatrix, CvArr* map1, CvArr* map2 ) .. ocv:cfunction:: void cvInitUndistortRectifyMap( const CvMat* camera_matrix, const CvMat* dist_coeffs, const CvMat * R, const CvMat* new_camera_matrix, CvArr* mapx, CvArr* mapy )
.. ocv:cfunction:: void cvInitUndistortMap( const CvMat* cameraMatrix, const CvMat* distCoeffs, CvArr* map1, CvArr* map2 ) .. ocv:cfunction:: void cvInitUndistortMap( const CvMat* camera_matrix, const CvMat* distortion_coeffs, CvArr* mapx, CvArr* mapy )
.. ocv:pyoldfunction:: cv.InitUndistortRectifyMap(cameraMatrix, distCoeffs, R, newCameraMatrix, map1, map2)-> None .. ocv:pyoldfunction:: cv.InitUndistortRectifyMap(cameraMatrix, distCoeffs, R, newCameraMatrix, map1, map2)-> None
.. ocv:pyoldfunction:: cv.InitUndistortMap(cameraMatrix, distCoeffs, map1, map2)-> None .. ocv:pyoldfunction:: cv.InitUndistortMap(cameraMatrix, distCoeffs, map1, map2)-> None
:param cameraMatrix: Input camera matrix :math:`A=\vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}` . :param cameraMatrix: Input camera matrix :math:`A=\vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}` .
:param distCoeffs: Input vector of distortion coefficients :math:`(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]])` of 4, 5, or 8 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed. :param distCoeffs: Input vector of distortion coefficients :math:`(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]])` of 4, 5, or 8 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
:param R: Optional rectification transformation in the object space (3x3 matrix). ``R1`` or ``R2`` , computed by :ocv:func:`stereoRectify` can be passed here. If the matrix is empty, the identity transformation is assumed. In ``cvInitUndistortMap`` R assumed to be an identity matrix. :param R: Optional rectification transformation in the object space (3x3 matrix). ``R1`` or ``R2`` , computed by :ocv:func:`stereoRectify` can be passed here. If the matrix is empty, the identity transformation is assumed. In ``cvInitUndistortMap`` R assumed to be an identity matrix.
:param newCameraMatrix: New camera matrix :math:`A'=\vecthreethree{f_x'}{0}{c_x'}{0}{f_y'}{c_y'}{0}{0}{1}` . :param newCameraMatrix: New camera matrix :math:`A'=\vecthreethree{f_x'}{0}{c_x'}{0}{f_y'}{c_y'}{0}{0}{1}` .
:param size: Undistorted image size. :param size: Undistorted image size.
:param m1type: Type of the first output map that can be ``CV_32FC1`` or ``CV_16SC2`` . See :ocv:func:`convertMaps` for details. :param m1type: Type of the first output map that can be ``CV_32FC1`` or ``CV_16SC2`` . See :ocv:func:`convertMaps` for details.
:param map1: The first output map. :param map1: The first output map.
:param map2: The second output map. :param map2: The second output map.
@ -606,7 +613,7 @@ where
:math:`(0,0)` and :math:`(0,0)` and
:math:`(1,1)` elements of ``cameraMatrix`` , respectively. :math:`(1,1)` elements of ``cameraMatrix`` , respectively.
By default, the undistortion functions in OpenCV (see By default, the undistortion functions in OpenCV (see
:ocv:func:`initUndistortRectifyMap`, :ocv:func:`initUndistortRectifyMap`,
:ocv:func:`undistort`) do not move the principal point. However, when you work with stereo, it is important to move the principal points in both views to the same y-coordinate (which is required by most of stereo correspondence algorithms), and may be to the same x-coordinate too. So, you can form the new camera matrix for each view where the principal points are located at the center. :ocv:func:`undistort`) do not move the principal point. However, when you work with stereo, it is important to move the principal points in both views to the same y-coordinate (which is required by most of stereo correspondence algorithms), and may be to the same x-coordinate too. So, you can form the new camera matrix for each view where the principal points are located at the center.
@ -621,16 +628,16 @@ Transforms an image to compensate for lens distortion.
.. ocv:pyfunction:: cv2.undistort(src, cameraMatrix, distCoeffs[, dst[, newCameraMatrix]]) -> dst .. ocv:pyfunction:: cv2.undistort(src, cameraMatrix, distCoeffs[, dst[, newCameraMatrix]]) -> dst
.. ocv:cfunction:: void cvUndistort2( const CvArr* src, CvArr* dst, const CvMat* cameraMatrix, const CvMat* distCoeffs, const CvMat* newCameraMatrix=NULL ) .. ocv:cfunction:: void cvUndistort2( const CvArr* src, CvArr* dst, const CvMat* camera_matrix, const CvMat* distortion_coeffs, const CvMat* new_camera_matrix=0 )
.. ocv:pyoldfunction:: cv.Undistort2(src, dst, cameraMatrix, distCoeffs)-> None .. ocv:pyoldfunction:: cv.Undistort2(src, dst, cameraMatrix, distCoeffs)-> None
:param src: Input (distorted) image. :param src: Input (distorted) image.
:param dst: Output (corrected) image that has the same size and type as ``src`` . :param dst: Output (corrected) image that has the same size and type as ``src`` .
:param cameraMatrix: Input camera matrix :math:`A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}` . :param cameraMatrix: Input camera matrix :math:`A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}` .
:param distCoeffs: Input vector of distortion coefficients :math:`(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]])` of 4, 5, or 8 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed. :param distCoeffs: Input vector of distortion coefficients :math:`(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]])` of 4, 5, or 8 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
:param newCameraMatrix: Camera matrix of the distorted image. By default, it is the same as ``cameraMatrix`` but you may additionally scale and shift the result by using a different matrix. :param newCameraMatrix: Camera matrix of the distorted image. By default, it is the same as ``cameraMatrix`` but you may additionally scale and shift the result by using a different matrix.
@ -660,7 +667,7 @@ Computes the ideal point coordinates from the observed point coordinates.
.. ocv:function:: void undistortPoints( InputArray src, OutputArray dst, InputArray cameraMatrix, InputArray distCoeffs, InputArray R=noArray(), InputArray P=noArray()) .. ocv:function:: void undistortPoints( InputArray src, OutputArray dst, InputArray cameraMatrix, InputArray distCoeffs, InputArray R=noArray(), InputArray P=noArray())
.. ocv:cfunction:: void cvUndistortPoints( const CvMat* src, CvMat* dst, const CvMat* cameraMatrix, const CvMat* distCoeffs, const CvMat* R=NULL, const CvMat* P=NULL) .. ocv:cfunction:: void cvUndistortPoints( const CvMat* src, CvMat* dst, const CvMat* camera_matrix, const CvMat* dist_coeffs, const CvMat* R=0, const CvMat* P=0 )
.. ocv:pyoldfunction:: cv.UndistortPoints(src, dst, cameraMatrix, distCoeffs, R=None, P=None)-> None .. ocv:pyoldfunction:: cv.UndistortPoints(src, dst, cameraMatrix, distCoeffs, R=None, P=None)-> None
:param src: Observed point coordinates, 1xN or Nx1 2-channel (CV_32FC2 or CV_64FC2). :param src: Observed point coordinates, 1xN or Nx1 2-channel (CV_32FC2 or CV_64FC2).
@ -668,7 +675,7 @@ Computes the ideal point coordinates from the observed point coordinates.
:param dst: Output ideal point coordinates after undistortion and reverse perspective transformation. If matrix ``P`` is identity or omitted, ``dst`` will contain normalized point coordinates. :param dst: Output ideal point coordinates after undistortion and reverse perspective transformation. If matrix ``P`` is identity or omitted, ``dst`` will contain normalized point coordinates.
:param cameraMatrix: Camera matrix :math:`\vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}` . :param cameraMatrix: Camera matrix :math:`\vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}` .
:param distCoeffs: Input vector of distortion coefficients :math:`(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]])` of 4, 5, or 8 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed. :param distCoeffs: Input vector of distortion coefficients :math:`(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]])` of 4, 5, or 8 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
:param R: Rectification transformation in the object space (3x3 matrix). ``R1`` or ``R2`` computed by :ocv:func:`stereoRectify` can be passed here. If the matrix is empty, the identity transformation is used. :param R: Rectification transformation in the object space (3x3 matrix). ``R1`` or ``R2`` computed by :ocv:func:`stereoRectify` can be passed here. If the matrix is empty, the identity transformation is used.
@ -696,4 +703,4 @@ where ``undistort()`` is an approximate iterative algorithm that estimates the n
The function can be used for both a stereo camera head or a monocular camera (when R is empty). The function can be used for both a stereo camera head or a monocular camera (when R is empty).

View File

@ -9,9 +9,9 @@ calcHist
------------ ------------
Calculates a histogram of a set of arrays. Calculates a histogram of a set of arrays.
.. ocv:function:: void calcHist( const Mat* arrays, int narrays, const int* channels, InputArray mask, OutputArray hist, int dims, const int* histSize, const float** ranges, bool uniform=true, bool accumulate=false ) .. ocv:function:: void calcHist( const Mat* images, int nimages, const int* channels, InputArray mask, OutputArray hist, int dims, const int* histSize, const float** ranges, bool uniform=true, bool accumulate=false )
.. ocv:function:: void calcHist( const Mat* arrays, int narrays, const int* channels, InputArray mask, SparseMat& hist, int dims, const int* histSize, const float** ranges, bool uniform=true, bool accumulate=false ) .. ocv:function:: 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 )
.. ocv:pyfunction:: cv2.calcHist(images, channels, mask, histSize, ranges[, hist[, accumulate]]) -> hist .. ocv:pyfunction:: cv2.calcHist(images, channels, mask, histSize, ranges[, hist[, accumulate]]) -> hist
@ -106,14 +106,14 @@ calcBackProject
------------------- -------------------
Calculates the back projection of a histogram. Calculates the back projection of a histogram.
.. ocv:function:: void calcBackProject( const Mat* arrays, int narrays, const int* channels, InputArray hist, OutputArray backProject, const float** ranges, double scale=1, bool uniform=true ) .. ocv:function:: void calcBackProject( const Mat* images, int nimages, const int* channels, InputArray hist, OutputArray backProject, const float** ranges, double scale=1, bool uniform=true )
.. ocv:function:: void calcBackProject( const Mat* arrays, int narrays, const int* channels, const SparseMat& hist, OutputArray backProject, const float** ranges, double scale=1, bool uniform=true ) .. ocv:function:: void calcBackProject( const Mat* images, int nimages, const int* channels, const SparseMat& hist, OutputArray backProject, const float** ranges, double scale=1, bool uniform=true )
.. ocv:pyfunction:: cv2.calcBackProject(images, channels, hist, ranges[, dst[, scale]]) -> dst .. ocv:pyfunction:: cv2.calcBackProject(images, channels, hist, ranges, scale[, dst]) -> dst
.. ocv:cfunction:: void cvCalcBackProject( IplImage** image, CvArr* backProject, const CvHistogram* hist ) .. ocv:cfunction:: void cvCalcBackProject( IplImage** image, CvArr* backProject, const CvHistogram* hist )
.. ocv:pyoldfunction:: cv.CalcBackProject(image, backProject, hist)-> None .. 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 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.
@ -124,9 +124,9 @@ Calculates the back projection of a histogram.
:param hist: Input histogram that can be dense or sparse. :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 ``arrays[0]`` .
:param ranges: Array of arrays of the histogram bin boundaries in each dimension. See :ocv:func:`calcHist` . :param ranges: Array of arrays of the histogram bin boundaries in each dimension. See :ocv:func:`calcHist` .
:param scale: Optional scale factor for the output back projection. :param scale: Optional scale factor for the output back projection.
:param uniform: Flag indicating whether the histogram is uniform or not (see above). :param uniform: Flag indicating whether the histogram is uniform or not (see above).
@ -164,7 +164,7 @@ Compares two histograms.
:param H1: First compared histogram. :param H1: First compared histogram.
:param H2: Second compared histogram of the same size as ``H1`` . :param H2: Second compared histogram of the same size as ``H1`` .
:param method: Comparison method that could be one of the following: :param method: Comparison method that could be one of the following:
* **CV_COMP_CORREL** Correlation * **CV_COMP_CORREL** Correlation
@ -225,8 +225,9 @@ Computes the "minimal work" distance between two weighted point configurations.
.. ocv:function:: float EMD( InputArray signature1, InputArray signature2, int distType, InputArray cost=noArray(), float* lowerBound=0, OutputArray flow=noArray() ) .. ocv:function:: float EMD( InputArray signature1, InputArray signature2, int distType, InputArray cost=noArray(), float* lowerBound=0, OutputArray flow=noArray() )
.. ocv:cfunction:: float cvCalcEMD2( const CvArr* signature1, const CvArr* signature2, int distType, CvDistanceFunction distFunc=NULL, const CvArr* cost=NULL, CvArr* flow=NULL, float* lowerBound=NULL, void* userdata=NULL ) .. ocv:cfunction:: float cvCalcEMD2( const CvArr* signature1, const CvArr* signature2, int distance_type, CvDistanceFunction distance_func=NULL, const CvArr* cost_matrix=NULL, CvArr* flow=NULL, float* lower_bound=NULL, void* userdata=NULL )
.. ocv:pyoldfunction:: cv.CalcEMD2(signature1, signature2, distType, distFunc=None, cost=None, flow=None, lowerBound=None, userdata=None) -> float
.. ocv:pyoldfunction:: cv.CalcEMD2(signature1, signature2, distance_type, distance_func=None, cost_matrix=None, flow=None, lower_bound=None, userdata=None) -> float
:param signature1: First signature, a :math:`\texttt{size1}\times \texttt{dims}+1` floating-point matrix. Each row stores the point weight followed by the point coordinates. The matrix is allowed to have a single column (weights only) if the user-defined cost matrix is used. :param signature1: First signature, a :math:`\texttt{size1}\times \texttt{dims}+1` floating-point matrix. Each row stores the point weight followed by the point coordinates. The matrix is allowed to have a single column (weights only) if the user-defined cost matrix is used.
@ -235,18 +236,18 @@ Computes the "minimal work" distance between two weighted point configurations.
: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 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 distFunc: Custom distance function supported by the old interface. ``CvDistanceFunction`` is defined as: ::
typedef float (CV_CDECL * CvDistanceFunction)( const float* a, typedef float (CV_CDECL * CvDistanceFunction)( const float* a,
const float* b, void* userdata ); const float* b, void* userdata );
where ``a`` and ``b`` are point coordinates and ``userdata`` is the same as the last parameter. where ``a`` and ``b`` are point coordinates and ``userdata`` is the same as the last parameter.
:param cost: User-defined :math:`\texttt{size1}\times \texttt{size2}` cost matrix. Also, if a cost matrix is used, lower boundary ``lowerBound`` cannot be calculated because it needs a metric function. :param cost: User-defined :math:`\texttt{size1}\times \texttt{size2}` cost matrix. Also, if a cost matrix is used, lower boundary ``lowerBound`` cannot be calculated because it needs a metric function.
:param lowerBound: Optional input/output parameter: lower boundary of a distance between the two signatures that is a distance between mass centers. The lower boundary may not be calculated if the user-defined cost matrix is used, the total weights of point configurations are not equal, or if the signatures consist of weights only (the signature matrices have a single column). You **must** initialize ``*lowerBound`` . If the calculated distance between mass centers is greater or equal to ``*lowerBound`` (it means that the signatures are far enough), the function does not calculate EMD. In any case ``*lowerBound`` is set to the calculated distance between mass centers on return. Thus, if you want to calculate both distance between mass centers and EMD, ``*lowerBound`` should be set to 0. :param lowerBound: Optional input/output parameter: lower boundary of a distance between the two signatures that is a distance between mass centers. The lower boundary may not be calculated if the user-defined cost matrix is used, the total weights of point configurations are not equal, or if the signatures consist of weights only (the signature matrices have a single column). You **must** initialize ``*lowerBound`` . If the calculated distance between mass centers is greater or equal to ``*lowerBound`` (it means that the signatures are far enough), the function does not calculate EMD. In any case ``*lowerBound`` is set to the calculated distance between mass centers on return. Thus, if you want to calculate both distance between mass centers and EMD, ``*lowerBound`` should be set to 0.
:param flow: Resultant :math:`\texttt{size1} \times \texttt{size2}` flow matrix: :math:`\texttt{flow}_{i,j}` is a flow from :math:`i` -th point of ``signature1`` to :math:`j` -th point of ``signature2`` . :param flow: Resultant :math:`\texttt{size1} \times \texttt{size2}` flow matrix: :math:`\texttt{flow}_{i,j}` is a flow from :math:`i` -th point of ``signature1`` to :math:`j` -th point of ``signature2`` .
:param userdata: Optional pointer directly passed to the custom distance function. :param userdata: Optional pointer directly passed to the custom distance function.
The function computes the earth mover distance and/or a lower boundary of the distance between the two weighted point configurations. One of the applications described in [RubnerSept98]_ is multi-dimensional histogram comparison for image retrieval. EMD is a transportation problem that is solved using some modification of a simplex algorithm, thus the complexity is exponential in the worst case, though, on average it is much faster. In the case of a real metric the lower boundary can be calculated even faster (using linear-time algorithm) and it can be used to determine roughly whether the two signatures are far enough so that they cannot relate to the same object. The function computes the earth mover distance and/or a lower boundary of the distance between the two weighted point configurations. One of the applications described in [RubnerSept98]_ is multi-dimensional histogram comparison for image retrieval. EMD is a transportation problem that is solved using some modification of a simplex algorithm, thus the complexity is exponential in the worst case, though, on average it is much faster. In the case of a real metric the lower boundary can be calculated even faster (using linear-time algorithm) and it can be used to determine roughly whether the two signatures are far enough so that they cannot relate to the same object.
@ -301,20 +302,20 @@ Locates a template within an image by using a histogram comparison.
.. ocv:cfunction:: void cvCalcBackProjectPatch( IplImage** images, CvArr* dst, CvSize patch_size, CvHistogram* hist, int method, double factor ) .. ocv:cfunction:: void cvCalcBackProjectPatch( IplImage** images, CvArr* dst, CvSize patch_size, CvHistogram* hist, int method, double factor )
.. ocv:pyoldfunction:: cv.CalcBackProjectPatch(images, dst, patchSize, hist, method, factor)-> None .. ocv:pyoldfunction:: cv.CalcBackProjectPatch(images, dst, patch_size, hist, method, factor)-> None
:param images: Source images (though, you may pass CvMat** as well). :param images: Source images (though, you may pass CvMat** as well).
:param dst: Destination image. :param dst: Destination image.
:param patch_size: Size of the patch slid though the source image. :param patch_size: Size of the patch slid though the source image.
:param hist: Histogram. :param hist: Histogram.
:param method: Comparison method passed to :ocv:cfunc:`CompareHist` (see the function description). :param method: Comparison method passed to :ocv:cfunc:`CompareHist` (see the function description).
:param factor: Normalization factor for histograms that affects the normalization scale of the destination image. Pass 1 if not sure. :param factor: Normalization factor for histograms that affects the normalization scale of the destination image. Pass 1 if not sure.
The function calculates the back projection by comparing histograms of the source image patches with the given histogram. The function is similar to :ocv:func:`matchTemplate`, but instead of comparing the raster patch with all its possible positions within the search window, the function ``CalcBackProjectPatch`` compares histograms. See the algorithm diagram below: The function calculates the back projection by comparing histograms of the source image patches with the given histogram. The function is similar to :ocv:func:`matchTemplate`, but instead of comparing the raster patch with all its possible positions within the search window, the function ``CalcBackProjectPatch`` compares histograms. See the algorithm diagram below:
.. image:: pics/backprojectpatch.png .. image:: pics/backprojectpatch.png
@ -324,23 +325,23 @@ CalcProbDensity
--------------- ---------------
Divides one histogram by another. Divides one histogram by another.
.. ocv:cfunction:: void cvCalcProbDensity( const CvHistogram* hist1, const CvHistogram* hist2, CvHistogram* dsthist, double scale=255 ) .. ocv:cfunction:: void cvCalcProbDensity( const CvHistogram* hist1, const CvHistogram* hist2, CvHistogram* dst_hist, double scale=255 )
.. ocv:pyoldfunction:: cv.CalcProbDensity(hist1, hist2, dst_hist, scale=255) -> None
:param hist1: First histogram (the divisor).
:param hist2: Second histogram.
:param dsthist: Destination histogram.
:param scale: Scale factor for the destination histogram.
.. ocv:pyoldfunction:: cv.CalcProbDensity(hist1, hist2, dsthist, scale=255)-> None
:param hist1: First histogram (the divisor).
:param hist2: Second histogram.
:param dsthist: Destination histogram.
:param scale: Scale factor for the destination histogram.
The function calculates the object probability density from two histograms as: The function calculates the object probability density from two histograms as:
.. math:: .. math::
\texttt{disthist} (I)= \forkthree{0}{if $\texttt{hist1}(I)=0$}{\texttt{scale}}{if $\texttt{hist1}(I) \ne 0$ and $\texttt{hist2}(I) > \texttt{hist1}(I)$}{\frac{\texttt{hist2}(I) \cdot \texttt{scale}}{\texttt{hist1}(I)}}{if $\texttt{hist1}(I) \ne 0$ and $\texttt{hist2}(I) \le \texttt{hist1}(I)$} \texttt{disthist} (I)= \forkthree{0}{if $\texttt{hist1}(I)=0$}{\texttt{scale}}{if $\texttt{hist1}(I) \ne 0$ and $\texttt{hist2}(I) > \texttt{hist1}(I)$}{\frac{\texttt{hist2}(I) \cdot \texttt{scale}}{\texttt{hist1}(I)}}{if $\texttt{hist1}(I) \ne 0$ and $\texttt{hist2}(I) \le \texttt{hist1}(I)$}
ClearHist ClearHist
@ -350,7 +351,7 @@ Clears the histogram.
.. ocv:cfunction:: void cvClearHist( CvHistogram* hist ) .. ocv:cfunction:: void cvClearHist( CvHistogram* hist )
.. ocv:pyoldfunction:: cv.ClearHist(hist)-> None .. ocv:pyoldfunction:: cv.ClearHist(hist)-> None
:param hist: Histogram. :param hist: Histogram.
The function sets all of the histogram bins to 0 in case of a dense histogram and removes all histogram bins in case of a sparse array. The function sets all of the histogram bins to 0 in case of a dense histogram and removes all histogram bins in case of a sparse array.
@ -361,10 +362,10 @@ Copies a histogram.
.. ocv:cfunction:: void cvCopyHist( const CvHistogram* src, CvHistogram** dst ) .. ocv:cfunction:: void cvCopyHist( const CvHistogram* src, CvHistogram** dst )
:param src: Source histogram. :param src: Source histogram.
:param dst: Pointer to the destination histogram. :param dst: Pointer to the destination histogram.
The function makes a copy of the histogram. If the second histogram pointer ``*dst`` is NULL, a new histogram of the same size as ``src`` is created. Otherwise, both histograms must have equal types and sizes. Then the function copies the bin values of the source histogram to the destination histogram and sets the same bin value ranges as in ``src``. The function makes a copy of the histogram. If the second histogram pointer ``*dst`` is NULL, a new histogram of the same size as ``src`` is created. Otherwise, both histograms must have equal types and sizes. Then the function copies the bin values of the source histogram to the destination histogram and sets the same bin value ranges as in ``src``.
.. _createhist: .. _createhist:
@ -375,33 +376,33 @@ Creates a histogram.
.. ocv:cfunction:: CvHistogram* cvCreateHist( int dims, int* sizes, int type, float** ranges=NULL, int uniform=1 ) .. ocv:cfunction:: CvHistogram* cvCreateHist( int dims, int* sizes, int type, float** ranges=NULL, int uniform=1 )
.. ocv:pyoldfunction:: cv.CreateHist(dims, type, ranges, uniform=1) -> hist .. ocv:pyoldfunction:: cv.CreateHist(dims, type, ranges=None, uniform=1) -> hist
:param dims: Number of histogram dimensions.
:param sizes: Array of the histogram dimension sizes.
:param type: Histogram representation format. ``CV_HIST_ARRAY`` means that the histogram data is represented as a multi-dimensional dense array CvMatND. ``CV_HIST_SPARSE`` means that histogram data is represented as a multi-dimensional sparse array ``CvSparseMat``.
:param ranges: Array of ranges for the histogram bins. Its meaning depends on the ``uniform`` parameter value. The ranges are used when the histogram is calculated or backprojected to determine which histogram bin corresponds to which value/tuple of values from the input image(s).
:param dims: Number of histogram dimensions.
:param sizes: Array of the histogram dimension sizes.
:param type: Histogram representation format. ``CV_HIST_ARRAY`` means that the histogram data is represented as a multi-dimensional dense array CvMatND. ``CV_HIST_SPARSE`` means that histogram data is represented as a multi-dimensional sparse array ``CvSparseMat``.
:param ranges: Array of ranges for the histogram bins. Its meaning depends on the ``uniform`` parameter value. The ranges are used when the histogram is calculated or backprojected to determine which histogram bin corresponds to which value/tuple of values from the input image(s).
:param uniform: Uniformity flag. If not zero, the histogram has evenly :param uniform: Uniformity flag. If not zero, the histogram has evenly
spaced bins and for every :math:`0<=i<cDims` ``ranges[i]`` spaced bins and for every :math:`0<=i<cDims` ``ranges[i]``
is an array of two numbers: lower and upper boundaries for the i-th is an array of two numbers: lower and upper boundaries for the i-th
histogram dimension. histogram dimension.
The whole range [lower,upper] is then split The whole range [lower,upper] is then split
into ``dims[i]`` equal parts to determine the ``i``-th input into ``dims[i]`` equal parts to determine the ``i``-th input
tuple value ranges for every histogram bin. And if ``uniform=0`` , tuple value ranges for every histogram bin. And if ``uniform=0`` ,
then the ``i``-th element of the ``ranges`` array contains ``dims[i]+1`` elements: :math:`\texttt{lower}_0, \texttt{upper}_0, then the ``i``-th element of the ``ranges`` array contains ``dims[i]+1`` elements: :math:`\texttt{lower}_0, \texttt{upper}_0,
\texttt{lower}_1, \texttt{upper}_1 = \texttt{lower}_2, \texttt{lower}_1, \texttt{upper}_1 = \texttt{lower}_2,
... ...
\texttt{upper}_{dims[i]-1}` \texttt{upper}_{dims[i]-1}`
where :math:`\texttt{lower}_j` and :math:`\texttt{upper}_j` where :math:`\texttt{lower}_j` and :math:`\texttt{upper}_j`
are lower and upper are lower and upper
boundaries of the ``i``-th input tuple value for the ``j``-th boundaries of the ``i``-th input tuple value for the ``j``-th
bin, respectively. In either case, the input values that are beyond bin, respectively. In either case, the input values that are beyond
the specified range for a histogram bin are not counted by :ocv:cfunc:`CalcHist` and filled with 0 by :ocv:cfunc:`CalcBackProject`. the specified range for a histogram bin are not counted by :ocv:cfunc:`CalcHist` and filled with 0 by :ocv:cfunc:`CalcBackProject`.
The function creates a histogram of the specified size and returns a pointer to the created histogram. If the array ``ranges`` is 0, the histogram bin ranges must be specified later via the function :ocv:cfunc:`SetHistBinRanges`. Though :ocv:cfunc:`CalcHist` and :ocv:cfunc:`CalcBackProject` may process 8-bit images without setting bin ranges, they assume they are equally spaced in 0 to 255 bins. The function creates a histogram of the specified size and returns a pointer to the created histogram. If the array ``ranges`` is 0, the histogram bin ranges must be specified later via the function :ocv:cfunc:`SetHistBinRanges`. Though :ocv:cfunc:`CalcHist` and :ocv:cfunc:`CalcBackProject` may process 8-bit images without setting bin ranges, they assume they are equally spaced in 0 to 255 bins.
@ -416,27 +417,27 @@ Returns a pointer to the histogram bin.
.. ocv:cfunction:: float cvGetHistValue_3D(CvHistogram hist, int idx0, int idx1, int idx2) .. ocv:cfunction:: float cvGetHistValue_3D(CvHistogram hist, int idx0, int idx1, int idx2)
.. ocv:cfunction:: float cvGetHistValue_nD(CvHistogram hist, int idx) .. ocv:cfunction:: float cvGetHistValue_nD(CvHistogram hist, int idx)
:param hist: Histogram. :param hist: Histogram.
:param idx0: 0-th index. :param idx0: 0-th index.
:param idx1: 1-st index. :param idx1: 1-st index.
:param idx2: 2-nd index. :param idx2: 2-nd index.
:param idx: Array of indices. :param idx: Array of indices.
:: ::
#define cvGetHistValue_1D( hist, idx0 ) #define cvGetHistValue_1D( hist, idx0 )
((float*)(cvPtr1D( (hist)->bins, (idx0), 0 )) ((float*)(cvPtr1D( (hist)->bins, (idx0), 0 ))
#define cvGetHistValue_2D( hist, idx0, idx1 ) #define cvGetHistValue_2D( hist, idx0, idx1 )
((float*)(cvPtr2D( (hist)->bins, (idx0), (idx1), 0 ))) ((float*)(cvPtr2D( (hist)->bins, (idx0), (idx1), 0 )))
#define cvGetHistValue_3D( hist, idx0, idx1, idx2 ) #define cvGetHistValue_3D( hist, idx0, idx1, idx2 )
((float*)(cvPtr3D( (hist)->bins, (idx0), (idx1), (idx2), 0 ))) ((float*)(cvPtr3D( (hist)->bins, (idx0), (idx1), (idx2), 0 )))
#define cvGetHistValue_nD( hist, idx ) #define cvGetHistValue_nD( hist, idx )
((float*)(cvPtrND( (hist)->bins, (idx), 0 ))) ((float*)(cvPtrND( (hist)->bins, (idx), 0 )))
.. ..
@ -448,19 +449,19 @@ GetMinMaxHistValue
Finds the minimum and maximum histogram bins. Finds the minimum and maximum histogram bins.
.. ocv:cfunction:: void cvGetMinMaxHistValue( const CvHistogram* hist, float* min_value, float* max_value, int* min_idx=NULL, int* max_idx=NULL ) .. ocv:cfunction:: void cvGetMinMaxHistValue( const CvHistogram* hist, float* min_value, float* max_value, int* min_idx=NULL, int* max_idx=NULL )
.. ocv:pyoldfunction:: cv.GetMinMaxHistValue(hist)-> (minValue, maxValue, minIdx, maxIdx) .. ocv:pyoldfunction:: cv.GetMinMaxHistValue(hist)-> (min_value, max_value, min_idx, max_idx)
:param hist: Histogram. :param hist: Histogram.
:param min_value: Pointer to the minimum value of the histogram. :param min_value: Pointer to the minimum value of the histogram.
:param max_value: Pointer to the maximum value of the histogram. :param max_value: Pointer to the maximum value of the histogram.
:param min_idx: Pointer to the array of coordinates for the minimum. :param min_idx: Pointer to the array of coordinates for the minimum.
:param max_idx: Pointer to the array of coordinates for the maximum. :param max_idx: Pointer to the array of coordinates for the maximum.
The function finds the minimum and maximum histogram bins and their positions. All of output arguments are optional. Among several extremas with the same value the ones with the minimum index (in the lexicographical order) are returned. In case of several maximums or minimums, the earliest in the lexicographical order (extrema locations) is returned. The function finds the minimum and maximum histogram bins and their positions. All of output arguments are optional. Among several extremas with the same value the ones with the minimum index (in the lexicographical order) are returned. In case of several maximums or minimums, the earliest in the lexicographical order (extrema locations) is returned.
@ -469,19 +470,19 @@ MakeHistHeaderForArray
Makes a histogram out of an array. Makes a histogram out of an array.
.. ocv:cfunction:: CvHistogram* cvMakeHistHeaderForArray( int dims, int* sizes, CvHistogram* hist, float* data, float** ranges=NULL, int uniform=1 ) .. ocv:cfunction:: CvHistogram* cvMakeHistHeaderForArray( int dims, int* sizes, CvHistogram* hist, float* data, float** ranges=NULL, int uniform=1 )
:param dims: Number of the histogram dimensions. :param dims: Number of the histogram dimensions.
:param sizes: Array of the histogram dimension sizes. :param sizes: Array of the histogram dimension sizes.
:param hist: Histogram header initialized by the function. :param hist: Histogram header initialized by the function.
:param data: Array used to store histogram bins. :param data: Array used to store histogram bins.
:param ranges: Histogram bin ranges. See :ocv:cfunc:`CreateHist` for details. :param ranges: Histogram bin ranges. See :ocv:cfunc:`CreateHist` for details.
:param uniform: Uniformity flag. See :ocv:cfunc:`CreateHist` for details. :param uniform: Uniformity flag. See :ocv:cfunc:`CreateHist` for details.
The function initializes the histogram, whose header and bins are allocated by the user. :ocv:cfunc:`ReleaseHist` does not need to be called afterwards. Only dense histograms can be initialized this way. The function returns ``hist``. The function initializes the histogram, whose header and bins are allocated by the user. :ocv:cfunc:`ReleaseHist` does not need to be called afterwards. Only dense histograms can be initialized this way. The function returns ``hist``.
NormalizeHist NormalizeHist
@ -490,11 +491,11 @@ Normalizes the histogram.
.. ocv:cfunction:: void cvNormalizeHist( CvHistogram* hist, double factor ) .. ocv:cfunction:: void cvNormalizeHist( CvHistogram* hist, double factor )
.. ocv:pyoldfunction:: cv.NormalizeHist(hist, factor)-> None .. ocv:pyoldfunction:: cv.NormalizeHist(hist, factor)-> None
:param hist: Pointer to the histogram. :param hist: Pointer to the histogram.
:param factor: Normalization factor. :param factor: Normalization factor.
The function normalizes the histogram bins by scaling them so that the sum of the bins becomes equal to ``factor``. The function normalizes the histogram bins by scaling them so that the sum of the bins becomes equal to ``factor``.
@ -510,17 +511,17 @@ Queries the value of the histogram bin.
.. ocv:pyoldfunction:: cv.QueryHistValue_1D(hist, idx0) -> float .. ocv:pyoldfunction:: cv.QueryHistValue_1D(hist, idx0) -> float
.. ocv:pyoldfunction:: cv.QueryHistValue_2D(hist, idx0, idx1) -> float .. ocv:pyoldfunction:: cv.QueryHistValue_2D(hist, idx0, idx1) -> float
.. ocv:pyoldfunction:: cv.QueryHistValue_3D(hist, idx0, idx1, idx2) -> float .. ocv:pyoldfunction:: cv.QueryHistValue_3D(hist, idx0, idx1, idx2) -> float
.. ocv:pyoldfunction:: cv.QueryHistValueND(hist, idx) -> float .. ocv:pyoldfunction:: cv.QueryHistValue_nD(hist, idx) -> float
:param hist: Histogram.
:param hist: Histogram.
:param idx0: 0-th index. :param idx0: 0-th index.
:param idx1: 1-st index. :param idx1: 1-st index.
:param idx2: 2-nd index. :param idx2: 2-nd index.
:param idx: Array of indices. :param idx: Array of indices.
The macros return the value of the specified bin of the 1D, 2D, 3D, or N-D histogram. In case of a sparse histogram, the function returns 0. If the bin is not present in the histogram, no new bin is created. The macros return the value of the specified bin of the 1D, 2D, 3D, or N-D histogram. In case of a sparse histogram, the function returns 0. If the bin is not present in the histogram, no new bin is created.
@ -529,9 +530,9 @@ ReleaseHist
Releases the histogram. Releases the histogram.
.. ocv:cfunction:: void cvReleaseHist( CvHistogram** hist ) .. ocv:cfunction:: void cvReleaseHist( CvHistogram** hist )
:param hist: Double pointer to the released histogram. :param hist: Double pointer to the released histogram.
The function releases the histogram (header and the data). The pointer to the histogram is cleared by the function. If ``*hist`` pointer is already ``NULL``, the function does nothing. The function releases the histogram (header and the data). The pointer to the histogram is cleared by the function. If ``*hist`` pointer is already ``NULL``, the function does nothing.
@ -541,12 +542,12 @@ Sets the bounds of the histogram bins.
.. ocv:cfunction:: void cvSetHistBinRanges( CvHistogram* hist, float** ranges, int uniform=1 ) .. ocv:cfunction:: void cvSetHistBinRanges( CvHistogram* hist, float** ranges, int uniform=1 )
:param hist: Histogram. :param hist: Histogram.
:param ranges: Array of bin ranges arrays. See :ocv:cfunc:`CreateHist` for details. :param ranges: Array of bin ranges arrays. See :ocv:cfunc:`CreateHist` for details.
:param uniform: Uniformity flag. See :ocv:cfunc:`CreateHist` for details. :param uniform: Uniformity flag. See :ocv:cfunc:`CreateHist` for details.
This is a standalone function for setting bin ranges in the histogram. For a more detailed description of the parameters ``ranges`` and ``uniform``, see the :ocv:cfunc:`CalcHist` function that can initialize the ranges as well. Ranges for the histogram bins must be set before the histogram is calculated or the backproject of the histogram is calculated. This is a standalone function for setting bin ranges in the histogram. For a more detailed description of the parameters ``ranges`` and ``uniform``, see the :ocv:cfunc:`CalcHist` function that can initialize the ranges as well. Ranges for the histogram bins must be set before the histogram is calculated or the backproject of the histogram is calculated.
@ -555,12 +556,12 @@ ThreshHist
Thresholds the histogram. Thresholds the histogram.
.. ocv:cfunction:: void cvThreshHist( CvHistogram* hist, double threshold ) .. ocv:cfunction:: void cvThreshHist( CvHistogram* hist, double threshold )
.. ocv:pyoldfunction:: cv.ThreshHist(hist, threshold)-> None .. ocv:pyoldfunction:: cv.ThreshHist(hist, threshold) -> None
:param hist: Pointer to the histogram. :param hist: Pointer to the histogram.
:param threshold: Threshold level. :param threshold: Threshold level.
The function clears histogram bins that are below the specified threshold. The function clears histogram bins that are below the specified threshold.
@ -569,12 +570,11 @@ CalcPGH
Calculates a pair-wise geometrical histogram for a contour. Calculates a pair-wise geometrical histogram for a contour.
.. ocv:cfunction:: void cvCalcPGH( const CvSeq* contour, CvHistogram* hist ) .. ocv:cfunction:: void cvCalcPGH( const CvSeq* contour, CvHistogram* hist )
.. ocv:pyoldfunction:: cv.CalcPGH(contour, hist)-> None
:param contour: Input contour. Currently, only integer point coordinates are allowed.
:param contour: Input contour. Currently, only integer point coordinates are allowed.
:param hist: Calculated histogram. It must be two-dimensional.
:param hist: Calculated histogram. It must be two-dimensional.
The function calculates a 2D pair-wise geometrical histogram (PGH), described in [Iivarinen97]_ for the contour. The algorithm considers every pair of contour The function calculates a 2D pair-wise geometrical histogram (PGH), described in [Iivarinen97]_ for the contour. The algorithm considers every pair of contour
edges. The angle between the edges and the minimum/maximum distances edges. The angle between the edges and the minimum/maximum distances
are determined for every pair. To do this, each of the edges in turn are determined for every pair. To do this, each of the edges in turn

View File

@ -12,19 +12,20 @@ Applies an adaptive threshold to an array.
.. ocv:pyfunction:: cv2.adaptiveThreshold(src, maxValue, adaptiveMethod, thresholdType, blockSize, C[, dst]) -> dst .. ocv:pyfunction:: cv2.adaptiveThreshold(src, maxValue, adaptiveMethod, thresholdType, blockSize, C[, dst]) -> dst
.. ocv:cfunction:: void cvAdaptiveThreshold( const CvArr* src, CvArr* dst, double maxValue, int adaptiveMethod=CV_ADAPTIVE_THRESH_MEAN_C, int thresholdType=CV_THRESH_BINARY, int blockSize=3, double param1=5 ) .. ocv:cfunction:: void cvAdaptiveThreshold( const CvArr* src, CvArr* dst, double max_value, int adaptive_method=CV_ADAPTIVE_THRESH_MEAN_C, int threshold_type=CV_THRESH_BINARY, int block_size=3, double param1=5 )
.. ocv:pyoldfunction:: cv.AdaptiveThreshold(src, dst, maxValue, adaptiveMethod=CV_ADAPTIVE_THRESH_MEAN_C, thresholdType=CV_THRESH_BINARY, blockSize=3, param1=5)-> None
.. ocv:pyoldfunction:: cv.AdaptiveThreshold(src, dst, maxValue, adaptive_method=CV_ADAPTIVE_THRESH_MEAN_C, thresholdType=CV_THRESH_BINARY, blockSize=3, param1=5)-> None
:param src: Source 8-bit single-channel image. :param src: Source 8-bit single-channel image.
:param dst: Destination image of the same size and the same type as ``src`` . :param dst: Destination image of the same size and the same type as ``src`` .
:param maxValue: Non-zero value assigned to the pixels for which the condition is satisfied. See the details below. :param maxValue: Non-zero value assigned to the pixels for which the condition is satisfied. See the details below.
:param adaptiveMethod: Adaptive thresholding algorithm to use, ``ADAPTIVE_THRESH_MEAN_C`` or ``ADAPTIVE_THRESH_GAUSSIAN_C`` . See the details below. :param adaptiveMethod: Adaptive thresholding algorithm to use, ``ADAPTIVE_THRESH_MEAN_C`` or ``ADAPTIVE_THRESH_GAUSSIAN_C`` . See the details below.
:param thresholdType: Thresholding type that must be either ``THRESH_BINARY`` or ``THRESH_BINARY_INV`` . :param thresholdType: Thresholding type that must be either ``THRESH_BINARY`` or ``THRESH_BINARY_INV`` .
:param blockSize: Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on. :param blockSize: Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on.
:param C: Constant subtracted from the mean or weighted mean (see the details below). Normally, it is positive but may be zero or negative as well. :param C: Constant subtracted from the mean or weighted mean (see the details below). Normally, it is positive but may be zero or negative as well.
@ -83,7 +84,7 @@ Converts an image from one color space to another.
:param src: Source image: 8-bit unsigned, 16-bit unsigned ( ``CV_16UC...`` ), or single-precision floating-point. :param src: Source image: 8-bit unsigned, 16-bit unsigned ( ``CV_16UC...`` ), or single-precision floating-point.
:param dst: Destination image of the same size and depth as ``src`` . :param dst: Destination image of the same size and depth as ``src`` .
:param code: Color space conversion code. See the description below. :param code: Color space conversion code. See the description below.
:param dstCn: Number of channels in the destination image. If the parameter is 0, the number of the channels is derived automatically from ``src`` and ``code`` . :param dstCn: Number of channels in the destination image. If the parameter is 0, the number of the channels is derived automatically from ``src`` and ``code`` .
@ -98,7 +99,7 @@ The conventional ranges for R, G, and B channel values are:
0 to 255 for ``CV_8U`` images 0 to 255 for ``CV_8U`` images
* *
0 to 65535 for ``CV_16U`` images 0 to 65535 for ``CV_16U`` images
* *
0 to 1 for ``CV_32F`` images 0 to 1 for ``CV_32F`` images
@ -414,22 +415,22 @@ Calculates the distance to the closest zero pixel for each pixel of the source i
.. ocv:function:: void distanceTransform( InputArray src, OutputArray dst, OutputArray labels, int distanceType, int maskSize, int labelType=DIST_LABEL_CCOMP ) .. ocv:function:: void distanceTransform( InputArray src, OutputArray dst, OutputArray labels, int distanceType, int maskSize, int labelType=DIST_LABEL_CCOMP )
.. ocv:pyfunction:: cv2.distanceTransform(src, distanceType, maskSize[, dst[, labels[, labelType=cv2.DIST_LABEL_CCOMP]]]) -> dst, labels .. ocv:pyfunction:: cv2.distanceTransform(src, distanceType, maskSize[, dst]) -> dst
.. ocv:cfunction:: void cvDistTransform( const CvArr* src, CvArr* dst, int distanceType=CV_DIST_L2, int maskSize=3, const float* mask=NULL, CvArr* labels=NULL, int labelType=CV_DIST_LABEL_CCOMP ) .. ocv:cfunction:: void cvDistTransform( const CvArr* src, CvArr* dst, int distance_type=CV_DIST_L2, int mask_size=3, const float* mask=NULL, CvArr* labels=NULL, int labelType=CV_DIST_LABEL_CCOMP )
.. ocv:pyoldfunction:: cv.DistTransform(src, dst, distanceType=CV_DIST_L2, maskSize=3, mask=None, labels=None)-> None .. ocv:pyoldfunction:: cv.DistTransform(src, dst, distance_type=CV_DIST_L2, mask_size=3, mask=None, labels=None) -> None
:param src: 8-bit, single-channel (binary) source image. :param src: 8-bit, single-channel (binary) source image.
:param dst: Output image with calculated distances. It is a 32-bit floating-point, single-channel image of the same size as ``src`` . :param dst: Output image with calculated distances. It is a 32-bit floating-point, single-channel image of the same size as ``src`` .
:param distanceType: Type of distance. It can be ``CV_DIST_L1, CV_DIST_L2`` , or ``CV_DIST_C`` . :param distanceType: Type of distance. It can be ``CV_DIST_L1, CV_DIST_L2`` , or ``CV_DIST_C`` .
:param maskSize: Size of the distance transform mask. It can be 3, 5, or ``CV_DIST_MASK_PRECISE`` (the latter option is only supported by the first function). In case of the ``CV_DIST_L1`` or ``CV_DIST_C`` distance type, the parameter is forced to 3 because a :math:`3\times 3` mask gives the same result as :math:`5\times 5` or any larger aperture. :param maskSize: Size of the distance transform mask. It can be 3, 5, or ``CV_DIST_MASK_PRECISE`` (the latter option is only supported by the first function). In case of the ``CV_DIST_L1`` or ``CV_DIST_C`` distance type, the parameter is forced to 3 because a :math:`3\times 3` mask gives the same result as :math:`5\times 5` or any larger aperture.
:param labels: Optional output 2D array of labels (the discrete Voronoi diagram). It has the type ``CV_32SC1`` and the same size as ``src`` . See the details below. :param labels: Optional output 2D array of labels (the discrete Voronoi diagram). It has the type ``CV_32SC1`` and the same size as ``src`` . See the details below.
:param labelType: Type of the label array to build. If ``labelType==DIST_LABEL_CCOMP`` then each connected component of zeros in ``src`` (as well as all the non-zero pixels closest to the connected component) will be assigned the same label. If ``labelType==DIST_LABEL_PIXEL`` then each zero pixel (and all the non-zero pixels closest to it) gets its own label. :param labelType: Type of the label array to build. If ``labelType==DIST_LABEL_CCOMP`` then each connected component of zeros in ``src`` (as well as all the non-zero pixels closest to the connected component) will be assigned the same label. If ``labelType==DIST_LABEL_PIXEL`` then each zero pixel (and all the non-zero pixels closest to it) gets its own label.
The functions ``distanceTransform`` calculate the approximate or precise The functions ``distanceTransform`` calculate the approximate or precise
@ -483,18 +484,18 @@ floodFill
------------- -------------
Fills a connected component with the given color. Fills a connected component with the given color.
.. ocv:function:: int floodFill( InputOutputArray image, Point seed, Scalar newVal, Rect* rect=0, Scalar loDiff=Scalar(), Scalar upDiff=Scalar(), int flags=4 ) .. ocv:function:: int floodFill( InputOutputArray image, Point seedPoint, Scalar newVal, Rect* rect=0, Scalar loDiff=Scalar(), Scalar upDiff=Scalar(), int flags=4 )
.. ocv:function:: int floodFill( InputOutputArray image, InputOutputArray mask, Point seed, Scalar newVal, Rect* rect=0, Scalar loDiff=Scalar(), Scalar upDiff=Scalar(), int flags=4 ) .. ocv:function:: int floodFill( InputOutputArray image, InputOutputArray mask, Point seedPoint, Scalar newVal, Rect* rect=0, Scalar loDiff=Scalar(), Scalar upDiff=Scalar(), int flags=4 )
.. ocv:pyfunction:: cv2.floodFill(image, mask, seedPoint, newVal[, loDiff[, upDiff[, flags]]]) -> retval, rect .. ocv:pyfunction:: cv2.floodFill(image, mask, seedPoint, newVal[, loDiff[, upDiff[, flags]]]) -> retval, rect
.. ocv:cfunction:: void cvFloodFill( CvArr* image, CvPoint seedPoint, CvScalar newVal, CvScalar loDiff=cvScalarAll(0), CvScalar upDiff=cvScalarAll(0), CvConnectedComp* comp=NULL, int flags=4, CvArr* mask=NULL ) .. ocv:cfunction:: void cvFloodFill( CvArr* image, CvPoint seed_point, CvScalar new_val, CvScalar lo_diff=cvScalarAll(0), CvScalar up_diff=cvScalarAll(0), CvConnectedComp* comp=NULL, int flags=4, CvArr* mask=NULL )
.. ocv:pyoldfunction:: cv.FloodFill(image, seedPoint, newVal, loDiff=(0, 0, 0, 0), upDiff=(0, 0, 0, 0), flags=4, mask=None)-> comp .. ocv:pyoldfunction:: cv.FloodFill(image, seed_point, new_val, lo_diff=(0, 0, 0, 0), up_diff=(0, 0, 0, 0), flags=4, mask=None)-> comp
:param image: Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the function unless the ``FLOODFILL_MASK_ONLY`` flag is set in the second variant of the function. See the details below. :param image: Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the function unless the ``FLOODFILL_MASK_ONLY`` flag is set in the second variant of the function. See the details below.
:param mask: (For the second function only) Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels taller. The function uses and updates the mask, so you take responsibility of initializing the ``mask`` content. Flood-filling cannot go across non-zero pixels in the mask. For example, an edge detector output can be used as a mask to stop filling at edges. It is possible to use the same mask in multiple calls to the function to make sure the filled area does not overlap. :param mask: (For the second function only) Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels taller. The function uses and updates the mask, so you take responsibility of initializing the ``mask`` content. Flood-filling cannot go across non-zero pixels in the mask. For example, an edge detector output can be used as a mask to stop filling at edges. It is possible to use the same mask in multiple calls to the function to make sure the filled area does not overlap.
.. 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`` . .. 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`` .
@ -517,14 +518,14 @@ Fills a connected component with the given color.
The functions ``floodFill`` fill a connected component starting from the seed point with the specified color. The connectivity is determined by the color/brightness closeness of the neighbor pixels. The pixel at The functions ``floodFill`` fill a connected component starting from the seed point with the specified color. The connectivity is determined by the color/brightness closeness of the neighbor pixels. The pixel at
:math:`(x,y)` is considered to belong to the repainted domain if: :math:`(x,y)` is considered to belong to the repainted domain if:
* *
.. math:: .. math::
\texttt{src} (x',y')- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} (x',y')+ \texttt{upDiff} \texttt{src} (x',y')- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} (x',y')+ \texttt{upDiff}
in case of a grayscale image and floating range in case of a grayscale image and floating range
* *
.. math:: .. math::
@ -541,7 +542,7 @@ The functions ``floodFill`` fill a connected component starting from the seed po
.. math:: .. math::
\texttt{src} (x',y')_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} (x',y')_g+ \texttt{upDiff} _g \texttt{src} (x',y')_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} (x',y')_g+ \texttt{upDiff} _g
and and
.. math:: .. math::
@ -588,11 +589,11 @@ integral
------------ ------------
Calculates the integral of an image. Calculates the integral of an image.
.. ocv:function:: void integral( InputArray image, OutputArray sum, int sdepth=-1 ) .. ocv:function:: void integral( InputArray src, OutputArray sum, int sdepth=-1 )
.. ocv:function:: void integral( InputArray image, OutputArray sum, OutputArray sqsum, int sdepth=-1 ) .. ocv:function:: void integral( InputArray src, OutputArray sum, OutputArray sqsum, int sdepth=-1 )
.. ocv:function:: void integral( InputArray image, OutputArray sum, OutputArray sqsum, OutputArray tilted, int sdepth=-1 ) .. ocv:function:: void integral( InputArray src, OutputArray sum, OutputArray sqsum, OutputArray tilted, int sdepth=-1 )
.. ocv:pyfunction:: cv2.integral(src[, sum[, sdepth]]) -> sum .. ocv:pyfunction:: cv2.integral(src[, sum[, sdepth]]) -> sum
@ -600,7 +601,8 @@ Calculates the integral of an image.
.. ocv:pyfunction:: cv2.integral3(src[, sum[, sqsum[, tilted[, sdepth]]]]) -> sum, sqsum, tilted .. ocv:pyfunction:: cv2.integral3(src[, sum[, sqsum[, tilted[, sdepth]]]]) -> sum, sqsum, tilted
.. ocv:cfunction:: void cvIntegral( const CvArr* image, CvArr* sum, CvArr* sqsum=NULL, CvArr* tiltedSum=NULL ) .. ocv:cfunction:: void cvIntegral( const CvArr* image, CvArr* sum, CvArr* sqsum=NULL, CvArr* tilted_sum=NULL )
.. ocv:pyoldfunction:: cv.Integral(image, sum, sqsum=None, tiltedSum=None)-> None .. ocv:pyoldfunction:: cv.Integral(image, sum, sqsum=None, tiltedSum=None)-> None
:param image: Source image as :math:`W \times H` , 8-bit or floating-point (32f or 64f). :param image: Source image as :math:`W \times H` , 8-bit or floating-point (32f or 64f).
@ -610,7 +612,7 @@ Calculates the integral of an image.
:param sqsum: Integral image for squared pixel values. It is :math:`(W+1)\times (H+1)`, double-precision floating-point (64f) array. :param sqsum: Integral image for squared pixel values. It is :math:`(W+1)\times (H+1)`, double-precision floating-point (64f) array.
:param tilted: Integral for the image rotated by 45 degrees. It is :math:`(W+1)\times (H+1)` array with the same data type as ``sum``. :param tilted: Integral for the image rotated by 45 degrees. It is :math:`(W+1)\times (H+1)` array with the same data type as ``sum``.
:param sdepth: Desired depth of the integral and the tilted integral images, ``CV_32S``, ``CV_32F``, or ``CV_64F``. :param sdepth: Desired depth of the integral and the tilted integral images, ``CV_32S``, ``CV_32F``, or ``CV_64F``.
The functions calculate one or more integral images for the source image as follows: The functions calculate one or more integral images for the source image as follows:
@ -647,17 +649,18 @@ threshold
------------- -------------
Applies a fixed-level threshold to each array element. Applies a fixed-level threshold to each array element.
.. ocv:function:: double threshold( InputArray src, OutputArray dst, double thresh, double maxVal, int thresholdType ) .. ocv:function:: double threshold( InputArray src, OutputArray dst, double thresh, double maxval, int type )
.. ocv:pyfunction:: cv2.threshold(src, thresh, maxval, type[, dst]) -> retval, dst .. ocv:pyfunction:: cv2.threshold(src, thresh, maxval, type[, dst]) -> retval, dst
.. ocv:cfunction:: double cvThreshold( const CvArr* src, CvArr* dst, double threshold, double maxValue, int thresholdType ) .. ocv:cfunction:: double cvThreshold( const CvArr* src, CvArr* dst, double threshold, double max_value, int threshold_type )
.. ocv:pyoldfunction:: cv.Threshold(src, dst, threshold, maxValue, thresholdType)-> None .. ocv:pyoldfunction:: cv.Threshold(src, dst, threshold, maxValue, thresholdType)-> None
:param src: Source array (single-channel, 8-bit of 32-bit floating point). :param src: Source array (single-channel, 8-bit of 32-bit floating point).
:param dst: Destination array of the same size and type as ``src`` . :param dst: Destination array of the same size and type as ``src`` .
:param thresh: Threshold value. :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.
@ -706,7 +709,7 @@ Also, the special value ``THRESH_OTSU`` may be combined with
one of the above values. In this case, the function determines the optimal threshold one of the above values. In this case, the function determines the optimal threshold
value using the Otsu's algorithm and uses it instead of the specified ``thresh`` . value using the Otsu's algorithm and uses it instead of the specified ``thresh`` .
The function returns the computed threshold value. The function returns the computed threshold value.
Currently, the Otsu's method is implemented only for 8-bit images. Currently, the Otsu's method is implemented only for 8-bit images.
.. image:: pics/threshold.png .. image:: pics/threshold.png
@ -748,7 +751,7 @@ grabCut
------- -------
Runs the GrabCut algorithm. Runs the GrabCut algorithm.
.. ocv:function:: void grabCut(InputArray image, InputOutputArray mask, Rect rect, InputOutputArray bgdModel, InputOutputArray fgdModel, int iterCount, int mode ) .. ocv:function:: void grabCut( InputArray img, InputOutputArray mask, Rect rect, InputOutputArray bgdModel, InputOutputArray fgdModel, int iterCount, int mode=GC_EVAL )
.. ocv:pyfunction:: cv2.grabCut(img, mask, rect, bgdModel, fgdModel, iterCount[, mode]) -> None .. ocv:pyfunction:: cv2.grabCut(img, mask, rect, bgdModel, fgdModel, iterCount[, mode]) -> None
@ -765,13 +768,13 @@ Runs the GrabCut algorithm.
* **GC_PR_BGD** defines a possible foreground pixel. * **GC_PR_BGD** defines a possible foreground pixel.
:param rect: ROI containing a segmented object. The pixels outside of the ROI are marked as "obvious background". The parameter is only used when ``mode==GC_INIT_WITH_RECT`` . :param rect: ROI containing a segmented object. The pixels outside of the ROI are marked as "obvious background". The parameter is only used when ``mode==GC_INIT_WITH_RECT`` .
:param bgdModel: Temporary array for the background model. Do not modify it while you are processing the same image. :param bgdModel: Temporary array for the background model. Do not modify it while you are processing the same image.
:param fgdModel: Temporary arrays for the foreground model. Do not modify it while you are processing the same image. :param fgdModel: Temporary arrays for the foreground model. Do not modify it while you are processing the same image.
:param iterCount: Number of iterations the algorithm should make before returning the result. Note that the result can be refined with further calls with ``mode==GC_INIT_WITH_MASK`` or ``mode==GC_EVAL`` . :param iterCount: Number of iterations the algorithm should make before returning the result. Note that the result can be refined with further calls with ``mode==GC_INIT_WITH_MASK`` or ``mode==GC_EVAL`` .
:param mode: Operation mode that could be one of the following: :param mode: Operation mode that could be one of the following:
* **GC_INIT_WITH_RECT** The function initializes the state and the mask using the provided rectangle. After that it runs ``iterCount`` iterations of the algorithm. * **GC_INIT_WITH_RECT** The function initializes the state and the mask using the provided rectangle. After that it runs ``iterCount`` iterations of the algorithm.

View File

@ -11,8 +11,9 @@ Adds an image to the accumulator.
.. ocv:pyfunction:: cv2.accumulate(src, dst[, mask]) -> None .. ocv:pyfunction:: cv2.accumulate(src, dst[, mask]) -> None
.. ocv:cfunction:: void cvAcc( const CvArr* src, CvArr* dst, const CvArr* mask=NULL ) .. ocv:cfunction:: void cvAcc( const CvArr* image, CvArr* sum, const CvArr* mask=NULL )
.. ocv:pyoldfunction:: cv.Acc(src, dst, mask=None)-> None
.. ocv:pyoldfunction:: cv.Acc(image, sum, mask=None) -> None
:param src: Input image as 1- or 3-channel, 8-bit or 32-bit floating point. :param src: Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
@ -46,8 +47,9 @@ Adds the square of a source image to the accumulator.
.. ocv:pyfunction:: cv2.accumulateSquare(src, dst[, mask]) -> None .. ocv:pyfunction:: cv2.accumulateSquare(src, dst[, mask]) -> None
.. ocv:cfunction:: void cvSquareAcc( const CvArr* src, CvArr* dst, const CvArr* mask=NULL ) .. ocv:cfunction:: void cvSquareAcc( const CvArr* image, CvArr* sqsum, const CvArr* mask=NULL )
.. ocv:pyoldfunction:: cv.SquareAcc(src, dst, mask=None)-> None
.. ocv:pyoldfunction:: cv.SquareAcc(image, sqsum, mask=None) -> None
:param src: Input image as 1- or 3-channel, 8-bit or 32-bit floating point. :param src: Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
@ -79,13 +81,14 @@ Adds the per-element product of two input images to the accumulator.
.. ocv:pyfunction:: cv2.accumulateProduct(src1, src2, dst[, mask]) -> None .. ocv:pyfunction:: cv2.accumulateProduct(src1, src2, dst[, mask]) -> None
.. ocv:cfunction:: void cvMultiplyAcc( const CvArr* src1, const CvArr* src2, CvArr* dst, const CvArr* mask=NULL ) .. ocv:cfunction:: void cvMultiplyAcc( const CvArr* image1, const CvArr* image2, CvArr* acc, const CvArr* mask=NULL )
.. ocv:pyoldfunction:: cv.MultiplyAcc(src1, src2, dst, mask=None)-> None
.. ocv:pyoldfunction:: cv.MultiplyAcc(image1, image2, acc, mask=None)-> None
:param src1: First input image, 1- or 3-channel, 8-bit or 32-bit floating point. :param src1: First input image, 1- or 3-channel, 8-bit or 32-bit floating point.
:param src2: Second input image of the same type and the same size as ``src1`` . :param src2: Second input image of the same type and the same size as ``src1`` .
:param dst: Accumulator with the same number of channels as input images, 32-bit or 64-bit floating-point. :param dst: Accumulator with the same number of channels as input images, 32-bit or 64-bit floating-point.
:param mask: Optional operation mask. :param mask: Optional operation mask.
@ -114,8 +117,8 @@ Updates a running average.
.. ocv:pyfunction:: cv2.accumulateWeighted(src, dst, alpha[, mask]) -> None .. ocv:pyfunction:: cv2.accumulateWeighted(src, dst, alpha[, mask]) -> None
.. ocv:cfunction:: void cvRunningAvg( const CvArr* src, CvArr* dst, double alpha, const CvArr* mask=NULL ) .. ocv:cfunction:: void cvRunningAvg( const CvArr* image, CvArr* acc, double alpha, const CvArr* mask=NULL )
.. ocv:pyoldfunction:: cv.RunningAvg(src, dst, alpha, mask=None)-> None .. ocv:pyoldfunction:: cv.RunningAvg(image, acc, alpha, mask=None)-> None
:param src: Input image as 1- or 3-channel, 8-bit or 32-bit floating point. :param src: Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
@ -138,7 +141,7 @@ The function supports multi-channel images. Each channel is processed independen
:ocv:func:`accumulate`, :ocv:func:`accumulate`,
:ocv:func:`accumulateSquare`, :ocv:func:`accumulateSquare`,
:ocv:func:`accumulateProduct` :ocv:func:`accumulateProduct`
@ -206,7 +209,7 @@ This function computes a Hanning window coefficients in two dimensions. See http
An example is shown below: :: An example is shown below: ::
// create hanning window of size 100x100 and type CV_32F // create hanning window of size 100x100 and type CV_32F
Mat hann; Mat hann;
createHanningWindow(hann, Size(100, 100), CV_32F); createHanningWindow(hann, Size(100, 100), CV_32F);

View File

@ -7,7 +7,7 @@ matchTemplate
----------------- -----------------
Compares a template against overlapped image regions. Compares a template against overlapped image regions.
.. ocv:function:: void matchTemplate( InputArray image, InputArray temp, OutputArray result, int method ) .. ocv:function:: void matchTemplate( InputArray image, InputArray templ, OutputArray result, int method )
.. ocv:pyfunction:: cv2.matchTemplate(image, templ, method[, result]) -> result .. ocv:pyfunction:: cv2.matchTemplate(image, templ, method[, result]) -> result
@ -19,7 +19,7 @@ Compares a template against overlapped image regions.
:param templ: Searched template. It must be not greater than the source image and have the same data type. :param templ: Searched template. It must be not greater than the source image and have the same data type.
:param result: Map of comparison results. It must be single-channel 32-bit floating-point. If ``image`` is :math:`W \times H` and ``templ`` is :math:`w \times h` , then ``result`` is :math:`(W-w+1) \times (H-h+1)` . :param result: Map of comparison results. It must be single-channel 32-bit floating-point. If ``image`` is :math:`W \times H` and ``templ`` is :math:`w \times h` , then ``result`` is :math:`(W-w+1) \times (H-h+1)` .
:param method: Parameter specifying the comparison method (see below). :param method: Parameter specifying the comparison method (see below).
The function slides through ``image`` , compares the The function slides through ``image`` , compares the

View File

@ -11,13 +11,14 @@ Calculates all of the moments up to the third order of a polygon or rasterized s
.. ocv:pyfunction:: cv2.moments(array[, binaryImage]) -> retval .. ocv:pyfunction:: cv2.moments(array[, binaryImage]) -> retval
.. ocv:cfunction:: void cvMoments( const CvArr* array, CvMoments* moments, int binary=0 ) .. ocv:cfunction:: void cvMoments( const CvArr* arr, CvMoments* moments, int binary=0 )
.. ocv:pyoldfunction:: cv.Moments(array, binary=0) -> moments
.. ocv:pyoldfunction:: cv.Moments(arr, binary=0) -> moments
:param array: Raster image (single-channel, 8-bit or floating-point 2D array) or an array ( :math:`1 \times N` or :math:`N \times 1` ) of 2D points (``Point`` or ``Point2f`` ). :param array: Raster image (single-channel, 8-bit or floating-point 2D array) or an array ( :math:`1 \times N` or :math:`N \times 1` ) of 2D points (``Point`` or ``Point2f`` ).
:param binaryImage: If it is true, all non-zero image pixels are treated as 1's. The parameter is used for images only. :param binaryImage: If it is true, all non-zero image pixels are treated as 1's. The parameter is used for images only.
:param moments: Output moments. :param moments: Output moments.
The function computes moments, up to the 3rd order, of a vector shape or a rasterized shape. The results are returned in the structure ``Moments`` defined as: :: The function computes moments, up to the 3rd order, of a vector shape or a rasterized shape. The results are returned in the structure ``Moments`` defined as: ::
@ -30,7 +31,7 @@ The function computes moments, up to the 3rd order, of a vector shape or a raste
double m02, double m30, double m21, double m12, double m03 ); double m02, double m30, double m21, double m12, double m03 );
Moments( const CvMoments& moments ); Moments( const CvMoments& moments );
operator CvMoments() const; operator CvMoments() const;
// spatial moments // spatial moments
double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03;
// central moments // central moments
@ -69,7 +70,7 @@ The normalized central moments
.. note:: .. note::
:math:`\texttt{mu}_{00}=\texttt{m}_{00}`, :math:`\texttt{mu}_{00}=\texttt{m}_{00}`,
:math:`\texttt{nu}_{00}=1` :math:`\texttt{nu}_{00}=1`
:math:`\texttt{nu}_{10}=\texttt{mu}_{10}=\texttt{mu}_{01}=\texttt{mu}_{10}=0` , hence the values are not stored. :math:`\texttt{nu}_{10}=\texttt{mu}_{10}=\texttt{mu}_{01}=\texttt{mu}_{10}=0` , hence the values are not stored.
The moments of a contour are defined in the same way but computed using the Green's formula (see http://en.wikipedia.org/wiki/Green_theorem). So, due to a limited raster resolution, the moments computed for a contour are slightly different from the moments computed for the same rasterized contour. The moments of a contour are defined in the same way but computed using the Green's formula (see http://en.wikipedia.org/wiki/Green_theorem). So, due to a limited raster resolution, the moments computed for a contour are slightly different from the moments computed for the same rasterized contour.
@ -89,11 +90,13 @@ HuMoments
------------- -------------
Calculates seven Hu invariants. Calculates seven Hu invariants.
.. ocv:function:: void HuMoments( const Moments& moments, double* hu ) .. ocv:function:: void HuMoments( const Moments& m, OutputArray hu )
.. ocv:pyfunction:: cv2.HuMoments(m) -> hu .. ocv:function:: void HuMoments( const Moments& moments, double hu[7] )
.. ocv:cfunction:: void cvGetHuMoments( const CvMoments* moments, CvHuMoments* hu ) .. ocv:pyfunction:: cv2.HuMoments(m[, hu]) -> hu
.. ocv:cfunction:: void cvGetHuMoments( CvMoments* moments, CvHuMoments* hu_moments )
.. ocv:pyoldfunction:: cv.GetHuMoments(moments) -> hu .. ocv:pyoldfunction:: cv.GetHuMoments(moments) -> hu
@ -126,9 +129,9 @@ Finds contours in a binary image.
.. ocv:pyfunction:: cv2.findContours(image, mode, method[, contours[, hierarchy[, offset]]]) -> contours, hierarchy .. ocv:pyfunction:: cv2.findContours(image, mode, method[, contours[, hierarchy[, offset]]]) -> contours, hierarchy
.. ocv:cfunction:: int cvFindContours( CvArr* image, CvMemStorage* storage, CvSeq** firstContour, int headerSize=sizeof(CvContour), int mode=CV_RETR_LIST, int method=CV_CHAIN_APPROX_SIMPLE, CvPoint offset=cvPoint(0, 0) ) .. ocv:cfunction:: int cvFindContours( CvArr* image, CvMemStorage* storage, CvSeq** first_contour, int header_size=sizeof(CvContour), int mode=CV_RETR_LIST, int method=CV_CHAIN_APPROX_SIMPLE, CvPoint offset=cvPoint(0,0) )
.. ocv:pyoldfunction:: cv.FindContours(image, storage, mode=CV_RETR_LIST, method=CV_CHAIN_APPROX_SIMPLE, offset=(0, 0)) -> cvseq .. ocv:pyoldfunction:: cv.FindContours(image, storage, mode=CV_RETR_LIST, method=CV_CHAIN_APPROX_SIMPLE, offset=(0, 0)) -> contours
:param image: Source, an 8-bit single-channel image. Non-zero pixels are treated as 1's. Zero pixels remain 0's, so the image is treated as ``binary`` . You can use :ocv:func:`compare` , :ocv:func:`inRange` , :ocv:func:`threshold` , :ocv:func:`adaptiveThreshold` , :ocv:func:`Canny` , and others to create a binary image out of a grayscale or color one. The function modifies the ``image`` while extracting the contours. :param image: Source, an 8-bit single-channel image. Non-zero pixels are treated as 1's. Zero pixels remain 0's, so the image is treated as ``binary`` . You can use :ocv:func:`compare` , :ocv:func:`inRange` , :ocv:func:`threshold` , :ocv:func:`adaptiveThreshold` , :ocv:func:`Canny` , and others to create a binary image out of a grayscale or color one. The function modifies the ``image`` while extracting the contours.
@ -172,7 +175,7 @@ Draws contours outlines or filled contours.
.. ocv:pyfunction:: cv2.drawContours(image, contours, contourIdx, color[, thickness[, lineType[, hierarchy[, maxLevel[, offset]]]]]) -> None .. ocv:pyfunction:: cv2.drawContours(image, contours, contourIdx, color[, thickness[, lineType[, hierarchy[, maxLevel[, offset]]]]]) -> None
.. ocv:cfunction:: void cvDrawContours( CvArr *img, CvSeq* contour, CvScalar externalColor, CvScalar holeColor, int maxLevel, int thickness=1, int lineType=8 ) .. ocv:cfunction:: void cvDrawContours( CvArr *img, CvSeq* contour, CvScalar externalColor, CvScalar holeColor, int maxLevel, int thickness=1, int lineType=8 )
.. ocv:pyoldfunction:: cv.DrawContours(img, contour, externalColor, holeColor, maxLevel, thickness=1, lineType=8, offset=(0, 0))-> None .. ocv:pyoldfunction:: cv.DrawContours(img, contour, external_color, hole_color, max_level, thickness=1, lineType=8, offset=(0, 0))-> None
:param image: Destination image. :param image: Destination image.
@ -181,7 +184,7 @@ Draws contours outlines or filled contours.
:param contourIdx: Parameter indicating a contour to draw. If it is negative, all the contours are drawn. :param contourIdx: Parameter indicating a contour to draw. If it is negative, all the contours are drawn.
:param color: Color of the contours. :param color: Color of the contours.
:param thickness: Thickness of lines the contours are drawn with. If it is negative (for example, ``thickness=CV_FILLED`` ), the contour interiors are :param thickness: Thickness of lines the contours are drawn with. If it is negative (for example, ``thickness=CV_FILLED`` ), the contour interiors are
drawn. drawn.
@ -253,28 +256,28 @@ Approximates a polygonal curve(s) with the specified precision.
.. ocv:pyfunction:: cv2.approxPolyDP(curve, epsilon, closed[, approxCurve]) -> approxCurve .. ocv:pyfunction:: cv2.approxPolyDP(curve, epsilon, closed[, approxCurve]) -> approxCurve
.. ocv:cfunction:: CvSeq* cvApproxPoly( const void* curve, int headerSize, CvMemStorage* storage, int method, double epsilon, int recursive=0 ) .. ocv:cfunction:: CvSeq* cvApproxPoly( const void* src_seq, int header_size, CvMemStorage* storage, int method, double parameter, int parameter2=0 )
:param curve: Input vector of a 2D point stored in: :param curve: Input vector of a 2D point stored in:
* ``std::vector`` or ``Mat`` (C++ interface) * ``std::vector`` or ``Mat`` (C++ interface)
* ``Nx2`` numpy array (Python interface) * ``Nx2`` numpy array (Python interface)
* ``CvSeq`` or `` ``CvMat`` (C interface) * ``CvSeq`` or `` ``CvMat`` (C interface)
:param approxCurve: Result of the approximation. The type should match the type of the input curve. In case of C interface the approximated curve is stored in the memory storage and pointer to it is returned. :param approxCurve: Result of the approximation. The type should match the type of the input curve. In case of C interface the approximated curve is stored in the memory storage and pointer to it is returned.
:param epsilon: Parameter specifying the approximation accuracy. This is the maximum distance between the original curve and its approximation. :param epsilon: Parameter specifying the approximation accuracy. This is the maximum distance between the original curve and its approximation.
:param closed: If true, the approximated curve is closed (its first and last vertices are connected). Otherwise, it is not closed. :param 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 headerSize: Header size of the approximated curve. Normally, ``sizeof(CvContour)`` is used.
:param storage: Memory storage where the approximated curve is stored. :param storage: Memory storage where the approximated curve is stored.
:param method: Contour approximation algorithm. Only ``CV_POLY_APPROX_DP`` is supported. :param method: Contour approximation algorithm. Only ``CV_POLY_APPROX_DP`` is supported.
:param recursive: Recursion flag. If it is non-zero and ``curve`` is ``CvSeq*``, the function ``cvApproxPoly`` approximates all the contours accessible from ``curve`` by ``h_next`` and ``v_next`` links. :param recursive: Recursion flag. If it is non-zero and ``curve`` is ``CvSeq*``, the function ``cvApproxPoly`` approximates all the contours accessible from ``curve`` by ``h_next`` and ``v_next`` links.
The functions ``approxPolyDP`` approximate a curve or a polygon with another curve/polygon with less vertices so that the distance between them is less or equal to the specified precision. It uses the Douglas-Peucker algorithm The functions ``approxPolyDP`` approximate a curve or a polygon with another curve/polygon with less vertices so that the distance between them is less or equal to the specified precision. It uses the Douglas-Peucker algorithm
@ -287,22 +290,22 @@ ApproxChains
------------- -------------
Approximates Freeman chain(s) with a polygonal curve. Approximates Freeman chain(s) with a polygonal curve.
.. ocv:cfunction:: CvSeq* cvApproxChains( CvSeq* chain, CvMemStorage* storage, int method=CV_CHAIN_APPROX_SIMPLE, double parameter=0, int minimalPerimeter=0, int recursive=0 ) .. ocv:cfunction:: CvSeq* cvApproxChains( CvSeq* src_seq, CvMemStorage* storage, int method=CV_CHAIN_APPROX_SIMPLE, double parameter=0, int minimal_perimeter=0, int recursive=0 )
.. 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 storage: Storage location for the resulting polylines.
:param method: Approximation method (see the description of the function :ocv:cfunc:`FindContours` ).
:param parameter: Method parameter (not used now).
:param minimalPerimeter: Approximates only those contours whose perimeters are not less than ``minimal_perimeter`` . Other chains are removed from the resulting structure.
.. ocv:pyoldfunction:: cv.ApproxChains(chain, storage, method=CV_CHAIN_APPROX_SIMPLE, parameter=0, minimalPerimeter=0, recursive=0)-> contours
:param chain: Pointer to the approximated Freeman chain that can refer to other chains.
:param storage: Storage location for the resulting polylines.
:param method: Approximation method (see the description of the function :ocv:cfunc:`FindContours` ).
:param parameter: Method parameter (not used now).
:param minimalPerimeter: Approximates only those contours whose perimeters are not less than ``minimal_perimeter`` . Other chains are removed from the resulting structure.
:param recursive: Recursion flag. If it is non-zero, the function approximates all chains that can be obtained from ``chain`` by using the ``h_next`` or ``v_next`` links. Otherwise, the single input chain is approximated. :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.
This is a standalone contour approximation routine, not represented in the new interface. When :ocv:cfunc:`FindContours` retrieves contours as Freeman chains, it calls the function to get approximated contours, represented as polygons. This is a standalone contour approximation routine, not represented in the new interface. When :ocv:cfunc:`FindContours` retrieves contours as Freeman chains, it calls the function to get approximated contours, represented as polygons.
@ -314,8 +317,9 @@ Calculates a contour perimeter or a curve length.
.. ocv:pyfunction:: cv2.arcLength(curve, closed) -> retval .. ocv:pyfunction:: cv2.arcLength(curve, closed) -> retval
.. ocv:cfunction:: double cvArcLength( const void* curve, CvSlice slice=CV_WHOLE_SEQ, int isClosed=-1 ) .. ocv:cfunction:: double cvArcLength( const void* curve, CvSlice slice=CV_WHOLE_SEQ, int is_closed=-1 )
.. ocv:pyoldfunction:: cv.ArcLength(curve, slice=CV_WHOLE_SEQ, isClosed=-1)-> double
.. ocv:pyoldfunction:: cv.ArcLength(curve, slice=CV_WHOLE_SEQ, isClosed=-1) -> float
:param curve: Input vector of 2D points, stored in ``std::vector`` or ``Mat``. :param curve: Input vector of 2D points, stored in ``std::vector`` or ``Mat``.
@ -351,9 +355,9 @@ Calculates a contour area.
.. ocv:pyfunction:: cv2.contourArea(contour[, oriented]) -> retval .. ocv:pyfunction:: cv2.contourArea(contour[, oriented]) -> retval
.. ocv:cfunction:: double cvContourArea( const CvArr* contour, CvSlice slice=CV_WHOLE_SEQ ) .. ocv:cfunction:: double cvContourArea( const CvArr* contour, CvSlice slice=CV_WHOLE_SEQ, int oriented=0 )
.. ocv:pyoldfunction:: cv.ContourArea(contour, slice=CV_WHOLE_SEQ)-> double .. ocv:pyoldfunction:: cv.ContourArea(contour, slice=CV_WHOLE_SEQ) -> float
:param contour: Input vector of 2D points (contour vertices), stored in ``std::vector`` or ``Mat``. :param contour: Input vector of 2D points (contour vertices), stored in ``std::vector`` or ``Mat``.
@ -390,22 +394,22 @@ Finds the convex hull of a point set.
.. ocv:function:: void convexHull( InputArray points, OutputArray hull, bool clockwise=false, bool returnPoints=true ) .. ocv:function:: void convexHull( InputArray points, OutputArray hull, bool clockwise=false, bool returnPoints=true )
.. ocv:pyfunction:: cv2.convexHull(points[, hull[, returnPoints[, clockwise]]]) -> hull .. ocv:pyfunction:: cv2.convexHull(points[, hull[, clockwise[, returnPoints]]]) -> hull
.. ocv:cfunction:: CvSeq* cvConvexHull2( const CvArr* input, void* storage=NULL, int orientation=CV_CLOCKWISE, int returnPoints=0 ) .. ocv:cfunction:: CvSeq* cvConvexHull2( const CvArr* input, void* hull_storage=NULL, int orientation=CV_CLOCKWISE, int return_points=0 )
.. ocv:pyoldfunction:: cv.ConvexHull2(points, storage, orientation=CV_CLOCKWISE, returnPoints=0)-> convexHull .. ocv:pyoldfunction:: cv.ConvexHull2(points, storage, orientation=CV_CLOCKWISE, return_points=0) -> convexHull
:param points: Input 2D point set, stored in ``std::vector`` or ``Mat``. :param points: Input 2D point set, stored in ``std::vector`` or ``Mat``.
: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 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 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. :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.
:param orientation: Convex hull orientation parameter in the old API, ``CV_CLOCKWISE`` or ``CV_COUNTERCLOCKWISE``. :param orientation: Convex hull orientation parameter in the old API, ``CV_CLOCKWISE`` or ``CV_COUNTERCLOCKWISE``.
:param returnPoints: Operation flag. In case of a matrix, when the flag is true, the function returns convex hull points. Otherwise, it returns indices of the convex hull points. When the output array is ``std::vector``, the flag is ignored, and the output depends on the type of the vector: ``std::vector<int>`` implies ``returnPoints=true``, ``std::vector<Point>`` implies ``returnPoints=false``. :param returnPoints: Operation flag. In case of a matrix, when the flag is true, the function returns convex hull points. Otherwise, it returns indices of the convex hull points. When the output array is ``std::vector``, the flag is ignored, and the output depends on the type of the vector: ``std::vector<int>`` implies ``returnPoints=true``, ``std::vector<Point>`` implies ``returnPoints=false``.
The functions find the convex hull of a 2D point set using the Sklansky's algorithm The functions find the convex hull of a 2D point set using the Sklansky's algorithm
@ -420,20 +424,20 @@ Finds the convexity defects of a contour.
.. ocv:function:: void convexityDefects( InputArray contour, InputArray convexhull, OutputArray convexityDefects ) .. ocv:function:: void convexityDefects( InputArray contour, InputArray convexhull, OutputArray convexityDefects )
.. ocv:pyfunction:: cv2.ConvexityDefects(contour, convexhull)-> convexityDefects .. ocv:pyfunction:: cv2.convexityDefects(contour, convexhull[, convexityDefects]) -> convexityDefects
.. ocv:cfunction:: CvSeq* cvConvexityDefects( const CvArr* contour, const CvArr* convexhull, CvMemStorage* storage=NULL ) .. ocv:cfunction:: CvSeq* cvConvexityDefects( const CvArr* contour, const CvArr* convexhull, CvMemStorage* storage=NULL )
.. ocv:pyoldfunction:: cv.ConvexityDefects(contour, convexhull, storage)-> convexityDefects .. ocv:pyoldfunction:: cv.ConvexityDefects(contour, convexhull, storage)-> convexityDefects
:param contour: Input contour. :param contour: Input contour.
:param convexhull: Convex hull obtained using :ocv:func:`convexHull` that should contain indices of the contour points that make the hull. :param convexhull: Convex hull obtained using :ocv:func:`convexHull` that should contain indices of the contour points that make the hull.
:param convexityDefects: The output vector of convexity defects. In C++ and the new Python/Java interface each convexity defect is represented as 4-element integer vector (a.k.a. ``cv::Vec4i``): ``(start_index, end_index, farthest_pt_index, fixpt_depth)``, where indices are 0-based indices in the original contour of the convexity defect beginning, end and the farthest point, and ``fixpt_depth`` is fixed-point approximation (with 8 fractional bits) of the distance between the farthest contour point and the hull. That is, to get the floating-point value of the depth will be ``fixpt_depth/256.0``. In C interface convexity defect is represented by ``CvConvexityDefect`` structure - see below. :param convexityDefects: The output vector of convexity defects. In C++ and the new Python/Java interface each convexity defect is represented as 4-element integer vector (a.k.a. ``cv::Vec4i``): ``(start_index, end_index, farthest_pt_index, fixpt_depth)``, where indices are 0-based indices in the original contour of the convexity defect beginning, end and the farthest point, and ``fixpt_depth`` is fixed-point approximation (with 8 fractional bits) of the distance between the farthest contour point and the hull. That is, to get the floating-point value of the depth will be ``fixpt_depth/256.0``. In C interface convexity defect is represented by ``CvConvexityDefect`` structure - see below.
:param storage: Container for the output sequence of convexity defects. If it is NULL, the contour or hull (in that order) storage is used. :param storage: Container for the output sequence of convexity defects. If it is NULL, the contour or hull (in that order) storage is used.
The function finds all convexity defects of the input contour and returns a sequence of the ``CvConvexityDefect`` structures, where ``CvConvexityDetect`` is defined as: :: The function finds all convexity defects of the input contour and returns a sequence of the ``CvConvexityDefect`` structures, where ``CvConvexityDetect`` is defined as: ::
struct CvConvexityDefect struct CvConvexityDefect
@ -460,7 +464,7 @@ Fits an ellipse around a set of 2D points.
.. ocv:pyoldfunction:: cv.FitEllipse2(points)-> Box2D .. ocv:pyoldfunction:: cv.FitEllipse2(points)-> Box2D
:param points: Input 2D point set, stored in: :param points: Input 2D point set, stored in:
* ``std::vector<>`` or ``Mat`` (C++ interface) * ``std::vector<>`` or ``Mat`` (C++ interface)
* ``CvSeq*`` or ``CvMat*`` (C interface) * ``CvSeq*`` or ``CvMat*`` (C interface)
@ -475,10 +479,11 @@ Fits a line to a 2D or 3D point set.
.. ocv:function:: void fitLine( InputArray points, OutputArray line, int distType, double param, double reps, double aeps ) .. ocv:function:: void fitLine( InputArray points, OutputArray line, int distType, double param, double reps, double aeps )
.. ocv:pyfunction:: cv2.fitLine(points, distType, param, reps, aeps) -> line .. ocv:pyfunction:: cv2.fitLine(points, distType, param, reps, aeps[, line]) -> line
.. ocv:cfunction:: void cvFitLine( const CvArr* points, int distType, double param, double reps, double aeps, float* line ) .. ocv:cfunction:: void cvFitLine( const CvArr* points, int dist_type, double param, double reps, double aeps, float* line )
.. ocv:pyoldfunction:: cv.FitLine(points, distType, param, reps, aeps) -> line
.. ocv:pyoldfunction:: cv.FitLine(points, dist_type, param, reps, aeps) -> line
:param points: Input vector of 2D or 3D points, stored in ``std::vector<>`` or ``Mat``. :param points: Input vector of 2D or 3D points, stored in ``std::vector<>`` or ``Mat``.
@ -489,7 +494,7 @@ Fits a line to a 2D or 3D point set.
:param param: Numerical parameter ( ``C`` ) for some types of distances. If it is 0, an optimal value is chosen. :param param: Numerical parameter ( ``C`` ) for some types of distances. If it is 0, an optimal value is chosen.
:param reps: Sufficient accuracy for the radius (distance between the coordinate origin and the line). :param reps: Sufficient accuracy for the radius (distance between the coordinate origin and the line).
:param aeps: Sufficient accuracy for the angle. 0.01 would be a good default value for ``reps`` and ``aeps``. :param aeps: Sufficient accuracy for the angle. 0.01 would be a good default value for ``reps`` and ``aeps``.
The function ``fitLine`` fits a line to a 2D or 3D point set by minimizing The function ``fitLine`` fits a line to a 2D or 3D point set by minimizing
@ -554,7 +559,7 @@ Tests a contour convexity.
.. ocv:pyoldfunction:: cv.CheckContourConvexity(contour)-> int .. ocv:pyoldfunction:: cv.CheckContourConvexity(contour)-> int
:param contour: Input vector of 2D points, stored in: :param contour: Input vector of 2D points, stored in:
* ``std::vector<>`` or ``Mat`` (C++ interface) * ``std::vector<>`` or ``Mat`` (C++ interface)
* ``CvSeq*`` or ``CvMat*`` (C interface) * ``CvSeq*`` or ``CvMat*`` (C interface)
@ -575,14 +580,14 @@ Finds a rotated rectangle of the minimum area enclosing the input 2D point set.
.. ocv:cfunction:: CvBox2D cvMinAreaRect2( const CvArr* points, CvMemStorage* storage=NULL ) .. ocv:cfunction:: CvBox2D cvMinAreaRect2( const CvArr* points, CvMemStorage* storage=NULL )
.. ocv:pyoldfunction:: cv.MinAreaRect2(points, storage=None)-> CvBox2D .. ocv:pyoldfunction:: cv.MinAreaRect2(points, storage=None) -> Box2D
:param points: Input vector of 2D points, stored in: :param points: Input vector of 2D points, stored in:
* ``std::vector<>`` or ``Mat`` (C++ interface) * ``std::vector<>`` or ``Mat`` (C++ interface)
* ``CvSeq*`` or ``CvMat*`` (C interface) * ``CvSeq*`` or ``CvMat*`` (C interface)
* Nx2 numpy array (Python interface) * Nx2 numpy array (Python interface)
The function calculates and returns the minimum-area bounding rectangle (possibly rotated) for a specified point set. See the OpenCV sample ``minarea.cpp`` . The function calculates and returns the minimum-area bounding rectangle (possibly rotated) for a specified point set. See the OpenCV sample ``minarea.cpp`` .
@ -595,18 +600,18 @@ Finds a circle of the minimum area enclosing a 2D point set.
.. ocv:function:: void minEnclosingCircle( InputArray points, Point2f& center, float& radius ) .. ocv:function:: void minEnclosingCircle( InputArray points, Point2f& center, float& radius )
.. ocv:pyfunction:: cv2.minEnclosingCircle(points, center, radius) -> None .. ocv:pyfunction:: cv2.minEnclosingCircle(points) -> center, radius
.. ocv:cfunction:: int cvMinEnclosingCircle( const CvArr* points, CvPoint2D32f* center, float* radius ) .. ocv:cfunction:: int cvMinEnclosingCircle( const CvArr* points, CvPoint2D32f* center, float* radius )
.. ocv:pyoldfunction:: cv.MinEnclosingCircle(points)-> (int, center, radius) .. ocv:pyoldfunction:: cv.MinEnclosingCircle(points)-> (int, center, radius)
:param points: Input vector of 2D points, stored in: :param points: Input vector of 2D points, stored in:
* ``std::vector<>`` or ``Mat`` (C++ interface) * ``std::vector<>`` or ``Mat`` (C++ interface)
* ``CvSeq*`` or ``CvMat*`` (C interface) * ``CvSeq*`` or ``CvMat*`` (C interface)
* Nx2 numpy array (Python interface) * Nx2 numpy array (Python interface)
:param center: Output center of the circle. :param center: Output center of the circle.
@ -621,12 +626,12 @@ matchShapes
--------------- ---------------
Compares two shapes. Compares two shapes.
.. ocv:function:: double matchShapes( InputArray object1, InputArray object2, int method, double parameter=0 ) .. ocv:function:: double matchShapes( InputArray contour1, InputArray contour2, int method, double parameter )
.. ocv:pyfunction:: cv2.matchShapes(contour1, contour2, method, parameter) -> retval .. ocv:pyfunction:: cv2.matchShapes(contour1, contour2, method, parameter) -> retval
.. ocv:cfunction:: double cvMatchShapes( const void* object1, const void* object2, int method, double parameter=0 ) .. ocv:cfunction:: double cvMatchShapes( const void* object1, const void* object2, int method, double parameter=0 )
.. ocv:pyoldfunction:: cv.MatchShapes(object1, object2, method, parameter=0)-> None .. ocv:pyoldfunction:: cv.MatchShapes(object1, object2, method, parameter=0) -> float
:param object1: First contour or grayscale image. :param object1: First contour or grayscale image.
@ -680,8 +685,8 @@ Performs a point-in-contour test.
.. ocv:pyfunction:: cv2.pointPolygonTest(contour, pt, measureDist) -> retval .. ocv:pyfunction:: cv2.pointPolygonTest(contour, pt, measureDist) -> retval
.. ocv:cfunction:: double cvPointPolygonTest( const CvArr* contour, CvPoint2D32f pt, int measureDist ) .. ocv:cfunction:: double cvPointPolygonTest( const CvArr* contour, CvPoint2D32f pt, int measure_dist )
.. ocv:pyoldfunction:: cv.PointPolygonTest(contour, pt, measureDist)-> double .. ocv:pyoldfunction:: cv.PointPolygonTest(contour, pt, measure_dist) -> float
:param contour: Input contour. :param contour: Input contour.

View File

@ -392,7 +392,7 @@ CV_EXPORTS_W void medianBlur( InputArray src, OutputArray dst, int ksize );
//! smooths the image using Gaussian filter. //! smooths the image using Gaussian filter.
CV_EXPORTS_W void GaussianBlur( InputArray src, CV_EXPORTS_W void GaussianBlur( InputArray src,
OutputArray dst, Size ksize, OutputArray dst, Size ksize,
double sigma1, double sigma2=0, double sigmaX, double sigmaY=0,
int borderType=BORDER_DEFAULT ); int borderType=BORDER_DEFAULT );
//! smooths the image using bilateral filter //! smooths the image using bilateral filter
CV_EXPORTS_W void bilateralFilter( InputArray src, OutputArray dst, int d, CV_EXPORTS_W void bilateralFilter( InputArray src, OutputArray dst, int d,

View File

@ -5,7 +5,7 @@ Common Interfaces of Generic Descriptor Matchers
OneWayDescriptorMatcher OneWayDescriptorMatcher
----------------------- -----------------------
.. ocv:class:: OneWayDescriptorMatcher .. ocv:class:: OneWayDescriptorMatcher : public GenericDescriptorMatcher
Wrapping class for computing, matching, and classifying descriptors using the Wrapping class for computing, matching, and classifying descriptors using the
:ocv:class:`OneWayDescriptorBase` class. :: :ocv:class:`OneWayDescriptorBase` class. ::
@ -64,7 +64,7 @@ Wrapping class for computing, matching, and classifying descriptors using the
FernDescriptorMatcher FernDescriptorMatcher
--------------------- ---------------------
.. ocv:class:: FernDescriptorMatcher .. ocv:class:: FernDescriptorMatcher : public GenericDescriptorMatcher
Wrapping class for computing, matching, and classifying descriptors using the Wrapping class for computing, matching, and classifying descriptors using the
:ocv:class:`FernClassifier` class. :: :ocv:class:`FernClassifier` class. ::

View File

@ -142,7 +142,7 @@ RandomizedTree::applyQuantization
RTreeNode RTreeNode
--------- ---------
.. ocv:class:: RTreeNode .. ocv:struct:: RTreeNode
Class containing a base structure for ``RandomizedTree``. :: Class containing a base structure for ``RandomizedTree``. ::

View File

@ -8,19 +8,19 @@ CalcOpticalFlowBM
----------------- -----------------
Calculates the optical flow for two images by using the block matching method. Calculates the optical flow for two images by using the block matching method.
.. ocv:cfunction:: void cvCalcOpticalFlowBM( const CvArr* prev, const CvArr* curr, CvSize blockSize, CvSize shiftSize, CvSize maxRange, int usePrevious, CvArr* velx, CvArr* vely ) .. ocv:cfunction:: void cvCalcOpticalFlowBM( const CvArr* prev, const CvArr* curr, CvSize block_size, CvSize shift_size, CvSize max_range, int use_previous, CvArr* velx, CvArr* vely )
.. ocv:pyoldfunction:: cv.CalcOpticalFlowBM(prev, curr, blockSize, shiftSize, maxRange, usePrevious, velx, vely)-> None .. ocv:pyoldfunction:: cv.CalcOpticalFlowBM(prev, curr, blockSize, shiftSize, max_range, usePrevious, velx, vely)-> None
:param prev: First image, 8-bit, single-channel :param prev: First image, 8-bit, single-channel
:param curr: Second image, 8-bit, single-channel :param curr: Second image, 8-bit, single-channel
:param blockSize: Size of basic blocks that are compared :param blockSize: Size of basic blocks that are compared
:param shiftSize: Block coordinate increments :param shiftSize: Block coordinate increments
:param maxRange: Size of the scanned neighborhood in pixels around the block :param maxRange: 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 usePrevious: Flag that specifies whether to use the input velocity as initial approximations or not.
@ -28,11 +28,11 @@ Calculates the optical flow for two images by using the block matching method.
.. math:: .. 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{blockSize.width}}{\texttt{shiftSize.width}} \right \rfloor \times \left \lfloor \frac{\texttt{prev->height} - \texttt{blockSize.height}}{\texttt{shiftSize.height}} \right \rfloor
size, 32-bit floating-point, single-channel 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 :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 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``
@ -43,23 +43,23 @@ CalcOpticalFlowHS
----------------- -----------------
Calculates the optical flow for two images using Horn-Schunck algorithm. Calculates the optical flow for two images using Horn-Schunck algorithm.
.. ocv:cfunction:: void cvCalcOpticalFlowHS(const CvArr* prev, const CvArr* curr, int usePrevious, CvArr* velx, CvArr* vely, double lambda, CvTermCriteria criteria) .. ocv:cfunction:: void cvCalcOpticalFlowHS(const CvArr* prev, const CvArr* curr, int use_previous, CvArr* velx, CvArr* vely, double lambda, CvTermCriteria criteria)
.. ocv:pyoldfunction:: cv.CalcOpticalFlowHS(prev, curr, usePrevious, velx, vely, lambda, criteria)-> None .. ocv:pyoldfunction:: cv.CalcOpticalFlowHS(prev, curr, usePrevious, velx, vely, lambda, criteria)-> None
:param prev: First image, 8-bit, single-channel :param prev: First image, 8-bit, single-channel
:param curr: Second image, 8-bit, single-channel :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 usePrevious: 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 velx: Horizontal component of the optical flow of the same size as input images, 32-bit floating-point, single-channel
:param vely: Vertical component of the optical flow of the same size as input images, 32-bit floating-point, single-channel :param vely: Vertical component of the optical flow of the same size as input images, 32-bit floating-point, single-channel
:param lambda: Smoothness weight. The larger it is, the smoother optical flow map you get. :param lambda: Smoothness weight. The larger it is, the smoother optical flow map you get.
:param criteria: Criteria of termination of velocity computing :param criteria: Criteria of termination of velocity computing
The function computes the flow for every pixel of the first input image using the Horn and Schunck algorithm [Horn81]_. The function is obsolete. To track sparse features, use :ocv:func:`calcOpticalFlowPyrLK`. To track all the pixels, use :ocv:func:`calcOpticalFlowFarneback`. The function computes the flow for every pixel of the first input image using the Horn and Schunck algorithm [Horn81]_. The function is obsolete. To track sparse features, use :ocv:func:`calcOpticalFlowPyrLK`. To track all the pixels, use :ocv:func:`calcOpticalFlowFarneback`.
@ -69,19 +69,19 @@ CalcOpticalFlowLK
Calculates the optical flow for two images using Lucas-Kanade algorithm. Calculates the optical flow for two images using Lucas-Kanade algorithm.
.. ocv:cfunction:: void cvCalcOpticalFlowLK( const CvArr* prev, const CvArr* curr, CvSize winSize, CvArr* velx, CvArr* vely ) .. ocv:cfunction:: void cvCalcOpticalFlowLK( const CvArr* prev, const CvArr* curr, CvSize win_size, CvArr* velx, CvArr* vely )
.. ocv:pyoldfunction:: cv.CalcOpticalFlowLK(prev, curr, winSize, velx, vely)-> None .. ocv:pyoldfunction:: cv.CalcOpticalFlowLK(prev, curr, winSize, velx, vely)-> None
:param prev: First image, 8-bit, single-channel :param prev: First image, 8-bit, single-channel
:param curr: Second image, 8-bit, single-channel :param curr: Second image, 8-bit, single-channel
:param winSize: Size of the averaging window used for grouping pixels :param winSize: 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 :param velx: Horizontal component of the optical flow of the same size as input images, 32-bit floating-point, single-channel
:param vely: Vertical component of the optical flow of the same size as input images, 32-bit floating-point, single-channel :param vely: Vertical component of the optical flow of the same size as input images, 32-bit floating-point, single-channel
The function computes the flow for every pixel of the first input image using the Lucas and Kanade algorithm [Lucas81]_. The function is obsolete. To track sparse features, use :ocv:func:`calcOpticalFlowPyrLK`. To track all the pixels, use :ocv:func:`calcOpticalFlowFarneback`. The function computes the flow for every pixel of the first input image using the Lucas and Kanade algorithm [Lucas81]_. The function is obsolete. To track sparse features, use :ocv:func:`calcOpticalFlowPyrLK`. To track all the pixels, use :ocv:func:`calcOpticalFlowFarneback`.

View File

@ -1768,8 +1768,8 @@ protected:
struct CV_EXPORTS_W_MAP CvEMParams struct CV_EXPORTS_W_MAP CvEMParams
{ {
CvEMParams(); CvEMParams();
CvEMParams( int nclusters, int cov_mat_type=1/*CvEM::COV_MAT_DIAGONAL*/, CvEMParams( int nclusters, int cov_mat_type=cv::EM::COV_MAT_DIAGONAL,
int start_step=0/*CvEM::START_AUTO_STEP*/, int start_step=cv::EM::START_AUTO_STEP,
CvTermCriteria term_crit=cvTermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS, 100, FLT_EPSILON), CvTermCriteria term_crit=cvTermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS, 100, FLT_EPSILON),
const CvMat* probs=0, const CvMat* weights=0, const CvMat* means=0, const CvMat** covs=0 ); const CvMat* probs=0, const CvMat* weights=0, const CvMat* means=0, const CvMat** covs=0 );

View File

@ -65,7 +65,7 @@ training examples are recomputed at each training iteration. Examples deleted at
CvBoostParams CvBoostParams
------------- -------------
.. ocv:class:: CvBoostParams .. ocv:struct:: CvBoostParams : public CvDTreeParams
Boosting training parameters. Boosting training parameters.
@ -82,13 +82,13 @@ The constructors.
.. ocv:function:: CvBoostParams::CvBoostParams( int boost_type, int weak_count, double weight_trim_rate, int max_depth, bool use_surrogates, const float* priors ) .. ocv:function:: CvBoostParams::CvBoostParams( int boost_type, int weak_count, double weight_trim_rate, int max_depth, bool use_surrogates, const float* priors )
:param boost_type: Type of the boosting algorithm. Possible values are: :param boost_type: Type of the boosting algorithm. Possible values are:
* **CvBoost::DISCRETE** Discrete AdaBoost. * **CvBoost::DISCRETE** Discrete AdaBoost.
* **CvBoost::REAL** Real AdaBoost. It is a technique that utilizes confidence-rated predictions and works well with categorical data. * **CvBoost::REAL** Real AdaBoost. It is a technique that utilizes confidence-rated predictions and works well with categorical data.
* **CvBoost::LOGIT** LogitBoost. It can produce good regression fits. * **CvBoost::LOGIT** LogitBoost. It can produce good regression fits.
* **CvBoost::GENTLE** Gentle AdaBoost. It puts less weight on outlier data points and for that reason is often good with regression data. * **CvBoost::GENTLE** Gentle AdaBoost. It puts less weight on outlier data points and for that reason is often good with regression data.
Gentle AdaBoost and Real AdaBoost are often the preferable choices. Gentle AdaBoost and Real AdaBoost are often the preferable choices.
:param weak_count: The number of weak classifiers. :param weak_count: The number of weak classifiers.
@ -122,7 +122,7 @@ Default parameters are:
CvBoostTree CvBoostTree
----------- -----------
.. ocv:class:: CvBoostTree .. ocv:class:: CvBoostTree : public CvDTree
The weak tree classifier, a component of the boosted tree classifier :ocv:class:`CvBoost`, is a derivative of :ocv:class:`CvDTree`. Normally, there is no need to use the weak classifiers directly. However, they can be accessed as elements of the sequence :ocv:member:`CvBoost::weak`, retrieved by :ocv:func:`CvBoost::get_weak_predictors`. The weak tree classifier, a component of the boosted tree classifier :ocv:class:`CvBoost`, is a derivative of :ocv:class:`CvDTree`. Normally, there is no need to use the weak classifiers directly. However, they can be accessed as elements of the sequence :ocv:member:`CvBoost::weak`, retrieved by :ocv:func:`CvBoost::get_weak_predictors`.
@ -130,7 +130,7 @@ The weak tree classifier, a component of the boosted tree classifier :ocv:class:
CvBoost CvBoost
------- -------
.. ocv:class:: CvBoost .. ocv:class:: CvBoost : public CvStatModel
Boosted tree classifier derived from :ocv:class:`CvStatModel`. Boosted tree classifier derived from :ocv:class:`CvStatModel`.
@ -144,7 +144,7 @@ Default and training constructors.
.. ocv:function:: CvBoost::CvBoost( const CvMat* trainData, int tflag, const CvMat* responses, const CvMat* varIdx=0, const CvMat* sampleIdx=0, const CvMat* varType=0, const CvMat* missingDataMask=0, CvBoostParams params=CvBoostParams() ) .. ocv:function:: CvBoost::CvBoost( const CvMat* trainData, int tflag, const CvMat* responses, const CvMat* varIdx=0, const CvMat* sampleIdx=0, const CvMat* varType=0, const CvMat* missingDataMask=0, CvBoostParams params=CvBoostParams() )
.. ocv:pyfunction:: cv2.Boost(trainData, tflag, responses[, varIdx[, sampleIdx[, varType[, missingDataMask[, params]]]]]) -> <Boost object> .. ocv:pyfunction:: cv2.Boost([trainData, tflag, responses[, varIdx[, sampleIdx[, varType[, missingDataMask[, params]]]]]]) -> <Boost object>
The constructors follow conventions of :ocv:func:`CvStatModel::CvStatModel`. See :ocv:func:`CvStatModel::train` for parameters descriptions. The constructors follow conventions of :ocv:func:`CvStatModel::CvStatModel`. See :ocv:func:`CvStatModel::train` for parameters descriptions.
@ -181,10 +181,10 @@ Predicts a response for an input sample.
:param weak_responses: Optional output parameter, a floating-point vector with responses of each individual weak classifier. The number of elements in the vector must be equal to the slice length. :param weak_responses: Optional output parameter, a floating-point vector with responses of each individual weak classifier. The number of elements in the vector must be equal to the slice length.
:param slice: Continuous subset of the sequence of weak classifiers to be used for prediction. By default, all the weak classifiers are used. :param slice: Continuous subset of the sequence of weak classifiers to be used for prediction. By default, all the weak classifiers are used.
:param raw_mode: Normally, it should be set to ``false``. :param raw_mode: Normally, it should be set to ``false``.
:param return_sum: If ``true`` then return sum of votes instead of the class label. :param return_sum: If ``true`` then return sum of votes instead of the class label.
The method runs the sample through the trees in the ensemble and returns the output class label based on the weighted voting. The method runs the sample through the trees in the ensemble and returns the output class label based on the weighted voting.
@ -199,7 +199,7 @@ Removes the specified weak classifiers.
:param slice: Continuous subset of the sequence of weak classifiers to be removed. :param slice: Continuous subset of the sequence of weak classifiers to be removed.
The method removes the specified weak classifiers from the sequence. The method removes the specified weak classifiers from the sequence.
.. note:: Do not confuse this method with the pruning of individual decision trees, which is currently not supported. .. note:: Do not confuse this method with the pruning of individual decision trees, which is currently not supported.

View File

@ -20,9 +20,9 @@ child node as the next observed node) or to the right based on the
value of a certain variable whose index is stored in the observed value of a certain variable whose index is stored in the observed
node. The following variables are possible: node. The following variables are possible:
* *
**Ordered variables.** The variable value is compared with a threshold that is also stored in the node. If the value is less than the threshold, the procedure goes to the left. Otherwise, it goes to the right. For example, if the weight is less than 1 kilogram, the procedure goes to the left, else to the right. **Ordered variables.** The variable value is compared with a threshold that is also stored in the node. If the value is less than the threshold, the procedure goes to the left. Otherwise, it goes to the right. For example, if the weight is less than 1 kilogram, the procedure goes to the left, else to the right.
* *
**Categorical variables.** A discrete variable value is tested to see whether it belongs to a certain subset of values (also stored in the node) from a limited set of values the variable could take. If it does, the procedure goes to the left. Otherwise, it goes to the right. For example, if the color is green or red, go to the left, else to the right. **Categorical variables.** A discrete variable value is tested to see whether it belongs to a certain subset of values (also stored in the node) from a limited set of values the variable could take. If it does, the procedure goes to the left. Otherwise, it goes to the right. For example, if the color is green or red, go to the left, else to the right.
So, in each node, a pair of entities (``variable_index`` , ``decision_rule So, in each node, a pair of entities (``variable_index`` , ``decision_rule
@ -57,7 +57,7 @@ Importance of each variable is computed over all the splits on this variable in
CvDTreeSplit CvDTreeSplit
------------ ------------
.. ocv:class:: CvDTreeSplit .. ocv:struct:: CvDTreeSplit
The structure represents a possible decision tree node split. It has public members: The structure represents a possible decision tree node split. It has public members:
@ -68,11 +68,11 @@ The structure represents a possible decision tree node split. It has public memb
.. ocv:member:: int inversed .. ocv:member:: int inversed
If it is not null then inverse split rule is used that is left and right branches are exchanged in the rule expressions below. If it is not null then inverse split rule is used that is left and right branches are exchanged in the rule expressions below.
.. ocv:member:: float quality .. ocv:member:: float quality
The split quality, a positive number. It is used to choose the best primary split, then to choose and sort the surrogate splits. After the tree is constructed, it is also used to compute variable importance. The split quality, a positive number. It is used to choose the best primary split, then to choose and sort the surrogate splits. After the tree is constructed, it is also used to compute variable importance.
.. ocv:member:: CvDTreeSplit* next .. ocv:member:: CvDTreeSplit* next
@ -82,16 +82,16 @@ The structure represents a possible decision tree node split. It has public memb
Bit array indicating the value subset in case of split on a categorical variable. The rule is: :: Bit array indicating the value subset in case of split on a categorical variable. The rule is: ::
if var_value in subset if var_value in subset
then next_node <- left then next_node <- left
else next_node <- right else next_node <- right
.. ocv:member:: float ord::c .. ocv:member:: float ord::c
The threshold value in case of split on an ordered variable. The rule is: :: The threshold value in case of split on an ordered variable. The rule is: ::
if var_value < ord.c if var_value < ord.c
then next_node<-left then next_node<-left
else next_node<-right else next_node<-right
.. ocv:member:: int ord::split_point .. ocv:member:: int ord::split_point
@ -100,12 +100,12 @@ The structure represents a possible decision tree node split. It has public memb
CvDTreeNode CvDTreeNode
----------- -----------
.. ocv:class:: CvDTreeNode .. ocv:struct:: CvDTreeNode
The structure represents a node in a decision tree. It has public members: The structure represents a node in a decision tree. It has public members:
.. ocv:member:: int class_idx .. ocv:member:: int class_idx
Class index normalized to 0..class_count-1 range and assigned to the node. It is used internally in classification trees and tree ensembles. Class index normalized to 0..class_count-1 range and assigned to the node. It is used internally in classification trees and tree ensembles.
@ -135,17 +135,17 @@ The structure represents a node in a decision tree. It has public members:
.. ocv:member:: int sample_count .. ocv:member:: int sample_count
The number of samples that fall into the node at the training stage. It is used to resolve the difficult cases - when the variable for the primary split is missing and all the variables for other surrogate splits are missing too. In this case the sample is directed to the left if ``left->sample_count > right->sample_count`` and to the right otherwise. The number of samples that fall into the node at the training stage. It is used to resolve the difficult cases - when the variable for the primary split is missing and all the variables for other surrogate splits are missing too. In this case the sample is directed to the left if ``left->sample_count > right->sample_count`` and to the right otherwise.
.. ocv:member:: int depth .. ocv:member:: int depth
Depth of the node. The root node depth is 0, the child nodes depth is the parent's depth + 1. Depth of the node. The root node depth is 0, the child nodes depth is the parent's depth + 1.
Other numerous fields of ``CvDTreeNode`` are used internally at the training stage. Other numerous fields of ``CvDTreeNode`` are used internally at the training stage.
CvDTreeParams CvDTreeParams
------------- -------------
.. ocv:class:: CvDTreeParams .. ocv:struct:: CvDTreeParams
The structure contains all the decision tree training parameters. You can initialize it by default constructor and then override any parameters directly before training, or the structure may be fully initialized using the advanced variant of the constructor. The structure contains all the decision tree training parameters. You can initialize it by default constructor and then override any parameters directly before training, or the structure may be fully initialized using the advanced variant of the constructor.
@ -153,19 +153,19 @@ CvDTreeParams::CvDTreeParams
---------------------------- ----------------------------
The constructors. The constructors.
.. ocv:function:: CvDTreeParams::CvDTreeParams() .. ocv:function:: CvDTreeParams::CvDTreeParams()
.. ocv:function:: CvDTreeParams::CvDTreeParams( int max_depth, int min_sample_count, float regression_accuracy, bool use_surrogates, int max_categories, int cv_folds, bool use_1se_rule, bool truncate_pruned_tree, const float* priors ) .. ocv:function:: CvDTreeParams::CvDTreeParams( int max_depth, int min_sample_count, float regression_accuracy, bool use_surrogates, int max_categories, int cv_folds, bool use_1se_rule, bool truncate_pruned_tree, const float* priors )
:param max_depth: The maximum possible depth of the tree. That is the training algorithms attempts to split a node while its depth is less than ``max_depth``. The actual depth may be smaller if the other termination criteria are met (see the outline of the training procedure in the beginning of the section), and/or if the tree is pruned. :param max_depth: The maximum possible depth of the tree. That is the training algorithms attempts to split a node while its depth is less than ``max_depth``. The actual depth may be smaller if the other termination criteria are met (see the outline of the training procedure in the beginning of the section), and/or if the tree is pruned.
:param min_sample_count: If the number of samples in a node is less than this parameter then the node will not be split. :param min_sample_count: If the number of samples in a node is less than this parameter then the node will not be split.
:param regression_accuracy: Termination criteria for regression trees. If all absolute differences between an estimated value in a node and values of train samples in this node are less than this parameter then the node will not be split. :param regression_accuracy: Termination criteria for regression trees. If all absolute differences between an estimated value in a node and values of train samples in this node are less than this parameter then the node will not be split.
:param use_surrogates: If true then surrogate splits will be built. These splits allow to work with missing data and compute variable importance correctly. :param use_surrogates: If true then surrogate splits will be built. These splits allow to work with missing data and compute variable importance correctly.
:param max_categories: Cluster possible values of a categorical variable into ``K`` :math:`\leq` ``max_categories`` clusters to find a suboptimal split. If a discrete variable, on which the training procedure tries to make a split, takes more than ``max_categories`` values, the precise best subset estimation may take a very long time because the algorithm is exponential. Instead, many decision trees engines (including ML) try to find sub-optimal split in this case by clustering all the samples into ``max_categories`` clusters that is some categories are merged together. The clustering is applied only in ``n``>2-class classification problems for categorical variables with ``N > max_categories`` possible values. In case of regression and 2-class classification the optimal split can be found efficiently without employing clustering, thus the parameter is not used in these cases. :param max_categories: Cluster possible values of a categorical variable into ``K`` :math:`\leq` ``max_categories`` clusters to find a suboptimal split. If a discrete variable, on which the training procedure tries to make a split, takes more than ``max_categories`` values, the precise best subset estimation may take a very long time because the algorithm is exponential. Instead, many decision trees engines (including ML) try to find sub-optimal split in this case by clustering all the samples into ``max_categories`` clusters that is some categories are merged together. The clustering is applied only in ``n``>2-class classification problems for categorical variables with ``N > max_categories`` possible values. In case of regression and 2-class classification the optimal split can be found efficiently without employing clustering, thus the parameter is not used in these cases.
:param cv_folds: If ``cv_folds > 1`` then prune a tree with ``K``-fold cross-validation where ``K`` is equal to ``cv_folds``. :param cv_folds: If ``cv_folds > 1`` then prune a tree with ``K``-fold cross-validation where ``K`` is equal to ``cv_folds``.
@ -184,10 +184,10 @@ The default constructor initializes all the parameters with the default values t
truncate_pruned_tree(true), regression_accuracy(0.01f), priors(0) truncate_pruned_tree(true), regression_accuracy(0.01f), priors(0)
{} {}
CvDTreeTrainData CvDTreeTrainData
---------------- ----------------
.. ocv:class:: CvDTreeTrainData .. ocv:struct:: CvDTreeTrainData
Decision tree training data and shared data for tree ensembles. The structure is mostly used internally for storing both standalone trees and tree ensembles efficiently. Basically, it contains the following types of information: Decision tree training data and shared data for tree ensembles. The structure is mostly used internally for storing both standalone trees and tree ensembles efficiently. Basically, it contains the following types of information:
@ -212,7 +212,7 @@ There are two ways of using this structure. In simple cases (for example, a stan
CvDTree CvDTree
------- -------
.. ocv:class:: CvDTree .. ocv:class:: CvDTree : public CvStatModel
The class implements a decision tree as described in the beginning of this section. The class implements a decision tree as described in the beginning of this section.
@ -221,7 +221,7 @@ CvDTree::train
-------------- --------------
Trains a decision tree. Trains a decision tree.
.. ocv:function:: bool CvDTree::train( const Mat& train_data, int tflag, const Mat& responses, const Mat& var_idx=Mat(), const Mat& sample_idx=Mat(), const Mat& var_type=Mat(), const Mat& missing_mask=Mat(), CvDTreeParams params=CvDTreeParams() ) .. ocv:function:: bool CvDTree::train( const Mat& trainData, int tflag, const Mat& responses, const Mat& varIdx=Mat(), const Mat& sampleIdx=Mat(), const Mat& varType=Mat(), const Mat& missingDataMask=Mat(), CvDTreeParams params=CvDTreeParams() )
.. ocv:function:: bool CvDTree::train( const CvMat* trainData, int tflag, const CvMat* responses, const CvMat* varIdx=0, const CvMat* sampleIdx=0, const CvMat* varType=0, const CvMat* missingDataMask=0, CvDTreeParams params=CvDTreeParams() ) .. ocv:function:: bool CvDTree::train( const CvMat* trainData, int tflag, const CvMat* responses, const CvMat* varIdx=0, const CvMat* sampleIdx=0, const CvMat* varType=0, const CvMat* missingDataMask=0, CvDTreeParams params=CvDTreeParams() )
@ -258,7 +258,7 @@ Returns the leaf node of a decision tree corresponding to the input vector.
:param missingDataMask: Optional input missing measurement mask. :param missingDataMask: Optional input missing measurement mask.
:param preprocessedInput: This parameter is normally set to ``false``, implying a regular input. If it is ``true``, the method assumes that all the values of the discrete input variables have been already normalized to :math:`0` to :math:`num\_of\_categories_i-1` ranges since the decision tree uses such normalized representation internally. It is useful for faster prediction with tree ensembles. For ordered input variables, the flag is not used. :param preprocessedInput: This parameter is normally set to ``false``, implying a regular input. If it is ``true``, the method assumes that all the values of the discrete input variables have been already normalized to :math:`0` to :math:`num\_of\_categories_i-1` ranges since the decision tree uses such normalized representation internally. It is useful for faster prediction with tree ensembles. For ordered input variables, the flag is not used.
The method traverses the decision tree and returns the reached leaf node as output. The prediction result, either the class label or the estimated function value, may be retrieved as the ``value`` field of the :ocv:class:`CvDTreeNode` structure, for example: ``dtree->predict(sample,mask)->value``. The method traverses the decision tree and returns the reached leaf node as output. The prediction result, either the class label or the estimated function value, may be retrieved as the ``value`` field of the :ocv:class:`CvDTreeNode` structure, for example: ``dtree->predict(sample,mask)->value``.
@ -270,7 +270,7 @@ Returns error of the decision tree.
.. ocv:function:: float CvDTree::calc_error( CvMLData* trainData, int type, std::vector<float> *resp = 0 ) .. ocv:function:: float CvDTree::calc_error( CvMLData* trainData, int type, std::vector<float> *resp = 0 )
:param trainData: Data for the decision tree. :param trainData: Data for the decision tree.
:param type: Type of error. Possible values are: :param type: Type of error. Possible values are:
* **CV_TRAIN_ERROR** Error on train samples. * **CV_TRAIN_ERROR** Error on train samples.
@ -290,7 +290,7 @@ Returns the variable importance array.
.. ocv:function:: const CvMat* CvDTree::get_var_importance() .. ocv:function:: const CvMat* CvDTree::get_var_importance()
.. ocv:pyfunction:: cv2.DTree.getVarImportance() -> importanceVector .. ocv:pyfunction:: cv2.DTree.getVarImportance() -> retval
CvDTree::get_root CvDTree::get_root
----------------- -----------------
@ -311,7 +311,7 @@ CvDTree::get_data
----------------- -----------------
Returns used train data of the decision tree. Returns used train data of the decision tree.
.. ocv:function:: const CvDTreeTrainData* CvDTree::get_data() const .. ocv:function:: CvDTreeTrainData* CvDTree::get_data() const
Example: building a tree for classifying mushrooms. See the ``mushroom.cpp`` sample that demonstrates how to build and use the Example: building a tree for classifying mushrooms. See the ``mushroom.cpp`` sample that demonstrates how to build and use the
decision tree. decision tree.

View File

@ -10,6 +10,6 @@ Extremely randomized trees have been introduced by Pierre Geurts, Damien Ernst a
CvERTrees CvERTrees
---------- ----------
.. ocv:class:: CvERTrees .. ocv:class:: CvERTrees : public CvRTrees
The class implements the Extremely randomized trees algorithm. ``CvERTrees`` is inherited from :ocv:class:`CvRTrees` and has the same interface, so see description of :ocv:class:`CvRTrees` class to get details. To set the training parameters of Extremely randomized trees the same class :ocv:class:`CvRTParams` is used. The class implements the Extremely randomized trees algorithm. ``CvERTrees`` is inherited from :ocv:class:`CvRTrees` and has the same interface, so see description of :ocv:class:`CvRTrees` class to get details. To set the training parameters of Extremely randomized trees the same class :ocv:class:`CvRTParams` is used.

View File

@ -60,7 +60,7 @@ At the second step (Maximization step or M-step), the mixture parameter estimate
.. math:: .. math::
\pi _k= \frac{1}{N} \sum _{i=1}^{N} \alpha _{ki}, \quad a_k= \frac{\sum\limits_{i=1}^{N}\alpha_{ki}x_i}{\sum\limits_{i=1}^{N}\alpha_{ki}} , \quad S_k= \frac{\sum\limits_{i=1}^{N}\alpha_{ki}(x_i-a_k)(x_i-a_k)^T}{\sum\limits_{i=1}^{N}\alpha_{ki}} \pi _k= \frac{1}{N} \sum _{i=1}^{N} \alpha _{ki}, \quad a_k= \frac{\sum\limits_{i=1}^{N}\alpha_{ki}x_i}{\sum\limits_{i=1}^{N}\alpha_{ki}} , \quad S_k= \frac{\sum\limits_{i=1}^{N}\alpha_{ki}(x_i-a_k)(x_i-a_k)^T}{\sum\limits_{i=1}^{N}\alpha_{ki}}
Alternatively, the algorithm may start with the M-step when the initial values for Alternatively, the algorithm may start with the M-step when the initial values for
:math:`p_{i,k}` can be provided. Another alternative when :math:`p_{i,k}` can be provided. Another alternative when
@ -91,7 +91,7 @@ already a good enough approximation).
EM EM
-- --
.. ocv:class:: EM .. ocv:class:: EM : public Algorithm
The class implements the EM algorithm as described in the beginning of this section. It is inherited from :ocv:class:`Algorithm`. The class implements the EM algorithm as described in the beginning of this section. It is inherited from :ocv:class:`Algorithm`.
@ -102,9 +102,10 @@ The constructor of the class
.. ocv:function:: EM::EM(int nclusters=EM::DEFAULT_NCLUSTERS, int covMatType=EM::COV_MAT_DIAGONAL, const TermCriteria& termCrit=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, EM::DEFAULT_MAX_ITERS, FLT_EPSILON) ) .. ocv:function:: EM::EM(int nclusters=EM::DEFAULT_NCLUSTERS, int covMatType=EM::COV_MAT_DIAGONAL, const TermCriteria& termCrit=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, EM::DEFAULT_MAX_ITERS, FLT_EPSILON) )
.. ocv:pyfunction:: cv2.EM([nclusters[, covMatType[, termCrit]]]) -> <EM object>
:param nclusters: The number of mixture components in the Gaussian mixture model. Default value of the parameter is ``EM::DEFAULT_NCLUSTERS=5``. Some of EM implementation could determine the optimal number of mixtures within a specified value range, but that is not the case in ML yet. :param nclusters: The number of mixture components in the Gaussian mixture model. Default value of the parameter is ``EM::DEFAULT_NCLUSTERS=5``. Some of EM implementation could determine the optimal number of mixtures within a specified value range, but that is not the case in ML yet.
:param covMatType: Constraint on covariance matrices which defines type of matrices. Possible values are: :param covMatType: Constraint on covariance matrices which defines type of matrices. Possible values are:
* **EM::COV_MAT_SPHERICAL** A scaled identity matrix :math:`\mu_k * I`. There is the only parameter :math:`\mu_k` to be estimated for each matrix. The option may be used in special cases, when the constraint is relevant, or as a first step in the optimization (for example in case when the data is preprocessed with PCA). The results of such preliminary estimation may be passed again to the optimization procedure, this time with ``covMatType=EM::COV_MAT_DIAGONAL``. * **EM::COV_MAT_SPHERICAL** A scaled identity matrix :math:`\mu_k * I`. There is the only parameter :math:`\mu_k` to be estimated for each matrix. The option may be used in special cases, when the constraint is relevant, or as a first step in the optimization (for example in case when the data is preprocessed with PCA). The results of such preliminary estimation may be passed again to the optimization procedure, this time with ``covMatType=EM::COV_MAT_DIAGONAL``.
@ -112,7 +113,7 @@ The constructor of the class
* **EM::COV_MAT_DIAGONAL** A diagonal matrix with positive diagonal elements. The number of free parameters is ``d`` for each matrix. This is most commonly used option yielding good estimation results. * **EM::COV_MAT_DIAGONAL** A diagonal matrix with positive diagonal elements. The number of free parameters is ``d`` for each matrix. This is most commonly used option yielding good estimation results.
* **EM::COV_MAT_GENERIC** A symmetric positively defined matrix. The number of free parameters in each matrix is about :math:`d^2/2`. It is not recommended to use this option, unless there is pretty accurate initial estimation of the parameters and/or a huge number of training samples. * **EM::COV_MAT_GENERIC** A symmetric positively defined matrix. The number of free parameters in each matrix is about :math:`d^2/2`. It is not recommended to use this option, unless there is pretty accurate initial estimation of the parameters and/or a huge number of training samples.
:param termCrit: The termination criteria of the EM algorithm. The EM algorithm can be terminated by the number of iterations ``termCrit.maxCount`` (number of M-steps) or when relative change of likelihood logarithm is less than ``termCrit.epsilon``. Default maximum number of iterations is ``EM::DEFAULT_MAX_ITERS=100``. :param termCrit: The termination criteria of the EM algorithm. The EM algorithm can be terminated by the number of iterations ``termCrit.maxCount`` (number of M-steps) or when relative change of likelihood logarithm is less than ``termCrit.epsilon``. Default maximum number of iterations is ``EM::DEFAULT_MAX_ITERS=100``.
EM::train EM::train
@ -122,23 +123,29 @@ Estimates the Gaussian mixture parameters from a samples set.
.. ocv:function:: bool EM::train(InputArray samples, OutputArray logLikelihoods=noArray(), OutputArray labels=noArray(), OutputArray probs=noArray()) .. ocv:function:: bool EM::train(InputArray samples, OutputArray logLikelihoods=noArray(), OutputArray labels=noArray(), OutputArray probs=noArray())
.. ocv:function:: bool EM::trainE(InputArray samples, InputArray means0, InputArray covs0=noArray(), InputArray weights0=noArray(), OutputArray logLikelihoods=noArray(), OutputArray labels=noArray(), OutputArray probs=noArray()) .. ocv:function:: bool EM::trainE(InputArray samples, InputArray means0, InputArray covs0=noArray(), InputArray weights0=noArray(), OutputArray logLikelihoods=noArray(), OutputArray labels=noArray(), OutputArray probs=noArray())
.. ocv:function:: bool EM::trainM(InputArray samples, InputArray probs0, OutputArray logLikelihoods=noArray(), OutputArray labels=noArray(), OutputArray probs=noArray()) .. ocv:function:: bool EM::trainM(InputArray samples, InputArray probs0, OutputArray logLikelihoods=noArray(), OutputArray labels=noArray(), OutputArray probs=noArray())
.. ocv:pyfunction:: cv2.EM.train(samples[, logLikelihoods[, labels[, probs]]]) -> retval, logLikelihoods, labels, probs
.. ocv:pyfunction:: cv2.EM.trainE(samples, means0[, covs0[, weights0[, logLikelihoods[, labels[, probs]]]]]) -> retval, logLikelihoods, labels, probs
.. ocv:pyfunction:: cv2.EM.trainM(samples, probs0[, logLikelihoods[, labels[, probs]]]) -> retval, logLikelihoods, labels, probs
:param samples: Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have ``CV_64F`` type it will be converted to the inner matrix of such type for the further computing. :param samples: Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have ``CV_64F`` type it will be converted to the inner matrix of such type for the further computing.
:param means0: Initial means :math:`a_k` of mixture components. It is a one-channel matrix of :math:`nclusters \times dims` size. If the matrix does not have ``CV_64F`` type it will be converted to the inner matrix of such type for the further computing. :param means0: Initial means :math:`a_k` of mixture components. It is a one-channel matrix of :math:`nclusters \times dims` size. If the matrix does not have ``CV_64F`` type it will be converted to the inner matrix of such type for the further computing.
:param covs0: The vector of initial covariance matrices :math:`S_k` of mixture components. Each of covariance matrices is a one-channel matrix of :math:`dims \times dims` size. If the matrices do not have ``CV_64F`` type they will be converted to the inner matrices of such type for the further computing. :param covs0: The vector of initial covariance matrices :math:`S_k` of mixture components. Each of covariance matrices is a one-channel matrix of :math:`dims \times dims` size. If the matrices do not have ``CV_64F`` type they will be converted to the inner matrices of such type for the further computing.
:param weights0: Initial weights :math:`\pi_k` of mixture components. It should be a one-channel floating-point matrix with :math:`1 \times nclusters` or :math:`nclusters \times 1` size. :param weights0: Initial weights :math:`\pi_k` of mixture components. It should be a one-channel floating-point matrix with :math:`1 \times nclusters` or :math:`nclusters \times 1` size.
:param probs0: Initial probabilities :math:`p_{i,k}` of sample :math:`i` to belong to mixture component :math:`k`. It is a one-channel floating-point matrix of :math:`nsamples \times nclusters` size. :param probs0: Initial probabilities :math:`p_{i,k}` of sample :math:`i` to belong to mixture component :math:`k`. It is a one-channel floating-point matrix of :math:`nsamples \times nclusters` size.
:param logLikelihoods: The optional output matrix that contains a likelihood logarithm value for each sample. It has :math:`nsamples \times 1` size and ``CV_64FC1`` type. :param logLikelihoods: The optional output matrix that contains a likelihood logarithm value for each sample. It has :math:`nsamples \times 1` size and ``CV_64FC1`` type.
:param labels: The optional output "class label" for each sample: :math:`\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N` (indices of the most probable mixture component for each sample). It has :math:`nsamples \times 1` size and ``CV_32SC1`` type. :param labels: The optional output "class label" for each sample: :math:`\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N` (indices of the most probable mixture component for each sample). It has :math:`nsamples \times 1` size and ``CV_32SC1`` type.
:param probs: The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has :math:`nsamples \times nclusters` size and ``CV_64FC1`` type. :param probs: The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has :math:`nsamples \times nclusters` size and ``CV_64FC1`` type.
Three versions of training method differ in the initialization of Gaussian mixture model parameters and start step: Three versions of training method differ in the initialization of Gaussian mixture model parameters and start step:
@ -167,7 +174,9 @@ EM::predict
Returns a likelihood logarithm value and an index of the most probable mixture component for the given sample. Returns a likelihood logarithm value and an index of the most probable mixture component for the given sample.
.. ocv:function:: Vec2d predict(InputArray sample, OutputArray probs=noArray()) const .. ocv:function:: Vec2d predict(InputArray sample, OutputArray probs=noArray()) const
.. ocv:pyfunction:: cv2.EM.predict(sample[, probs]) -> retval, probs
:param sample: A sample for classification. It should be a one-channel matrix of :math:`1 \times dims` or :math:`dims \times 1` size. :param sample: A sample for classification. It should be a one-channel matrix of :math:`1 \times dims` or :math:`dims \times 1` size.
:param probs: Optional output matrix that contains posterior probabilities of each component given the sample. It has :math:`1 \times nclusters` size and ``CV_64FC1`` type. :param probs: Optional output matrix that contains posterior probabilities of each component given the sample. It has :math:`1 \times nclusters` size and ``CV_64FC1`` type.
@ -180,6 +189,8 @@ Returns ``true`` if the Gaussian mixture model was trained.
.. ocv:function:: bool EM::isTrained() const .. ocv:function:: bool EM::isTrained() const
.. ocv:pyfunction:: cv2.EM.isTrained() -> retval
EM::read, EM::write EM::read, EM::write
------------------- -------------------
See :ocv:func:`Algorithm::read` and :ocv:func:`Algorithm::write`. See :ocv:func:`Algorithm::read` and :ocv:func:`Algorithm::write`.

View File

@ -104,7 +104,7 @@ For classification problems, the result is :math:`\arg\max_{i=1..K}(f_i(x))`.
CvGBTreesParams CvGBTreesParams
--------------- ---------------
.. ocv:class:: CvGBTreesParams .. ocv:struct:: CvGBTreesParams : public CvDTreeParams
GBT training parameters. GBT training parameters.
@ -149,7 +149,7 @@ By default the following constructor is used:
CvGBTrees CvGBTrees
--------- ---------
.. ocv:class:: CvGBTrees .. ocv:class:: CvGBTrees : public CvStatModel
The class implements the Gradient boosted tree model as described in the beginning of this section. The class implements the Gradient boosted tree model as described in the beginning of this section.

View File

@ -7,7 +7,7 @@ The algorithm caches all training samples and predicts the response for a new sa
CvKNearest CvKNearest
---------- ----------
.. ocv:class:: CvKNearest .. ocv:class:: CvKNearest : public CvStatModel
The class implements K-Nearest Neighbors model as described in the beginning of this section. The class implements K-Nearest Neighbors model as described in the beginning of this section.

View File

@ -251,7 +251,7 @@ The method returns a map that converts string class labels to the numerical clas
CvTrainTestSplit CvTrainTestSplit
---------------- ----------------
.. ocv:class:: CvTrainTestSplit .. ocv:struct:: CvTrainTestSplit
Structure setting the split of a data set read by :ocv:class:`CvMLData`. Structure setting the split of a data set read by :ocv:class:`CvMLData`.
:: ::

View File

@ -8,7 +8,7 @@ ML implements feed-forward artificial neural networks or, more particularly, mul
.. image:: pics/mlp.png .. image:: pics/mlp.png
All the neurons in MLP are similar. Each of them has several input links (it takes the output values from several neurons in the previous layer as input) and several output links (it passes the response to several neurons in the next layer). The values retrieved from the previous layer are summed up with certain weights, individual for each neuron, plus the bias term. The sum is transformed using the activation function All the neurons in MLP are similar. Each of them has several input links (it takes the output values from several neurons in the previous layer as input) and several output links (it passes the response to several neurons in the next layer). The values retrieved from the previous layer are summed up with certain weights, individual for each neuron, plus the bias term. The sum is transformed using the activation function
:math:`f` that may be also different for different neurons. :math:`f` that may be also different for different neurons.
.. image:: pics/neuron_model.png .. image:: pics/neuron_model.png
@ -45,7 +45,7 @@ Different activation functions may be used. ML implements three standard functio
In ML, all the neurons have the same activation functions, with the same free parameters ( In ML, all the neurons have the same activation functions, with the same free parameters (
:math:`\alpha, \beta` ) that are specified by user and are not altered by the training algorithms. :math:`\alpha, \beta` ) that are specified by user and are not altered by the training algorithms.
So, the whole trained network works as follows: So, the whole trained network works as follows:
#. Take the feature vector as input. The vector size is equal to the size of the input layer. #. Take the feature vector as input. The vector size is equal to the size of the input layer.
@ -93,11 +93,11 @@ The second (default) one is a batch RPROP algorithm.
.. [LeCun98] Y. LeCun, L. Bottou, G.B. Orr and K.-R. Muller, *Efficient backprop*, in Neural Networks---Tricks of the Trade, Springer Lecture Notes in Computer Sciences 1524, pp.5-50, 1998. .. [LeCun98] Y. LeCun, L. Bottou, G.B. Orr and K.-R. Muller, *Efficient backprop*, in Neural Networks---Tricks of the Trade, Springer Lecture Notes in Computer Sciences 1524, pp.5-50, 1998.
.. [RPROP93] M. Riedmiller and H. Braun, *A Direct Adaptive Method for Faster Backpropagation Learning: The RPROP Algorithm*, Proc. ICNN, San Francisco (1993). .. [RPROP93] M. Riedmiller and H. Braun, *A Direct Adaptive Method for Faster Backpropagation Learning: The RPROP Algorithm*, Proc. ICNN, San Francisco (1993).
CvANN_MLP_TrainParams CvANN_MLP_TrainParams
--------------------- ---------------------
.. ocv:class:: CvANN_MLP_TrainParams .. ocv:struct:: CvANN_MLP_TrainParams
Parameters of the MLP training algorithm. You can initialize the structure by a constructor or the individual parameters can be adjusted after the structure is created. Parameters of the MLP training algorithm. You can initialize the structure by a constructor or the individual parameters can be adjusted after the structure is created.
@ -169,9 +169,9 @@ By default the RPROP algorithm is used:
CvANN_MLP CvANN_MLP
--------- ---------
.. ocv:class:: CvANN_MLP .. ocv:class:: CvANN_MLP : public CvStatModel
MLP model. MLP model.
Unlike many other models in ML that are constructed and trained at once, in the MLP model these steps are separated. First, a network with the specified topology is created using the non-default constructor or the method :ocv:func:`CvANN_MLP::create`. All the weights are set to zeros. Then, the network is trained using a set of input and output vectors. The training procedure can be repeated more than once, that is, the weights can be adjusted based on the new training data. Unlike many other models in ML that are constructed and trained at once, in the MLP model these steps are separated. First, a network with the specified topology is created using the non-default constructor or the method :ocv:func:`CvANN_MLP::create`. All the weights are set to zeros. Then, the network is trained using a set of input and output vectors. The training procedure can be repeated more than once, that is, the weights can be adjusted based on the new training data.
@ -184,7 +184,7 @@ The constructors.
.. ocv:function:: CvANN_MLP::CvANN_MLP( const CvMat* layerSizes, int activateFunc=CvANN_MLP::SIGMOID_SYM, double fparam1=0, double fparam2=0 ) .. ocv:function:: CvANN_MLP::CvANN_MLP( const CvMat* layerSizes, int activateFunc=CvANN_MLP::SIGMOID_SYM, double fparam1=0, double fparam2=0 )
.. ocv:pyfunction:: cv2.ANN_MLP(layerSizes[, activateFunc[, fparam1[, fparam2]]]) -> <ANN_MLP object> .. ocv:pyfunction:: cv2.ANN_MLP([layerSizes[, activateFunc[, fparam1[, fparam2]]]]) -> <ANN_MLP object>
The advanced constructor allows to create MLP with the specified topology. See :ocv:func:`CvANN_MLP::create` for details. The advanced constructor allows to create MLP with the specified topology. See :ocv:func:`CvANN_MLP::create` for details.
@ -203,7 +203,7 @@ Constructs MLP with the specified topology.
:param activateFunc: Parameter specifying the activation function for each neuron: one of ``CvANN_MLP::IDENTITY``, ``CvANN_MLP::SIGMOID_SYM``, and ``CvANN_MLP::GAUSSIAN``. :param activateFunc: Parameter specifying the activation function for each neuron: one of ``CvANN_MLP::IDENTITY``, ``CvANN_MLP::SIGMOID_SYM``, and ``CvANN_MLP::GAUSSIAN``.
:param fparam1: Free parameter of the activation function, :math:`\alpha`. See the formulas in the introduction section. :param fparam1: Free parameter of the activation function, :math:`\alpha`. See the formulas in the introduction section.
:param fparam2: Free parameter of the activation function, :math:`\beta`. See the formulas in the introduction section. :param fparam2: Free parameter of the activation function, :math:`\beta`. See the formulas in the introduction section.
The method creates an MLP network with the specified topology and assigns the same activation function to all the neurons. The method creates an MLP network with the specified topology and assigns the same activation function to all the neurons.
@ -216,7 +216,7 @@ Trains/updates MLP.
.. ocv:function:: int CvANN_MLP::train( const CvMat* inputs, const CvMat* outputs, const CvMat* sampleWeights, const CvMat* sampleIdx=0, CvANN_MLP_TrainParams params = CvANN_MLP_TrainParams(), int flags=0 ) .. ocv:function:: int CvANN_MLP::train( const CvMat* inputs, const CvMat* outputs, const CvMat* sampleWeights, const CvMat* sampleIdx=0, CvANN_MLP_TrainParams params = CvANN_MLP_TrainParams(), int flags=0 )
.. ocv:pyfunction:: cv2.ANN_MLP.train(inputs, outputs, sampleWeights[, sampleIdx[, params[, flags]]]) -> niterations .. ocv:pyfunction:: cv2.ANN_MLP.train(inputs, outputs, sampleWeights[, sampleIdx[, params[, flags]]]) -> retval
:param inputs: Floating-point matrix of input vectors, one vector per row. :param inputs: Floating-point matrix of input vectors, one vector per row.
@ -249,7 +249,7 @@ Predicts responses for input samples.
.. ocv:function:: float CvANN_MLP::predict( const CvMat* inputs, CvMat* outputs ) const .. ocv:function:: float CvANN_MLP::predict( const CvMat* inputs, CvMat* outputs ) const
.. ocv:pyfunction:: cv2.ANN_MLP.predict(inputs, outputs) -> retval .. ocv:pyfunction:: cv2.ANN_MLP.predict(inputs[, outputs]) -> retval, outputs
:param inputs: Input samples. :param inputs: Input samples.
@ -278,4 +278,4 @@ Returns neurons weights of the particular layer.
.. ocv:function:: double* CvANN_MLP::get_weights(int layer) .. ocv:function:: double* CvANN_MLP::get_weights(int layer)
:param layer: Index of the particular layer. :param layer: Index of the particular layer.

View File

@ -11,7 +11,7 @@ This simple classification model assumes that feature vectors from each class ar
CvNormalBayesClassifier CvNormalBayesClassifier
----------------------- -----------------------
.. ocv:class:: CvNormalBayesClassifier .. ocv:class:: CvNormalBayesClassifier : public CvStatModel
Bayes classifier for normally distributed data. Bayes classifier for normally distributed data.
@ -25,7 +25,7 @@ Default and training constructors.
.. ocv:function:: CvNormalBayesClassifier::CvNormalBayesClassifier( const CvMat* trainData, const CvMat* responses, const CvMat* varIdx=0, const CvMat* sampleIdx=0 ) .. ocv:function:: CvNormalBayesClassifier::CvNormalBayesClassifier( const CvMat* trainData, const CvMat* responses, const CvMat* varIdx=0, const CvMat* sampleIdx=0 )
.. ocv:pyfunction:: cv2.NormalBayesClassifier(trainData, responses[, varIdx[, sampleIdx]]) -> <NormalBayesClassifier object> .. ocv:pyfunction:: cv2.NormalBayesClassifier([trainData, responses[, varIdx[, sampleIdx]]]) -> <NormalBayesClassifier object>
The constructors follow conventions of :ocv:func:`CvStatModel::CvStatModel`. See :ocv:func:`CvStatModel::train` for parameters descriptions. The constructors follow conventions of :ocv:func:`CvStatModel::CvStatModel`. See :ocv:func:`CvStatModel::train` for parameters descriptions.
@ -41,7 +41,7 @@ Trains the model.
:param update: Identifies whether the model should be trained from scratch (``update=false``) or should be updated using the new training data (``update=true``). :param update: Identifies whether the model should be trained from scratch (``update=false``) or should be updated using the new training data (``update=true``).
The method trains the Normal Bayes classifier. It follows the conventions of the generic :ocv:func:`CvStatModel::train` approach with the following limitations: The method trains the Normal Bayes classifier. It follows the conventions of the generic :ocv:func:`CvStatModel::train` approach with the following limitations:
* Only ``CV_ROW_SAMPLE`` data layout is supported. * Only ``CV_ROW_SAMPLE`` data layout is supported.
* Input variables are all ordered. * Input variables are all ordered.

View File

@ -42,7 +42,7 @@ For the random trees usage example, please, see letter_recog.cpp sample in OpenC
CvRTParams CvRTParams
---------- ----------
.. ocv:class:: CvRTParams .. ocv:struct:: CvRTParams : public CvDTreeParams
Training parameters of random trees. Training parameters of random trees.
@ -53,7 +53,7 @@ CvRTParams::CvRTParams:
----------------------- -----------------------
The constructors. The constructors.
.. ocv:function:: CvRTParams::CvRTParams() .. ocv:function:: CvRTParams::CvRTParams()
.. ocv:function:: CvRTParams::CvRTParams( int max_depth, int min_sample_count, float regression_accuracy, bool use_surrogates, int max_categories, const float* priors, bool calc_var_importance, int nactive_vars, int max_num_of_trees_in_the_forest, float forest_accuracy, int termcrit_type ) .. ocv:function:: CvRTParams::CvRTParams( int max_depth, int min_sample_count, float regression_accuracy, bool use_surrogates, int max_categories, const float* priors, bool calc_var_importance, int nactive_vars, int max_num_of_trees_in_the_forest, float forest_accuracy, int termcrit_type )
@ -72,9 +72,9 @@ The constructors.
:param forest_accuracy: Sufficient accuracy (OOB error). :param forest_accuracy: Sufficient accuracy (OOB error).
:param termcrit_type: The type of the termination criteria: :param termcrit_type: The type of the termination criteria:
* **CV_TERMCRIT_ITER** Terminate learning by the ``max_num_of_trees_in_the_forest``; * **CV_TERMCRIT_ITER** Terminate learning by the ``max_num_of_trees_in_the_forest``;
* **CV_TERMCRIT_EPS** Terminate learning by the ``forest_accuracy``; * **CV_TERMCRIT_EPS** Terminate learning by the ``forest_accuracy``;
* **CV_TERMCRIT_ITER | CV_TERMCRIT_EPS** Use both termination criteria. * **CV_TERMCRIT_ITER | CV_TERMCRIT_EPS** Use both termination criteria.
@ -94,7 +94,7 @@ The default constructor sets all parameters to default values which are differen
CvRTrees CvRTrees
-------- --------
.. ocv:class:: CvRTrees .. ocv:class:: CvRTrees : public CvStatModel
The class implements the random forest predictor as described in the beginning of this section. The class implements the random forest predictor as described in the beginning of this section.
@ -118,7 +118,7 @@ CvRTrees::predict
----------------- -----------------
Predicts the output for an input sample. Predicts the output for an input sample.
.. ocv:function:: double CvRTrees::predict( const Mat& sample, const Mat& missing=Mat() ) const .. ocv:function:: float CvRTrees::predict( const Mat& sample, const Mat& missing=Mat() ) const
.. ocv:function:: float CvRTrees::predict( const CvMat* sample, const CvMat* missing = 0 ) const .. ocv:function:: float CvRTrees::predict( const CvMat* sample, const CvMat* missing = 0 ) const
@ -156,7 +156,7 @@ Returns the variable importance array.
.. ocv:function:: const CvMat* CvRTrees::get_var_importance() .. ocv:function:: const CvMat* CvRTrees::get_var_importance()
.. ocv:pyfunction:: cv2.RTrees.getVarImportance() -> importanceVector .. ocv:pyfunction:: cv2.RTrees.getVarImportance() -> retval
The method returns the variable importance vector, computed at the training stage when ``CvRTParams::calc_var_importance`` is set to true. If this flag was set to false, the ``NULL`` pointer is returned. This differs from the decision trees where variable importance can be computed anytime after the training. The method returns the variable importance vector, computed at the training stage when ``CvRTParams::calc_var_importance`` is set to true. If this flag was set to false, the ``NULL`` pointer is returned. This differs from the decision trees where variable importance can be computed anytime after the training.
@ -181,7 +181,7 @@ CvRTrees::calc_error
-------------------- --------------------
Returns error of the random forest. Returns error of the random forest.
.. ocv:function:: float CvRTrees::calc_error( CvMLData* data, int type, std::vector<float> *resp = 0 ) .. ocv:function:: float CvRTrees::calc_error( CvMLData* data, int type, std::vector<float>* resp=0 )
The method is identical to :ocv:func:`CvDTree::calc_error` but uses the random forest as predictor. The method is identical to :ocv:func:`CvDTree::calc_error` but uses the random forest as predictor.

View File

@ -52,7 +52,7 @@ CvStatModel::CvStatModel(...)
----------------------------- -----------------------------
The training constructor. The training constructor.
.. ocv:function:: CvStatModel::CvStatModel( const Mat& train_data ... ) .. ocv:function:: CvStatModel::CvStatModel()
Most ML classes provide a single-step constructor and train constructors. This constructor is equivalent to the default constructor, followed by the :ocv:func:`CvStatModel::train` method with the parameters that are passed to the constructor. Most ML classes provide a single-step constructor and train constructors. This constructor is equivalent to the default constructor, followed by the :ocv:func:`CvStatModel::train` method with the parameters that are passed to the constructor.

View File

@ -16,9 +16,9 @@ SVM implementation in OpenCV is based on [LibSVM]_.
CvParamGrid CvParamGrid
----------- -----------
.. ocv:class:: CvParamGrid .. ocv:struct:: CvParamGrid
The structure represents the logarithmic grid range of statmodel parameters. It is used for optimizing statmodel accuracy by varying model parameters, the accuracy estimate being computed by cross-validation. The structure represents the logarithmic grid range of statmodel parameters. It is used for optimizing statmodel accuracy by varying model parameters, the accuracy estimate being computed by cross-validation.
.. ocv:member:: double CvParamGrid::min_val .. ocv:member:: double CvParamGrid::min_val
@ -77,7 +77,7 @@ Returns ``true`` if the grid is valid and ``false`` otherwise. The grid is valid
CvSVMParams CvSVMParams
----------- -----------
.. ocv:class:: CvSVMParams .. ocv:struct:: CvSVMParams
SVM training parameters. SVM training parameters.
@ -114,7 +114,7 @@ The constructors.
* **CvSVM::RBF** Radial basis function (RBF), a good choice in most cases. :math:`K(x_i, x_j) = e^{-\gamma ||x_i - x_j||^2}, \gamma > 0`. * **CvSVM::RBF** Radial basis function (RBF), a good choice in most cases. :math:`K(x_i, x_j) = e^{-\gamma ||x_i - x_j||^2}, \gamma > 0`.
* **CvSVM::SIGMOID** Sigmoid kernel: :math:`K(x_i, x_j) = \tanh(\gamma x_i^T x_j + coef0)`. * **CvSVM::SIGMOID** Sigmoid kernel: :math:`K(x_i, x_j) = \tanh(\gamma x_i^T x_j + coef0)`.
:param degree: Parameter ``degree`` of a kernel function (POLY). :param degree: Parameter ``degree`` of a kernel function (POLY).
:param gamma: Parameter :math:`\gamma` of a kernel function (POLY / RBF / SIGMOID). :param gamma: Parameter :math:`\gamma` of a kernel function (POLY / RBF / SIGMOID).
@ -146,7 +146,7 @@ The default constructor initialize the structure with following values:
CvSVM CvSVM
----- -----
.. ocv:class:: CvSVM .. ocv:class:: CvSVM : public CvStatModel
Support Vector Machines. Support Vector Machines.
@ -160,7 +160,7 @@ Default and training constructors.
.. ocv:function:: CvSVM::CvSVM( const CvMat* trainData, const CvMat* responses, const CvMat* varIdx=0, const CvMat* sampleIdx=0, CvSVMParams params=CvSVMParams() ) .. ocv:function:: CvSVM::CvSVM( const CvMat* trainData, const CvMat* responses, const CvMat* varIdx=0, const CvMat* sampleIdx=0, CvSVMParams params=CvSVMParams() )
.. ocv:pyfunction:: cv2.SVM(trainData, responses[, varIdx[, sampleIdx[, params]]]) -> <SVM object> .. ocv:pyfunction:: cv2.SVM([trainData, responses[, varIdx[, sampleIdx[, params]]]]) -> <SVM object>
The constructors follow conventions of :ocv:func:`CvStatModel::CvStatModel`. See :ocv:func:`CvStatModel::train` for parameters descriptions. The constructors follow conventions of :ocv:func:`CvStatModel::CvStatModel`. See :ocv:func:`CvStatModel::train` for parameters descriptions.
@ -174,7 +174,7 @@ Trains an SVM.
.. ocv:pyfunction:: cv2.SVM.train(trainData, responses[, varIdx[, sampleIdx[, params]]]) -> retval .. ocv:pyfunction:: cv2.SVM.train(trainData, responses[, varIdx[, sampleIdx[, params]]]) -> retval
The method trains the SVM model. It follows the conventions of the generic :ocv:func:`CvStatModel::train` approach with the following limitations: The method trains the SVM model. It follows the conventions of the generic :ocv:func:`CvStatModel::train` approach with the following limitations:
* Only the ``CV_ROW_SAMPLE`` data layout is supported. * Only the ``CV_ROW_SAMPLE`` data layout is supported.
@ -199,7 +199,7 @@ Trains an SVM with optimal parameters.
.. ocv:pyfunction:: cv2.SVM.train_auto(trainData, responses, varIdx, sampleIdx, params[, k_fold[, Cgrid[, gammaGrid[, pGrid[, nuGrid[, coeffGrid[, degreeGrid[, balanced]]]]]]]]) -> retval .. ocv:pyfunction:: cv2.SVM.train_auto(trainData, responses, varIdx, sampleIdx, params[, k_fold[, Cgrid[, gammaGrid[, pGrid[, nuGrid[, coeffGrid[, degreeGrid[, balanced]]]]]]]]) -> retval
:param k_fold: Cross-validation parameter. The training set is divided into ``k_fold`` subsets. One subset is used to train the model, the others form the test set. So, the SVM algorithm is executed ``k_fold`` times. :param k_fold: Cross-validation parameter. The training set is divided into ``k_fold`` subsets. One subset is used to train the model, the others form the test set. So, the SVM algorithm is executed ``k_fold`` times.
:param \*Grid: Iteration grid for the corresponding SVM parameter. :param \*Grid: Iteration grid for the corresponding SVM parameter.
:param balanced: If ``true`` and the problem is 2-class classification then the method creates more balanced cross-validation subsets that is proportions between classes in subsets are close to such proportion in the whole train dataset. :param balanced: If ``true`` and the problem is 2-class classification then the method creates more balanced cross-validation subsets that is proportions between classes in subsets are close to such proportion in the whole train dataset.
@ -285,7 +285,7 @@ Retrieves a number of support vectors and the particular vector.
.. ocv:function:: const float* CvSVM::get_support_vector(int i) const .. ocv:function:: const float* CvSVM::get_support_vector(int i) const
.. ocv:pyfunction:: cv2.SVM.get_support_vector_count() -> nsupportVectors .. ocv:pyfunction:: cv2.SVM.get_support_vector_count() -> retval
:param i: Index of the particular support vector. :param i: Index of the particular support vector.
@ -297,4 +297,4 @@ Returns the number of used features (variables count).
.. ocv:function:: int CvSVM::get_var_count() const .. ocv:function:: int CvSVM::get_var_count() const
.. ocv:pyfunction:: cv2.SVM.get_var_count() -> nvars .. ocv:pyfunction:: cv2.SVM.get_var_count() -> retval

View File

@ -170,10 +170,10 @@ struct CV_EXPORTS_W_MAP CvParamGrid
min_val = max_val = step = 0; min_val = max_val = step = 0;
} }
CvParamGrid( double _min_val, double _max_val, double log_step ) CvParamGrid( double min_val, double max_val, double log_step )
{ {
min_val = _min_val; this->min_val = min_val;
max_val = _max_val; this->max_val = max_val;
step = log_step; step = log_step;
} }
//CvParamGrid( int param_id ); //CvParamGrid( int param_id );
@ -291,10 +291,10 @@ protected:
struct CV_EXPORTS_W_MAP CvSVMParams struct CV_EXPORTS_W_MAP CvSVMParams
{ {
CvSVMParams(); CvSVMParams();
CvSVMParams( int _svm_type, int _kernel_type, CvSVMParams( int svm_type, int kernel_type,
double _degree, double _gamma, double _coef0, double degree, double gamma, double coef0,
double Cvalue, double _nu, double _p, double Cvalue, double nu, double p,
CvMat* _class_weights, CvTermCriteria _term_crit ); CvMat* class_weights, CvTermCriteria term_crit );
CV_PROP_RW int svm_type; CV_PROP_RW int svm_type;
CV_PROP_RW int kernel_type; CV_PROP_RW int kernel_type;
@ -569,8 +569,7 @@ public:
enum {START_E_STEP=1, START_M_STEP=2, START_AUTO_STEP=0}; enum {START_E_STEP=1, START_M_STEP=2, START_AUTO_STEP=0};
CV_WRAP EM(int nclusters=EM::DEFAULT_NCLUSTERS, int covMatType=EM::COV_MAT_DIAGONAL, CV_WRAP EM(int nclusters=EM::DEFAULT_NCLUSTERS, int covMatType=EM::COV_MAT_DIAGONAL,
const TermCriteria& termCrit=TermCriteria(TermCriteria::COUNT+ const TermCriteria& termCrit=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS,
TermCriteria::EPS,
EM::DEFAULT_MAX_ITERS, FLT_EPSILON)); EM::DEFAULT_MAX_ITERS, FLT_EPSILON));
virtual ~EM(); virtual ~EM();
@ -1026,7 +1025,7 @@ public:
virtual float get_proximity( const CvMat* sample1, const CvMat* sample2, virtual float get_proximity( const CvMat* sample1, const CvMat* sample2,
const CvMat* missing1 = 0, const CvMat* missing2 = 0 ) const; const CvMat* missing1 = 0, const CvMat* missing2 = 0 ) const;
virtual float calc_error( CvMLData* _data, int type , std::vector<float> *resp = 0 ); // type in {CV_TRAIN_ERROR, CV_TEST_ERROR} virtual float calc_error( CvMLData* data, int type , std::vector<float>* resp = 0 ); // type in {CV_TRAIN_ERROR, CV_TEST_ERROR}
virtual float get_train_error(); virtual float get_train_error();

View File

@ -3,7 +3,7 @@ Feature Detection and Description
SIFT SIFT
---- ----
.. ocv:class:: SIFT .. ocv:class:: SIFT : public Feature2D
Class for extracting keypoints and computing descriptors using the Scale Invariant Feature Transform (SIFT) algorithm by D. Lowe [Lowe04]_. Class for extracting keypoints and computing descriptors using the Scale Invariant Feature Transform (SIFT) algorithm by D. Lowe [Lowe04]_.
@ -17,11 +17,11 @@ The SIFT constructors.
.. ocv:function:: SIFT::SIFT( int nfeatures=0, int nOctaveLayers=3, double contrastThreshold=0.04, double edgeThreshold=10, double sigma=1.6) .. ocv:function:: SIFT::SIFT( int nfeatures=0, int nOctaveLayers=3, double contrastThreshold=0.04, double edgeThreshold=10, double sigma=1.6)
:param nfeatures: The number of best features to retain. The features are ranked by their scores (measured in SIFT algorithm as the local contrast) :param nfeatures: The number of best features to retain. The features are ranked by their scores (measured in SIFT algorithm as the local contrast)
:param nOctaveLayers: The number of layers in each octave. 3 is the value used in D. Lowe paper. The number of octaves is computed automatically from the image resolution. :param nOctaveLayers: The number of layers in each octave. 3 is the value used in D. Lowe paper. The number of octaves is computed automatically from the image resolution.
:param contrastThreshold: The contrast threshold used to filter out weak features in semi-uniform (low-contrast) regions. The larger the threshold, the less features are produced by the detector. :param contrastThreshold: The contrast threshold used to filter out weak features in semi-uniform (low-contrast) regions. The larger the threshold, the less features are produced by the detector.
:param edgeThreshold: The threshold used to filter out edge-like features. Note that the its meaning is different from the contrastThreshold, i.e. the larger the ``edgeThreshold``, the less features are filtered out (more features are retained). :param edgeThreshold: The threshold used to filter out edge-like features. Note that the its meaning is different from the contrastThreshold, i.e. the larger the ``edgeThreshold``, the less features are filtered out (more features are retained).
:param sigma: The sigma of the Gaussian applied to the input image at the octave #0. If your image is captured with a weak camera with soft lenses, you might want to reduce the number. :param sigma: The sigma of the Gaussian applied to the input image at the octave #0. If your image is captured with a weak camera with soft lenses, you might want to reduce the number.
@ -31,7 +31,7 @@ SIFT::operator ()
----------------- -----------------
Extract features and computes their descriptors using SIFT algorithm Extract features and computes their descriptors using SIFT algorithm
.. ocv:function:: void SIFT::operator()(InputArray image, InputArray mask, vector<KeyPoint>& keypoints, OutputArray descriptors, bool useProvidedKeypoints=false) .. 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 image: Input 8-bit grayscale image
@ -43,33 +43,33 @@ Extract features and computes their descriptors using SIFT algorithm
:param useProvidedKeypoints: Boolean flag. If it is true, the keypoint detector is not run. Instead, the provided vector of keypoints is used and the algorithm just computes their descriptors. :param useProvidedKeypoints: Boolean flag. If it is true, the keypoint detector is not run. Instead, the provided vector of keypoints is used and the algorithm just computes their descriptors.
SURF SURF
---- ----
.. ocv:class:: SURF .. ocv:class:: SURF : public Feature2D
Class for extracting Speeded Up Robust Features from an image [Bay06]_. The class is derived from ``CvSURFParams`` structure, which specifies the algorithm parameters: Class for extracting Speeded Up Robust Features from an image [Bay06]_. The class is derived from ``CvSURFParams`` structure, which specifies the algorithm parameters:
.. ocv:member:: int extended .. ocv:member:: int extended
* 0 means that the basic descriptors (64 elements each) shall be computed * 0 means that the basic descriptors (64 elements each) shall be computed
* 1 means that the extended descriptors (128 elements each) shall be computed * 1 means that the extended descriptors (128 elements each) shall be computed
.. ocv:member:: int upright .. ocv:member:: int upright
* 0 means that detector computes orientation of each feature. * 0 means that detector computes orientation of each feature.
* 1 means that the orientation is not computed (which is much, much faster). For example, if you match images from a stereo pair, or do image stitching, the matched features likely have very similar angles, and you can speed up feature extraction by setting ``upright=1``. * 1 means that the orientation is not computed (which is much, much faster). For example, if you match images from a stereo pair, or do image stitching, the matched features likely have very similar angles, and you can speed up feature extraction by setting ``upright=1``.
.. ocv:member:: double hessianThreshold .. ocv:member:: double hessianThreshold
Threshold for the keypoint detector. Only features, whose hessian is larger than ``hessianThreshold`` are retained by the detector. Therefore, the larger the value, the less keypoints you will get. A good default value could be from 300 to 500, depending from the image contrast. Threshold for the keypoint detector. Only features, whose hessian is larger than ``hessianThreshold`` are retained by the detector. Therefore, the larger the value, the less keypoints you will get. A good default value could be from 300 to 500, depending from the image contrast.
.. ocv:member:: int nOctaves .. ocv:member:: int nOctaves
The number of a gaussian pyramid octaves that the detector uses. It is set to 4 by default. If you want to get very large features, use the larger value. If you want just small features, decrease it. The number of a gaussian pyramid octaves that the detector uses. It is set to 4 by default. If you want to get very large features, use the larger value. If you want just small features, decrease it.
.. ocv:member:: int nOctaveLayers .. ocv:member:: int nOctaveLayers
The number of images within each octave of a gaussian pyramid. It is set to 2 by default. The number of images within each octave of a gaussian pyramid. It is set to 2 by default.
@ -82,18 +82,18 @@ The SURF extractor constructors.
.. ocv:function:: SURF::SURF() .. ocv:function:: SURF::SURF()
.. ocv:function:: SURF::SURF(double hessianThreshold, int nOctaves=4, int nOctaveLayers=2, bool extended=false, bool upright=false) .. ocv:function:: SURF::SURF( double hessianThreshold, int nOctaves=4, int nOctaveLayers=2, bool extended=true, bool upright=false )
.. ocv:pyfunction:: cv2.SURF(_hessianThreshold[, _nOctaves[, _nOctaveLayers[, _extended[, _upright]]]]) -> <SURF object> .. ocv:pyfunction:: cv2.SURF([hessianThreshold[, nOctaves[, nOctaveLayers[, extended[, upright]]]]]) -> <SURF object>
:param hessianThreshold: Threshold for hessian keypoint detector used in SURF. :param hessianThreshold: Threshold for hessian keypoint detector used in SURF.
:param nOctaves: Number of pyramid octaves the keypoint detector will use. :param nOctaves: Number of pyramid octaves the keypoint detector will use.
:param nOctaveLayers: Number of octave layers within each octave. :param nOctaveLayers: Number of octave layers within each octave.
:param extended: Extended descriptor flag (true - use extended 128-element descriptors; false - use 64-element descriptors). :param extended: Extended descriptor flag (true - use extended 128-element descriptors; false - use 64-element descriptors).
:param upright: Up-right or rotated features flag (true - do not compute orientation of features; false - compute orientation). :param upright: Up-right or rotated features flag (true - do not compute orientation of features; false - compute orientation).
@ -101,28 +101,28 @@ SURF::operator()
---------------- ----------------
Detects keypoints and computes SURF descriptors for them. Detects keypoints and computes SURF descriptors for them.
.. ocv:function:: void SURF::operator()(InputArray image, InputArray mask, vector<KeyPoint>& keypoints) const .. ocv:function:: void SURF::operator()(InputArray img, InputArray mask, vector<KeyPoint>& keypoints) const
.. ocv:function:: void SURF::operator()(InputArray image, InputArray mask, vector<KeyPoint>& keypoints, OutputArray descriptors, bool useProvidedKeypoints=false) .. ocv:function:: void SURF::operator()(InputArray img, InputArray mask, vector<KeyPoint>& keypoints, OutputArray descriptors, bool useProvidedKeypoints=false)
.. ocv:pyfunction:: cv2.SURF.detect(img, mask) -> keypoints .. ocv:pyfunction:: cv2.SURF.detect(img, mask) -> keypoints
.. ocv:pyfunction:: cv2.SURF.detect(img, mask[, useProvidedKeypoints]) -> keypoints, descriptors .. ocv:pyfunction:: cv2.SURF.detect(img, mask[, descriptors[, useProvidedKeypoints]]) -> keypoints, descriptors
.. ocv:cfunction:: void cvExtractSURF( const CvArr* image, const CvArr* mask, CvSeq** keypoints, CvSeq** descriptors, CvMemStorage* storage, CvSURFParams params ) .. ocv:cfunction:: void cvExtractSURF( const CvArr* image, const CvArr* mask, CvSeq** keypoints, CvSeq** descriptors, CvMemStorage* storage, CvSURFParams params )
.. ocv:pyoldfunction:: cv.ExtractSURF(image, mask, storage, params)-> (keypoints, descriptors) .. ocv:pyoldfunction:: cv.ExtractSURF(image, mask, storage, params)-> (keypoints, descriptors)
:param image: Input 8-bit grayscale image :param image: Input 8-bit grayscale image
:param mask: Optional input mask that marks the regions where we should detect features. :param mask: Optional input mask that marks the regions where we should detect features.
:param keypoints: The input/output vector of keypoints :param keypoints: The input/output vector of keypoints
:param descriptors: The output matrix of descriptors. Pass ``cv::noArray()`` if you do not need them. :param descriptors: The output matrix of descriptors. Pass ``cv::noArray()`` if you do not need them.
:param useProvidedKeypoints: Boolean flag. If it is true, the keypoint detector is not run. Instead, the provided vector of keypoints is used and the algorithm just computes their descriptors. :param useProvidedKeypoints: Boolean flag. If it is true, the keypoint detector is not run. Instead, the provided vector of keypoints is used and the algorithm just computes their descriptors.
:param storage: Memory storage for the output keypoints and descriptors in OpenCV 1.x API. :param storage: Memory storage for the output keypoints and descriptors in OpenCV 1.x API.
:param params: SURF algorithm parameters in OpenCV 1.x API. :param params: SURF algorithm parameters in OpenCV 1.x API.
The function is parallelized with the TBB library. The function is parallelized with the TBB library.

View File

@ -58,9 +58,9 @@ namespace cv
class CV_EXPORTS_W SIFT : public Feature2D class CV_EXPORTS_W SIFT : public Feature2D
{ {
public: public:
explicit SIFT( int _nfeatures=0, int _nOctaveLayers=3, explicit SIFT( int nfeatures=0, int nOctaveLayers=3,
double _contrastThreshold=0.04, double _edgeThreshold=10, double contrastThreshold=0.04, double edgeThreshold=10,
double _sigma=1.6); double sigma=1.6);
//! returns the descriptor size in floats (128) //! returns the descriptor size in floats (128)
int descriptorSize() const; int descriptorSize() const;
@ -108,23 +108,23 @@ class CV_EXPORTS_W SURF : public Feature2D
{ {
public: public:
//! the default constructor //! the default constructor
SURF(); CV_WRAP SURF();
//! the full constructor taking all the necessary parameters //! the full constructor taking all the necessary parameters
explicit SURF(double _hessianThreshold, explicit CV_WRAP SURF(double hessianThreshold,
int _nOctaves=4, int _nOctaveLayers=2, int nOctaves=4, int nOctaveLayers=2,
bool _extended=true, bool _upright=false); bool extended=true, bool upright=false);
//! returns the descriptor size in float's (64 or 128) //! returns the descriptor size in float's (64 or 128)
int descriptorSize() const; CV_WRAP int descriptorSize() const;
//! returns the descriptor type //! returns the descriptor type
int descriptorType() const; CV_WRAP int descriptorType() const;
//! finds the keypoints using fast hessian detector used in SURF //! finds the keypoints using fast hessian detector used in SURF
void operator()(InputArray img, InputArray mask, CV_WRAP_AS(detect) void operator()(InputArray img, InputArray mask,
CV_OUT vector<KeyPoint>& keypoints) const; CV_OUT vector<KeyPoint>& keypoints) const;
//! finds the keypoints and computes their descriptors. Optionally it can compute descriptors for the user-provided keypoints //! finds the keypoints and computes their descriptors. Optionally it can compute descriptors for the user-provided keypoints
void operator()(InputArray img, InputArray mask, CV_WRAP_AS(detect) void operator()(InputArray img, InputArray mask,
CV_OUT vector<KeyPoint>& keypoints, CV_OUT vector<KeyPoint>& keypoints,
OutputArray descriptors, OutputArray descriptors,
bool useProvidedKeypoints=false) const; bool useProvidedKeypoints=false) const;

View File

@ -131,7 +131,7 @@ FeatureEvaluator::create
---------------------------- ----------------------------
Constructs the feature evaluator. Constructs the feature evaluator.
.. ocv:function:: static Ptr<FeatureEvaluator> FeatureEvaluator::create(int type) .. ocv:function:: Ptr<FeatureEvaluator> FeatureEvaluator::create(int type)
:param type: Type of features evaluated by cascade (``HAAR`` or ``LBP`` for now). :param type: Type of features evaluated by cascade (``HAAR`` or ``LBP`` for now).
@ -148,7 +148,7 @@ Loads a classifier from a file.
.. ocv:function:: CascadeClassifier::CascadeClassifier(const string& filename) .. ocv:function:: CascadeClassifier::CascadeClassifier(const string& filename)
.. ocv:pyfunction:: cv2.CascadeClassifier(filename) -> <CascadeClassifier object> .. ocv:pyfunction:: cv2.CascadeClassifier([filename]) -> <CascadeClassifier object>
:param filename: Name of the file from which the classifier is loaded. :param filename: Name of the file from which the classifier is loaded.
@ -193,9 +193,9 @@ Detects objects of different sizes in the input image. The detected objects are
.. ocv:pyfunction:: cv2.CascadeClassifier.detectMultiScale(image[, scaleFactor[, minNeighbors[, flags[, minSize[, maxSize]]]]]) -> objects .. ocv:pyfunction:: cv2.CascadeClassifier.detectMultiScale(image[, scaleFactor[, minNeighbors[, flags[, minSize[, maxSize]]]]]) -> objects
.. ocv:pyfunction:: cv2.CascadeClassifier.detectMultiScale(image, rejectLevels, levelWeights[, scaleFactor[, minNeighbors[, flags[, minSize[, maxSize[, outputRejectLevels]]]]]]) -> objects .. ocv:pyfunction:: cv2.CascadeClassifier.detectMultiScale(image, rejectLevels, levelWeights[, scaleFactor[, minNeighbors[, flags[, minSize[, maxSize[, outputRejectLevels]]]]]]) -> objects
.. ocv:cfunction:: CvSeq* cvHaarDetectObjects( const CvArr* image, CvHaarClassifierCascade* cascade, CvMemStorage* storage, double scaleFactor=1.1, int minNeighbors=3, int flags=0, CvSize minSize=cvSize(0, 0), CvSize maxSize=cvSize(0, 0) ) .. ocv:cfunction:: CvSeq* cvHaarDetectObjects( const CvArr* image, CvHaarClassifierCascade* cascade, CvMemStorage* storage, double scale_factor=1.1, int min_neighbors=3, int flags=0, CvSize min_size=cvSize(0,0), CvSize max_size=cvSize(0,0) )
.. ocv:pyoldfunction:: cv.HaarDetectObjects(image, cascade, storage, scaleFactor=1.1, minNeighbors=3, flags=0, minSize=(0, 0))-> detectedObjects .. ocv:pyoldfunction:: cv.HaarDetectObjects(image, cascade, storage, scale_factor=1.1, min_neighbors=3, flags=0, min_size=(0, 0)) -> detectedObjects
:param cascade: Haar classifier cascade (OpenCV 1.x API only). It can be loaded from XML or YAML file using :ocv:cfunc:`Load`. When the cascade is not needed anymore, release it using ``cvReleaseHaarClassifierCascade(&cascade)``. :param cascade: Haar classifier cascade (OpenCV 1.x API only). It can be loaded from XML or YAML file using :ocv:cfunc:`Load`. When the cascade is not needed anymore, release it using ``cvReleaseHaarClassifierCascade(&cascade)``.
@ -222,7 +222,7 @@ Sets an image for detection.
.. ocv:function:: bool CascadeClassifier::setImage( Ptr<FeatureEvaluator>& feval, const Mat& image ) .. ocv:function:: bool CascadeClassifier::setImage( Ptr<FeatureEvaluator>& feval, const Mat& image )
.. ocv:cfunction:: void cvSetImagesForHaarClassifierCascade( CvHaarClassifierCascade* cascade, const CvArr* sum, const CvArr* sqsum, const CvArr* tiltedSum, double scale ) .. ocv:cfunction:: void cvSetImagesForHaarClassifierCascade( CvHaarClassifierCascade* cascade, const CvArr* sum, const CvArr* sqsum, const CvArr* tilted_sum, double scale )
:param cascade: Haar classifier cascade (OpenCV 1.x API only). See :ocv:func:`CascadeClassifier::detectMultiScale` for more information. :param cascade: Haar classifier cascade (OpenCV 1.x API only). See :ocv:func:`CascadeClassifier::detectMultiScale` for more information.
@ -241,7 +241,7 @@ Runs the detector at the specified point.
.. ocv:function:: int CascadeClassifier::runAt( Ptr<FeatureEvaluator>& feval, Point pt ) .. ocv:function:: int CascadeClassifier::runAt( Ptr<FeatureEvaluator>& feval, Point pt )
.. ocv:cfunction:: int cvRunHaarClassifierCascade( CvHaarClassifierCascade* cascade, CvPoint pt, int startStage=0 ) .. ocv:cfunction:: int cvRunHaarClassifierCascade( const CvHaarClassifierCascade* cascade, CvPoint pt, int start_stage=0 )
:param cascade: Haar classifier cascade (OpenCV 1.x API only). See :ocv:func:`CascadeClassifier::detectMultiScale` for more information. :param cascade: Haar classifier cascade (OpenCV 1.x API only). See :ocv:func:`CascadeClassifier::detectMultiScale` for more information.

View File

@ -27,13 +27,13 @@ model at a particular position and scale is the maximum over
components, of the score of that component model at the given components, of the score of that component model at the given
location. location.
In OpenCV there are C implementation of Latent SVM and C++ wrapper of it. In OpenCV there are C implementation of Latent SVM and C++ wrapper of it.
C version is the structure :ocv:struct:`CvObjectDetection` and a set of functions C version is the structure :ocv:struct:`CvObjectDetection` and a set of functions
working with this structure (see :ocv:func:`cvLoadLatentSvmDetector`, working with this structure (see :ocv:func:`cvLoadLatentSvmDetector`,
:ocv:func:`cvReleaseLatentSvmDetector`, :ocv:func:`cvLatentSvmDetectObjects`). :ocv:func:`cvReleaseLatentSvmDetector`, :ocv:func:`cvLatentSvmDetectObjects`).
C++ version is the class :ocv:class:`LatentSvmDetector` and has slightly different C++ version is the class :ocv:class:`LatentSvmDetector` and has slightly different
functionality in contrast with C version - it supports loading and detection functionality in contrast with C version - it supports loading and detection
of several models. of several models.
There are two examples of Latent SVM usage: ``samples/c/latentsvmdetect.cpp`` There are two examples of Latent SVM usage: ``samples/c/latentsvmdetect.cpp``
and ``samples/cpp/latentsvm_multidetect.cpp``. and ``samples/cpp/latentsvm_multidetect.cpp``.
@ -48,18 +48,18 @@ CvLSVMFilterPosition
Structure describes the position of the filter in the feature pyramid. Structure describes the position of the filter in the feature pyramid.
.. ocv:member:: unsigned int l .. ocv:member:: unsigned int l
level in the feature pyramid level in the feature pyramid
.. ocv:member:: unsigned int x .. ocv:member:: unsigned int x
x-coordinate in level l x-coordinate in level l
.. ocv:member:: unsigned int y .. ocv:member:: unsigned int y
y-coordinate in level l y-coordinate in level l
CvLSVMFilterObject CvLSVMFilterObject
------------------ ------------------
.. ocv:struct:: CvLSVMFilterObject .. ocv:struct:: CvLSVMFilterObject
@ -67,31 +67,31 @@ CvLSVMFilterObject
Description of the filter, which corresponds to the part of the object. Description of the filter, which corresponds to the part of the object.
.. ocv:member:: CvLSVMFilterPosition V .. ocv:member:: CvLSVMFilterPosition V
ideal (penalty = 0) position of the partial filter ideal (penalty = 0) position of the partial filter
from the root filter position (V_i in the paper) from the root filter position (V_i in the paper)
.. ocv:member:: float fineFunction[4] .. ocv:member:: float fineFunction[4]
vector describes penalty function (d_i in the paper) vector describes penalty function (d_i in the paper)
pf[0] * x + pf[1] * y + pf[2] * x^2 + pf[3] * y^2 pf[0] * x + pf[1] * y + pf[2] * x^2 + pf[3] * y^2
.. ocv:member:: int sizeX .. ocv:member:: int sizeX
.. ocv:member:: int sizeY .. ocv:member:: int sizeY
Rectangular map (sizeX x sizeY), Rectangular map (sizeX x sizeY),
every cell stores feature vector (dimension = p) every cell stores feature vector (dimension = p)
.. ocv:member:: int numFeatures .. ocv:member:: int numFeatures
number of features number of features
.. ocv:member:: float *H .. ocv:member:: float *H
matrix of feature vectors to set and get matrix of feature vectors to set and get
feature vectors (i,j) used formula H[(j * sizeX + i) * p + k], feature vectors (i,j) used formula H[(j * sizeX + i) * p + k],
where k - component of feature vector in cell (i, j) where k - component of feature vector in cell (i, j)
CvLatentSvmDetector CvLatentSvmDetector
------------------- -------------------
.. ocv:struct:: CvLatentSvmDetector .. ocv:struct:: CvLatentSvmDetector
@ -99,30 +99,30 @@ CvLatentSvmDetector
Structure contains internal representation of trained Latent SVM detector. Structure contains internal representation of trained Latent SVM detector.
.. ocv:member:: int num_filters .. ocv:member:: int num_filters
total number of filters (root plus part) in model total number of filters (root plus part) in model
.. ocv:member:: int num_components .. ocv:member:: int num_components
number of components in model number of components in model
.. ocv:member:: int* num_part_filters .. ocv:member:: int* num_part_filters
array containing number of part filters for each component array containing number of part filters for each component
.. ocv:member:: CvLSVMFilterObject** filters .. ocv:member:: CvLSVMFilterObject** filters
root and part filters for all model components root and part filters for all model components
.. ocv:member:: float* b .. ocv:member:: float* b
biases for all model components biases for all model components
.. ocv:member:: float score_threshold .. ocv:member:: float score_threshold
confidence level threshold confidence level threshold
CvObjectDetection CvObjectDetection
----------------- -----------------
.. ocv:struct:: CvObjectDetection .. ocv:struct:: CvObjectDetection
@ -130,11 +130,11 @@ CvObjectDetection
Structure contains the bounding box and confidence level for detected object. Structure contains the bounding box and confidence level for detected object.
.. ocv:member:: CvRect rect .. ocv:member:: CvRect rect
bounding box for a detected object bounding box for a detected object
.. ocv:member:: float score .. ocv:member:: float score
confidence level confidence level
@ -145,7 +145,7 @@ Loads trained detector from a file.
.. ocv:function:: CvLatentSvmDetector* cvLoadLatentSvmDetector(const char* filename) .. ocv:function:: CvLatentSvmDetector* cvLoadLatentSvmDetector(const char* filename)
:param filename: Name of the file containing the description of a trained detector :param filename: Name of the file containing the description of a trained detector
cvReleaseLatentSvmDetector cvReleaseLatentSvmDetector
-------------------------- --------------------------
@ -158,46 +158,46 @@ Release memory allocated for CvLatentSvmDetector structure.
cvLatentSvmDetectObjects cvLatentSvmDetectObjects
------------------------ ------------------------
Find rectangular regions in the given image that are likely to contain objects Find rectangular regions in the given image that are likely to contain objects
and corresponding confidence levels. and corresponding confidence levels.
.. ocv:function:: CvSeq* cvLatentSvmDetectObjects(IplImage* image, CvLatentSvmDetector* detector, CvMemStorage* storage, float overlap_threshold, int numThreads) .. ocv:function:: CvSeq* cvLatentSvmDetectObjects( IplImage* image, CvLatentSvmDetector* detector, CvMemStorage* storage, float overlap_threshold=0.5f, int numThreads=-1 )
:param image: image :param image: image
:param detector: LatentSVM detector in internal representation :param detector: LatentSVM detector in internal representation
:param storage: Memory storage to store the resultant sequence of the object candidate rectangles :param storage: Memory storage to store the resultant sequence of the object candidate rectangles
:param overlap_threshold: Threshold for the non-maximum suppression algorithm :param overlap_threshold: Threshold for the non-maximum suppression algorithm
:param numThreads: Number of threads used in parallel version of the algorithm :param numThreads: Number of threads used in parallel version of the algorithm
.. highlight:: cpp .. highlight:: cpp
LatentSvmDetector LatentSvmDetector
----------------- -----------------
.. ocv:class:: LatentSvmDetector .. ocv:class:: LatentSvmDetector
This is a C++ wrapping class of Latent SVM. It contains internal representation of several This is a C++ wrapping class of Latent SVM. It contains internal representation of several
trained Latent SVM detectors (models) and a set of methods to load the detectors and detect objects trained Latent SVM detectors (models) and a set of methods to load the detectors and detect objects
using them. using them.
LatentSvmDetector::ObjectDetection LatentSvmDetector::ObjectDetection
---------------------------------- ----------------------------------
.. ocv:class:: LatentSvmDetector::ObjectDetection .. ocv:struct:: LatentSvmDetector::ObjectDetection
Structure contains the detection information. Structure contains the detection information.
.. ocv:member:: Rect rect .. ocv:member:: Rect rect
bounding box for a detected object bounding box for a detected object
.. ocv:member:: float score .. ocv:member:: float score
confidence level confidence level
.. ocv:member:: int classID .. ocv:member:: int classID
class (model or detector) ID that detect an object class (model or detector) ID that detect an object
LatentSvmDetector::LatentSvmDetector LatentSvmDetector::LatentSvmDetector
------------------------------------ ------------------------------------
Two types of constructors. Two types of constructors.
@ -208,8 +208,8 @@ Two types of constructors.
:param filenames: A set of filenames storing the trained detectors (models). Each file contains one model. See examples of such files here /opencv_extra/testdata/cv/latentsvmdetector/models_VOC2007/. :param filenames: A set of filenames storing the trained detectors (models). Each file contains one model. See examples of such files here /opencv_extra/testdata/cv/latentsvmdetector/models_VOC2007/.
:param classNames: A set of trained models names. If it's empty then the name of each model will be constructed from the name of file containing the model. E.g. the model stored in "/home/user/cat.xml" will get the name "cat". :param classNames: A set of trained models names. If it's empty then the name of each model will be constructed from the name of file containing the model. E.g. the model stored in "/home/user/cat.xml" will get the name "cat".
LatentSvmDetector::~LatentSvmDetector LatentSvmDetector::~LatentSvmDetector
@ -228,10 +228,10 @@ LatentSvmDetector::load
----------------------- -----------------------
Load the trained models from given ``.xml`` files and return ``true`` if at least one model was loaded. Load the trained models from given ``.xml`` files and return ``true`` if at least one model was loaded.
.. ocv:function:: bool LatentSvmDetector::load(const vector<string>& filenames, const vector<string>& classNames) .. ocv:function:: bool LatentSvmDetector::load( const vector<string>& filenames, const vector<string>& classNames=vector<string>() )
:param filenames: A set of filenames storing the trained detectors (models). Each file contains one model. See examples of such files here /opencv_extra/testdata/cv/latentsvmdetector/models_VOC2007/. :param filenames: A set of filenames storing the trained detectors (models). Each file contains one model. See examples of such files here /opencv_extra/testdata/cv/latentsvmdetector/models_VOC2007/.
:param classNames: A set of trained models names. If it's empty then the name of each model will be constructed from the name of file containing the model. E.g. the model stored in "/home/user/cat.xml" will get the name "cat". :param classNames: A set of trained models names. If it's empty then the name of each model will be constructed from the name of file containing the model. E.g. the model stored in "/home/user/cat.xml" will get the name "cat".
LatentSvmDetector::detect LatentSvmDetector::detect
@ -239,13 +239,13 @@ LatentSvmDetector::detect
Find rectangular regions in the given image that are likely to contain objects of loaded classes (models) Find rectangular regions in the given image that are likely to contain objects of loaded classes (models)
and corresponding confidence levels. and corresponding confidence levels.
.. ocv:function:: void LatentSvmDetector::detect( const Mat& image, vector<ObjectDetection>& objectDetections, float overlapThreshold=0.5, int numThreads=-1 ) .. ocv:function:: void LatentSvmDetector::detect( const Mat& image, vector<ObjectDetection>& objectDetections, float overlapThreshold=0.5f, int numThreads=-1 )
:param image: An image. :param image: An image.
:param objectDetections: The detections: rectangulars, scores and class IDs. :param objectDetections: The detections: rectangulars, scores and class IDs.
:param overlapThreshold: Threshold for the non-maximum suppression algorithm. :param overlapThreshold: Threshold for the non-maximum suppression algorithm.
:param numThreads: Number of threads used in parallel version of the algorithm. :param numThreads: Number of threads used in parallel version of the algorithm.
LatentSvmDetector::getClassNames LatentSvmDetector::getClassNames
-------------------------------- --------------------------------
Return the class (model) names that were passed in constructor or method ``load`` or extracted from models filenames in those methods. Return the class (model) names that were passed in constructor or method ``load`` or extracted from models filenames in those methods.
@ -257,8 +257,8 @@ LatentSvmDetector::getClassCount
Return a count of loaded models (classes). Return a count of loaded models (classes).
.. ocv:function:: size_t getClassCount() const .. ocv:function:: size_t getClassCount() const
.. [Felzenszwalb2010] Felzenszwalb, P. F. and Girshick, R. B. and McAllester, D. and Ramanan, D. *Object Detection with Discriminatively Trained Part Based Models*. PAMI, vol. 32, no. 9, pp. 1627-1645, September 2010 .. [Felzenszwalb2010] Felzenszwalb, P. F. and Girshick, R. B. and McAllester, D. and Ramanan, D. *Object Detection with Discriminatively Trained Part Based Models*. PAMI, vol. 32, no. 9, pp. 1627-1645, September 2010

View File

@ -346,7 +346,7 @@ public:
virtual Ptr<FeatureEvaluator> clone() const; virtual Ptr<FeatureEvaluator> clone() const;
virtual int getFeatureType() const; virtual int getFeatureType() const;
virtual bool setImage(const Mat&, Size origWinSize); virtual bool setImage(const Mat& img, Size origWinSize);
virtual bool setWindow(Point p); virtual bool setWindow(Point p);
virtual double calcOrd(int featureIdx) const; virtual double calcOrd(int featureIdx) const;

View File

@ -9,9 +9,9 @@ Restores the selected region in an image using the region neighborhood.
.. ocv:function:: void inpaint( InputArray src, InputArray inpaintMask, OutputArray dst, double inpaintRadius, int flags ) .. ocv:function:: void inpaint( InputArray src, InputArray inpaintMask, OutputArray dst, double inpaintRadius, int flags )
.. ocv:pyfunction:: cv2.inpaint(src, inpaintMask, inpaintRange, flags[, dst]) -> dst .. ocv:pyfunction:: cv2.inpaint(src, inpaintMask, inpaintRadius, flags[, dst]) -> dst
.. ocv:cfunction:: void cvInpaint( const CvArr* src, const CvArr* mask, CvArr* dst, double inpaintRadius, int flags) .. ocv:cfunction:: void cvInpaint( const CvArr* src, const CvArr* inpaint_mask, CvArr* dst, double inpaintRange, int flags )
.. ocv:pyoldfunction:: cv.Inpaint(src, mask, dst, inpaintRadius, flags) -> None .. ocv:pyoldfunction:: cv.Inpaint(src, mask, dst, inpaintRadius, flags) -> None
:param src: Input 8-bit 1-channel or 3-channel image. :param src: Input 8-bit 1-channel or 3-channel image.
@ -19,7 +19,7 @@ Restores the selected region in an image using the region neighborhood.
:param inpaintMask: Inpainting mask, 8-bit 1-channel image. Non-zero pixels indicate the area that needs to be inpainted. :param inpaintMask: Inpainting mask, 8-bit 1-channel image. Non-zero pixels indicate the area that needs to be inpainted.
:param dst: Output image with the same size and type as ``src`` . :param dst: Output image with the same size and type as ``src`` .
:param inpaintRadius: Radius of a circular neighborhood of each point inpainted that is considered by the algorithm. :param inpaintRadius: Radius of a circular neighborhood of each point inpainted that is considered by the algorithm.
:param flags: Inpainting method that could be one of the following: :param flags: Inpainting method that could be one of the following:

View File

@ -1669,7 +1669,7 @@ ApproxPoly /doconly
int method int method
double parameter 0.0 double parameter 0.0
int parameter2 0 int parameter2 0
CalcEMD2 /doconly CalcEMD2 float /doconly
CvArr signature1 CvArr signature1
CvArr signature2 CvArr signature2
int distance_type int distance_type
@ -1688,7 +1688,7 @@ CalcOpticalFlowPyrLK currFeatures,status,track_error /doconly
int level int level
CvTermCriteria criteria CvTermCriteria criteria
int flags int flags
CvPoint2D32f* guesses CvPoint2D32f* guesses NULL
CvPoint2D32f currFeatures /O CvPoint2D32f currFeatures /O
char status /O char status /O
float track_error /O float track_error /O
@ -1726,7 +1726,7 @@ CreateMatND CvMatND /doconly
ints dims ints dims
int type int type
CreateMemStorage CvMemStorage /doconly CreateMemStorage CvMemStorage /doconly
int blockSize int blockSize 0
CreateTrackbar /doconly CreateTrackbar /doconly
char* trackbarName char* trackbarName
char* windowName char* windowName
@ -1738,7 +1738,7 @@ FindChessboardCorners corners /doconly
CvSize patternSize CvSize patternSize
CvPoint2D32fs corners /O CvPoint2D32fs corners /O
int flags CV_CALIB_CB_ADAPTIVE_THRESH int flags CV_CALIB_CB_ADAPTIVE_THRESH
FindContours /doconly FindContours CvSeq /doconly
CvArr image CvArr image
CvMemStorage storage CvMemStorage storage
int mode CV_RETR_LIST int mode CV_RETR_LIST
@ -1751,14 +1751,14 @@ FitLine line /doconly
double reps double reps
double aeps double aeps
PyObject* line /O PyObject* line /O
GetDims /doconly GetDims dim1,dim2,... /doconly
CvArr arr CvArr arr
GetHuMoments hu /doconly GetHuMoments hu /doconly
CvMoments moments CvMoments moments
PyObject* hu /O PyObject* hu /O
GetImage /doconly GetImage iplimage /doconly
CvMat arr CvMat arr
GetMat /doconly GetMat CvMat /doconly
IplImage arr IplImage arr
int allowND 0 int allowND 0
GetMinMaxHistValue min_value,max_value,min_idx,max_idx /doconly GetMinMaxHistValue min_value,max_value,min_idx,max_idx /doconly
@ -1780,14 +1780,14 @@ LoadImageM /doconly
LoadImage /doconly LoadImage /doconly
char* filename char* filename
int iscolor CV_LOAD_IMAGE_COLOR int iscolor CV_LOAD_IMAGE_COLOR
ReshapeMatND /doconly ReshapeMatND CvMat /doconly
CvMat arr CvMat arr
int newCn int newCn
ints newDims ints newDims
Reshape /doconly Reshape CvMat /doconly
CvArr arr CvArr arr
int newCn int newCn
int newRows int newRows 0
SetData /doconly SetData /doconly
CvArr arr CvArr arr
PyObject* data PyObject* data
@ -1801,5 +1801,5 @@ Subdiv2DLocate loc,where /doconly
CvPoint2D32f pt CvPoint2D32f pt
int loc /O int loc /O
edgeorpoint where /O edgeorpoint where /O
WaitKey /doconly WaitKey int /doconly
int delay 0 int delay 0

View File

@ -3844,7 +3844,7 @@ static double cppKMeans(const CvArr* _samples, int cluster_count, CvArr* _labels
static PyMethodDef old_methods[] = { static PyMethodDef old_methods[] = {
#if PYTHON_USE_NUMPY #if PYTHON_USE_NUMPY
{"fromarray", (PyCFunction)pycvfromarray, METH_KEYWORDS, "fromarray(array) -> cvmatnd"}, {"fromarray", (PyCFunction)pycvfromarray, METH_KEYWORDS, "fromarray(array [, allowND]) -> CvMat"},
#endif #endif
{"FindDataMatrix", pyfinddatamatrix, METH_VARARGS}, {"FindDataMatrix", pyfinddatamatrix, METH_VARARGS},

View File

@ -64,7 +64,7 @@ Blends and returns the final pano.
detail::FeatherBlender detail::FeatherBlender
---------------------- ----------------------
.. ocv:class:: detail::FeatherBlender .. ocv:class:: detail::FeatherBlender : public Blender
Simple blender which mixes images at its borders. :: Simple blender which mixes images at its borders. ::
@ -93,7 +93,7 @@ Simple blender which mixes images at its borders. ::
detail::MultiBandBlender detail::MultiBandBlender
------------------------ ------------------------
.. ocv:class:: detail::MultiBandBlender .. ocv:class:: detail::MultiBandBlender : public Blender
Blender which uses multi-band blending algorithm (see [BA83]_). :: Blender which uses multi-band blending algorithm (see [BA83]_). ::

View File

@ -5,7 +5,7 @@ Camera
detail::CameraParams detail::CameraParams
-------------------- --------------------
.. ocv:class:: detail::CameraParams .. ocv:struct:: detail::CameraParams
Describes camera parameters. Describes camera parameters.

View File

@ -54,7 +54,7 @@ Compensate exposure in the specified image.
detail::NoExposureCompensator detail::NoExposureCompensator
----------------------------- -----------------------------
.. ocv:class:: detail::NoExposureCompensator .. ocv:class:: detail::NoExposureCompensator : public ExposureCompensator
Stub exposure compensator which does nothing. :: Stub exposure compensator which does nothing. ::
@ -70,7 +70,7 @@ Stub exposure compensator which does nothing. ::
detail::GainCompensator detail::GainCompensator
----------------------- -----------------------
.. ocv:class:: detail::GainCompensator .. ocv:class:: detail::GainCompensator : public ExposureCompensator
Exposure compensator which tries to remove exposure related artifacts by adjusting image intensities, see [BL07]_ and [WJ10]_ for details. :: Exposure compensator which tries to remove exposure related artifacts by adjusting image intensities, see [BL07]_ and [WJ10]_ for details. ::
@ -90,7 +90,7 @@ Exposure compensator which tries to remove exposure related artifacts by adjusti
detail::BlocksGainCompensator detail::BlocksGainCompensator
----------------------------- -----------------------------
.. ocv:class:: detail::BlocksGainCompensator .. ocv:class:: detail::BlocksGainCompensator : public ExposureCompensator
Exposure compensator which tries to remove exposure related artifacts by adjusting image block intensities, see [UES01]_ for details. :: Exposure compensator which tries to remove exposure related artifacts by adjusting image block intensities, see [UES01]_ for details. ::

View File

@ -164,7 +164,7 @@ Image warper factories base class. ::
PlaneWarper PlaneWarper
----------- -----------
.. ocv:class:: PlaneWarper .. ocv:class:: PlaneWarper : public WarperCreator
Plane warper factory class. :: Plane warper factory class. ::
@ -178,7 +178,7 @@ Plane warper factory class. ::
CylindricalWarper CylindricalWarper
----------------- -----------------
.. ocv:class:: CylindricalWarper .. ocv:class:: CylindricalWarper : public WarperCreator
Cylindrical warper factory class. :: Cylindrical warper factory class. ::
@ -192,7 +192,7 @@ Cylindrical warper factory class. ::
SphericalWarper SphericalWarper
--------------- ---------------
.. ocv:class:: SphericalWarper .. ocv:class:: SphericalWarper : public WarperCreator
Spherical warper factory class. :: Spherical warper factory class. ::

View File

@ -5,7 +5,7 @@ Features Finding and Images Matching
detail::ImageFeatures detail::ImageFeatures
----------------------- -----------------------
.. ocv:struct:: detail::ImageFeatures .. ocv:struct:: detail::ImageFeatures
Structure containing image keypoints and descriptors. :: Structure containing image keypoints and descriptors. ::
@ -47,10 +47,10 @@ Finds features in the given image.
:param image: Source image :param image: Source image
:param features: Found features :param features: Found features
:param rois: Regions of interest :param rois: Regions of interest
.. seealso:: :ocv:struct:`detail::ImageFeatures`, :ocv:class:`Rect_` .. seealso:: :ocv:struct:`detail::ImageFeatures`, :ocv:class:`Rect_`
detail::FeaturesFinder::collectGarbage detail::FeaturesFinder::collectGarbage
-------------------------------------- --------------------------------------
@ -67,14 +67,14 @@ This method must implement features finding logic in order to make the wrappers
.. ocv:function:: void find(const Mat &image, ImageFeatures &features) .. ocv:function:: void find(const Mat &image, ImageFeatures &features)
:param image: Source image :param image: Source image
:param features: Found features :param features: Found features
.. seealso:: :ocv:struct:`detail::ImageFeatures` .. seealso:: :ocv:struct:`detail::ImageFeatures`
detail::SurfFeaturesFinder detail::SurfFeaturesFinder
-------------------------- --------------------------
.. ocv:class:: detail::SurfFeaturesFinder .. ocv:class:: detail::SurfFeaturesFinder : public FeaturesFinder
SURF features finder. :: SURF features finder. ::
@ -92,14 +92,14 @@ SURF features finder. ::
detail::OrbFeaturesFinder detail::OrbFeaturesFinder
------------------------- -------------------------
.. ocv:class:: detail::OrbFeaturesFinder .. ocv:class:: detail::OrbFeaturesFinder : public FeaturesFinder
ORB features finder. :: ORB features finder. ::
class CV_EXPORTS OrbFeaturesFinder : public FeaturesFinder class CV_EXPORTS OrbFeaturesFinder : public FeaturesFinder
{ {
public: public:
OrbFeaturesFinder(Size _grid_size = Size(3,1), size_t n_features = 1500, OrbFeaturesFinder(Size _grid_size = Size(3,1), size_t n_features = 1500,
const ORB::CommonParams &detector_params = ORB::CommonParams(1.3f, 5)); const ORB::CommonParams &detector_params = ORB::CommonParams(1.3f, 5));
private: private:
@ -139,10 +139,10 @@ Feature matchers base class. ::
public: public:
virtual ~FeaturesMatcher() {} virtual ~FeaturesMatcher() {}
void operator ()(const ImageFeatures &features1, const ImageFeatures &features2, void operator ()(const ImageFeatures &features1, const ImageFeatures &features2,
MatchesInfo& matches_info) { match(features1, features2, matches_info); } MatchesInfo& matches_info) { match(features1, features2, matches_info); }
void operator ()(const std::vector<ImageFeatures> &features, std::vector<MatchesInfo> &pairwise_matches, void operator ()(const std::vector<ImageFeatures> &features, std::vector<MatchesInfo> &pairwise_matches,
const Mat &mask = cv::Mat()); const Mat &mask = cv::Mat());
bool isThreadSafe() const { return is_thread_safe_; } bool isThreadSafe() const { return is_thread_safe_; }
@ -152,7 +152,7 @@ Feature matchers base class. ::
protected: protected:
FeaturesMatcher(bool is_thread_safe = false) : is_thread_safe_(is_thread_safe) {} FeaturesMatcher(bool is_thread_safe = false) : is_thread_safe_(is_thread_safe) {}
virtual void match(const ImageFeatures &features1, const ImageFeatures &features2, virtual void match(const ImageFeatures &features1, const ImageFeatures &features2,
MatchesInfo& matches_info) = 0; MatchesInfo& matches_info) = 0;
bool is_thread_safe_; bool is_thread_safe_;
@ -172,7 +172,7 @@ Performs images matching.
:param matches_info: Found matches :param matches_info: Found matches
.. ocv:function:: void detail::FeaturesMatcher::operator ()(const std::vector<ImageFeatures> &features, std::vector<MatchesInfo> &pairwise_matches, const Mat &mask) .. ocv:function:: void detail::FeaturesMatcher::operator ()(const std::vector<ImageFeatures> &features, std::vector<MatchesInfo> &pairwise_matches, const Mat &mask)
:param features: Features of the source images :param features: Features of the source images
:param pairwise_matches: Found pairwise matches :param pairwise_matches: Found pairwise matches
@ -205,21 +205,21 @@ This method must implement matching logic in order to make the wrappers `detail:
.. ocv:function:: void detail::FeaturesMatcher::match(const ImageFeatures &features1, const ImageFeatures &features2, MatchesInfo& matches_info) .. ocv:function:: void detail::FeaturesMatcher::match(const ImageFeatures &features1, const ImageFeatures &features2, MatchesInfo& matches_info)
:param features1: First image features :param features1: First image features
:param features2: Second image features :param features2: Second image features
:param matches_info: Found matches :param matches_info: Found matches
detail::BestOf2NearestMatcher detail::BestOf2NearestMatcher
----------------------------- -----------------------------
.. ocv:class:: detail::BestOf2NearestMatcher .. ocv:class:: detail::BestOf2NearestMatcher : public FeaturesMatcher
Features matcher which finds two best matches for each feature and leaves the best one only if the ratio between descriptor distances is greater than the threshold ``match_conf``. :: Features matcher which finds two best matches for each feature and leaves the best one only if the ratio between descriptor distances is greater than the threshold ``match_conf``. ::
class CV_EXPORTS BestOf2NearestMatcher : public FeaturesMatcher class CV_EXPORTS BestOf2NearestMatcher : public FeaturesMatcher
{ {
public: public:
BestOf2NearestMatcher(bool try_use_gpu = false, float match_conf = 0.65f, BestOf2NearestMatcher(bool try_use_gpu = false, float match_conf = 0.65f,
int num_matches_thresh1 = 6, int num_matches_thresh2 = 6); int num_matches_thresh1 = 6, int num_matches_thresh2 = 6);
void collectGarbage(); void collectGarbage();
@ -239,7 +239,7 @@ detail::BestOf2NearestMatcher::BestOf2NearestMatcher
Constructs a "best of 2 nearest" matcher. Constructs a "best of 2 nearest" matcher.
.. ocv:function:: detail::BestOf2NearestMatcher::BestOf2NearestMatcher(bool try_use_gpu = false, float match_conf = 0.65f, int num_matches_thresh1 = 6, int num_matches_thresh2 = 6) .. ocv:function:: detail::BestOf2NearestMatcher::BestOf2NearestMatcher(bool try_use_gpu = false, float match_conf = 0.3f, int num_matches_thresh1 = 6, int num_matches_thresh2 = 6)
:param try_use_gpu: Should try to use GPU or not :param try_use_gpu: Should try to use GPU or not

View File

@ -55,7 +55,7 @@ This method must implement camera parameters estimation logic in order to make t
detail::HomographyBasedEstimator detail::HomographyBasedEstimator
-------------------------------- --------------------------------
.. ocv:class:: detail::HomographyBasedEstimator .. ocv:class:: detail::HomographyBasedEstimator : public Estimator
Homography based rotation estimator. :: Homography based rotation estimator. ::
@ -71,7 +71,7 @@ Homography based rotation estimator. ::
detail::BundleAdjusterBase detail::BundleAdjusterBase
-------------------------- --------------------------
.. ocv:class:: detail::BundleAdjusterBase .. ocv:class:: detail::BundleAdjusterBase : public Estimator
Base class for all camera parameters refinement methods. :: Base class for all camera parameters refinement methods. ::
@ -187,7 +187,7 @@ Gets the refined camera parameters.
detail::BundleAdjusterReproj detail::BundleAdjusterReproj
---------------------------- ----------------------------
.. ocv:class:: detail::BundleAdjusterReproj .. ocv:class:: detail::BundleAdjusterReproj : public BundleAdjusterBase
Implementation of the camera parameters refinement algorithm which minimizes sum of the reprojection error squares. :: Implementation of the camera parameters refinement algorithm which minimizes sum of the reprojection error squares. ::
@ -204,7 +204,7 @@ Implementation of the camera parameters refinement algorithm which minimizes sum
detail::BundleAdjusterRay detail::BundleAdjusterRay
------------------------- -------------------------
.. ocv:class:: detail::BundleAdjusterRay .. ocv:class:: detail::BundleAdjusterRay : public BundleAdjusterBase
Implementation of the camera parameters refinement algorithm which minimizes sum of the distances between the rays passing through the camera center and a feature. :: Implementation of the camera parameters refinement algorithm which minimizes sum of the distances between the rays passing through the camera center and a feature. ::

View File

@ -33,7 +33,7 @@ Estimates seams.
detail::NoSeamFinder detail::NoSeamFinder
-------------------- --------------------
.. ocv:class:: detail::NoSeamFinder .. ocv:class:: detail::NoSeamFinder : public SeamFinder
Stub seam estimator which does nothing. :: Stub seam estimator which does nothing. ::
@ -47,7 +47,7 @@ Stub seam estimator which does nothing. ::
detail::PairwiseSeamFinder detail::PairwiseSeamFinder
-------------------------- --------------------------
.. ocv:class:: detail::PairwiseSeamFinder .. ocv:class:: detail::PairwiseSeamFinder : public SeamFinder
Base class for all pairwise seam estimators. :: Base class for all pairwise seam estimators. ::
@ -84,7 +84,7 @@ Resolves masks intersection of two specified images in the given ROI.
detail::VoronoiSeamFinder detail::VoronoiSeamFinder
------------------------- -------------------------
.. ocv:class:: detail::VoronoiSeamFinder .. ocv:class:: detail::VoronoiSeamFinder : public PairwiseSeamFinder
Voronoi diagram-based seam estimator. :: Voronoi diagram-based seam estimator. ::
@ -113,7 +113,7 @@ Base class for all minimum graph-cut-based seam estimators. ::
detail::GraphCutSeamFinder detail::GraphCutSeamFinder
-------------------------- --------------------------
.. ocv:class:: detail::GraphCutSeamFinder .. ocv:class:: detail::GraphCutSeamFinder : public GraphCutSeamFinderBase, public SeamFinder
Minimum graph cut-based seam estimator. See details in [V03]_. :: Minimum graph cut-based seam estimator. See details in [V03]_. ::

View File

@ -172,7 +172,7 @@ Base class for rotation-based warper using a `detail::ProjectorBase`_ derived cl
detail::PlaneWarper detail::PlaneWarper
------------------- -------------------
.. ocv:class:: detail::PlaneWarper .. ocv:class:: detail::PlaneWarper : public RotationWarperBase<PlaneProjector>
Warper that maps an image onto the z = 1 plane. :: Warper that maps an image onto the z = 1 plane. ::
@ -209,7 +209,7 @@ Construct an instance of the plane warper class.
detail::SphericalWarper detail::SphericalWarper
----------------------- -----------------------
.. ocv:class:: detail::SphericalWarper .. ocv:class:: detail::SphericalWarper : public RotationWarperBase<SphericalProjector>
Warper that maps an image onto the unit sphere located at the origin. :: Warper that maps an image onto the unit sphere located at the origin. ::
@ -235,7 +235,7 @@ Construct an instance of the spherical warper class.
detail::CylindricalWarper detail::CylindricalWarper
------------------------- -------------------------
.. ocv:class:: detail::CylindricalWarper .. ocv:class:: detail::CylindricalWarper : public RotationWarperBase<CylindricalProjector>
Warper that maps an image onto the x*x + z*z = 1 cylinder. :: Warper that maps an image onto the x*x + z*z = 1 cylinder. ::

View File

@ -8,12 +8,12 @@ calcOpticalFlowPyrLK
------------------------ ------------------------
Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids. Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.
.. ocv:function:: void calcOpticalFlowPyrLK( InputArray prevImg, InputArray nextImg, InputArray prevPts, InputOutputArray nextPts, OutputArray status, OutputArray err, Size winSize=Size(15,15), int maxLevel=3, TermCriteria criteria=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 0.01), int flags=0, double minEigThreshold=1e-4) .. ocv:function:: void calcOpticalFlowPyrLK( InputArray prevImg, InputArray nextImg, InputArray prevPts, InputOutputArray nextPts, OutputArray status, OutputArray err, Size winSize=Size(21,21), int maxLevel=3, TermCriteria criteria=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 0.01), int flags=0, double minEigThreshold=1e-4 )
.. ocv:pyfunction:: cv2.calcOpticalFlowPyrLK(prevImg, nextImg, prevPts[, nextPts[, status[, err[, winSize[, maxLevel[, criteria[, flags[, minEigThreshold]]]]]]]]) -> nextPts, status, err .. ocv:pyfunction:: cv2.calcOpticalFlowPyrLK(prevImg, nextImg, prevPts[, nextPts[, status[, err[, winSize[, maxLevel[, criteria[, flags[, minEigThreshold]]]]]]]]) -> nextPts, status, err
.. ocv:cfunction:: void cvCalcOpticalFlowPyrLK( const CvArr* prev, const CvArr* curr, CvArr* prevPyr, CvArr* currPyr, const CvPoint2D32f* prevFeatures, CvPoint2D32f* currFeatures, int count, CvSize winSize, int level, char* status, float* trackError, CvTermCriteria criteria, int flags ) .. ocv:cfunction:: void cvCalcOpticalFlowPyrLK( const CvArr* prev, const CvArr* curr, CvArr* prev_pyr, CvArr* curr_pyr, const CvPoint2D32f* prev_features, CvPoint2D32f* curr_features, int count, CvSize win_size, int level, char* status, float* track_error, CvTermCriteria criteria, int flags )
.. ocv:pyoldfunction:: cv.CalcOpticalFlowPyrLK( prev, curr, prevPyr, currPyr, prevFeatures, winSize, level, criteria, flags, guesses=None) -> (currFeatures, status, trackError) .. ocv:pyoldfunction:: cv.CalcOpticalFlowPyrLK(prev, curr, prevPyr, currPyr, prevFeatures, winSize, level, criteria, flags, guesses=None) -> (currFeatures, status, track_error)
:param prevImg: First 8-bit input image or pyramid constructed by :ocv:func:`buildOpticalFlowPyramid`. :param prevImg: First 8-bit input image or pyramid constructed by :ocv:func:`buildOpticalFlowPyramid`.
@ -32,14 +32,14 @@ Calculates an optical flow for a sparse feature set using the iterative Lucas-Ka
:param maxLevel: 0-based maximal pyramid level number. If set to 0, pyramids are not used (single level). If set to 1, two levels are used, and so on. If pyramids are passed to input then algorithm will use as many levels as pyramids have but no more than ``maxLevel``. :param maxLevel: 0-based maximal pyramid level number. If set to 0, pyramids are not used (single level). If set to 1, two levels are used, and so on. If pyramids are passed to input then algorithm will use as many levels as pyramids have but no more than ``maxLevel``.
:param criteria: Parameter specifying the termination criteria of the iterative search algorithm (after the specified maximum number of iterations ``criteria.maxCount`` or when the search window moves by less than ``criteria.epsilon`` . :param criteria: Parameter specifying the termination criteria of the iterative search algorithm (after the specified maximum number of iterations ``criteria.maxCount`` or when the search window moves by less than ``criteria.epsilon`` .
:param flags: Operation flags: :param flags: Operation flags:
* **OPTFLOW_USE_INITIAL_FLOW** Use initial estimations stored in ``nextPts`` . If the flag is not set, then ``prevPts`` is copied to ``nextPts`` and is considered as the initial estimate. * **OPTFLOW_USE_INITIAL_FLOW** Use initial estimations stored in ``nextPts`` . If the flag is not set, then ``prevPts`` is copied to ``nextPts`` and is considered as the initial estimate.
* **OPTFLOW_LK_GET_MIN_EIGENVALS** Use minimum eigen values as a error measure (see ``minEigThreshold`` description). If the flag is not set, then L1 distance between patches around the original and a moved point divided by number of pixels in a window is used as a error measure. * **OPTFLOW_LK_GET_MIN_EIGENVALS** Use minimum eigen values as a error measure (see ``minEigThreshold`` description). If the flag is not set, then L1 distance between patches around the original and a moved point divided by number of pixels in a window is used as a error measure.
:param minEigThreshold: The algorithm computes a minimum eigen value of a 2x2 normal matrix of optical flow equations (this matrix is called a spatial gradient matrix in [Bouguet00]_) divided by number of pixels in a window. If this value is less then ``minEigThreshold`` then a corresponding feature is filtered out and its flow is not computed. So it allows to remove bad points earlier and speed up the computation. :param minEigThreshold: The algorithm computes a minimum eigen value of a 2x2 normal matrix of optical flow equations (this matrix is called a spatial gradient matrix in [Bouguet00]_) divided by number of pixels in a window. If this value is less then ``minEigThreshold`` then a corresponding feature is filtered out and its flow is not computed. So it allows to remove bad points earlier and speed up the computation.
The function implements a sparse iterative version of the Lucas-Kanade optical flow in pyramids. See [Bouguet00]_. The function is parallelized with the TBB library. The function implements a sparse iterative version of the Lucas-Kanade optical flow in pyramids. See [Bouguet00]_. The function is parallelized with the TBB library.
buildOpticalFlowPyramid buildOpticalFlowPyramid
@ -73,11 +73,11 @@ calcOpticalFlowFarneback
---------------------------- ----------------------------
Computes a dense optical flow using the Gunnar Farneback's algorithm. Computes a dense optical flow using the Gunnar Farneback's algorithm.
.. ocv:function:: void calcOpticalFlowFarneback( InputArray prevImg, InputArray nextImg, InputOutputArray flow, double pyrScale, int levels, int winsize, int iterations, int polyN, double polySigma, int flags ) .. ocv:function:: void calcOpticalFlowFarneback( InputArray prev, InputArray next, InputOutputArray flow, double pyr_scale, int levels, int winsize, int iterations, int poly_n, double poly_sigma, int flags )
.. ocv:cfunction:: void cvCalcOpticalFlowFarneback( const CvArr* prevImg, const CvArr* nextImg, CvArr* flow, double pyrScale, int levels, int winsize, int iterations, int polyN, double polySigma, int flags ) .. ocv:cfunction:: void cvCalcOpticalFlowFarneback( const CvArr* prev, const CvArr* next, CvArr* flow, double pyr_scale, int levels, int winsize, int iterations, int poly_n, double poly_sigma, int flags )
.. ocv:pyfunction:: cv2.calcOpticalFlowFarneback(prevImg, nextImg, pyr_scale, levels, winsize, iterations, poly_n, poly_sigma, flags[, flow]) -> flow .. 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 prevImg: First 8-bit single-channel input image.
@ -96,7 +96,7 @@ Computes a dense optical flow using the Gunnar Farneback's algorithm.
: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 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 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 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 flags: Operation flags that can be a combination of the following: :param flags: Operation flags that can be a combination of the following:
* **OPTFLOW_USE_INITIAL_FLOW** Use the input ``flow`` as an initial flow approximation. * **OPTFLOW_USE_INITIAL_FLOW** Use the input ``flow`` as an initial flow approximation.
@ -130,7 +130,7 @@ The function finds an optimal affine transform *[A|b]* (a ``2 x 3`` floating-poi
Two point sets Two point sets
* *
Two raster images. In this case, the function first finds some features in the ``src`` image and finds the corresponding features in ``dst`` image. After that, the problem is reduced to the first case. Two raster images. In this case, the function first finds some features in the ``src`` image and finds the corresponding features in ``dst`` image. After that, the problem is reduced to the first case.
In case of point sets, the problem is formulated as follows: you need to find a 2x2 matrix *A* and 2x1 vector *b* so that: In case of point sets, the problem is formulated as follows: you need to find a 2x2 matrix *A* and 2x1 vector *b* so that:
.. math:: .. math::
@ -138,7 +138,7 @@ In case of point sets, the problem is formulated as follows: you need to find a
[A^*|b^*] = arg \min _{[A|b]} \sum _i \| \texttt{dst}[i] - A { \texttt{src}[i]}^T - b \| ^2 [A^*|b^*] = arg \min _{[A|b]} \sum _i \| \texttt{dst}[i] - A { \texttt{src}[i]}^T - b \| ^2
where ``src[i]`` and ``dst[i]`` are the i-th points in ``src`` and ``dst``, respectively where ``src[i]`` and ``dst[i]`` are the i-th points in ``src`` and ``dst``, respectively
:math:`[A|b]` can be either arbitrary (when ``fullAffine=true`` ) or have a form of :math:`[A|b]` can be either arbitrary (when ``fullAffine=true`` ) or have a form of
.. math:: .. math::
@ -197,7 +197,7 @@ Calculates a gradient orientation of a motion history image.
.. ocv:pyfunction:: cv2.calcMotionGradient(mhi, delta1, delta2[, mask[, orientation[, apertureSize]]]) -> mask, orientation .. ocv:pyfunction:: cv2.calcMotionGradient(mhi, delta1, delta2[, mask[, orientation[, apertureSize]]]) -> mask, orientation
.. ocv:cfunction:: void cvCalcMotionGradient( const CvArr* mhi, CvArr* mask, CvArr* orientation, double delta1, double delta2, int apertureSize=3 ) .. ocv:cfunction:: void cvCalcMotionGradient( const CvArr* mhi, CvArr* mask, CvArr* orientation, double delta1, double delta2, int aperture_size=3 )
.. ocv:pyoldfunction:: cv.CalcMotionGradient(mhi, mask, orientation, delta1, delta2, apertureSize=3)-> None .. ocv:pyoldfunction:: cv.CalcMotionGradient(mhi, mask, orientation, delta1, delta2, apertureSize=3)-> None
:param mhi: Motion history single-channel floating-point image. :param mhi: Motion history single-channel floating-point image.
@ -207,7 +207,7 @@ Calculates a gradient orientation of a motion history image.
:param orientation: Output motion gradient orientation image that has the same type and the same size as ``mhi`` . Each pixel of the image is a motion orientation, from 0 to 360 degrees. :param orientation: Output motion gradient orientation image that has the same type and the same size as ``mhi`` . Each pixel of the image is a motion orientation, from 0 to 360 degrees.
:param delta1: Minimal (or maximal) allowed difference between ``mhi`` values within a pixel neighborhood. :param delta1: Minimal (or maximal) allowed difference between ``mhi`` values within a pixel neighborhood.
:param delta2: Maximal (or minimal) allowed difference between ``mhi`` values within a pixel neighborhood. That is, the function finds the minimum ( :math:`m(x,y)` ) and maximum ( :math:`M(x,y)` ) ``mhi`` values over :math:`3 \times 3` neighborhood of each pixel and marks the motion orientation at :math:`(x, y)` as valid only if :param delta2: Maximal (or minimal) allowed difference between ``mhi`` values within a pixel neighborhood. That is, the function finds the minimum ( :math:`m(x,y)` ) and maximum ( :math:`M(x,y)` ) ``mhi`` values over :math:`3 \times 3` neighborhood of each pixel and marks the motion orientation at :math:`(x, y)` as valid only if
.. math:: .. math::
@ -241,13 +241,13 @@ Calculates a global motion orientation in a selected region.
.. ocv:pyoldfunction:: cv.CalcGlobalOrientation(orientation, mask, mhi, timestamp, duration)-> float .. ocv:pyoldfunction:: cv.CalcGlobalOrientation(orientation, mask, mhi, timestamp, duration)-> float
:param orientation: Motion gradient orientation image calculated by the function :ocv:func:`calcMotionGradient` . :param orientation: Motion gradient orientation image calculated by the function :ocv:func:`calcMotionGradient` .
:param mask: Mask image. It may be a conjunction of a valid gradient mask, also calculated by :ocv:func:`calcMotionGradient` , and the mask of a region whose direction needs to be calculated. :param mask: Mask image. It may be a conjunction of a valid gradient mask, also calculated by :ocv:func:`calcMotionGradient` , and the mask of a region whose direction needs to be calculated.
:param mhi: Motion history image calculated by :ocv:func:`updateMotionHistory` . :param mhi: Motion history image calculated by :ocv:func:`updateMotionHistory` .
:param timestamp: Timestamp passed to :ocv:func:`updateMotionHistory` . :param timestamp: Timestamp passed to :ocv:func:`updateMotionHistory` .
:param duration: Maximum duration of a motion track in milliseconds, passed to :ocv:func:`updateMotionHistory` . :param duration: Maximum duration of a motion track in milliseconds, passed to :ocv:func:`updateMotionHistory` .
The function calculates an average The function calculates an average
@ -267,8 +267,8 @@ Splits a motion history image into a few parts corresponding to separate indepen
.. ocv:pyfunction:: cv2.segmentMotion(mhi, timestamp, segThresh[, segmask]) -> segmask, boundingRects .. ocv:pyfunction:: cv2.segmentMotion(mhi, timestamp, segThresh[, segmask]) -> segmask, boundingRects
.. ocv:cfunction:: CvSeq* cvSegmentMotion( const CvArr* mhi, CvArr* segMask, CvMemStorage* storage, double timestamp, double segThresh ) .. ocv:cfunction:: CvSeq* cvSegmentMotion( const CvArr* mhi, CvArr* seg_mask, CvMemStorage* storage, double timestamp, double seg_thresh )
.. ocv:pyoldfunction:: cv.SegmentMotion(mhi, segMask, storage, timestamp, segThresh)-> None .. ocv:pyoldfunction:: cv.SegmentMotion(mhi, seg_mask, storage, timestamp, seg_thresh) -> boundingRects
:param mhi: Motion history image. :param mhi: Motion history image.
@ -279,7 +279,7 @@ Splits a motion history image into a few parts corresponding to separate indepen
:param timestamp: Current time in milliseconds or other units. :param timestamp: Current time in milliseconds or other units.
:param segThresh: Segmentation threshold that is recommended to be equal to the interval between motion history "steps" or greater. :param segThresh: Segmentation threshold that is recommended to be equal to the interval between motion history "steps" or greater.
The function finds all of the motion segments and marks them in ``segmask`` with individual values (1,2,...). It also computes a vector with ROIs of motion connected components. After that the motion direction for every component can be calculated with :ocv:func:`calcGlobalOrientation` using the extracted mask of the particular component. The function finds all of the motion segments and marks them in ``segmask`` with individual values (1,2,...). It also computes a vector with ROIs of motion connected components. After that the motion direction for every component can be calculated with :ocv:func:`calcGlobalOrientation` using the extracted mask of the particular component.
@ -294,17 +294,17 @@ Finds an object center, size, and orientation.
.. ocv:pyfunction:: cv2.CamShift(probImage, window, criteria) -> retval, window .. ocv:pyfunction:: cv2.CamShift(probImage, window, criteria) -> retval, window
.. ocv:cfunction:: int cvCamShift( const CvArr* probImage, CvRect window, CvTermCriteria criteria, CvConnectedComp* comp, CvBox2D* box=NULL ) .. ocv:cfunction:: int cvCamShift( const CvArr* prob_image, CvRect window, CvTermCriteria criteria, CvConnectedComp* comp, CvBox2D* box=NULL )
.. ocv:pyoldfunction:: cv.CamShift(probImage, window, criteria)-> (int, comp, box) .. ocv:pyoldfunction:: cv.CamShift(prob_image, window, criteria) -> (int, comp, box)
:param probImage: Back projection of the object histogram. See :ocv:func:`calcBackProject` . :param probImage: Back projection of the object histogram. See :ocv:func:`calcBackProject` .
:param window: Initial search window. :param window: Initial search window.
:param criteria: Stop criteria for the underlying :ocv:func:`meanShift` . :param criteria: Stop criteria for the underlying :ocv:func:`meanShift` .
:returns: (in old interfaces) Number of iterations CAMSHIFT took to converge :returns: (in old interfaces) Number of iterations CAMSHIFT took to converge
The function implements the CAMSHIFT object tracking algorithm The function implements the CAMSHIFT object tracking algorithm
[Bradski98]_. [Bradski98]_.
@ -323,11 +323,11 @@ Finds an object on a back projection image.
.. ocv:pyfunction:: cv2.meanShift(probImage, window, criteria) -> retval, window .. ocv:pyfunction:: cv2.meanShift(probImage, window, criteria) -> retval, window
.. ocv:cfunction:: int cvMeanShift( const CvArr* probImage, CvRect window, CvTermCriteria criteria, CvConnectedComp* comp ) .. ocv:cfunction:: int cvMeanShift( const CvArr* prob_image, CvRect window, CvTermCriteria criteria, CvConnectedComp* comp )
.. ocv:pyoldfunction:: cv.MeanShift(probImage, window, criteria)-> comp .. ocv:pyoldfunction:: cv.MeanShift(prob_image, window, criteria) -> comp
:param probImage: Back projection of the object histogram. See :ocv:func:`calcBackProject` for details. :param probImage: Back projection of the object histogram. See :ocv:func:`calcBackProject` for details.
:param window: Initial search window. :param window: Initial search window.
:param criteria: Stop criteria for the iterative search algorithm. :param criteria: Stop criteria for the iterative search algorithm.
@ -364,17 +364,17 @@ The constructors.
.. ocv:function:: KalmanFilter::KalmanFilter(int dynamParams, int measureParams, int controlParams=0, int type=CV_32F) .. ocv:function:: KalmanFilter::KalmanFilter(int dynamParams, int measureParams, int controlParams=0, int type=CV_32F)
.. ocv:pyfunction:: cv2.KalmanFilter(dynamParams, measureParams[, controlParams[, type]]) -> <KalmanFilter object> .. ocv:pyfunction:: cv2.KalmanFilter([dynamParams, measureParams[, controlParams[, type]]]) -> <KalmanFilter object>
.. ocv:cfunction:: CvKalman* cvCreateKalman( int dynamParams, int measureParams, int controlParams=0 ) .. ocv:cfunction:: CvKalman* cvCreateKalman( int dynam_params, int measure_params, int control_params=0 )
.. ocv:pyoldfunction:: cv.CreateKalman(dynamParams, measureParams, controlParams=0) -> CvKalman .. ocv:pyoldfunction:: cv.CreateKalman(dynam_params, measure_params, control_params=0) -> CvKalman
The full constructor. The full constructor.
:param dynamParams: Dimensionality of the state. :param dynamParams: Dimensionality of the state.
:param measureParams: Dimensionality of the measurement. :param measureParams: Dimensionality of the measurement.
:param controlParams: Dimensionality of the control vector. :param controlParams: Dimensionality of the control vector.
:param type: Type of the created matrices that should be ``CV_32F`` or ``CV_64F``. :param type: Type of the created matrices that should be ``CV_32F`` or ``CV_64F``.
@ -388,9 +388,9 @@ Re-initializes Kalman filter. The previous content is destroyed.
.. ocv:function:: void KalmanFilter::init(int dynamParams, int measureParams, int controlParams=0, int type=CV_32F) .. ocv:function:: void KalmanFilter::init(int dynamParams, int measureParams, int controlParams=0, int type=CV_32F)
:param dynamParams: Dimensionalityensionality of the state. :param dynamParams: Dimensionalityensionality of the state.
:param measureParams: Dimensionality of the measurement. :param measureParams: Dimensionality of the measurement.
:param controlParams: Dimensionality of the control vector. :param controlParams: Dimensionality of the control vector.
:param type: Type of the created matrices that should be ``CV_32F`` or ``CV_64F``. :param type: Type of the created matrices that should be ``CV_32F`` or ``CV_64F``.
@ -402,10 +402,10 @@ Computes a predicted state.
.. ocv:function:: const Mat& KalmanFilter::predict(const Mat& control=Mat()) .. ocv:function:: const Mat& KalmanFilter::predict(const Mat& control=Mat())
.. ocv:pyfunction:: cv2.KalmanFilter.predict([, control]) -> retval .. ocv:pyfunction:: cv2.KalmanFilter.predict([control]) -> retval
.. ocv:cfunction:: const CvMat* cvKalmanPredict( CvKalman* kalman, const CvMat* control=NULL) .. ocv:cfunction:: const CvMat* cvKalmanPredict( CvKalman* kalman, const CvMat* control=NULL)
.. ocv:pyoldfunction:: cv.KalmanPredict(kalman, control=None) -> cvmat .. ocv:pyoldfunction:: cv.KalmanPredict(kalman, control=None) -> mat
:param control: The optional input control :param control: The optional input control
@ -420,7 +420,7 @@ Updates the predicted state from the measurement.
.. ocv:cfunction:: const CvMat* cvKalmanCorrect( CvKalman* kalman, const CvMat* measurement ) .. ocv:cfunction:: const CvMat* cvKalmanCorrect( CvKalman* kalman, const CvMat* measurement )
.. ocv:pyoldfunction:: cv.KalmanCorrect(kalman, measurement) -> cvmat .. ocv:pyoldfunction:: cv.KalmanCorrect(kalman, measurement) -> mat
:param measurement: The measured system parameters :param measurement: The measured system parameters
@ -464,7 +464,7 @@ Computes a background image.
.. ocv:function:: void BackgroundSubtractor::getBackgroundImage(OutputArray backgroundImage) const .. ocv:function:: void BackgroundSubtractor::getBackgroundImage(OutputArray backgroundImage) const
:param backgroundImage: The output background image. :param backgroundImage: The output background image.
.. note:: Sometimes the background image can be very blurry, as it contain the average background statistics. .. note:: Sometimes the background image can be very blurry, as it contain the average background statistics.
BackgroundSubtractorMOG BackgroundSubtractorMOG
@ -487,7 +487,7 @@ The constructors.
.. ocv:function:: BackgroundSubtractorMOG::BackgroundSubtractorMOG(int history, int nmixtures, double backgroundRatio, double noiseSigma=0) .. ocv:function:: BackgroundSubtractorMOG::BackgroundSubtractorMOG(int history, int nmixtures, double backgroundRatio, double noiseSigma=0)
.. ocv:pyfunction:: cv2.BackgroundSubtractorMOG(history, nmixtures, backgroundRatio[, noiseSigma]) -> <BackgroundSubtractorMOG object> .. ocv:pyfunction:: cv2.BackgroundSubtractorMOG([history, nmixtures, backgroundRatio[, noiseSigma]]) -> <BackgroundSubtractorMOG object>
:param history: Length of the history. :param history: Length of the history.
@ -520,39 +520,39 @@ Gaussian Mixture-based Background/Foreground Segmentation Algorithm.
Here are important members of the class that control the algorithm, which you can set after constructing the class instance: Here are important members of the class that control the algorithm, which you can set after constructing the class instance:
.. ocv:member:: int nmixtures .. ocv:member:: int nmixtures
Maximum allowed number of mixture components. Actual number is determined dynamically per pixel. Maximum allowed number of mixture components. Actual number is determined dynamically per pixel.
.. ocv:member:: float backgroundRatio .. ocv:member:: float backgroundRatio
Threshold defining whether the component is significant enough to be included into the background model ( corresponds to ``TB=1-cf`` from the paper??which paper??). ``cf=0.1 => TB=0.9`` is default. For ``alpha=0.001``, it means that the mode should exist for approximately 105 frames before it is considered foreground. Threshold defining whether the component is significant enough to be included into the background model ( corresponds to ``TB=1-cf`` from the paper??which paper??). ``cf=0.1 => TB=0.9`` is default. For ``alpha=0.001``, it means that the mode should exist for approximately 105 frames before it is considered foreground.
.. ocv:member:: float varThresholdGen .. ocv:member:: float varThresholdGen
Threshold for the squared Mahalanobis distance that helps decide when a sample is close to the existing components (corresponds to ``Tg``). If it is not close to any component, a new component is generated. ``3 sigma => Tg=3*3=9`` is default. A smaller ``Tg`` value generates more components. A higher ``Tg`` value may result in a small number of components but they can grow too large. Threshold for the squared Mahalanobis distance that helps decide when a sample is close to the existing components (corresponds to ``Tg``). If it is not close to any component, a new component is generated. ``3 sigma => Tg=3*3=9`` is default. A smaller ``Tg`` value generates more components. A higher ``Tg`` value may result in a small number of components but they can grow too large.
.. ocv:member:: float fVarInit .. ocv:member:: float fVarInit
Initial variance for the newly generated components. It affects the speed of adaptation. The parameter value is based on your estimate of the typical standard deviation from the images. OpenCV uses 15 as a reasonable value. Initial variance for the newly generated components. It affects the speed of adaptation. The parameter value is based on your estimate of the typical standard deviation from the images. OpenCV uses 15 as a reasonable value.
.. ocv:member:: float fVarMin .. ocv:member:: float fVarMin
Parameter used to further control the variance. Parameter used to further control the variance.
.. ocv:member:: float fVarMax .. ocv:member:: float fVarMax
Parameter used to further control the variance. Parameter used to further control the variance.
.. ocv:member:: float fCT .. ocv:member:: float fCT
Complexity reduction parameter. This parameter defines the number of samples needed to accept to prove the component exists. ``CT=0.05`` is a default value for all the samples. By setting ``CT=0`` you get an algorithm very similar to the standard Stauffer&Grimson algorithm. Complexity reduction parameter. This parameter defines the number of samples needed to accept to prove the component exists. ``CT=0.05`` is a default value for all the samples. By setting ``CT=0`` you get an algorithm very similar to the standard Stauffer&Grimson algorithm.
.. ocv:member:: uchar nShadowDetection .. ocv:member:: uchar nShadowDetection
The value for marking shadow pixels in the output foreground mask. Default value is 127. The value for marking shadow pixels in the output foreground mask. Default value is 127.
.. ocv:member:: float fTau .. ocv:member:: float fTau
Shadow threshold. The shadow is detected if the pixel is a darker version of the background. ``Tau`` is a threshold defining how much darker the shadow can be. ``Tau= 0.5`` means that if a pixel is more than twice darker then it is not shadow. See Prati,Mikic,Trivedi,Cucchiarra, *Detecting Moving Shadows...*, IEEE PAMI,2003. Shadow threshold. The shadow is detected if the pixel is a darker version of the background. ``Tau`` is a threshold defining how much darker the shadow can be. ``Tau= 0.5`` means that if a pixel is more than twice darker then it is not shadow. See Prati,Mikic,Trivedi,Cucchiarra, *Detecting Moving Shadows...*, IEEE PAMI,2003.
@ -569,7 +569,7 @@ The constructors.
.. ocv:function:: BackgroundSubtractorMOG2::BackgroundSubtractorMOG2() .. ocv:function:: BackgroundSubtractorMOG2::BackgroundSubtractorMOG2()
.. ocv:function:: BackgroundSubtractorMOG2::BackgroundSubtractorMOG2(int history, float varThreshold, bool bShadowDetection=1) .. ocv:function:: BackgroundSubtractorMOG2::BackgroundSubtractorMOG2( int history, float varThreshold, bool bShadowDetection=true )
:param history: Length of the history. :param history: Length of the history.
@ -605,7 +605,7 @@ See :ocv:func:`BackgroundSubtractor::getBackgroundImage`.
.. [Davis97] Davis, J.W. and Bobick, A.F. “The Representation and Recognition of Action Using Temporal Templates”, CVPR97, 1997 .. [Davis97] Davis, J.W. and Bobick, A.F. “The Representation and Recognition of Action Using Temporal Templates”, CVPR97, 1997
.. [Farneback2003] Gunnar Farneback, Two-frame motion estimation based on polynomial expansion, Lecture Notes in Computer Science, 2003, (2749), , 363-370. .. [Farneback2003] Gunnar Farneback, Two-frame motion estimation based on polynomial expansion, Lecture Notes in Computer Science, 2003, (2749), , 363-370.
.. [Horn81] Berthold K.P. Horn and Brian G. Schunck. Determining Optical Flow. Artificial Intelligence, 17, pp. 185-203, 1981. .. [Horn81] Berthold K.P. Horn and Brian G. Schunck. Determining Optical Flow. Artificial Intelligence, 17, pp. 185-203, 1981.