From eb2f1f81ed530fa7dd5130b52fb57c42b99e1647 Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Mon, 28 May 2012 07:36:14 +0000 Subject: [PATCH] Fixed hundreds of documentation problems --- .../camera_calibration_and_3d_reconstruction.rst | 91 +-- .../calib3d/include/opencv2/calib3d/calib3d.hpp | 77 +-- modules/core/doc/clustering.rst | 2 +- modules/core/doc/drawing_functions.rst | 58 +- modules/core/doc/old_basic_structures.rst | 752 ++++++++++----------- modules/core/doc/operations_on_arrays.rst | 315 +++++---- .../utility_and_system_functions_and_macros.rst | 22 +- .../common_interfaces_of_descriptor_extractors.rst | 6 +- .../common_interfaces_of_descriptor_matchers.rst | 32 +- .../doc/common_interfaces_of_feature_detectors.rst | 24 +- ...n_interfaces_of_generic_descriptor_matchers.rst | 16 +- .../drawing_function_of_keypoints_and_matches.rst | 8 +- .../doc/feature_detection_and_description.rst | 30 +- modules/features2d/doc/object_categorization.rst | 4 +- .../include/opencv2/features2d/features2d.hpp | 6 +- modules/gpu/doc/data_structures.rst | 2 +- modules/gpu/doc/image_processing.rst | 4 +- modules/gpu/doc/object_detection.rst | 2 +- modules/gpu/doc/video.rst | 4 +- modules/highgui/doc/qt_new_functions.rst | 72 +- .../doc/reading_and_writing_images_and_video.rst | 80 +-- modules/highgui/doc/user_interface.rst | 50 +- modules/imgproc/doc/feature_detection.rst | 114 ++-- modules/imgproc/doc/filtering.rst | 323 ++++----- modules/imgproc/doc/geometric_transformations.rst | 89 +-- modules/imgproc/doc/histograms.rst | 258 +++---- .../imgproc/doc/miscellaneous_transformations.rst | 69 +- .../doc/motion_analysis_and_object_tracking.rst | 25 +- modules/imgproc/doc/object_detection.rst | 4 +- .../structural_analysis_and_shape_descriptors.rst | 145 ++-- .../imgproc/include/opencv2/imgproc/imgproc.hpp | 2 +- ...n_interfaces_of_generic_descriptor_matchers.rst | 4 +- .../doc/feature_detection_and_description.rst | 2 +- modules/legacy/doc/motion_analysis.rst | 44 +- modules/legacy/include/opencv2/legacy/legacy.hpp | 4 +- modules/ml/doc/boosting.rst | 20 +- modules/ml/doc/decision_trees.rst | 58 +- modules/ml/doc/ertrees.rst | 2 +- modules/ml/doc/expectation_maximization.rst | 37 +- modules/ml/doc/gradient_boosted_trees.rst | 4 +- modules/ml/doc/k_nearest_neighbors.rst | 2 +- modules/ml/doc/mldata.rst | 2 +- modules/ml/doc/neural_networks.rst | 22 +- modules/ml/doc/normal_bayes_classifier.rst | 6 +- modules/ml/doc/random_trees.rst | 16 +- modules/ml/doc/statistical_models.rst | 2 +- modules/ml/doc/support_vector_machines.rst | 20 +- modules/ml/include/opencv2/ml/ml.hpp | 19 +- modules/nonfree/doc/feature_detection.rst | 62 +- .../nonfree/include/opencv2/nonfree/features2d.hpp | 22 +- modules/objdetect/doc/cascade_classification.rst | 12 +- modules/objdetect/doc/latent_svm.rst | 140 ++-- .../include/opencv2/objdetect/objdetect.hpp | 2 +- modules/photo/doc/inpainting.rst | 6 +- modules/python/src2/api | 22 +- modules/python/src2/cv2.cv.hpp | 2 +- modules/stitching/doc/blenders.rst | 4 +- modules/stitching/doc/camera.rst | 2 +- modules/stitching/doc/exposure_compensation.rst | 6 +- modules/stitching/doc/high_level.rst | 6 +- modules/stitching/doc/matching.rst | 30 +- modules/stitching/doc/motion_estimation.rst | 8 +- modules/stitching/doc/seam_estimation.rst | 8 +- modules/stitching/doc/warpers.rst | 6 +- .../doc/motion_analysis_and_object_tracking.rst | 104 +-- 65 files changed, 1710 insertions(+), 1682 deletions(-) diff --git a/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.rst b/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.rst index 4d40ea7..8f04eb6 100644 --- a/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.rst +++ b/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.rst @@ -111,11 +111,11 @@ calibrateCamera --------------- 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: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 @@ -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: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 @@ -344,10 +344,8 @@ Converts points to/from homogeneous coordinates. .. 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: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. @@ -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: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 @@ -428,7 +426,7 @@ Renders the detected chessboard corners. .. 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 :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. -.. 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: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 :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 &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. @@ -551,13 +549,13 @@ solvePnP ------------ 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`` can be also passed here. @@ -587,7 +585,7 @@ solvePnPRansac ------------------ 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 @@ -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: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:pyoldfunction:: cv.FindFundamentalMat(points1, points2, fundamentalMatrix, method=CV_FM_RANSAC, param1=1., param2=0.99, status=None) -> None +.. 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) -> retval :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: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`` . @@ -773,9 +771,9 @@ estimateAffine3D -------------------- 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. @@ -815,13 +813,13 @@ getOptimalNewCameraMatrix ----------------------------- 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: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. @@ -854,9 +852,9 @@ Finds an initial camera matrix from 3D-2D point correspondences. .. 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. @@ -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: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 :param objectPoints: Array of object points, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel (or ``vector`` ), where N is the number of points in the view. @@ -943,11 +942,11 @@ reprojectImageTo3D ---------------------- 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: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 @@ -978,11 +977,11 @@ RQDecomp3x3 --------------- 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: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 :param M: 3x3 input matrix. @@ -1083,11 +1082,11 @@ The constructors. .. ocv:function:: StereoBM::StereoBM() .. ocv:function:: StereoBM::StereoBM(int preset, int ndisparities=0, int SADWindowSize=21) -.. ocv:pyfunction:: cv2.StereoBM.StereoBM(preset[, ndisparities[, SADWindowSize]]) -> +.. ocv:pyfunction:: cv2.StereoBM([preset[, ndisparities[, SADWindowSize]]]) -> -.. 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: @@ -1109,7 +1108,7 @@ StereoBM::operator() ----------------------- 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 @@ -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:pyfunction:: cv2.StereoSGBM.StereoSGBM(minDisparity, numDisparities, SADWindowSize[, P1[, P2[, disp12MaxDiff[, preFilterCap[, uniquenessRatio[, speckleWindowSize[, speckleRange[, fullDP]]]]]]]]) -> +.. ocv:pyfunction:: cv2.StereoSGBM([minDisparity, numDisparities, SADWindowSize[, P1[, P2[, disp12MaxDiff[, preFilterCap[, uniquenessRatio[, speckleWindowSize[, speckleRange[, fullDP]]]]]]]]]) -> Initializes ``StereoSGBM`` and sets parameters to custom values.?? @@ -1349,12 +1348,13 @@ stereoCalibrate ------------------- 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: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: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, 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. @@ -1439,10 +1439,11 @@ stereoRectify ----------------- 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* 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: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: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. @@ -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: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 diff --git a/modules/calib3d/include/opencv2/calib3d/calib3d.hpp b/modules/calib3d/include/opencv2/calib3d/calib3d.hpp index 966fffe..fb70eef 100644 --- a/modules/calib3d/include/opencv2/calib3d/calib3d.hpp +++ b/modules/calib3d/include/opencv2/calib3d/calib3d.hpp @@ -81,7 +81,7 @@ CVAPI(void) cvConvertPointsHomogeneous( const CvMat* src, CvMat* dst ); #define CV_LMEDS 4 #define CV_RANSAC 8 - + #define CV_FM_LMEDS_ONLY CV_LMEDS #define CV_FM_RANSAC_ONLY CV_RANSAC #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_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, CvMat* fundamental_matrix, 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, CvMat* new_points1, CvMat* new_points2); - + /* 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=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_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 // - src: input image // - 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 CVAPI(int) cvCheckChessboard(IplImage* src, CvSize size); - + /* Detects corners on a chessboard calibration pattern */ CVAPI(int) cvFindChessboardCorners( const void* image, CvSize pattern_size, CvPoint2D32f* corners, int* corner_count CV_DEFAULT(NULL), - int flags CV_DEFAULT(CV_CALIB_CB_ADAPTIVE_THRESH+ - CV_CALIB_CB_NORMALIZE_IMAGE) ); + int flags CV_DEFAULT(CV_CALIB_CB_ADAPTIVE_THRESH+CV_CALIB_CB_NORMALIZE_IMAGE) ); /* Draws individual chessboard corners or the whole chessboard detected */ CVAPI(void) cvDrawChessboardCorners( CvArr* image, CvSize pattern_size, @@ -330,7 +329,7 @@ typedef struct CvStereoBMState int speckleRange; // acceptable range of variation in window 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; int disp12MaxDiff; @@ -353,13 +352,13 @@ CVAPI(void) cvReleaseStereoBMState( CvStereoBMState** state ); CVAPI(void) cvFindStereoCorrespondenceBM( const CvArr* left, const CvArr* right, CvArr* disparity, CvStereoBMState* state ); - + CVAPI(CvRect) cvGetValidDisparityROI( CvRect roi1, CvRect roi2, int minDisparity, int numberOfDisparities, int SADWindowSize ); - + CVAPI(void) cvValidateDisparity( CvArr* disparity, const CvArr* cost, 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 */ CVAPI(void) cvReprojectImageTo3D( const CvArr* disparityImage, @@ -384,11 +383,11 @@ public: bool completeSymmFlag=false ); bool update( const CvMat*& param, CvMat*& J, CvMat*& err ); bool updateAlt( const CvMat*& param, CvMat*& JtJ, CvMat*& JtErr, double*& errNorm ); - + void clear(); void step(); enum { DONE=0, STARTED=1, CALC_J=2, CHECK_ERR=3 }; - + cv::Ptr mask; cv::Ptr prevParam; cv::Ptr param; @@ -427,7 +426,7 @@ CV_EXPORTS_W Mat findHomography( InputArray srcPoints, InputArray dstPoints, //! variant of findHomography for backward compatibility CV_EXPORTS Mat findHomography( InputArray srcPoints, InputArray dstPoints, OutputArray mask, int method=0, double ransacReprojThreshold=3); - + //! Computes RQ decomposition of 3x3 matrix CV_EXPORTS_W Vec3d RQDecomp3x3( InputArray src, OutputArray mtxR, OutputArray mtxQ, OutputArray Qx=noArray(), @@ -440,7 +439,7 @@ CV_EXPORTS_W void decomposeProjectionMatrix( InputArray projMatrix, OutputArray OutputArray rotMatrixX=noArray(), OutputArray rotMatrixY=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 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. enum { - ITERATIVE=CV_ITERATIVE, + ITERATIVE=CV_ITERATIVE, EPNP=CV_EPNP, - P3P=CV_P3P + P3P=CV_P3P }; CV_EXPORTS_W bool solvePnP( InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix, InputArray distCoeffs, 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. CV_EXPORTS_W void solvePnPRansac( InputArray objectPoints, @@ -483,12 +482,12 @@ CV_EXPORTS_W void solvePnPRansac( InputArray objectPoints, InputArray distCoeffs, OutputArray rvec, OutputArray tvec, - bool useExtrinsicGuess = false, + bool useExtrinsicGuess = false, int iterationsCount = 100, float reprojectionError = 8.0, int minInliersCount = 100, OutputArray inliers = noArray(), - int flags = 0); + int flags = ITERATIVE); //! initializes camera matrix from a few 3D points and the corresponding projections. 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 CV_EXPORTS_W bool findChessboardCorners( InputArray image, Size patternSize, OutputArray corners, - int flags=CALIB_CB_ADAPTIVE_THRESH+ - CALIB_CB_NORMALIZE_IMAGE ); + int flags=CALIB_CB_ADAPTIVE_THRESH+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); //! 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, Size imageSize, OutputArray R, OutputArray T, OutputArray E, OutputArray F, - TermCriteria criteria = TermCriteria(TermCriteria::COUNT+ - TermCriteria::EPS, 30, 1e-6), + TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6), int flags=CALIB_FIX_INTRINSIC ); - + //! computes the rectification transformation for a stereo camera from its intrinsic and extrinsic parameters CV_EXPORTS_W void stereoRectify( InputArray cameraMatrix1, InputArray distCoeffs1, InputArray cameraMatrix2, InputArray distCoeffs2, @@ -606,7 +603,7 @@ CV_EXPORTS_W float rectify3Collinear( InputArray cameraMatrix1, InputArray distC OutputArray P1, OutputArray P2, OutputArray P3, OutputArray Q, double alpha, Size newImgSize, CV_OUT Rect* roi1, CV_OUT Rect* roi2, int flags ); - + //! returns the optimal new camera matrix CV_EXPORTS_W Mat getOptimalNewCameraMatrix( InputArray cameraMatrix, InputArray distCoeffs, 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)) 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)) CV_EXPORTS_W void convertPointsFromHomogeneous( InputArray src, OutputArray dst ); //! for backward compatibility CV_EXPORTS void convertPointsHomogeneous( InputArray src, OutputArray dst ); - + //! the algorithm for finding fundamental matrix enum -{ +{ FM_7POINT = CV_FM_7POINT, //!< 7-point algorithm FM_8POINT = CV_FM_8POINT, //!< 8-point 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); //! 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, OutputArray lines ); @@ -657,7 +654,7 @@ template<> CV_EXPORTS void Ptr::delete_obj(); /*! Block Matching Stereo Correspondence Algorithm - + The class implements BM stereo correspondence algorithm by K. Konolige. */ class CV_EXPORTS_W StereoBM @@ -683,7 +680,7 @@ public: /*! Semi-Global Block Matching Stereo Correspondence Algorithm - + The class implements the original SGBM stereo correspondence algorithm by H. Hirschmuller and some its modification. */ class CV_EXPORTS_W StereoSGBM @@ -693,7 +690,7 @@ public: //! the default constructor CV_WRAP StereoSGBM(); - + //! the full constructor taking all the necessary algorithm parameters CV_WRAP StereoSGBM(int minDisparity, int numDisparities, int SADWindowSize, int P1=0, int P2=0, int disp12MaxDiff=0, @@ -742,11 +739,11 @@ CV_EXPORTS_W void reprojectImageTo3D( InputArray disparity, OutputArray _3dImage, InputArray Q, bool handleMissingValues=false, int ddepth=-1 ); - -CV_EXPORTS_W int estimateAffine3D(InputArray _from, InputArray _to, - OutputArray _out, OutputArray _inliers, - double param1=3, double param2=0.99); - + +CV_EXPORTS_W int estimateAffine3D(InputArray src, InputArray dst, + OutputArray out, OutputArray inliers, + double ransacThreshold=3, double confidence=0.99); + } #endif diff --git a/modules/core/doc/clustering.rst b/modules/core/doc/clustering.rst index 6788651..c4422a1 100644 --- a/modules/core/doc/clustering.rst +++ b/modules/core/doc/clustering.rst @@ -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: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. diff --git a/modules/core/doc/drawing_functions.rst b/modules/core/doc/drawing_functions.rst index a4d8dce..7bdafbf 100644 --- a/modules/core/doc/drawing_functions.rst +++ b/modules/core/doc/drawing_functions.rst @@ -64,9 +64,9 @@ Clips the line against the image rectangle. .. ocv:pyfunction:: cv2.clipLine(imgRect, pt1, pt2) -> retval, pt1, 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. @@ -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: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: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 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 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 startAngle: Starting 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 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. @@ -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 ) - :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: - * **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. .. seealso:: :ocv:cfunc:`PutText` -.. _Line: +.. _Line: line -------- @@ -416,7 +416,7 @@ Draws a simple, thick, or filled up-right rectangle. :param pt1: Vertex of the rectangle. :param pt2: Vertex of the rectangle opposite to ``pt1`` . - + :param r: Alternative specification of the drawn rectangle. :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: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. @@ -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: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:pyoldfunction:: cv.PutText(img, text, org, font, color)-> None diff --git a/modules/core/doc/old_basic_structures.rst b/modules/core/doc/old_basic_structures.rst index 5c5aec4..710e0e3 100644 --- a/modules/core/doc/old_basic_structures.rst +++ b/modules/core/doc/old_basic_structures.rst @@ -13,12 +13,12 @@ CvPoint 2D point with integer coordinates (usually zero-based). .. ocv:member:: int x - - x-coordinate - + + x-coordinate + .. ocv:member:: int y - y-coordinate + y-coordinate .. ocv:cfunction:: CvPoint cvPoint( int x, int y ) @@ -39,11 +39,11 @@ CvPoint2D32f .. ocv:member:: float x - x-coordinate + x-coordinate .. ocv:member:: float y - y-coordinate + y-coordinate .. ocv:cfunction:: CvPoint2D32f cvPoint2D32f( float x, float y ) @@ -64,11 +64,11 @@ CvPoint3D32f .. ocv:member:: float x - x-coordinate + x-coordinate .. ocv:member:: float y - y-coordinate + y-coordinate .. ocv:member:: float z @@ -89,11 +89,11 @@ CvPoint2D64f .. ocv:member:: double x - x-coordinate + x-coordinate .. ocv:member:: double y - y-coordinate + y-coordinate .. ocv:cfunction:: CvPoint2D64f cvPoint2D64f( double x, double y ) @@ -110,13 +110,13 @@ CvPoint3D64f .. ocv:member:: double x - x-coordinate + x-coordinate .. ocv:member:: double y y-coordinate - - .. ocv:member:: double z + + .. ocv:member:: double z .. ocv:cfunction:: CvPoint3D64f cvPoint3D64f( double x, double y, double z ) @@ -130,13 +130,13 @@ CvSize .. ocv:struct:: CvSize Size of a rectangle or an image. - + .. ocv:member:: int width - - Width of the rectangle - + + Width of the rectangle + .. ocv:member:: int height - + Height of the rectangle .. ocv:cfunction:: CvSize cvSize( int width, int height ) @@ -153,18 +153,18 @@ CvSize2D32f Sub-pixel accurate size of a rectangle. .. ocv:member:: float width - - Width of the rectangle - + + Width of the rectangle + .. ocv:member:: float height - + Height of the rectangle .. ocv:cfunction:: CvSize2D32f cvSize2D23f( float width, float height ) constructs ``CvSize2D32f`` structure. -.. seealso:: :ocv:class:`Size\_` +.. seealso:: :ocv:class:`Size\_` CvRect ------ @@ -174,25 +174,25 @@ CvRect Stores coordinates of a rectangle. .. ocv:member:: int x - - x-coordinate of the top-left corner - + + x-coordinate of the top-left corner + .. ocv:member:: int y - + y-coordinate of the top-left corner (sometimes bottom-left corner) - + .. ocv:member:: int width - - Width of the rectangle - + + Width of the rectangle + .. ocv:member:: int height - - Height of the rectangle - + + Height of the rectangle + .. ocv:cfunction:: CvRect cvRect( int x, int y, int width, int height ) constructs ``CvRect`` structure. - + .. seealso:: :ocv:class:`Rect\_` @@ -230,10 +230,10 @@ A container for 1-,2-,3- or 4-tuples of doubles. .. ocv::cfunction:: CvScalar cvScalar( double val0, double val1=0, double val2=0, double val3=0 ) initializes val[0] with val0, val[1] with val1, val[2] with val2 and val[3] with val3. - + .. ocv::cfunction:: CvScalar cvScalarAll( double val0123 ) - initializes all of val[0]...val[3] with val0123 + initializes all of val[0]...val[3] with val0123 .. ocv::cfunction:: CvScalar cvRealScalar( double val0 ) @@ -249,21 +249,21 @@ CvTermCriteria Termination criteria for iterative algorithms. .. ocv:member:: int type - + type of the termination criteria, one of: - + * ``CV_TERMCRIT_ITER`` - stop the algorithm after ``max_iter`` iterations at maximum. - + * ``CV_TERMCRIT_EPS`` - stop the algorithm after the achieved algorithm-dependent accuracy becomes lower than ``epsilon``. - + * ``CV_TERMCRIT_ITER+CV_TERMCRIT_EPS`` - stop the algorithm after ``max_iter`` iterations or when the achieved accuracy is lower than ``epsilon``, whichever comes the earliest. - .. ocv:member:: int max_iter + .. ocv:member:: int max_iter + + Maximum number of iterations - Maximum number of iterations - .. ocv:member:: double epsilon - + Required accuracy .. seealso:: :ocv:class:`TermCriteria` @@ -276,44 +276,44 @@ CvMat A multi-channel dense matrix. .. ocv:member:: int type - + ``CvMat`` signature (``CV_MAT_MAGIC_VAL``) plus type of the elements. Type of the matrix elements can be retrieved using ``CV_MAT_TYPE`` macro: :: - + int type = CV_MAT_TYPE(matrix->type); - + For description of possible matrix elements, see :ocv:class:`Mat`. - + .. ocv:member:: int step - - Full row length in bytes - + + Full row length in bytes + .. ocv:member:: int* refcount - - Underlying data reference counter - + + Underlying data reference counter + .. ocv:member:: union data - + Pointers to the actual matrix data: - + * ptr - pointer to 8-bit unsigned elements * s - pointer to 16-bit signed elements * i - pointer to 32-bit signed elements * fl - pointer to 32-bit floating-point elements * db - pointer to 64-bit floating-point elements - + .. ocv:member:: int rows - - Number of rows - + + Number of rows + .. ocv:member:: int cols - - Number of columns + + Number of columns Matrix elements are stored row by row. Element (i, j) (i - 0-based row index, j - 0-based column index) of a matrix can be retrieved or modified using ``CV_MAT_ELEM`` macro: :: uchar pixval = CV_MAT_ELEM(grayimg, uchar, i, j) CV_MAT_ELEM(cameraMatrix, float, 0, 2) = image.width*0.5f; - + To access multiple-channel matrices, you can use ``CV_MAT_ELEM(matrix, type, i, j*nchannels + channel_idx)``. ``CvMat`` is now obsolete; consider using :ocv:class:`Mat` instead. @@ -326,36 +326,36 @@ CvMatND Multi-dimensional dense multi-channel array. .. ocv:member:: int type - + A ``CvMatND`` signature (``CV_MATND_MAGIC_VAL``) plus the type of elements. Type of the matrix elements can be retrieved using ``CV_MAT_TYPE`` macro: :: - + int type = CV_MAT_TYPE(ndmatrix->type); - + .. ocv:member:: int dims - - The number of array dimensions - + + The number of array dimensions + .. ocv:member:: int* refcount - - Underlying data reference counter - + + Underlying data reference counter + .. ocv:member:: union data - - Pointers to the actual matrix data - + + Pointers to the actual matrix data + * ptr - pointer to 8-bit unsigned elements * s - pointer to 16-bit signed elements * i - pointer to 32-bit signed elements * fl - pointer to 32-bit floating-point elements * db - pointer to 64-bit floating-point elements - + .. ocv:member:: array dim - + Arrays of pairs (array size along the i-th dimension, distance between neighbor elements along i-th dimension): :: - + for(int i = 0; i < ndmatrix->dims; i++) printf("size[i] = %d, step[i] = %d\n", ndmatrix->dim[i].size, ndmatrix->dim[i].step); - + ``CvMatND`` is now obsolete; consider using :ocv:class:`Mat` instead. CvSparseMat @@ -364,33 +364,33 @@ CvSparseMat .. ocv:struct:: CvSparseMat Multi-dimensional sparse multi-channel array. - + .. ocv:member:: int type - + A ``CvSparseMat`` signature (CV_SPARSE_MAT_MAGIC_VAL) plus the type of sparse matrix elements. Similarly to ``CvMat`` and ``CvMatND``, use ``CV_MAT_TYPE()`` to retrieve type of the elements. - + .. ocv:member:: int dims - - Number of dimensions - + + Number of dimensions + .. ocv:member:: int* refcount - - Underlying reference counter. Not used. - + + Underlying reference counter. Not used. + .. ocv:member:: CvSet* heap - + A pool of hash table nodes - + .. ocv:member:: void** hashtable - - The hash table. Each entry is a list of nodes. - + + The hash table. Each entry is a list of nodes. + .. ocv:member:: int hashsize - - Size of the hash table - + + Size of the hash table + .. ocv:member:: int[] size - + Array of dimension sizes IplImage @@ -399,27 +399,27 @@ IplImage .. ocv:struct:: IplImage IPL image header - + .. ocv:member:: int nSize - - ``sizeof(IplImage)`` - + + ``sizeof(IplImage)`` + .. ocv:member:: int ID - - Version, always equals 0 - + + Version, always equals 0 + .. ocv:member:: int nChannels - - Number of channels. Most OpenCV functions support 1-4 channels. - + + Number of channels. Most OpenCV functions support 1-4 channels. + .. ocv:member:: int alphaChannel - - Ignored by OpenCV - + + Ignored by OpenCV + .. ocv:member:: int depth - - Channel depth in bits + the optional sign bit ( ``IPL_DEPTH_SIGN`` ). The supported depths are: - + + Channel depth in bits + the optional sign bit ( ``IPL_DEPTH_SIGN`` ). The supported depths are: + * ``IPL_DEPTH_8U`` - unsigned 8-bit integer. Equivalent to ``CV_8U`` in matrix types. * ``IPL_DEPTH_8S`` - signed 8-bit integer. Equivalent to ``CV_8S`` in matrix types. * ``IPL_DEPTH_16U`` - unsigned 16-bit integer. Equivalent to ``CV_16U`` in matrix types. @@ -427,75 +427,75 @@ IPL image header * ``IPL_DEPTH_32S`` - signed 32-bit integer. Equivalent to ``CV_32S`` in matrix types. * ``IPL_DEPTH_32F`` - single-precision floating-point number. Equivalent to ``CV_32F`` in matrix types. * ``IPL_DEPTH_64F`` - double-precision floating-point number. Equivalent to ``CV_64F`` in matrix types. - + .. ocv:member:: char[] colorModel - - Ignored by OpenCV. - + + Ignored by OpenCV. + .. ocv:member:: char[] channelSeq - - Ignored by OpenCV - + + Ignored by OpenCV + .. ocv:member:: int dataOrder - - 0 = ``IPL_DATA_ORDER_PIXEL`` - interleaved color channels, 1 - separate color channels. :ocv:cfunc:`CreateImage` only creates images with interleaved channels. For example, the usual layout of a color image is: :math:`b_{00} g_{00} r_{00} b_{10} g_{10} r_{10} ...` - + + 0 = ``IPL_DATA_ORDER_PIXEL`` - interleaved color channels, 1 - separate color channels. :ocv:cfunc:`CreateImage` only creates images with interleaved channels. For example, the usual layout of a color image is: :math:`b_{00} g_{00} r_{00} b_{10} g_{10} r_{10} ...` + .. ocv:member:: int origin - - 0 - top-left origin, 1 - bottom-left origin (Windows bitmap style) - + + 0 - top-left origin, 1 - bottom-left origin (Windows bitmap style) + .. ocv:member:: int align - - Alignment of image rows (4 or 8). OpenCV ignores this and uses widthStep instead. - + + Alignment of image rows (4 or 8). OpenCV ignores this and uses widthStep instead. + .. ocv:member:: int width - - Image width in pixels - + + Image width in pixels + .. ocv:member:: int height - - Image height in pixels - + + Image height in pixels + .. ocv:member:: IplROI* roi - - Region Of Interest (ROI). If not NULL, only this image region will be processed. - + + Region Of Interest (ROI). If not NULL, only this image region will be processed. + .. ocv:member:: IplImage* maskROI - - Must be NULL in OpenCV - + + Must be NULL in OpenCV + .. ocv:member:: void* imageId - - Must be NULL in OpenCV - + + Must be NULL in OpenCV + .. ocv:member:: void* tileInfo - - Must be NULL in OpenCV - + + Must be NULL in OpenCV + .. ocv:member:: int imageSize - - Image data size in bytes. For interleaved data, this equals :math:`\texttt{image->height} \cdot \texttt{image->widthStep}` - + + Image data size in bytes. For interleaved data, this equals :math:`\texttt{image->height} \cdot \texttt{image->widthStep}` + .. ocv:member:: char* imageData - + A pointer to the aligned image data. Do not assign imageData directly. Use :ocv:cfunc:`SetData`. - + .. ocv:member:: int widthStep - - The size of an aligned image row, in bytes. - + + The size of an aligned image row, in bytes. + .. ocv:member:: int[] BorderMode - - Border completion mode, ignored by OpenCV - + + Border completion mode, ignored by OpenCV + .. ocv:member:: int[] BorderConst - - Constant border value, ignored by OpenCV - + + Constant border value, ignored by OpenCV + .. ocv:member:: char* imageDataOrigin - - A pointer to the origin of the image data (not necessarily aligned). This is used for image deallocation. - + + A pointer to the origin of the image data (not necessarily aligned). This is used for image deallocation. + The ``IplImage`` is taken from the Intel Image Processing Library, in which the format is native. OpenCV only supports a subset of possible ``IplImage`` formats, as outlined in the parameter list above. In addition to the above restrictions, OpenCV handles ROIs differently. OpenCV functions require that the image size or ROI size of all source and destination images match exactly. On the other hand, the Intel Image Processing Library processes the area of intersection between the source and destination images (or ROIs), allowing them to vary independently. @@ -514,9 +514,9 @@ Clears a specific array element. .. ocv:cfunction:: void cvClearND(CvArr* arr, int* idx) .. ocv:pyoldfunction:: cv.ClearND(arr, idx)-> None - :param arr: Input array - :param idx: Array of the element indices - + :param arr: Input array + :param idx: Array of the element indices + The function clears (sets to zero) a specific element of a dense array or deletes the element of a sparse array. If the sparse array element does not exists, the function does nothing. CloneImage @@ -524,8 +524,8 @@ CloneImage Makes a full copy of an image, including the header, data, and ROI. .. ocv:cfunction:: IplImage* cvCloneImage(const IplImage* image) -.. ocv:pyoldfunction:: cv.CloneImage(image)-> copy - +.. ocv:pyoldfunction:: cv.CloneImage(image) -> image + :param image: The original image CloneMat @@ -533,10 +533,10 @@ CloneMat Creates a full matrix copy. .. ocv:cfunction:: CvMat* cvCloneMat(const CvMat* mat) -.. ocv:pyoldfunction:: cv.CloneMat(mat)-> copy - - :param mat: Matrix to be copied - +.. ocv:pyoldfunction:: cv.CloneMat(mat) -> mat + + :param mat: Matrix to be copied + Creates a full copy of a matrix and returns a pointer to the copy. Note that the matrix copy is compacted, that is, it will not have gaps between rows. CloneMatND @@ -544,8 +544,8 @@ CloneMatND Creates full copy of a multi-dimensional array and returns a pointer to the copy. .. ocv:cfunction:: CvMatND* cvCloneMatND(const CvMatND* mat) -.. ocv:pyoldfunction:: cv.CloneMatND(mat)-> copy - +.. ocv:pyoldfunction:: cv.CloneMatND(mat) -> matND + :param mat: Input array CloneSparseMat @@ -553,9 +553,9 @@ CloneSparseMat Creates full copy of sparse array. .. ocv:cfunction:: CvSparseMat* cvCloneSparseMat(const CvSparseMat* mat) - - :param mat: Input array - + + :param mat: Input array + The function creates a copy of the input array and returns pointer to the copy. @@ -568,26 +568,26 @@ Converts one array to another with optional linear transformation. .. ocv:pyoldfunction:: cv.Convert(src, dst)-> None :: - + #define cvCvtScale cvConvertScale #define cvScale cvConvertScale #define cvConvert(src, dst ) cvConvertScale((src), (dst), 1, 0 ) .. - - :param src: Source array - - :param dst: Destination array - - :param scale: Scale factor - - :param shift: Value added to the scaled source array elements - + + :param src: Source array + + :param dst: Destination array + + :param scale: Scale factor + + :param shift: Value added to the scaled source array elements + The function has several different purposes, and thus has several different names. It copies one array to another with optional scaling, which is performed first, and/or optional type conversion, performed after: .. math:: - \texttt{dst} (I) = \texttt{scale} \texttt{src} (I) + ( \texttt{shift} _0, \texttt{shift} _1,...) + \texttt{dst} (I) = \texttt{scale} \texttt{src} (I) + ( \texttt{shift} _0, \texttt{shift} _1,...) All the channels of multi-channel arrays are processed independently. @@ -605,17 +605,17 @@ Copies one array to another. .. ocv:cfunction:: void cvCopy(const CvArr* src, CvArr* dst, const CvArr* mask=NULL) .. ocv:pyoldfunction:: cv.Copy(src, dst, mask=None)-> None - :param src: The source array - - :param dst: The destination array - - :param mask: Operation mask, 8-bit single channel array; specifies elements of the destination array to be changed - + :param src: The source array + + :param dst: The destination array + + :param mask: Operation mask, 8-bit single channel array; specifies elements of the destination array to be changed + The function copies selected elements from an input array to an output array: .. math:: - \texttt{dst} (I)= \texttt{src} (I) \quad \text{if} \quad \texttt{mask} (I) \ne 0. + \texttt{dst} (I)= \texttt{src} (I) \quad \text{if} \quad \texttt{mask} (I) \ne 0. If any of the passed arrays is of ``IplImage`` type, then its ROI and COI fields are used. Both arrays must have the same type, the same number of dimensions, and the same size. The function can also copy sparse arrays (mask is not supported in this case). @@ -625,10 +625,10 @@ CreateData Allocates array data .. ocv:cfunction:: void cvCreateData(CvArr* arr) -.. ocv:pyoldfunction:: cv.CreateData(arr) -> None +.. ocv:pyoldfunction:: cv.CreateData(arr) -> None + + :param arr: Array header - :param arr: Array header - The function allocates image, matrix or multi-dimensional dense array data. Note that in the case of matrix types OpenCV allocation functions are used. In the case of IplImage they are used unless ``CV_TURN_ON_IPL_COMPATIBILITY()`` has been called before. In the latter case IPL functions are used to allocate the data. @@ -638,13 +638,13 @@ Creates an image header and allocates the image data. .. ocv:cfunction:: IplImage* cvCreateImage(CvSize size, int depth, int channels) .. ocv:pyoldfunction:: cv.CreateImage(size, depth, channels)->image - - :param size: Image width and height - - :param depth: Bit depth of image elements. See :ocv:struct:`IplImage` for valid depths. - - :param channels: Number of channels per pixel. See :ocv:struct:`IplImage` for details. This function only creates images with interleaved channels. - + + :param size: Image width and height + + :param depth: Bit depth of image elements. See :ocv:struct:`IplImage` for valid depths. + + :param channels: Number of channels per pixel. See :ocv:struct:`IplImage` for details. This function only creates images with interleaved channels. + This function call is equivalent to the following code: :: header = cvCreateImageHeader(size, depth, channels); @@ -657,23 +657,23 @@ Creates an image header but does not allocate the image data. .. ocv:cfunction:: IplImage* cvCreateImageHeader(CvSize size, int depth, int channels) .. ocv:pyoldfunction:: cv.CreateImageHeader(size, depth, channels) -> image - :param size: Image width and height - - :param depth: Image depth (see :ocv:cfunc:`CreateImage` ) - + :param size: Image width and height + + :param depth: Image depth (see :ocv:cfunc:`CreateImage` ) + :param channels: Number of channels (see :ocv:cfunc:`CreateImage` ) CreateMat --------- -Creates a matrix header and allocates the matrix data. +Creates a matrix header and allocates the matrix data. .. ocv:cfunction:: CvMat* cvCreateMat( int rows, int cols, int type) .. ocv:pyoldfunction:: cv.CreateMat(rows, cols, type) -> mat - - :param rows: Number of rows in the matrix - - :param cols: Number of columns in the matrix - + + :param rows: Number of rows in the matrix + + :param cols: Number of columns in the matrix + :param type: The type of the matrix elements in the form ``CV_C`` , where S=signed, U=unsigned, F=float. For example, CV _ 8UC1 means the elements are 8-bit unsigned and the there is 1 channel, and CV _ 32SC2 means the elements are 32-bit signed and there are 2 channels. The function call is equivalent to the following code: :: @@ -687,13 +687,13 @@ Creates a matrix header but does not allocate the matrix data. .. ocv:cfunction:: CvMat* cvCreateMatHeader( int rows, int cols, int type) .. ocv:pyoldfunction:: cv.CreateMatHeader(rows, cols, type) -> mat - - :param rows: Number of rows in the matrix - - :param cols: Number of columns in the matrix - - :param type: Type of the matrix elements, see :ocv:cfunc:`CreateMat` - + + :param rows: Number of rows in the matrix + + :param cols: Number of columns in the matrix + + :param type: Type of the matrix elements, see :ocv:cfunc:`CreateMat` + The function allocates a new matrix header and returns a pointer to it. The matrix data can then be allocated using :ocv:cfunc:`CreateData` or set explicitly to user-allocated data via :ocv:cfunc:`SetData`. CreateMatND @@ -701,16 +701,16 @@ CreateMatND Creates the header and allocates the data for a multi-dimensional dense array. .. ocv:cfunction:: CvMatND* cvCreateMatND( int dims, const int* sizes, int type) -.. ocv:pyoldfunction:: cv.CreateMatND(dims, type) -> None - - :param dims: Number of array dimensions. This must not exceed CV_MAX_DIM (32 by default, but can be changed at build time). - - :param sizes: Array of dimension sizes. - - :param type: Type of array elements, see :ocv:cfunc:`CreateMat` . - +.. ocv:pyoldfunction:: cv.CreateMatND(dims, type) -> matND + + :param dims: Number of array dimensions. This must not exceed CV_MAX_DIM (32 by default, but can be changed at build time). + + :param sizes: Array of dimension sizes. + + :param type: Type of array elements, see :ocv:cfunc:`CreateMat` . + This function call is equivalent to the following code: :: - + CvMatND* mat = cvCreateMatNDHeader(dims, sizes, type); cvCreateData(mat); @@ -719,12 +719,12 @@ CreateMatNDHeader Creates a new matrix header but does not allocate the matrix data. .. ocv:cfunction:: CvMatND* cvCreateMatNDHeader( int dims, const int* sizes, int type) -.. ocv:pyoldfunction:: cv.CreateMatNDHeader(dims, type) -> None - - :param dims: Number of array dimensions - - :param sizes: Array of dimension sizes - +.. ocv:pyoldfunction:: cv.CreateMatNDHeader(dims, type) -> matND + + :param dims: Number of array dimensions + + :param sizes: Array of dimension sizes + :param type: Type of array elements, see :ocv:cfunc:`CreateMat` The function allocates a header for a multi-dimensional dense array. The array data can further be allocated using :ocv:cfunc:`CreateData` or set explicitly to user-allocated data via :ocv:cfunc:`SetData`. @@ -734,14 +734,14 @@ CreateSparseMat Creates sparse array. .. ocv:cfunction:: CvSparseMat* cvCreateSparseMat(int dims, const int* sizes, int type) - - :param dims: Number of array dimensions. In contrast to the dense matrix, the number of dimensions is practically unlimited (up to :math:`2^{16}` ). - - :param sizes: Array of dimension sizes - + + :param dims: Number of array dimensions. In contrast to the dense matrix, the number of dimensions is practically unlimited (up to :math:`2^{16}` ). + + :param sizes: Array of dimension sizes + :param type: Type of array elements. The same as for CvMat -The function allocates a multi-dimensional sparse array. Initially the array contain no elements, that is +The function allocates a multi-dimensional sparse array. Initially the array contain no elements, that is :ocv:cfunc:`PtrND` and other related functions will return 0 for every index. @@ -751,24 +751,24 @@ Calculates the cross product of two 3D vectors. .. ocv:cfunction:: void cvCrossProduct(const CvArr* src1, const CvArr* src2, CvArr* dst) .. ocv:pyoldfunction:: cv.CrossProduct(src1, src2, dst)-> None - - :param src1: The first source vector - - :param src2: The second source vector - - :param dst: The destination vector - + + :param src1: The first source vector + + :param src2: The second source vector + + :param dst: The destination vector + The function calculates the cross product of two 3D vectors: .. math:: - \texttt{dst} = \texttt{src1} \times \texttt{src2} + \texttt{dst} = \texttt{src1} \times \texttt{src2} or: .. math:: - \begin{array}{l} \texttt{dst} _1 = \texttt{src1} _2 \texttt{src2} _3 - \texttt{src1} _3 \texttt{src2} _2 \\ \texttt{dst} _2 = \texttt{src1} _3 \texttt{src2} _1 - \texttt{src1} _1 \texttt{src2} _3 \\ \texttt{dst} _3 = \texttt{src1} _1 \texttt{src2} _2 - \texttt{src1} _2 \texttt{src2} _1 \end{array} + \begin{array}{l} \texttt{dst} _1 = \texttt{src1} _2 \texttt{src2} _3 - \texttt{src1} _3 \texttt{src2} _2 \\ \texttt{dst} _2 = \texttt{src1} _3 \texttt{src2} _1 - \texttt{src1} _1 \texttt{src2} _3 \\ \texttt{dst} _3 = \texttt{src1} _1 \texttt{src2} _2 - \texttt{src1} _2 \texttt{src2} _1 \end{array} DotProduct @@ -776,19 +776,19 @@ DotProduct Calculates the dot product of two arrays in Euclidean metrics. .. ocv:cfunction:: double cvDotProduct(const CvArr* src1, const CvArr* src2) -.. ocv:pyoldfunction:: cv.DotProduct(src1, src2)-> double +.. ocv:pyoldfunction:: cv.DotProduct(src1, src2) -> float - :param src1: The first source array + :param src1: The first source array - :param src2: The second source array + :param src2: The second source array The function calculates and returns the Euclidean dot product of two arrays. .. math:: - src1 \bullet src2 = \sum _I ( \texttt{src1} (I) \texttt{src2} (I)) + src1 \bullet src2 = \sum _I ( \texttt{src1} (I) \texttt{src2} (I)) -In the case of multiple channel arrays, the results for all channels are accumulated. In particular, +In the case of multiple channel arrays, the results for all channels are accumulated. In particular, ``cvDotProduct(a,a)`` where ``a`` is a complex vector, will return :math:`||\texttt{a}||^2`. The function can process multi-dimensional arrays, row by row, layer by layer, and so on. @@ -807,15 +807,15 @@ Get?D .. ocv:pyoldfunction:: cv.GetND(arr, indices) -> scalar Return a specific array element. - - :param arr: Input array - - :param idx0: The first zero-based component of the element index - - :param idx1: The second zero-based component of the element index - - :param idx2: The third zero-based component of the element index - + + :param arr: Input array + + :param idx0: The first zero-based component of the element index + + :param idx1: The second zero-based component of the element index + + :param idx2: The third zero-based component of the element index + :param idx: Array of the element indices The functions return a specific array element. In the case of a sparse array the functions return 0 if the requested node does not exist (no new node is created by the functions). @@ -826,18 +826,18 @@ Returns one of more array columns. .. ocv:cfunction:: CvMat* cvGetCol(const CvArr* arr, CvMat* submat, int col) .. ocv:cfunction:: CvMat* cvGetCols(const CvArr* arr, CvMat* submat, int startCol, int endCol) - + .. ocv:pyoldfunction:: cv.GetCol(arr, col)-> submat .. ocv:pyoldfunction:: cv.GetCols(arr, startCol, endCol)-> submat - - :param arr: Input array - - :param submat: Pointer to the resulting sub-array header - - :param col: Zero-based index of the selected column - - :param startCol: Zero-based index of the starting column (inclusive) of the span - + + :param arr: Input array + + :param submat: Pointer to the resulting sub-array header + + :param col: Zero-based index of the selected column + + :param startCol: Zero-based index of the starting column (inclusive) of the span + :param endCol: Zero-based index of the ending column (exclusive) of the span The functions return the header, corresponding to a specified column span of the input array. That is, no data is copied. Therefore, any modifications of the submatrix will affect the original array. If you need to copy the columns, use :ocv:cfunc:`CloneMat`. ``cvGetCol(arr, submat, col)`` is a shortcut for ``cvGetCols(arr, submat, col, col+1)``. @@ -848,13 +848,13 @@ Returns one of array diagonals. .. ocv:cfunction:: CvMat* cvGetDiag(const CvArr* arr, CvMat* submat, int diag=0) .. ocv:pyoldfunction:: cv.GetDiag(arr, diag=0)-> submat - - :param arr: Input array - - :param submat: Pointer to the resulting sub-array header - - :param diag: Index of the array diagonal. Zero value corresponds to the main diagonal, -1 corresponds to the diagonal above the main, 1 corresponds to the diagonal below the main, and so forth. - + + :param arr: Input array + + :param submat: Pointer to the resulting sub-array header + + :param diag: Index of the array diagonal. Zero value corresponds to the main diagonal, -1 corresponds to the diagonal above the main, 1 corresponds to the diagonal below the main, and so forth. + The function returns the header, corresponding to a specified diagonal of the input array. GetDims @@ -862,16 +862,16 @@ GetDims Return number of array dimensions .. ocv:cfunction:: int cvGetDims(const CvArr* arr, int* sizes=NULL) -.. ocv:pyoldfunction:: cv.GetDims(arr)-> list +.. ocv:pyoldfunction:: cv.GetDims(arr) -> (dim1, dim2, ...) + + :param arr: Input array - :param arr: Input array - :param sizes: Optional output vector of the array dimension sizes. For 2d arrays the number of rows (height) goes first, number of columns - (width) next. - + (width) next. + The function returns the array dimensionality and the array of dimension sizes. In the case of ``IplImage`` or `CvMat` it always returns 2 regardless of number of image/matrix rows. For example, the following code calculates total number of array elements: :: - + int sizes[CV_MAX_DIM]; int i, total = 1; int dims = cvGetDims(arr, size); @@ -884,7 +884,7 @@ Returns array size along the specified dimension. .. ocv:cfunction:: int cvGetDimSize(const CvArr* arr, int index) - :param arr: Input array + :param arr: Input array :param index: Zero-based dimension index (for matrices 0 means number of rows, 1 means number of columns; for images 0 means height, 1 means width) @@ -893,14 +893,14 @@ GetElemType Returns type of array elements. .. ocv:cfunction:: int cvGetElemType(const CvArr* arr) -.. ocv:pyoldfunction:: cv.GetElemType(arr)-> int - - :param arr: Input array - +.. ocv:pyoldfunction:: cv.GetElemType(arr)-> int + + :param arr: Input array + The function returns type of the array elements. In the case of ``IplImage`` the type is converted to ``CvMat``-like representation. For example, if the image has been created as: :: IplImage* img = cvCreateImage(cvSize(640, 480), IPL_DEPTH_8U, 3); - + The code ``cvGetElemType(img)`` will return ``CV_8UC3``. GetImage @@ -909,23 +909,23 @@ Returns image header for arbitrary array. .. ocv:cfunction:: IplImage* cvGetImage(const CvArr* arr, IplImage* imageHeader) .. ocv:pyoldfunction:: cv.GetImage(arr) -> iplimage - - :param arr: Input array - - :param imageHeader: Pointer to ``IplImage`` structure used as a temporary buffer - + + :param arr: Input array + + :param imageHeader: Pointer to ``IplImage`` structure used as a temporary buffer + The function returns the image header for the input array that can be a matrix (:ocv:struct:`CvMat`) or image (:ocv:struct:`IplImage`). In the case of an image the function simply returns the input pointer. In the case of ``CvMat`` it initializes an ``imageHeader`` structure with the parameters of the input matrix. Note that if we transform ``IplImage`` to ``CvMat`` using :ocv:cfunc:`GetMat` and then transform ``CvMat`` back to IplImage using this function, we will get different headers if the ROI is set in the original image. GetImageCOI ----------- -Returns the index of the channel of interest. +Returns the index of the channel of interest. .. ocv:cfunction:: int cvGetImageCOI(const IplImage* image) -.. ocv:pyoldfunction:: cv.GetImageCOI(image)-> channel - - :param image: A pointer to the image header - -Returns the channel of interest of in an IplImage. Returned values correspond to the ``coi`` in +.. ocv:pyoldfunction:: cv.GetImageCOI(image) -> int + + :param image: A pointer to the image header + +Returns the channel of interest of in an IplImage. Returned values correspond to the ``coi`` in :ocv:cfunc:`SetImageCOI`. GetImageROI @@ -935,8 +935,8 @@ Returns the image ROI. .. ocv:cfunction:: CvRect cvGetImageROI(const IplImage* image) .. ocv:pyoldfunction:: cv.GetImageROI(image)-> CvRect - :param image: A pointer to the image header - + :param image: A pointer to the image header + If there is no ROI set, ``cvRect(0,0,image->width,image->height)`` is returned. GetMat @@ -944,16 +944,16 @@ GetMat Returns matrix header for arbitrary array. .. ocv:cfunction:: CvMat* cvGetMat(const CvArr* arr, CvMat* header, int* coi=NULL, int allowND=0) -.. ocv:pyoldfunction:: cv.GetMat(arr, allowND=0) -> cvmat - - :param arr: Input array - - :param header: Pointer to :ocv:struct:`CvMat` structure used as a temporary buffer - - :param coi: Optional output parameter for storing COI - - :param allowND: If non-zero, the function accepts multi-dimensional dense arrays (CvMatND*) and returns 2D matrix (if CvMatND has two dimensions) or 1D matrix (when CvMatND has 1 dimension or more than 2 dimensions). The ``CvMatND`` array must be continuous. - +.. ocv:pyoldfunction:: cv.GetMat(arr, allowND=0) -> mat + + :param arr: Input array + + :param header: Pointer to :ocv:struct:`CvMat` structure used as a temporary buffer + + :param coi: Optional output parameter for storing COI + + :param allowND: If non-zero, the function accepts multi-dimensional dense arrays (CvMatND*) and returns 2D matrix (if CvMatND has two dimensions) or 1D matrix (when CvMatND has 1 dimension or more than 2 dimensions). The ``CvMatND`` array must be continuous. + The function returns a matrix header for the input array that can be a matrix - :ocv:struct:`CvMat`, an image - :ocv:struct:`IplImage`, or a multi-dimensional dense array - :ocv:struct:`CvMatND` (the third option is allowed only if ``allowND != 0``) . In the case of matrix the function simply returns the input pointer. In the case of ``IplImage*`` or ``CvMatND`` it initializes the ``header`` structure with parameters of the current image ROI and returns ``&header``. Because COI is not supported by ``CvMat``, it is returned separately. The function provides an easy way to handle both types of arrays - ``IplImage`` and ``CvMat`` using the same code. Input array must have non-zero data pointer, otherwise the function will report an error. @@ -977,7 +977,7 @@ The function moves iterator to the next sparse matrix element and returns pointe int i, dims = cvGetDims(sparsemat); CvSparseMatIterator it; CvSparseNode* node = cvInitSparseMatIterator(sparsemat, &it); - + for(; node != 0; node = cvGetNextSparseNode(&it)) { /* get pointer to the element indices */ @@ -988,10 +988,10 @@ The function moves iterator to the next sparse matrix element and returns pointe for(i = 0; i < dims; i++ ) printf("[%d]", idx[i]); printf("=%g\n", val); - + sum += val; } - + printf("nTotal sum = %g\n", sum); @@ -1016,10 +1016,10 @@ The following example shows how to get access to array elements. It computes abs float* data; int step; CvSize size; - + cvGetRawData(array, (uchar**)&data, &step, &size); step /= sizeof(data[0]); - + for(int y = 0; y < size.height; y++, data += step ) for(int x = 0; x < size.width; x++ ) data[x] = (float)fabs(data[x]); @@ -1171,19 +1171,19 @@ This function is often used to process raw data with OpenCV matrix functions. Fo double a[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; - + double b[] = { 1, 5, 9, 2, 6, 10, 3, 7, 11, 4, 8, 12 }; - + double c[9]; CvMat Ma, Mb, Mc ; - + cvInitMatHeader(&Ma, 3, 4, CV_64FC1, a); cvInitMatHeader(&Mb, 4, 3, CV_64FC1, b); cvInitMatHeader(&Mc, 3, 3, CV_64FC1, c); - + cvMatMulAdd(&Ma, &Mb, 0, &Mc); // the c array now contains the product of a (3x4) and b (4x3) @@ -1274,13 +1274,13 @@ The functions can be used for sparse arrays as well - if the requested node does All these as well as other functions accessing array elements ( :ocv:cfunc:`GetND` -, +, :ocv:cfunc:`GetRealND` -, +, :ocv:cfunc:`Set` -, +, :ocv:cfunc:`SetND` -, +, :ocv:cfunc:`SetRealND` ) raise an error in case if the element index is out of range. @@ -1293,11 +1293,11 @@ Releases array data. :param arr: Array header -The function releases the array data. In the case of +The function releases the array data. In the case of :ocv:struct:`CvMat` -or +or :ocv:struct:`CvMatND` -it simply calls cvDecRefData(), that is the function can not deallocate external data. See also the note to +it simply calls cvDecRefData(), that is the function can not deallocate external data. See also the note to :ocv:cfunc:`CreateData` . @@ -1404,7 +1404,7 @@ Reshape Changes shape of matrix/image without copying data. .. ocv:cfunction:: CvMat* cvReshape(const CvArr* arr, CvMat* header, int newCn, int newRows=0) -.. ocv:pyoldfunction:: cv.Reshape(arr, newCn, newRows=0) -> cvmat +.. ocv:pyoldfunction:: cv.Reshape(arr, newCn, newRows=0) -> mat :param arr: Input array @@ -1441,7 +1441,7 @@ ReshapeMatND Changes the shape of a multi-dimensional array without copying the data. .. ocv:cfunction:: CvArr* cvReshapeMatND(const CvArr* arr, int sizeofHeader, CvArr* header, int newCn, int newDims, int* newSizes) -.. ocv:pyoldfunction:: cv.ReshapeMatND(arr, newCn, newDims) -> cvmat +.. ocv:pyoldfunction:: cv.ReshapeMatND(arr, newCn, newDims) -> mat :param arr: Input array @@ -1457,18 +1457,18 @@ Changes the shape of a multi-dimensional array without copying the data. The function is an advanced version of :ocv:cfunc:`Reshape` that can work with multi-dimensional arrays as well (though it can work with ordinary images and matrices) and change the number of dimensions. -Below are the two samples from the +Below are the two samples from the :ocv:cfunc:`Reshape` -description rewritten using +description rewritten using :ocv:cfunc:`ReshapeMatND` : :: IplImage* color_img = cvCreateImage(cvSize(320,240), IPL_DEPTH_8U, 3); IplImage gray_img_hdr, *gray_img; gray_img = (IplImage*)cvReshapeND(color_img, &gray_img_hdr, 1, 0, 0); - + ... - + /* second example is modified to convert 2x2x2 array to 8x1 vector */ int size[] = { 2, 2, 2 }; CvMatND* mat = cvCreateMatND(3, size, CV_32F); @@ -1543,7 +1543,7 @@ Assigns user data to the array header. :param step: Full row length in bytes -The function assigns user data to the array header. Header should be initialized before using +The function assigns user data to the array header. Header should be initialized before using :ocv:cfunc:`cvCreateMatHeader`, :ocv:cfunc:`cvCreateImageHeader`, :ocv:cfunc:`cvCreateMatNDHeader`, :ocv:cfunc:`cvInitMatHeader`, :ocv:cfunc:`cvInitImageHeader` or :ocv:cfunc:`cvInitMatNDHeader`. @@ -1617,7 +1617,7 @@ SetZero Clears the array. .. ocv:cfunction:: void cvSetZero(CvArr* arr) -.. ocv:pyoldfunction:: cv.SetZero(arr)-> None +.. ocv:pyoldfunction:: cv.SetZero(arr) -> None :param arr: Array to be cleared @@ -1628,7 +1628,7 @@ mGet Returns the particular element of single-channel floating-point matrix. .. ocv:cfunction:: double cvmGet(const CvMat* mat, int row, int col) -.. ocv:pyoldfunction:: cv.mGet(mat, row, col)-> double +.. ocv:pyoldfunction:: cv.mGet(mat, row, col) -> float :param mat: Input matrix @@ -1667,7 +1667,7 @@ Normally, the function is not called directly. Instead, a simple macro ``CV_TURN ... CV_TURN_ON_IPL_COMPATIBILITY() ... - + RNG --- @@ -1676,8 +1676,8 @@ Initializes a random number generator state. .. ocv:cfunction:: CvRNG cvRNG(int64 seed=-1) .. ocv:pyoldfunction:: cv.RNG(seed=-1LL)-> CvRNG - :param seed: 64-bit value used to initiate a random sequence - + :param seed: 64-bit value used to initiate a random sequence + The function initializes a random number generator and returns the state. The pointer to the state can be then passed to the :ocv:cfunc:`RandInt`, :ocv:cfunc:`RandReal` and :ocv:cfunc:`RandArr` functions. In the current implementation a multiply-with-carry generator is used. .. seealso:: the C++ class :ocv:class:`RNG` replaced ``CvRNG``. @@ -1688,22 +1688,22 @@ RandArr Fills an array with random numbers and updates the RNG state. .. ocv:cfunction:: void cvRandArr( CvRNG* rng, CvArr* arr, int distType, CvScalar param1, CvScalar param2) -.. ocv:pyoldfunction:: cv.RandArr(rng, arr, distType, param1, param2)-> None - - :param rng: CvRNG state initialized by :ocv:cfunc:`RNG` - - :param arr: The destination array - - :param distType: Distribution type - - * **CV_RAND_UNI** uniform distribution - - * **CV_RAND_NORMAL** normal or Gaussian distribution - - :param param1: The first parameter of the distribution. In the case of a uniform distribution it is the inclusive lower boundary of the random numbers range. In the case of a normal distribution it is the mean value of the random numbers. - - :param param2: The second parameter of the distribution. In the case of a uniform distribution it is the exclusive upper boundary of the random numbers range. In the case of a normal distribution it is the standard deviation of the random numbers. - +.. ocv:pyoldfunction:: cv.RandArr(rng, arr, distType, param1, param2)-> None + + :param rng: CvRNG state initialized by :ocv:cfunc:`RNG` + + :param arr: The destination array + + :param distType: Distribution type + + * **CV_RAND_UNI** uniform distribution + + * **CV_RAND_NORMAL** normal or Gaussian distribution + + :param param1: The first parameter of the distribution. In the case of a uniform distribution it is the inclusive lower boundary of the random numbers range. In the case of a normal distribution it is the mean value of the random numbers. + + :param param2: The second parameter of the distribution. In the case of a uniform distribution it is the exclusive upper boundary of the random numbers range. In the case of a normal distribution it is the standard deviation of the random numbers. + The function fills the destination array with uniformly or normally distributed random numbers. .. seealso:: :ocv:func:`randu`, :ocv:func:`randn`, :ocv:func:`RNG::fill`. @@ -1714,9 +1714,9 @@ Returns a 32-bit unsigned integer and updates RNG. .. ocv:cfunction:: unsigned cvRandInt(CvRNG* rng) .. ocv:pyoldfunction:: cv.RandInt(rng)-> unsigned - + :param rng: CvRNG state initialized by :ocv:cfunc:`RNG`. - + The function returns a uniformly-distributed random 32-bit unsigned integer and updates the RNG state. It is similar to the rand() function from the C runtime library, except that OpenCV functions always generates a 32-bit random number, regardless of the platform. @@ -1725,10 +1725,10 @@ RandReal Returns a floating-point random number and updates RNG. .. ocv:cfunction:: double cvRandReal(CvRNG* rng) -.. ocv:pyoldfunction:: cv.RandReal(rng)-> double +.. ocv:pyoldfunction:: cv.RandReal(rng) -> float + + :param rng: RNG state initialized by :ocv:cfunc:`RNG` - :param rng: RNG state initialized by :ocv:cfunc:`RNG` - The function returns a uniformly-distributed random floating-point number between 0 and 1 (1 is not included). @@ -1736,12 +1736,12 @@ fromarray --------- Create a CvMat from an object that supports the array interface. -.. ocv:pyoldfunction:: cv.fromarray(object, allowND=False) -> CvMat - - :param object: Any object that supports the array interface - - :param allowND: If true, will return a CvMatND - +.. ocv:pyoldfunction:: cv.fromarray(array, allowND=False) -> mat + + :param object: Any object that supports the array interface + + :param allowND: If true, will return a CvMatND + If the object supports the `array interface `_ , return a :ocv:struct:`CvMat` or :ocv:struct:`CvMatND`, depending on ``allowND`` flag: @@ -1753,7 +1753,7 @@ return a :ocv:struct:`CvMat` or :ocv:struct:`CvMatND`, depending on ``allowND`` For example, `NumPy `_ arrays support the array interface, so can be converted to OpenCV objects: .. code-block::python - + >>> import cv2.cv as cv, numpy >>> a = numpy.ones((480, 640)) >>> mat = cv.fromarray(a) diff --git a/modules/core/doc/operations_on_arrays.rst b/modules/core/doc/operations_on_arrays.rst index 445d135..7e7979f 100644 --- a/modules/core/doc/operations_on_arrays.rst +++ b/modules/core/doc/operations_on_arrays.rst @@ -11,15 +11,15 @@ Computes an absolute value of each matrix element. .. ocv:function:: MatExpr abs(const MatExpr& src) :param src: Matrix or matrix expression. - + ``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_ >(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`` . .. 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 :param src1: First 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``). - + 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 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 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. 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. .. seealso:: - + :ocv:func:`subtract`, :ocv:func:`addWeighted`, :ocv:func:`scaleAdd`, @@ -158,13 +158,13 @@ Computes the weighted sum of two arrays. :param alpha: Weight for the first array elements. :param src2: Second source array of the same size and channel number as ``src1`` . - + :param beta: Weight for the second array elements. :param dst: Destination array that has the same size and number of channels as the input arrays. - + :param gamma: Scalar added to each sum. - + :param dtype: Optional depth of the destination array. When both input arrays have the same depth, ``dtype`` can be set to ``-1``, which will be equivalent to ``src1.depth()``. 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 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. 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 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. 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. - + 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. - + calcCovarMatrix --------------- @@ -391,7 +391,7 @@ Calculates the covariance matrix of a set of vectors. .. 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} ,...], - + 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: @@ -399,7 +399,7 @@ Calculates the covariance matrix of a set of vectors. .. 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, - + ``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. @@ -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 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 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. @@ -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:pyfunction:: cv2.checkRange(a[, quiet[, minVal[, maxVal]]]) -> retval, pt +.. ocv:pyfunction:: cv2.checkRange(a[, quiet[, minVal[, maxVal]]]) -> retval, pos :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: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 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 cmpop: Flag specifying the relation between the elements to be checked. * **CMP_EQ** ``src1`` equal to ``src2``. * **CMP_GT** ``src1`` greater than ``src2``. * **CMP_GE** ``src1`` greater than or equal to ``src2``. - * **CMP_LT** ``src1`` less than ``src2``. - * **CMP_LE** ``src1`` less than or equal to ``src2``. + * **CMP_LT** ``src1`` less than ``src2``. + * **CMP_LE** ``src1`` less than or equal to ``src2``. * **CMP_NE** ``src1`` not equal to ``src2``. - + The function compares: @@ -535,7 +535,7 @@ The function compares: \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: :: 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:`i > j` if ``lowerToUpper=false`` - + * :math:`\texttt{mtx}_{ij}=\texttt{mtx}_{ji}` for :math:`i < j` if ``lowerToUpper=true`` - + .. seealso:: :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) :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 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:func:`extractImageCOI`, :ocv:func:`insertImageCOI`, - :ocv:func:`mixChannels` + :ocv:func:`mixChannels` 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 dst: Destination array of the same size and type as ``src`` . - + :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. @@ -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 ) and - + :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. .. note:: - + 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 @@ -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 dst: Destination array whose size and type depends on the ``flags`` . - + :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_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_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 :math:`F^{(N)}_{jk}=\exp(-2\pi i j k/N)` and :math:`i=\sqrt{-1}` - + * Inverse the Fourier transform of a 1D vector of ``N`` elements: @@ -863,7 +863,7 @@ The function performs one of the following: where :math:`F^*=\left(\textrm{Re}(F^{(N)})-\textrm{Im}(F^{(N)})\right)^T` -* +* Forward the 2D Fourier transform of a ``M x N`` matrix: .. 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: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 src2: Second source array of the same size and type as ``src1`` . - + :param scale: Scalar factor. :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()``. - + The functions ``divide`` divide one array by another: .. math:: @@ -1022,7 +1022,7 @@ Returns the determinant of a square floating-point matrix. .. ocv:pyfunction:: cv2.determinant(mtx) -> retval .. 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. @@ -1043,21 +1043,20 @@ For symmetric positively-determined matrices, it is also possible to use :ocv:fu 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, OutputArray eigenvectors, 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:pyfunction:: cv2.eigen(src, computeEigenvectors[, eigenvalues[, eigenvectors]]) -> retval, eigenvalues, eigenvectors - Computes eigenvalues and eigenvectors of a symmetric matrix. +.. ocv:cfunction:: void cvEigenVV( CvArr* src, CvArr* eigenvectors, CvArr* eigenvalues, double eps=0, int lowindex=-1, int highindex=-1) -.. ocv:pyfunction:: cv2.eigen(src, computeEigenvectors[, eigenvalues[, eigenvectors[, lowindex[, highindex]]]]) -> retval, eigenvalues, eigenvectors +.. ocv:pyoldfunction:: cv.EigenVV(mat, evects, evals, eps, lowindex=-1, highindex=-1)-> None :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 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) :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 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. @@ -1170,7 +1169,7 @@ Flips a 2D array around vertical, horizontal, or both axes. :param src: Source array. :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. 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 src2: Second multiplied input matrix of the same type as ``src1`` . - + :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 beta: Weight of ``src3`` . - + :param dst: Destination matrix. It has the proper size and the same type as input matrices. :param flags: Operation flags: @@ -1232,7 +1231,7 @@ Performs generalized matrix multiplication. * **GEMM_1_T** transpose ``src1`` * **GEMM_2_T** transpose ``src2`` * **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 .. 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 dst: Destination array of the same size and type as ``src`` . - + :param flags: Operation flags. - + ``idct(src, dst, flags)`` is equivalent to ``dct(src, dst, flags | DCT_INVERSE)``. .. 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 dst: Destination array whose size and type depend on the ``flags`` . - + :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. - + ``idft(src, dst, flags)`` is equivalent to ``dft(src, dst, flags | DFT_INVERSE)`` . 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 lowerb: Inclusive lower 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. 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: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 dst: Destination matrix of ``N x M`` size and the same type as ``src`` . - + :param flags: Inversion method : * **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 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: .. 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 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: .. math:: @@ -1530,9 +1529,9 @@ Calculates the magnitude of 2D 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 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: .. 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:pyoldfunction:: cv.Mahalanobis(vec1, vec2, icovar)-> None +.. ocv:pyoldfunction:: cv.Mahalonobis(vec1, vec2, mat) -> None :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 src2: Second source array of the same size and type as ``src1`` . - + :param value: Real scalar value. :param dst: Destination array of the same size and type as ``src1`` . - + The functions ``max`` compute the per-element maximum of two arrays: .. math:: @@ -1644,7 +1643,7 @@ Calculates an average (mean) of array elements. .. ocv:pyfunction:: cv2.mean(src[, mask]) -> retval .. 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_` . @@ -1676,7 +1675,7 @@ Calculates a mean and standard deviation of array elements. .. 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: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. @@ -1765,11 +1764,11 @@ Calculates per-element minimum of two arrays or array and a scalar. :param src1: First source array. :param src2: Second source array of the same size and type as ``src1`` . - + :param value: Real scalar value. :param dst: Destination array of the same size and type as ``src1`` . - + The functions ``min`` compute the per-element minimum of two arrays: .. 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 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. - + .. 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)``). :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 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:`mixChannels`, :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 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 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 npairs: Number of index pairs in ``fromTo``. - + The functions ``mixChannels`` provide an advanced mechanism for shuffling image channels. - + :ocv:func:`split` and :ocv:func:`merge` and some forms of :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 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 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). @@ -1970,14 +1969,14 @@ Calculates the per-element scaled product of two arrays. .. 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:pyoldfunction:: cv.Mul(src1, src2, dst, scale)-> None +.. ocv:pyoldfunction:: cv.Mul(src1, src2, dst, scale=1) -> None :param src1: First source array. :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 scale: Optional scale factor. 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: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. @@ -2032,7 +2031,7 @@ Calculates the product of a matrix and its transposition. :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`` . - + The function ``mulTransposed`` calculates the product of ``src`` and its transposition: .. 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: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 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 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 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 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 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. @@ -2279,7 +2278,7 @@ Projects vector(s) to the principal component subspace. .. 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. @@ -2297,7 +2296,7 @@ Reconstructs vectors from their PC projections. .. 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. @@ -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 dst: Destination array of the same size and type as ``src`` . - + :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: @@ -2366,10 +2365,10 @@ Calculates the rotation angle 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 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`` : @@ -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 :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 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 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`` : @@ -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 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 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)``. 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: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:pyfunction:: cv2.randShuffle(src[, dst[, iterFactor]]) -> dst +.. ocv:pyfunction:: cv2.randShuffle(dst[, iterFactor]) -> None :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. :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. .. 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 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 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 } The second variant of the function is more convenient to use with -:ref:`MatrixExpressions` . +:ref:`MatrixExpressions` . .. seealso:: @@ -2779,9 +2778,9 @@ Calculates the sum of a scaled array and another array. :param scale: Scale factor for the first array. :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`` . - + The function ``scaleAdd`` is one of the classical primitive linear algebra operations, known as ``DAXPY`` or ``SAXPY`` in `BLAS `_. It calculates the sum of a scaled array and another array: .. 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_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`` ): .. math:: @@ -2960,7 +2959,7 @@ Sorts each row or each column of a matrix. :param src: Source single-channel array. :param dst: Destination array of the same size and type as ``src`` . - + :param flags: Operation flags, a combination of the following values: * **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 dst: Destination integer array of the same size as ``src`` . - + :param flags: Operation flags that could be a combination of the following values: * **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& 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: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 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`` . .. 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 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.SubRS(src1, src2, dst, mask=None)-> None -.. ocv:pyoldfunction:: cv.SubS(src1, src2, dst, mask=None)-> None +.. ocv:pyoldfunction:: cv.Sub(src1, src2, dst, mask=None) -> None +.. ocv:pyoldfunction:: cv.SubRS(src, value, dst, mask=None) -> None +.. ocv:pyoldfunction:: cv.SubS(src, value, dst, mask=None) -> None :param src1: First 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 dtype: Optional depth of the output array. See the details below. The function ``subtract`` computes: @@ -3124,10 +3123,10 @@ The function ``subtract`` computes: .. math:: \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``: - + .. math:: \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: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 w: Computed singular values - + :param u: Computed left singular vectors - + :param v: Computed right singular vectors - + :param vt: Transposed matrix of right singular values - + :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. :: Mat A, w, u, vt; SVD::compute(A, w, u, vt); - + SVD::solveZ ----------- @@ -3254,7 +3253,7 @@ Solves an under-determined singular linear system. :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: .. 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: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 u: Left singular vectors - + :param v: 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 dst: Found solution of the system. 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} -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. @@ -3306,10 +3305,10 @@ Calculates the sum of array elements. .. 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:pyoldfunction:: cv.Sum(arr)-> CvScalar +.. ocv:pyoldfunction:: cv.Sum(arr) -> scalar :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:pyfunction:: cv2.trace(mat) -> retval +.. ocv:pyfunction:: cv2.trace(mtx) -> retval .. ocv:cfunction:: CvScalar cvTrace(const CvArr* mat) -.. ocv:pyoldfunction:: cv.Trace(mat)-> CvScalar +.. ocv:pyoldfunction:: cv.Trace(mat) -> scalar :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: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: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 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 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`` : @@ -3430,7 +3429,7 @@ Transposes a matrix. :param src: Source array. :param dst: Destination array of the same type as ``src`` . - + The function :ocv:func:`transpose` transposes the matrix ``src`` : .. math:: diff --git a/modules/core/doc/utility_and_system_functions_and_macros.rst b/modules/core/doc/utility_and_system_functions_and_macros.rst index 5751e09..0835f24 100644 --- a/modules/core/doc/utility_and_system_functions_and_macros.rst +++ b/modules/core/doc/utility_and_system_functions_and_macros.rst @@ -95,7 +95,7 @@ Computes the cube root of an argument. .. ocv:cfunction:: float cvCbrt(float val) -.. ocv:pyoldfunction:: cv.Cbrt(val)-> float +.. ocv:pyoldfunction:: cv.Cbrt(value)-> float :param val: A function argument. @@ -151,7 +151,7 @@ Determines if the argument is Infinity. .. ocv:cfunction:: int cvIsInf(double value) .. 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. @@ -162,7 +162,7 @@ Determines if the argument is Not A Number. .. ocv:cfunction:: int cvIsNaN(double value) .. 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. @@ -186,8 +186,8 @@ Signals an error and raises an exception. :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 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 --------- -.. ocv:class:: Exception +.. ocv:class:: Exception : public std::exception Exception class passed to an error. :: @@ -261,7 +261,7 @@ Deallocates a memory buffer. .. ocv:cfunction:: void cvFree( void** pptr ) :param ptr: 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. @@ -286,10 +286,10 @@ Returns true if the specified feature is supported by the host hardware. .. ocv:function:: bool checkHardwareSupport(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: - + * ``CV_CPU_MMX`` - MMX * ``CV_CPU_SSE`` - SSE * ``CV_CPU_SSE2`` - SSE 2 @@ -312,7 +312,7 @@ The function returns the number of threads that is used by OpenCV. .. seealso:: :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:: :ocv:func:`getNumThreads`, - :ocv:func:`getThreadNum` + :ocv:func:`getThreadNum` diff --git a/modules/features2d/doc/common_interfaces_of_descriptor_extractors.rst b/modules/features2d/doc/common_interfaces_of_descriptor_extractors.rst index cf250d2..8f624ae 100644 --- a/modules/features2d/doc/common_interfaces_of_descriptor_extractors.rst +++ b/modules/features2d/doc/common_interfaces_of_descriptor_extractors.rst @@ -13,7 +13,7 @@ descriptor extractors inherit the DescriptorExtractor ------------------- -.. ocv:class:: DescriptorExtractor +.. ocv:class:: DescriptorExtractor : public Algorithm Abstract base class for computing descriptors for image keypoints. :: @@ -107,7 +107,7 @@ for example: ``"OpponentSIFT"`` . OpponentColorDescriptorExtractor -------------------------------- -.. ocv:class:: OpponentColorDescriptorExtractor +.. ocv:class:: OpponentColorDescriptorExtractor : public DescriptorExtractor 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*). @@ -132,7 +132,7 @@ them into a single color descriptor. :: BriefDescriptorExtractor ------------------------ -.. ocv:class:: BriefDescriptorExtractor +.. ocv:class:: BriefDescriptorExtractor : public DescriptorExtractor Class for computing BRIEF descriptors described in a paper of Calonder M., Lepetit V., Strecha C., Fua P. *BRIEF: Binary Robust Independent Elementary Features* , diff --git a/modules/features2d/doc/common_interfaces_of_descriptor_matchers.rst b/modules/features2d/doc/common_interfaces_of_descriptor_matchers.rst index e55a617..2ddd986 100644 --- a/modules/features2d/doc/common_interfaces_of_descriptor_matchers.rst +++ b/modules/features2d/doc/common_interfaces_of_descriptor_matchers.rst @@ -11,7 +11,7 @@ descriptor matchers inherit the DMatch ------ -.. ocv:class:: DMatch +.. ocv:struct:: DMatch Class for matching keypoint descriptors: query descriptor index, 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 ----------------- -.. ocv:class:: DescriptorMatcher +.. ocv:class:: DescriptorMatcher : public Algorithm Abstract base class for matching keypoint descriptors. It has two groups 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& 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]``. -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(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(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. -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 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. @@ -227,7 +227,7 @@ DescriptorMatcher::clone ---------------------------- Clones the matcher. -.. ocv:function:: Ptr DescriptorMatcher::clone( bool emptyTrainData ) const +.. ocv:function:: Ptr 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. @@ -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: - * + * ``BruteForce`` (it uses ``L2`` ) - * + * ``BruteForce-L1`` - * + * ``BruteForce-Hamming`` - * + * ``BruteForce-Hamming(2)`` - * + * ``FlannBased`` @@ -258,7 +258,7 @@ Creates a descriptor matcher of a given type with the default parameters (using 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. :: @@ -267,16 +267,16 @@ BFMatcher::BFMatcher -------------------- 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 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 ----------------- -.. 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. :: diff --git a/modules/features2d/doc/common_interfaces_of_feature_detectors.rst b/modules/features2d/doc/common_interfaces_of_feature_detectors.rst index 62af451..0449887 100644 --- a/modules/features2d/doc/common_interfaces_of_feature_detectors.rst +++ b/modules/features2d/doc/common_interfaces_of_feature_detectors.rst @@ -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:pyfunction:: cv2.KeyPoint(x, y, _size[, _angle[, _response[, _octave[, _class_id]]]]) -> +.. ocv:pyfunction:: cv2.KeyPoint([x, y, _size[, _angle[, _response[, _octave[, _class_id]]]]]) -> :param x: x-coordinate of the keypoint @@ -69,7 +69,7 @@ The keypoint constructors FeatureDetector --------------- -.. ocv:class:: FeatureDetector +.. ocv:class:: FeatureDetector : public Algorithm Abstract base class for 2D image feature detectors. :: @@ -156,7 +156,7 @@ for example: ``"GridFAST"``, ``"PyramidSTAR"`` . FastFeatureDetector ------------------- -.. ocv:class:: FastFeatureDetector +.. ocv:class:: FastFeatureDetector : public FeatureDetector Wrapping class for feature detection using the :ocv:func:`FAST` method. :: @@ -252,7 +252,7 @@ Wrapping class for feature detection using the DenseFeatureDetector -------------------- -.. ocv:class:: DenseFeatureDetector +.. ocv:class:: DenseFeatureDetector : public FeatureDetector 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 ------------------- -.. ocv:class:: SimpleBlobDetector +.. ocv:class:: SimpleBlobDetector : public FeatureDetector Class for extracting blobs from an image. :: @@ -344,7 +344,7 @@ Default values of parameters are tuned to extract dark circular blobs. 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. :: @@ -369,7 +369,7 @@ Class adapting a detector to partition the source image into a grid and detect p 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. :: @@ -387,7 +387,7 @@ Class adapting a detector to detect points over multiple levels of a Gaussian py DynamicAdaptedFeatureDetector ----------------------------- -.. ocv:class:: DynamicAdaptedFeatureDetector +.. ocv:class:: DynamicAdaptedFeatureDetector : public FeatureDetector Adaptively adjusting detector that iteratively detects features until the desired number is found. :: @@ -431,7 +431,7 @@ DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector ---------------------------------------------------------------- The constructor -.. ocv:function:: DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector( const Ptr& adjuster, int min_features, int max_features, int max_iters ) +.. ocv:function:: DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector( const Ptr& adjaster, int min_features=400, int max_features=500, int max_iters=5 ) :param adjuster: :ocv:class:`AdjusterAdapter` that detects features and adjusts parameters. @@ -443,7 +443,7 @@ The constructor 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. :: @@ -522,7 +522,7 @@ Creates an adjuster adapter by name 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. :: @@ -535,7 +535,7 @@ FastAdjuster StarAdjuster ------------ -.. ocv:class:: StarAdjuster +.. ocv:class:: StarAdjuster : public AdjusterAdapter :ocv:class:`AdjusterAdapter` for :ocv:class:`StarFeatureDetector`. This class adjusts the ``responseThreshhold`` of ``StarFeatureDetector``. :: diff --git a/modules/features2d/doc/common_interfaces_of_generic_descriptor_matchers.rst b/modules/features2d/doc/common_interfaces_of_generic_descriptor_matchers.rst index ad791cc..a306c66 100644 --- a/modules/features2d/doc/common_interfaces_of_generic_descriptor_matchers.rst +++ b/modules/features2d/doc/common_interfaces_of_generic_descriptor_matchers.rst @@ -3,7 +3,7 @@ Common Interfaces of Generic Descriptor Matchers .. 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 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 @@ -130,7 +130,7 @@ GenericDescriptorMatcher::isMaskSupported --------------------------------------------- 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. 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: - + #. 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. @@ -195,7 +195,7 @@ Finds the ``k`` best matches for each query keypoint. .. ocv:function:: void GenericDescriptorMatcher::knnMatch( const Mat& queryImage, vector& queryKeypoints, const Mat& trainImage, vector& trainKeypoints, vector >& matches, int k, const Mat& mask=Mat(), bool compactResult=false ) const .. ocv:function:: void GenericDescriptorMatcher::knnMatch( const Mat& queryImage, vector& queryKeypoints, vector >& matches, int k, const vector& masks=vector(), 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. @@ -231,7 +231,7 @@ GenericDescriptorMatcher::clone ----------------------------------- Clones the matcher. -.. ocv:function:: Ptr GenericDescriptorMatcher::clone( bool emptyTrainData ) const +.. ocv:function:: Ptr GenericDescriptorMatcher::clone( bool emptyTrainData=false ) const :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 @@ -240,7 +240,7 @@ Clones the matcher. 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. :: diff --git a/modules/features2d/doc/drawing_function_of_keypoints_and_matches.rst b/modules/features2d/doc/drawing_function_of_keypoints_and_matches.rst index 8a5a1cb..5e360d9 100644 --- a/modules/features2d/doc/drawing_function_of_keypoints_and_matches.rst +++ b/modules/features2d/doc/drawing_function_of_keypoints_and_matches.rst @@ -7,9 +7,9 @@ drawMatches --------------- Draws the found matches of keypoints from two images. -.. ocv:function:: void drawMatches( const Mat& img1, const vector& keypoints1, const Mat& img2, const vector& keypoints2, const vector& matches1to2, Mat& outImg, const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1), const vector& matchesMask=vector(), int flags=DrawMatchesFlags::DEFAULT ) +.. ocv:function:: void drawMatches( const Mat& img1, const vector& keypoints1, const Mat& img2, const vector& keypoints2, const vector& matches1to2, Mat& outImg, const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1), const vector& matchesMask=vector(), int flags=DrawMatchesFlags::DEFAULT ) -.. ocv:function:: void drawMatches( const Mat& img1, const vector& keypoints1, const Mat& img2, const vector& keypoints2, const vector >& matches1to2, Mat& outImg, const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1), const vector>& matchesMask= vector >(), int flags=DrawMatchesFlags::DEFAULT ) +.. ocv:function:: void drawMatches( const Mat& img1, const vector& keypoints1, const Mat& img2, const vector& keypoints2, const vector >& matches1to2, Mat& outImg, const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1), const vector >& matchesMask=vector >(), int flags=DrawMatchesFlags::DEFAULT ) :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 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: .. code-block:: cpp @@ -65,7 +65,7 @@ drawKeypoints ----------------- Draws keypoints. -.. ocv:function:: void drawKeypoints( const Mat& image, const vector& keypoints, Mat& outImg, const Scalar& color=Scalar::all(-1), int flags=DrawMatchesFlags::DEFAULT ) +.. ocv:function:: void drawKeypoints( const Mat& image, const vector& keypoints, Mat& outImage, const Scalar& color=Scalar::all(-1), int flags=DrawMatchesFlags::DEFAULT ) :param image: Source image. diff --git a/modules/features2d/doc/feature_detection_and_description.rst b/modules/features2d/doc/feature_detection_and_description.rst index 3994a6c..b5d1b93 100644 --- a/modules/features2d/doc/feature_detection_and_description.rst +++ b/modules/features2d/doc/feature_detection_and_description.rst @@ -24,7 +24,7 @@ Detects corners using the FAST algorithm by [Rosten06]_. MSER ---- -.. ocv:class:: MSER +.. ocv:class:: MSER : public FeatureDetector Maximally stable extremal region extractor. :: @@ -50,7 +50,7 @@ http://en.wikipedia.org/wiki/Maximally_stable_extremal_regions). Also see http:/ 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). @@ -60,39 +60,37 @@ ORB::ORB -------- 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) :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 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 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 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. ORB::operator() --------------- Finds keypoints in an image and computes their descriptors - + .. ocv:function:: void ORB::operator()(InputArray image, InputArray mask, vector& keypoints, OutputArray descriptors, bool useProvidedKeypoints=false ) const :param image: The input 8-bit grayscale image. - + :param mask: The operation mask. - + :param keypoints: The output vector of keypoints. - + :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. diff --git a/modules/features2d/doc/object_categorization.rst b/modules/features2d/doc/object_categorization.rst index d952092..d7b34af 100644 --- a/modules/features2d/doc/object_categorization.rst +++ b/modules/features2d/doc/object_categorization.rst @@ -54,7 +54,7 @@ BOWTrainer::descripotorsCount --------------------------------- Returns the count of all descriptors stored in the training set. -.. ocv:function:: const vector& 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 ---------------- -.. ocv:class:: BOWKMeansTrainer +.. ocv:class:: BOWKMeansTrainer : public BOWTrainer :ocv:func:`kmeans` -based class to train visual vocabulary using the *bag of visual words* approach. :: diff --git a/modules/features2d/include/opencv2/features2d/features2d.hpp b/modules/features2d/include/opencv2/features2d/features2d.hpp index 0e01810..52165e1 100644 --- a/modules/features2d/include/opencv2/features2d/features2d.hpp +++ b/modules/features2d/include/opencv2/features2d/features2d.hpp @@ -276,7 +276,7 @@ public: enum { kBytes = 32, HARRIS_SCORE=0, FAST_SCORE=1 }; 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 int descriptorSize() const; @@ -1158,9 +1158,9 @@ public: const vector& masks=vector(), bool compactResult=false ); // 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 - 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) virtual bool empty() const; diff --git a/modules/gpu/doc/data_structures.rst b/modules/gpu/doc/data_structures.rst index 3021890..3152c51 100644 --- a/modules/gpu/doc/data_structures.rst +++ b/modules/gpu/doc/data_structures.rst @@ -338,7 +338,7 @@ Blocks the current CPU thread until all operations in the stream are complete. 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. :: diff --git a/modules/gpu/doc/image_processing.rst b/modules/gpu/doc/image_processing.rst index 7795d0d..401280d 100644 --- a/modules/gpu/doc/image_processing.rst +++ b/modules/gpu/doc/image_processing.rst @@ -238,7 +238,7 @@ The source matrix should be continuous, otherwise reallocation and data copying 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. :: @@ -290,7 +290,7 @@ Computes a convolution (or cross-correlation) of two images. 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. :: diff --git a/modules/gpu/doc/object_detection.rst b/modules/gpu/doc/object_detection.rst index 163039a..9d38939 100644 --- a/modules/gpu/doc/object_detection.rst +++ b/modules/gpu/doc/object_detection.rst @@ -7,7 +7,7 @@ Object Detection gpu::HOGDescriptor ------------------ -.. ocv:class:: gpu::HOGDescriptor +.. ocv:struct:: gpu::HOGDescriptor The class implements Histogram of Oriented Gradients ([Dalal2005]_) object detector. :: diff --git a/modules/gpu/doc/video.rst b/modules/gpu/doc/video.rst index 944fbc3..b5919dc 100644 --- a/modules/gpu/doc/video.rst +++ b/modules/gpu/doc/video.rst @@ -377,7 +377,7 @@ The method write the specified image to video file. The image must have the same gpu::VideoWriter_GPU::EncoderParams ----------------------------------- -.. ocv:class:: gpu::VideoWriter_GPU::EncoderParams +.. ocv:struct:: gpu::VideoWriter_GPU::EncoderParams Different parameters for CUDA video encoder. :: @@ -561,7 +561,7 @@ Chroma formats supported by ocv:class:`gpu::VideoReader_GPU` . :: gpu::VideoReader_GPU::FormatInfo -------------------------------- -.. ocv:class:: gpu::VideoReader_GPU::FormatInfo +.. ocv:struct:: gpu::VideoReader_GPU::FormatInfo Struct providing information about video file format. :: diff --git a/modules/highgui/doc/qt_new_functions.rst b/modules/highgui/doc/qt_new_functions.rst index 7d27353..929f320 100644 --- a/modules/highgui/doc/qt_new_functions.rst +++ b/modules/highgui/doc/qt_new_functions.rst @@ -61,35 +61,35 @@ setWindowProperty --------------------- 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: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 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_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`` ). - + :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_AUTOSIZE** Constrain the size by the displayed image. The window is not resizable. - + * **CV_WINDOW_FULLSCREEN** Change the window to fullscreen. - + * **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. - + The function ``setWindowProperty`` enables changing properties of a window. @@ -97,22 +97,22 @@ getWindowProperty --------------------- 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: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 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_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`` ). - + See :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 weight: Font weight. The following operation flags are available: - + * **CV_FONT_LIGHT** Weight of 25 - + * **CV_FONT_NORMAL** Weight of 50 - + * **CV_FONT_DEMIBOLD** Weight of 63 - + * **CV_FONT_BOLD** Weight of 75 - + * **CV_FONT_BLACK** Weight of 87 You can also specify a positive integer for better control. :param style: Font style. The following operation flags are available: - + * **CV_STYLE_NORMAL** Normal font - + * **CV_STYLE_ITALIC** Italic font - + * **CV_STYLE_OBLIQUE** Oblique font - + :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`` . @@ -169,9 +169,9 @@ addText ----------- 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. @@ -193,9 +193,9 @@ using a specific font 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) @@ -212,7 +212,7 @@ displayStatusBar -------------------- 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) @@ -282,7 +282,7 @@ saveWindowParameters ------------------------ 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) @@ -295,7 +295,7 @@ loadWindowParameters ------------------------ 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) @@ -308,9 +308,9 @@ createButton ---------------- 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. diff --git a/modules/highgui/doc/reading_and_writing_images_and_video.rst b/modules/highgui/doc/reading_and_writing_images_and_video.rst index 0d70b05..3e4acf3 100644 --- a/modules/highgui/doc/reading_and_writing_images_and_video.rst +++ b/modules/highgui/doc/reading_and_writing_images_and_video.rst @@ -18,7 +18,7 @@ Reads an image from a buffer in memory. :param buf: Input array or vector of bytes. :param flags: The same flags as in :ocv:func:`imread` . - + 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. @@ -31,9 +31,9 @@ Encodes an image into a memory buffer. .. ocv:function:: bool imencode( const string& ext, InputArray img, vector& buf, const vector& params=vector()) -.. 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. @@ -57,13 +57,13 @@ Loads an image from a file. .. 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. @@ -103,11 +103,11 @@ imwrite ----------- Saves an image to a specified file. -.. ocv:function:: bool imwrite( const string& filename, InputArray image, const vector& params=vector()) +.. ocv:function:: bool imwrite( const string& filename, InputArray img, const vector& params=vector() ) -.. 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 @@ -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. 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 #include #include - + using namespace cv; using namespace std; @@ -225,7 +225,7 @@ VideoCapture constructors. .. ocv:pyfunction:: cv2.VideoCapture(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: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(int device) -.. ocv:pyfunction:: cv2.VideoCapture.open(filename) -> successFlag -.. ocv:pyfunction:: cv2.VideoCapture.open(device) -> successFlag +.. ocv:pyfunction:: cv2.VideoCapture.open(filename) -> retval +.. ocv:pyfunction:: cv2.VideoCapture.open(device) -> retval :param filename: name of the opened video file :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 @@ -259,7 +259,7 @@ Returns true if video capturing has been initialized already. .. 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. @@ -269,7 +269,7 @@ Closes video file or capturing device. .. ocv:function:: void VideoCapture::release() -.. ocv:pyfunction:: cv2.VideoCapture.release() +.. ocv:pyfunction:: cv2.VideoCapture.release() -> None .. 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:pyfunction:: cv2.VideoCapture.grab() -> successFlag +.. ocv:pyfunction:: cv2.VideoCapture.grab() -> retval .. 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: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. @@ -322,11 +322,11 @@ Grabs, decodes and returns the next video frame. .. 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: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. @@ -335,15 +335,15 @@ The methods/functions combine :ocv:func:`VideoCapture::grab` and :ocv:func:`Vide VideoCapture::get --------------------- -Returns the specified ``VideoCapture`` property +Returns the specified ``VideoCapture`` property .. ocv:function:: double VideoCapture::get(int propId) .. 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: @@ -393,13 +393,13 @@ VideoCapture::set --------------------- 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: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: @@ -463,22 +463,22 @@ VideoWriter constructors .. ocv:pyfunction:: cv2.VideoWriter([filename, fourcc, fps, frameSize[, isColor]]) -> -.. ocv:cfunction:: CvVideoWriter* cvCreateVideoWriter( const char* filename, int fourcc, double fps, CvSize frameSize, int isColor=1 ) -.. ocv:pyoldfunction:: cv.CreateVideoWriter(filename, fourcc, fps, frameSize, isColor) -> CvVideoWriter +.. 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, frame_size, is_color=true) -> CvVideoWriter .. ocv:pyfunction:: cv2.VideoWriter.isOpened() -> retval .. ocv:pyfunction:: cv2.VideoWriter.open(filename, fourcc, fps, frameSize[, isColor]) -> retval .. 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 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. @@ -526,9 +526,9 @@ Writes the next video frame .. ocv:cfunction:: int cvWriteFrame( CvVideoWriter* writer, const IplImage* image ) .. ocv:pyoldfunction:: cv.WriteFrame(writer, image)->int - :param writer: Video writer structure (OpenCV 1.x API) - - :param image: The written frame - + :param writer: Video writer structure (OpenCV 1.x API) + + :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. diff --git a/modules/highgui/doc/user_interface.rst b/modules/highgui/doc/user_interface.rst index 29066e5..bad9244 100644 --- a/modules/highgui/doc/user_interface.rst +++ b/modules/highgui/doc/user_interface.rst @@ -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: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 :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``. .. note:: - + **[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. @@ -40,8 +40,8 @@ Returns the trackbar position. .. ocv:pyfunction:: cv2.getTrackbarPos(trackbarname, winname) -> retval -.. ocv:cfunction:: int cvGetTrackbarPos( const char* trackbarName, const char* windowName ) -.. ocv:pyoldfunction:: cv.GetTrackbarPos(trackbarName, windowName)-> None +.. ocv:cfunction:: int cvGetTrackbarPos( const char* trackbar_name, const char* window_name ) +.. ocv:pyoldfunction:: cv.GetTrackbarPos(trackbarName, windowName) -> retval :param trackbarname: Name of the trackbar. @@ -57,12 +57,12 @@ imshow ---------- 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:pyoldfunction:: cv.ShowImage(winname, image)-> None +.. ocv:cfunction:: void cvShowImage( const char* name, const CvArr* image ) +.. ocv:pyoldfunction:: cv.ShowImage(name, image) -> None :param winname: Name of the window. @@ -81,11 +81,11 @@ namedWindow --------------- 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: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 :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. -.. ocv:function:: void destroyWindow( const string &winname ) - +.. ocv:function:: void destroyWindow( const string& winname ) + .. ocv:pyfunction:: cv2.destroyWindow(winname) -> None .. ocv:cfunction:: void cvDestroyWindow( const char* name ) .. 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. @@ -149,9 +149,9 @@ Moves window to the specified position .. ocv:pyoldfunction:: cv.MoveWindow(name, x, y)-> None :param name: Window name - + :param x: The new x-coordinate of the window - + :param y: The new y-coordinate of the window @@ -171,7 +171,7 @@ Resizes window to the specified size .. note:: * The specified window size is for the image area. Toolbars are not counted. - + * Only windows created without CV_WINDOW_AUTOSIZE flag can be resized. @@ -179,13 +179,13 @@ SetMouseCallback ---------------- Sets mouse handler for the specified window -.. ocv:cfunction:: void cvSetMouseCallback( const char* name, CvMouseCallback onMouse, void* param=NULL ) -.. ocv:pyoldfunction:: cv.SetMouseCallback(name, onMouse, param) -> None +.. ocv:cfunction:: void cvSetMouseCallback( const char* window_name, CvMouseCallback on_mouse, void* param=NULL ) +.. ocv:pyoldfunction:: cv.SetMouseCallback(windowName, onMouse, param=None) -> None :param name: Window name - + :param 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. @@ -197,7 +197,7 @@ Sets the trackbar position. .. 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 :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. .. note:: - + **[Qt Backend Only]** ``winname`` can be empty (or NULL) if the trackbar is attached to the control panel. waitKey @@ -218,7 +218,7 @@ Waits for a pressed key. .. 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: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. .. 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. diff --git a/modules/imgproc/doc/feature_detection.rst b/modules/imgproc/doc/feature_detection.rst index 4e6b9fd..449a83e 100644 --- a/modules/imgproc/doc/feature_detection.rst +++ b/modules/imgproc/doc/feature_detection.rst @@ -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:cfunction:: void cvCanny( const CvArr* image, CvArr* edges, double threshold1, double threshold2, int apertureSize=3 ) -.. ocv:pyoldfunction:: cv.Canny(image, edges, threshold1, threshold2, apertureSize=3)-> None +.. 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, aperture_size=3) -> None :param image: Single-channel 8-bit input image. @@ -37,17 +38,18 @@ cornerEigenValsAndVecs ---------------------- 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:cfunction:: void cvCornerEigenValsAndVecs( const CvArr* image, CvArr* eigenvv, int blockSize, int apertureSize=3 ) -.. ocv:pyoldfunction:: cv.CornerEigenValsAndVecs(image, eigenvv, blockSize, apertureSize=3)-> None +.. ocv:cfunction:: void cvCornerEigenValsAndVecs( const CvArr* image, CvArr* eigenvv, int block_size, int aperture_size=3 ) + +.. ocv:pyoldfunction:: cv.CornerEigenValsAndVecs(image, eigenvv, blockSize, aperture_size=3) -> None :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 blockSize: Neighborhood size (see details below). :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:`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` The output of the function can be used for robust edge or corner detection. @@ -89,17 +91,18 @@ cornerHarris ------------ 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:cfunction:: void cvCornerHarris( const CvArr* image, CvArr* harrisDst, int blockSize, int apertureSize=3, double k=0.04 ) -.. ocv:pyoldfunction:: cv.CornerHarris(image, harrisDst, blockSize, apertureSize=3, k=0.04)-> None +.. 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, harris_dst, blockSize, aperture_size=3, k=0.04) -> None :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 blockSize: Neighborhood size (see the details on :ocv:func:`cornerEigenValsAndVecs` ). :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. -.. 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: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 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 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: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. @@ -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: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 eigImage: The parameter is ignored. - + :param tempImage: The parameter is ignored. :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 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 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]_: @@ -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 :ocv:func:`cornerMinEigenVal` or :ocv:func:`cornerHarris` . - + #. 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``. - + 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`` . .. seealso:: - :ocv:func:`cornerMinEigenVal`, - :ocv:func:`cornerHarris`, - :ocv:func:`calcOpticalFlowPyrLK`, + :ocv:func:`cornerMinEigenVal`, + :ocv:func:`cornerHarris`, + :ocv:func:`calcOpticalFlowPyrLK`, :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: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 :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 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 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. -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: :: @@ -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: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 @@ -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 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: - - * **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. - + + :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_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``. - + :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 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 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. @@ -501,21 +504,22 @@ preCornerDetect --------------- 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: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 :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 apertureSize: Aperture size of the :ocv:func:`Sobel` . - + :param borderType: Pixel extrapolation method. See :ocv:func:`borderInterpolate` . - + The function calculates the complex spatial derivative-based function of the source image .. math:: diff --git a/modules/imgproc/doc/filtering.rst b/modules/imgproc/doc/filtering.rst index 7d23e15..5a79ac0 100644 --- a/modules/imgproc/doc/filtering.rst +++ b/modules/imgproc/doc/filtering.rst @@ -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 '|' - + * BORDER_REPLICATE: aaaaaa|abcdefgh|hhhhhhh * BORDER_REFLECT: fedcba|abcdefgh|hgfedcb * 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' */ @@ -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 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 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`` . @@ -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 dst: Destination image of the same size and type as ``src`` . - + :param ksize: Smoothing kernel size. :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:`bilateralFilter`, :ocv:func:`GaussianBlur`, - :ocv:func:`medianBlur` + :ocv:func:`medianBlur` borderInterpolate @@ -453,7 +453,7 @@ Computes the source location of an extrapolated pixel. .. 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 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`` . @@ -486,7 +486,7 @@ Smoothes an image using the box filter. :param src: Source image. :param dst: Destination image of the same size and type as ``src`` . - + :param ksize: Smoothing kernel size. :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:`GaussianBlur`, :ocv:func:`medianBlur`, - :ocv:func:`integral` + :ocv:func:`integral` @@ -523,7 +523,7 @@ buildPyramid ---------------- 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. @@ -550,19 +550,19 @@ Forms a border around an 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 top: - + :param bottom: - + :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 borderType: Border type. See :ocv:func:`borderInterpolate` for details. - + :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 :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 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 ksize: Aperture size. :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 scale: Another way to specify normalization in lower-level ``getColumnSumFilter`` . - + :param borderType: Border type to use. See :ocv:func:`borderInterpolate` . 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: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 dstType: Destination image type that must have as many channels as ``srcType`` . - + :param dx: Derivative order in respect of x. :param dy: Derivative order in respect of y. :param ksize: Aperture size See :ocv:func:`getDerivKernels` . - + :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 @@ -664,7 +664,7 @@ The function :ocv:func:`createDerivFilter` is a small convenience function that :ocv:func:`createSeparableLinearFilter`, :ocv:func:`getDerivKernels`, :ocv:func:`Scharr`, - :ocv:func:`Sobel` + :ocv:func:`Sobel` @@ -672,16 +672,16 @@ createGaussianFilter ------------------------ Returns an engine for smoothing images with the Gaussian filter. -.. ocv:function:: Ptr createGaussianFilter( int type, Size ksize, double sigmaX, double sigmaY=0, int borderType=BORDER_DEFAULT) +.. ocv:function:: Ptr createGaussianFilter( int type, Size ksize, double sigma1, double sigma2=0, int borderType=BORDER_DEFAULT ) :param type: Source and destination image type. :param ksize: Aperture size. 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 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 @@ -693,7 +693,7 @@ The function :ocv:func:`createGaussianFilter` computes Gaussian kernel coefficie :ocv:func:`createSeparableLinearFilter`, :ocv:func:`getGaussianKernel`, - :ocv:func:`GaussianBlur` + :ocv:func:`GaussianBlur` @@ -701,14 +701,14 @@ createLinearFilter ---------------------- Creates a non-separable linear filter engine. -.. ocv:function:: Ptr 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 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 getLinearFilter(int srcType, int dstType, InputArray kernel, Point anchor=Point(-1,-1), double delta=0, int bits=0) +.. ocv:function:: Ptr getLinearFilter(int srcType, int dstType, InputArray kernel, Point anchor=Point(-1,-1), double delta=0, int bits=0) :param srcType: Source image type. :param dstType: Destination image type that must have as many channels as ``srcType`` . - + :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. @@ -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 rowBorderType: Pixel extrapolation method in the vertical direction. For details, see :ocv:func:`borderInterpolate`. - + :param columnBorderType: Pixel extrapolation method in the horizontal direction. - + :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 @@ -737,13 +737,13 @@ createMorphologyFilter -------------------------- Creates an engine for non-separable morphological operations. -.. ocv:function:: Ptr 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 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 getMorphologyFilter(int op, int type, InputArray element, Point anchor=Point(-1,-1)) +.. ocv:function:: Ptr getMorphologyFilter( int op, int type, InputArray kernel, Point anchor=Point(-1,-1) ) -.. ocv:function:: Ptr getMorphologyRowFilter(int op, int type, int esize, int anchor=-1) +.. ocv:function:: Ptr getMorphologyRowFilter( int op, int type, int ksize, int anchor=-1 ) -.. ocv:function:: Ptr getMorphologyColumnFilter(int op, int type, int esize, int anchor=-1) +.. ocv:function:: Ptr getMorphologyColumnFilter( int op, int type, int ksize, int anchor=-1 ) .. 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 rowBorderType: Pixel extrapolation method in the vertical direction. For details, see :ocv:func:`borderInterpolate`. - + :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. 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. -.. ocv:function:: Ptr 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 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 getLinearColumnFilter(int bufType, int dstType, InputArray columnKernel, int anchor, int symmetryType, double delta=0, int bits=0) +.. ocv:function:: Ptr getLinearColumnFilter( int bufType, int dstType, InputArray kernel, int anchor, int symmetryType, double delta=0, int bits=0 ) -.. ocv:function:: Ptr getLinearRowFilter(int srcType, int bufType, InputArray rowKernel, int anchor, int symmetryType) +.. ocv:function:: Ptr getLinearRowFilter( int srcType, int bufType, InputArray kernel, int anchor, int symmetryType ) :param srcType: Source array type. :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 rowKernel: Coefficients for filtering each row. :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 rowBorderType: Pixel extrapolation method in the vertical direction. For details, see :ocv:func:`borderInterpolate`. - + :param columnBorderType: Pixel extrapolation method in the horizontal direction. - + :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 :ocv:func:`createSeparableLinearFilter` or even higher-level @@ -831,7 +831,7 @@ dilate ---------- 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 @@ -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 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 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 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. - + 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:: @@ -871,7 +871,7 @@ erode --------- 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 @@ -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 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 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 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. - + 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:: @@ -916,27 +916,28 @@ Convolves an image with the kernel. .. 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 :param src: Source image. :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: * ``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_32F``, ``ddepth`` = -1/``CV_32F``/``CV_64F`` * ``src.depth()`` = ``CV_64F``, ``ddepth`` = -1/``CV_64F`` - + 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 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 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. @@ -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 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 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 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. @@ -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 :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 dx: Derivative order in respect of x. :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:`getDerivKernels`, :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_INTEGER** All the kernel coefficients are integer numbers. This flag can be combined with ``KERNEL_SYMMETRICAL`` or ``KERNEL_ASYMMETRICAL`` . - + 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: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 @@ -1108,27 +1109,27 @@ Returns a structuring element of the specified size and shape for morphological 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_CROSS** - a cross-shaped structuring element: .. math:: 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) :param ksize: Size of the structuring element. :param cols: Width 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 anchorX: x-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``. 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 :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 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 @@ -1170,7 +1171,7 @@ morphologyEx ---------------- 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 @@ -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 dst: Destination image of the same size and type as ``src`` . - + :param element: Structuring element. :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 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. 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` - Laplacian ------------- 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: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 dst: Destination image of the same size and the same number of channels as ``src`` . - + :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. @@ -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 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. 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. -.. 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 ) @@ -1304,7 +1304,7 @@ Smoothes an image and downsamples it. :param src: Source image. :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: .. math:: @@ -1326,9 +1326,9 @@ pyrUp --------- 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 ) @@ -1337,7 +1337,7 @@ Upsamples an image and then smoothes it. :param src: Source image. :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: .. math:: @@ -1353,46 +1353,46 @@ pyrMeanShiftFiltering --------------------- 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: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 - - :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 sp: The spatial window radius. - - :param sr: The color window radius. - - :param maxLevel: Maximum level of the pyramid for the segmentation. - - :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 +.. 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 dst: The destination image of the same format and the same size as the source. + + :param sp: The spatial window radius. + + :param sr: The color window radius. + + :param maxLevel: Maximum level of the pyramid for the segmentation. + + :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 ``(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: .. 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:: (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:: - + 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``). @@ -1402,20 +1402,20 @@ sepFilter2D --------------- 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 :param src: Source image. :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: * ``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_32F``, ``ddepth`` = -1/``CV_32F``/``CV_64F`` * ``src.depth()`` = ``CV_64F``, ``ddepth`` = -1/``CV_64F`` - + when ``ddepth=-1``, the destination image will have the same depth as the source. :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:`GaussianBlur`, :ocv:func:`boxFilter`, - :ocv:func:`blur` + :ocv:func:`blur` Smooth ------ 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 - :param src: The source image - - :param dst: The destination image - - :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** 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_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 - - - :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 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 src: The source image + + :param dst: The destination image + + :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** 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_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 + + + :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 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:: - - \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). - + + \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). + 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. @@ -1496,23 +1496,24 @@ Sobel --------- 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: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 :param src: Source image. :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: * ``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_32F``, ``ddepth`` = -1/``CV_32F``/``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. :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 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. 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 :math:`3\times3` Scharr 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:: @@ -1582,14 +1583,14 @@ Scharr ---------- 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 :param src: Source image. :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 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 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. - + The function computes the first x- or y- spatial image derivative using the Scharr operator. The call .. math:: diff --git a/modules/imgproc/doc/geometric_transformations.rst b/modules/imgproc/doc/geometric_transformations.rst index 800790b..5391a04 100644 --- a/modules/imgproc/doc/geometric_transformations.rst +++ b/modules/imgproc/doc/geometric_transformations.rst @@ -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 :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 dstmap1: The first output map that has the type ``dstmap1type`` and the same size as ``src`` . - + :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 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 @@ -77,11 +77,13 @@ getAffineTransform ---------------------- 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: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 @@ -114,11 +116,13 @@ getPerspectiveTransform --------------------------- 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: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 @@ -151,7 +155,7 @@ getRectSubPix ----------------- 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 @@ -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 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`` . 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: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 @@ -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 - :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: - - * **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 + :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_INVERSE_MAP** See below 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:: - 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:: - dst(x,y) = src( \phi , \rho ) + dst(x,y) = src( \phi , \rho ) where .. 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. @@ -372,7 +376,7 @@ Resizes an image. \texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))} - + 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 @@ -417,7 +421,7 @@ To shrink an image, it will generally look best with CV_INTER_AREA interpolation :ocv:func:`warpAffine`, :ocv:func:`warpPerspective`, - :ocv:func:`remap` + :ocv:func:`remap` 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: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: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 :param src: Source image. :param dst: Destination image that has the size ``dsize`` and the same type as ``src`` . - + :param M: :math:`2\times 3` transformation matrix. :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: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 :param src: Source image. :param dst: Destination image that has the size ``dsize`` and the same type as ``src`` . - + :param M: :math:`3\times 3` transformation matrix. :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:cfunction:: void cvInitUndistortRectifyMap( const CvMat* cameraMatrix, const CvMat* distCoeffs, const CvMat* R, const CvMat* newCameraMatrix, CvArr* map1, CvArr* map2 ) -.. ocv:cfunction:: void cvInitUndistortMap( const CvMat* cameraMatrix, const CvMat* distCoeffs, 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* camera_matrix, const CvMat* distortion_coeffs, CvArr* mapx, CvArr* mapy ) .. ocv:pyoldfunction:: cv.InitUndistortRectifyMap(cameraMatrix, distCoeffs, R, newCameraMatrix, 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 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 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 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 map2: The second output map. @@ -606,7 +613,7 @@ where :math:`(0,0)` and :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:`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: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 :param src: Input (distorted) image. :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 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. @@ -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: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 :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 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 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). - + diff --git a/modules/imgproc/doc/histograms.rst b/modules/imgproc/doc/histograms.rst index 268d12b..6c19bed 100644 --- a/modules/imgproc/doc/histograms.rst +++ b/modules/imgproc/doc/histograms.rst @@ -9,9 +9,9 @@ calcHist ------------ 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 @@ -106,14 +106,14 @@ calcBackProject ------------------- 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: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. @@ -124,9 +124,9 @@ Calculates the back projection of a histogram. :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 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 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 H2: Second compared histogram of the same size as ``H1`` . - + :param method: Comparison method that could be one of the following: * **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:cfunction:: float cvCalcEMD2( const CvArr* signature1, const CvArr* signature2, int distType, CvDistanceFunction distFunc=NULL, const CvArr* cost=NULL, CvArr* flow=NULL, float* lowerBound=NULL, void* userdata=NULL ) -.. ocv:pyoldfunction:: cv.CalcEMD2(signature1, signature2, distType, distFunc=None, cost=None, flow=None, lowerBound=None, userdata=None) -> float +.. 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, 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. @@ -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 distFunc: Custom distance function supported by the old interface. ``CvDistanceFunction`` is defined as: :: - + typedef float (CV_CDECL * CvDistanceFunction)( const float* a, const float* b, void* userdata ); - + where ``a`` and ``b`` are point coordinates and ``userdata`` is the same as the last parameter. - + :param cost: 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 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. 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:pyoldfunction:: cv.CalcBackProjectPatch(images, dst, patchSize, hist, method, factor)-> None - - :param images: Source images (though, you may pass CvMat** as well). - - :param dst: Destination image. - - :param patch_size: Size of the patch slid though the source image. - - :param hist: Histogram. - - :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. - +.. ocv:pyoldfunction:: cv.CalcBackProjectPatch(images, dst, patch_size, hist, method, factor)-> None + + :param images: Source images (though, you may pass CvMat** as well). + + :param dst: Destination image. + + :param patch_size: Size of the patch slid though the source image. + + :param hist: Histogram. + + :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. + 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 @@ -324,23 +325,23 @@ CalcProbDensity --------------- Divides one histogram by another. -.. ocv:cfunction:: void cvCalcProbDensity( const CvHistogram* hist1, const CvHistogram* hist2, CvHistogram* dsthist, double scale=255 ) - -.. 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. - +.. 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. + The function calculates the object probability density from two histograms as: .. 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 @@ -350,7 +351,7 @@ Clears the histogram. .. ocv:cfunction:: void cvClearHist( CvHistogram* hist ) .. 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. @@ -361,10 +362,10 @@ Copies a histogram. .. ocv:cfunction:: void cvCopyHist( const CvHistogram* src, CvHistogram** dst ) - :param src: Source histogram. - - :param dst: Pointer to the destination histogram. - + :param src: Source 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``. .. _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: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 - spaced bins and for every :math:`0<=ibins, (idx0), 0 )) - #define cvGetHistValue_2D( hist, idx0, idx1 ) + #define cvGetHistValue_2D( hist, idx0, idx1 ) ((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 ))) - #define cvGetHistValue_nD( hist, idx ) - ((float*)(cvPtrND( (hist)->bins, (idx), 0 ))) + #define cvGetHistValue_nD( hist, idx ) + ((float*)(cvPtrND( (hist)->bins, (idx), 0 ))) .. @@ -448,19 +449,19 @@ GetMinMaxHistValue 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: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 min_value: Pointer to the minimum 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 max_idx: Pointer to the array of coordinates for the maximum. - + + :param min_value: Pointer to the minimum 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 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. @@ -469,19 +470,19 @@ MakeHistHeaderForArray 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 ) - - :param dims: Number of the histogram dimensions. - - :param sizes: Array of the histogram dimension sizes. - - :param hist: Histogram header initialized by the function. - - :param data: Array used to store histogram bins. - + + :param dims: Number of the histogram dimensions. + + :param sizes: Array of the histogram dimension sizes. + + :param hist: Histogram header initialized by the function. + + :param data: Array used to store histogram bins. + :param ranges: Histogram bin ranges. 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``. NormalizeHist @@ -490,11 +491,11 @@ Normalizes the histogram. .. ocv:cfunction:: void cvNormalizeHist( CvHistogram* hist, double factor ) .. ocv:pyoldfunction:: cv.NormalizeHist(hist, factor)-> None - - :param hist: Pointer to the histogram. - - :param factor: Normalization factor. - + + :param hist: Pointer to the histogram. + + :param factor: Normalization 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_2D(hist, idx0, idx1) -> 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 idx1: 1-st 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. @@ -529,9 +530,9 @@ ReleaseHist Releases the histogram. .. 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. @@ -541,12 +542,12 @@ Sets the bounds of the histogram bins. .. 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 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. @@ -555,12 +556,12 @@ ThreshHist Thresholds the histogram. .. ocv:cfunction:: void cvThreshHist( CvHistogram* hist, double threshold ) -.. ocv:pyoldfunction:: cv.ThreshHist(hist, threshold)-> None - - :param hist: Pointer to the histogram. - - :param threshold: Threshold level. - +.. ocv:pyoldfunction:: cv.ThreshHist(hist, threshold) -> None + + :param hist: Pointer to the histogram. + + :param threshold: Threshold level. + 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. .. 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 hist: Calculated histogram. It must be two-dimensional. - + + :param contour: Input contour. Currently, only integer point coordinates are allowed. + + :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 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 diff --git a/modules/imgproc/doc/miscellaneous_transformations.rst b/modules/imgproc/doc/miscellaneous_transformations.rst index a7cc79c..c70f2c0 100644 --- a/modules/imgproc/doc/miscellaneous_transformations.rst +++ b/modules/imgproc/doc/miscellaneous_transformations.rst @@ -12,19 +12,20 @@ Applies an adaptive threshold to an array. .. 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:pyoldfunction:: cv.AdaptiveThreshold(src, dst, maxValue, adaptiveMethod=CV_ADAPTIVE_THRESH_MEAN_C, thresholdType=CV_THRESH_BINARY, blockSize=3, param1=5)-> None +.. 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, 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 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 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 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. @@ -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 dst: Destination image of the same size and depth as ``src`` . - + :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`` . @@ -98,7 +99,7 @@ The conventional ranges for R, G, and B channel values are: 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 @@ -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: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 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 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 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 @@ -483,18 +484,18 @@ floodFill ------------- 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: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:pyoldfunction:: cv.FloodFill(image, seedPoint, newVal, loDiff=(0, 0, 0, 0), upDiff=(0, 0, 0, 0), flags=4, mask=None)-> comp +.. 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, 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 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`` . @@ -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 :math:`(x,y)` is considered to belong to the repainted domain if: -* +* .. math:: \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 -* +* .. math:: @@ -541,7 +542,7 @@ The functions ``floodFill`` fill a connected component starting from the seed po .. math:: \texttt{src} (x',y')_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} (x',y')_g+ \texttt{upDiff} _g - + and .. math:: @@ -588,11 +589,11 @@ integral ------------ 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 @@ -600,7 +601,8 @@ Calculates the integral of an image. .. 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 :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 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``. 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. -.. 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: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 :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 thresh: Threshold value. :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 value using the Otsu's algorithm and uses it instead of the specified ``thresh`` . 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 @@ -748,7 +751,7 @@ grabCut ------- 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 @@ -765,13 +768,13 @@ Runs the GrabCut algorithm. * **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 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 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: * **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. diff --git a/modules/imgproc/doc/motion_analysis_and_object_tracking.rst b/modules/imgproc/doc/motion_analysis_and_object_tracking.rst index 40ad850..34dae1e 100644 --- a/modules/imgproc/doc/motion_analysis_and_object_tracking.rst +++ b/modules/imgproc/doc/motion_analysis_and_object_tracking.rst @@ -11,8 +11,9 @@ Adds an image to the accumulator. .. ocv:pyfunction:: cv2.accumulate(src, dst[, mask]) -> None -.. ocv:cfunction:: void cvAcc( const CvArr* src, CvArr* dst, const CvArr* mask=NULL ) -.. ocv:pyoldfunction:: cv.Acc(src, dst, mask=None)-> None +.. ocv:cfunction:: void cvAcc( const CvArr* image, CvArr* sum, const CvArr* mask=NULL ) + +.. 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. @@ -46,8 +47,9 @@ Adds the square of a source image to the accumulator. .. ocv:pyfunction:: cv2.accumulateSquare(src, dst[, mask]) -> None -.. ocv:cfunction:: void cvSquareAcc( const CvArr* src, CvArr* dst, const CvArr* mask=NULL ) -.. ocv:pyoldfunction:: cv.SquareAcc(src, dst, mask=None)-> None +.. ocv:cfunction:: void cvSquareAcc( const CvArr* image, CvArr* sqsum, const CvArr* mask=NULL ) + +.. 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. @@ -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:cfunction:: void cvMultiplyAcc( const CvArr* src1, const CvArr* src2, CvArr* dst, const CvArr* mask=NULL ) -.. ocv:pyoldfunction:: cv.MultiplyAcc(src1, src2, dst, mask=None)-> None +.. ocv:cfunction:: void cvMultiplyAcc( const CvArr* image1, const CvArr* image2, CvArr* acc, const CvArr* mask=NULL ) + +.. 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 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 mask: Optional operation mask. @@ -114,8 +117,8 @@ Updates a running average. .. 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:pyoldfunction:: cv.RunningAvg(src, dst, alpha, mask=None)-> None +.. ocv:cfunction:: void cvRunningAvg( const CvArr* image, CvArr* acc, double alpha, const CvArr* mask=NULL ) +.. 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. @@ -138,7 +141,7 @@ The function supports multi-channel images. Each channel is processed independen :ocv:func:`accumulate`, :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: :: - // create hanning window of size 100x100 and type CV_32F + // create hanning window of size 100x100 and type CV_32F Mat hann; createHanningWindow(hann, Size(100, 100), CV_32F); diff --git a/modules/imgproc/doc/object_detection.rst b/modules/imgproc/doc/object_detection.rst index 3ee6bf3..c6231a0 100644 --- a/modules/imgproc/doc/object_detection.rst +++ b/modules/imgproc/doc/object_detection.rst @@ -7,7 +7,7 @@ matchTemplate ----------------- 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 @@ -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 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). The function slides through ``image`` , compares the diff --git a/modules/imgproc/doc/structural_analysis_and_shape_descriptors.rst b/modules/imgproc/doc/structural_analysis_and_shape_descriptors.rst index f6284bf..fbb7343 100644 --- a/modules/imgproc/doc/structural_analysis_and_shape_descriptors.rst +++ b/modules/imgproc/doc/structural_analysis_and_shape_descriptors.rst @@ -11,13 +11,14 @@ Calculates all of the moments up to the third order of a polygon or rasterized s .. ocv:pyfunction:: cv2.moments(array[, binaryImage]) -> retval -.. ocv:cfunction:: void cvMoments( const CvArr* array, CvMoments* moments, int binary=0 ) -.. ocv:pyoldfunction:: cv.Moments(array, binary=0) -> moments +.. ocv:cfunction:: void cvMoments( const CvArr* arr, CvMoments* moments, int binary=0 ) + +.. 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 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. 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 ); Moments( const CvMoments& moments ); operator CvMoments() const; - + // spatial moments double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; // central moments @@ -69,7 +70,7 @@ The normalized central moments .. note:: :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. 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. -.. 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 @@ -126,9 +129,9 @@ Finds contours in a binary image. .. 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. @@ -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: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. @@ -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 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 drawn. @@ -253,28 +256,28 @@ Approximates a polygonal curve(s) with the specified precision. .. 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: - + * ``std::vector`` or ``Mat`` (C++ 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 epsilon: Parameter specifying the approximation accuracy. This is the maximum distance between the original curve and its approximation. :param closed: If true, the approximated curve is closed (its first and last vertices are connected). Otherwise, it is not closed. - + :param headerSize: Header size of the approximated curve. Normally, ``sizeof(CvContour)`` is used. - + :param storage: Memory storage where the approximated curve is stored. - + :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. 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. -.. ocv:cfunction:: CvSeq* cvApproxChains( CvSeq* chain, CvMemStorage* storage, int method=CV_CHAIN_APPROX_SIMPLE, double parameter=0, int minimalPerimeter=0, int recursive=0 ) - -.. ocv:pyoldfunction:: cv.ApproxChains(chain, storage, method=CV_CHAIN_APPROX_SIMPLE, parameter=0, minimalPerimeter=0, recursive=0)-> contours - - :param chain: Pointer to the approximated Freeman chain that can refer to other chains. - - :param storage: Storage location for the resulting polylines. - - :param method: Approximation method (see the description of the function :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: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. + :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. @@ -314,8 +317,9 @@ Calculates a contour perimeter or a curve length. .. ocv:pyfunction:: cv2.arcLength(curve, closed) -> retval -.. ocv:cfunction:: double cvArcLength( const void* curve, CvSlice slice=CV_WHOLE_SEQ, int isClosed=-1 ) -.. ocv:pyoldfunction:: cv.ArcLength(curve, slice=CV_WHOLE_SEQ, isClosed=-1)-> double +.. 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) -> float :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: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``. @@ -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: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 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 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 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`` implies ``returnPoints=true``, ``std::vector`` implies ``returnPoints=false``. 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: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:pyoldfunction:: cv.ConvexityDefects(contour, convexhull, storage)-> convexityDefects - :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 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 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. - + 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 @@ -460,7 +464,7 @@ Fits an ellipse around a set of 2D points. .. ocv:pyoldfunction:: cv.FitEllipse2(points)-> Box2D :param points: Input 2D point set, stored in: - + * ``std::vector<>`` or ``Mat`` (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: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:pyoldfunction:: cv.FitLine(points, distType, param, reps, aeps) -> line +.. ocv:cfunction:: void cvFitLine( const CvArr* points, int dist_type, double param, double reps, double aeps, float* 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``. @@ -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 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``. 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 :param contour: Input vector of 2D points, stored in: - + * ``std::vector<>`` or ``Mat`` (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:pyoldfunction:: cv.MinAreaRect2(points, storage=None)-> CvBox2D +.. ocv:pyoldfunction:: cv.MinAreaRect2(points, storage=None) -> Box2D :param points: Input vector of 2D points, stored in: - + * ``std::vector<>`` or ``Mat`` (C++ interface) - + * ``CvSeq*`` or ``CvMat*`` (C interface) - + * Nx2 numpy array (Python interface) The function calculates and returns the minimum-area bounding rectangle (possibly rotated) for a specified point set. See the OpenCV sample ``minarea.cpp`` . @@ -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: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:pyoldfunction:: cv.MinEnclosingCircle(points)-> (int, center, radius) :param points: Input vector of 2D points, stored in: - + * ``std::vector<>`` or ``Mat`` (C++ interface) - + * ``CvSeq*`` or ``CvMat*`` (C interface) - + * Nx2 numpy array (Python interface) :param center: Output center of the circle. @@ -621,12 +626,12 @@ matchShapes --------------- 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: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. @@ -680,8 +685,8 @@ Performs a point-in-contour test. .. ocv:pyfunction:: cv2.pointPolygonTest(contour, pt, measureDist) -> retval -.. ocv:cfunction:: double cvPointPolygonTest( const CvArr* contour, CvPoint2D32f pt, int measureDist ) -.. ocv:pyoldfunction:: cv.PointPolygonTest(contour, pt, measureDist)-> double +.. ocv:cfunction:: double cvPointPolygonTest( const CvArr* contour, CvPoint2D32f pt, int measure_dist ) +.. ocv:pyoldfunction:: cv.PointPolygonTest(contour, pt, measure_dist) -> float :param contour: Input contour. diff --git a/modules/imgproc/include/opencv2/imgproc/imgproc.hpp b/modules/imgproc/include/opencv2/imgproc/imgproc.hpp index 3562a92..56605c7 100644 --- a/modules/imgproc/include/opencv2/imgproc/imgproc.hpp +++ b/modules/imgproc/include/opencv2/imgproc/imgproc.hpp @@ -392,7 +392,7 @@ CV_EXPORTS_W void medianBlur( InputArray src, OutputArray dst, int ksize ); //! smooths the image using Gaussian filter. CV_EXPORTS_W void GaussianBlur( InputArray src, OutputArray dst, Size ksize, - double sigma1, double sigma2=0, + double sigmaX, double sigmaY=0, int borderType=BORDER_DEFAULT ); //! smooths the image using bilateral filter CV_EXPORTS_W void bilateralFilter( InputArray src, OutputArray dst, int d, diff --git a/modules/legacy/doc/common_interfaces_of_generic_descriptor_matchers.rst b/modules/legacy/doc/common_interfaces_of_generic_descriptor_matchers.rst index e23f4cd..2a15369 100644 --- a/modules/legacy/doc/common_interfaces_of_generic_descriptor_matchers.rst +++ b/modules/legacy/doc/common_interfaces_of_generic_descriptor_matchers.rst @@ -5,7 +5,7 @@ Common Interfaces of Generic Descriptor Matchers OneWayDescriptorMatcher ----------------------- -.. ocv:class:: OneWayDescriptorMatcher +.. ocv:class:: OneWayDescriptorMatcher : public GenericDescriptorMatcher Wrapping class for computing, matching, and classifying descriptors using the :ocv:class:`OneWayDescriptorBase` class. :: @@ -64,7 +64,7 @@ Wrapping class for computing, matching, and classifying descriptors using the FernDescriptorMatcher --------------------- -.. ocv:class:: FernDescriptorMatcher +.. ocv:class:: FernDescriptorMatcher : public GenericDescriptorMatcher Wrapping class for computing, matching, and classifying descriptors using the :ocv:class:`FernClassifier` class. :: diff --git a/modules/legacy/doc/feature_detection_and_description.rst b/modules/legacy/doc/feature_detection_and_description.rst index 7fc9993..16d3ad3 100644 --- a/modules/legacy/doc/feature_detection_and_description.rst +++ b/modules/legacy/doc/feature_detection_and_description.rst @@ -142,7 +142,7 @@ RandomizedTree::applyQuantization RTreeNode --------- -.. ocv:class:: RTreeNode +.. ocv:struct:: RTreeNode Class containing a base structure for ``RandomizedTree``. :: diff --git a/modules/legacy/doc/motion_analysis.rst b/modules/legacy/doc/motion_analysis.rst index b4f9da2..bc03977 100644 --- a/modules/legacy/doc/motion_analysis.rst +++ b/modules/legacy/doc/motion_analysis.rst @@ -8,19 +8,19 @@ CalcOpticalFlowBM ----------------- 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. @@ -28,11 +28,11 @@ Calculates the optical flow for two images by using the block matching method. .. 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`` @@ -43,23 +43,23 @@ CalcOpticalFlowHS ----------------- 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 - :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 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 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`. @@ -69,19 +69,19 @@ CalcOpticalFlowLK 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 - :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`. diff --git a/modules/legacy/include/opencv2/legacy/legacy.hpp b/modules/legacy/include/opencv2/legacy/legacy.hpp index bc43562..18c9c29 100644 --- a/modules/legacy/include/opencv2/legacy/legacy.hpp +++ b/modules/legacy/include/opencv2/legacy/legacy.hpp @@ -1768,8 +1768,8 @@ protected: struct CV_EXPORTS_W_MAP CvEMParams { CvEMParams(); - CvEMParams( int nclusters, int cov_mat_type=1/*CvEM::COV_MAT_DIAGONAL*/, - int start_step=0/*CvEM::START_AUTO_STEP*/, + CvEMParams( int nclusters, int cov_mat_type=cv::EM::COV_MAT_DIAGONAL, + int start_step=cv::EM::START_AUTO_STEP, 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 ); diff --git a/modules/ml/doc/boosting.rst b/modules/ml/doc/boosting.rst index c6355a1..99b2492 100644 --- a/modules/ml/doc/boosting.rst +++ b/modules/ml/doc/boosting.rst @@ -65,7 +65,7 @@ training examples are recomputed at each training iteration. Examples deleted at CvBoostParams ------------- -.. ocv:class:: CvBoostParams +.. ocv:struct:: CvBoostParams : public CvDTreeParams 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 ) :param boost_type: Type of the boosting algorithm. Possible values are: - + * **CvBoost::DISCRETE** Discrete AdaBoost. * **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::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. @@ -122,7 +122,7 @@ Default parameters are: 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`. @@ -130,7 +130,7 @@ The weak tree classifier, a component of the boosted tree classifier :ocv:class: CvBoost ------- -.. ocv:class:: CvBoost +.. ocv:class:: CvBoost : public 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:pyfunction:: cv2.Boost(trainData, tflag, responses[, varIdx[, sampleIdx[, varType[, missingDataMask[, params]]]]]) -> +.. ocv:pyfunction:: cv2.Boost([trainData, tflag, responses[, varIdx[, sampleIdx[, varType[, missingDataMask[, params]]]]]]) -> 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 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 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. @@ -199,7 +199,7 @@ Removes the specified weak classifiers. :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. diff --git a/modules/ml/doc/decision_trees.rst b/modules/ml/doc/decision_trees.rst index bf72ddc..2e567c2 100644 --- a/modules/ml/doc/decision_trees.rst +++ b/modules/ml/doc/decision_trees.rst @@ -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 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. -* +* **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 @@ -57,7 +57,7 @@ Importance of each variable is computed over all the splits on this variable in CvDTreeSplit ------------ -.. ocv:class:: CvDTreeSplit +.. ocv:struct:: CvDTreeSplit 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 - 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 - 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 @@ -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: :: - if var_value in subset - then next_node <- left + if var_value in subset + then next_node <- left 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: :: - if var_value < ord.c - then next_node<-left + if var_value < ord.c + then next_node<-left else next_node<-right .. ocv:member:: int ord::split_point @@ -100,12 +100,12 @@ The structure represents a possible decision tree node split. It has public memb 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. @@ -135,17 +135,17 @@ The structure represents a node in a decision tree. It has public members: .. 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 - 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. 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. @@ -153,19 +153,19 @@ CvDTreeParams::CvDTreeParams ---------------------------- 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 ) - :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 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 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``. @@ -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) {} - + 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: @@ -212,7 +212,7 @@ There are two ways of using this structure. In simple cases (for example, a stan CvDTree ------- -.. ocv:class:: CvDTree +.. ocv:class:: CvDTree : public CvStatModel The class implements a decision tree as described in the beginning of this section. @@ -221,7 +221,7 @@ CvDTree::train -------------- 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() ) @@ -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 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``. @@ -270,7 +270,7 @@ Returns error of the decision tree. .. ocv:function:: float CvDTree::calc_error( CvMLData* trainData, int type, std::vector *resp = 0 ) :param trainData: Data for the decision tree. - + :param type: Type of error. Possible values are: * **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:pyfunction:: cv2.DTree.getVarImportance() -> importanceVector +.. ocv:pyfunction:: cv2.DTree.getVarImportance() -> retval CvDTree::get_root ----------------- @@ -311,7 +311,7 @@ CvDTree::get_data ----------------- 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 decision tree. diff --git a/modules/ml/doc/ertrees.rst b/modules/ml/doc/ertrees.rst index 7d0654b..3cd9d28 100644 --- a/modules/ml/doc/ertrees.rst +++ b/modules/ml/doc/ertrees.rst @@ -10,6 +10,6 @@ Extremely randomized trees have been introduced by Pierre Geurts, Damien Ernst a 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. diff --git a/modules/ml/doc/expectation_maximization.rst b/modules/ml/doc/expectation_maximization.rst index 4c5c2c5..4bfacce 100644 --- a/modules/ml/doc/expectation_maximization.rst +++ b/modules/ml/doc/expectation_maximization.rst @@ -60,7 +60,7 @@ At the second step (Maximization step or M-step), the mixture parameter estimate .. 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 :math:`p_{i,k}` can be provided. Another alternative when @@ -91,7 +91,7 @@ already a good enough approximation). 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`. @@ -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:pyfunction:: cv2.EM([nclusters[, covMatType[, termCrit]]]) -> :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: * **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_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``. 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::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: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 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 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 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 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 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: @@ -167,7 +174,9 @@ EM::predict 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: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 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:pyfunction:: cv2.EM.isTrained() -> retval + EM::read, EM::write ------------------- See :ocv:func:`Algorithm::read` and :ocv:func:`Algorithm::write`. diff --git a/modules/ml/doc/gradient_boosted_trees.rst b/modules/ml/doc/gradient_boosted_trees.rst index 4f0b381..3d72301 100644 --- a/modules/ml/doc/gradient_boosted_trees.rst +++ b/modules/ml/doc/gradient_boosted_trees.rst @@ -104,7 +104,7 @@ For classification problems, the result is :math:`\arg\max_{i=1..K}(f_i(x))`. CvGBTreesParams --------------- -.. ocv:class:: CvGBTreesParams +.. ocv:struct:: CvGBTreesParams : public CvDTreeParams GBT training parameters. @@ -149,7 +149,7 @@ By default the following constructor is used: 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. diff --git a/modules/ml/doc/k_nearest_neighbors.rst b/modules/ml/doc/k_nearest_neighbors.rst index 6e72119..739f52d 100644 --- a/modules/ml/doc/k_nearest_neighbors.rst +++ b/modules/ml/doc/k_nearest_neighbors.rst @@ -7,7 +7,7 @@ The algorithm caches all training samples and predicts the response for a new sa CvKNearest ---------- -.. ocv:class:: CvKNearest +.. ocv:class:: CvKNearest : public CvStatModel The class implements K-Nearest Neighbors model as described in the beginning of this section. diff --git a/modules/ml/doc/mldata.rst b/modules/ml/doc/mldata.rst index b093037..5a3896c 100644 --- a/modules/ml/doc/mldata.rst +++ b/modules/ml/doc/mldata.rst @@ -251,7 +251,7 @@ The method returns a map that converts string class labels to the numerical clas CvTrainTestSplit ---------------- -.. ocv:class:: CvTrainTestSplit +.. ocv:struct:: CvTrainTestSplit Structure setting the split of a data set read by :ocv:class:`CvMLData`. :: diff --git a/modules/ml/doc/neural_networks.rst b/modules/ml/doc/neural_networks.rst index f0250f0..61a05d9 100644 --- a/modules/ml/doc/neural_networks.rst +++ b/modules/ml/doc/neural_networks.rst @@ -8,7 +8,7 @@ ML implements feed-forward artificial neural networks or, more particularly, mul .. 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 -: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 @@ -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 ( :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. @@ -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. .. [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 --------------------- -.. 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. @@ -169,9 +169,9 @@ By default the RPROP algorithm is used: 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. @@ -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:pyfunction:: cv2.ANN_MLP(layerSizes[, activateFunc[, fparam1[, fparam2]]]) -> +.. ocv:pyfunction:: cv2.ANN_MLP([layerSizes[, activateFunc[, fparam1[, fparam2]]]]) -> 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 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. 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: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. @@ -249,7 +249,7 @@ Predicts responses for input samples. .. 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. @@ -278,4 +278,4 @@ Returns neurons weights of the particular layer. .. ocv:function:: double* CvANN_MLP::get_weights(int layer) :param layer: Index of the particular layer. - + diff --git a/modules/ml/doc/normal_bayes_classifier.rst b/modules/ml/doc/normal_bayes_classifier.rst index 5c0d1b1..a247598 100644 --- a/modules/ml/doc/normal_bayes_classifier.rst +++ b/modules/ml/doc/normal_bayes_classifier.rst @@ -11,7 +11,7 @@ This simple classification model assumes that feature vectors from each class ar CvNormalBayesClassifier ----------------------- -.. ocv:class:: CvNormalBayesClassifier +.. ocv:class:: CvNormalBayesClassifier : public CvStatModel 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:pyfunction:: cv2.NormalBayesClassifier(trainData, responses[, varIdx[, sampleIdx]]) -> +.. ocv:pyfunction:: cv2.NormalBayesClassifier([trainData, responses[, varIdx[, sampleIdx]]]) -> 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``). -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. * Input variables are all ordered. diff --git a/modules/ml/doc/random_trees.rst b/modules/ml/doc/random_trees.rst index 7845121..8d7911d 100644 --- a/modules/ml/doc/random_trees.rst +++ b/modules/ml/doc/random_trees.rst @@ -42,7 +42,7 @@ For the random trees usage example, please, see letter_recog.cpp sample in OpenC CvRTParams ---------- -.. ocv:class:: CvRTParams +.. ocv:struct:: CvRTParams : public CvDTreeParams Training parameters of random trees. @@ -53,7 +53,7 @@ CvRTParams::CvRTParams: ----------------------- 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 ) @@ -72,9 +72,9 @@ The constructors. :param forest_accuracy: Sufficient accuracy (OOB error). :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_EPS** Terminate learning by the ``forest_accuracy``; * **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 -------- -.. ocv:class:: CvRTrees +.. ocv:class:: CvRTrees : public CvStatModel 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. -.. 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 @@ -156,7 +156,7 @@ Returns the variable importance array. .. 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. @@ -181,7 +181,7 @@ CvRTrees::calc_error -------------------- Returns error of the random forest. -.. ocv:function:: float CvRTrees::calc_error( CvMLData* data, int type, std::vector *resp = 0 ) +.. ocv:function:: float CvRTrees::calc_error( CvMLData* data, int type, std::vector* resp=0 ) The method is identical to :ocv:func:`CvDTree::calc_error` but uses the random forest as predictor. diff --git a/modules/ml/doc/statistical_models.rst b/modules/ml/doc/statistical_models.rst index d79b50d..49ac58e 100644 --- a/modules/ml/doc/statistical_models.rst +++ b/modules/ml/doc/statistical_models.rst @@ -52,7 +52,7 @@ CvStatModel::CvStatModel(...) ----------------------------- 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. diff --git a/modules/ml/doc/support_vector_machines.rst b/modules/ml/doc/support_vector_machines.rst index 8fcac03..97e0442 100644 --- a/modules/ml/doc/support_vector_machines.rst +++ b/modules/ml/doc/support_vector_machines.rst @@ -16,9 +16,9 @@ SVM implementation in OpenCV is based on [LibSVM]_. 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 @@ -77,7 +77,7 @@ Returns ``true`` if the grid is valid and ``false`` otherwise. The grid is valid CvSVMParams ----------- -.. ocv:class:: CvSVMParams +.. ocv:struct:: CvSVMParams 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::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 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 ----- -.. ocv:class:: CvSVM +.. ocv:class:: CvSVM : public CvStatModel 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:pyfunction:: cv2.SVM(trainData, responses[, varIdx[, sampleIdx[, params]]]) -> +.. ocv:pyfunction:: cv2.SVM([trainData, responses[, varIdx[, sampleIdx[, params]]]]) -> 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 -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. @@ -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 :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 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: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. @@ -297,4 +297,4 @@ Returns the number of used features (variables count). .. ocv:function:: int CvSVM::get_var_count() const -.. ocv:pyfunction:: cv2.SVM.get_var_count() -> nvars +.. ocv:pyfunction:: cv2.SVM.get_var_count() -> retval diff --git a/modules/ml/include/opencv2/ml/ml.hpp b/modules/ml/include/opencv2/ml/ml.hpp index 24e4a4b..a38d044 100644 --- a/modules/ml/include/opencv2/ml/ml.hpp +++ b/modules/ml/include/opencv2/ml/ml.hpp @@ -170,10 +170,10 @@ struct CV_EXPORTS_W_MAP CvParamGrid 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; - max_val = _max_val; + this->min_val = min_val; + this->max_val = max_val; step = log_step; } //CvParamGrid( int param_id ); @@ -291,10 +291,10 @@ protected: struct CV_EXPORTS_W_MAP CvSVMParams { CvSVMParams(); - CvSVMParams( int _svm_type, int _kernel_type, - double _degree, double _gamma, double _coef0, - double Cvalue, double _nu, double _p, - CvMat* _class_weights, CvTermCriteria _term_crit ); + CvSVMParams( int svm_type, int kernel_type, + double degree, double gamma, double coef0, + double Cvalue, double nu, double p, + CvMat* class_weights, CvTermCriteria term_crit ); CV_PROP_RW int svm_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}; CV_WRAP EM(int nclusters=EM::DEFAULT_NCLUSTERS, int covMatType=EM::COV_MAT_DIAGONAL, - const TermCriteria& termCrit=TermCriteria(TermCriteria::COUNT+ - TermCriteria::EPS, + const TermCriteria& termCrit=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, EM::DEFAULT_MAX_ITERS, FLT_EPSILON)); virtual ~EM(); @@ -1026,7 +1025,7 @@ public: virtual float get_proximity( const CvMat* sample1, const CvMat* sample2, const CvMat* missing1 = 0, const CvMat* missing2 = 0 ) const; - virtual float calc_error( CvMLData* _data, int type , std::vector *resp = 0 ); // type in {CV_TRAIN_ERROR, CV_TEST_ERROR} + virtual float calc_error( CvMLData* data, int type , std::vector* resp = 0 ); // type in {CV_TRAIN_ERROR, CV_TEST_ERROR} virtual float get_train_error(); diff --git a/modules/nonfree/doc/feature_detection.rst b/modules/nonfree/doc/feature_detection.rst index 2bd1078..36958c8 100644 --- a/modules/nonfree/doc/feature_detection.rst +++ b/modules/nonfree/doc/feature_detection.rst @@ -3,7 +3,7 @@ Feature Detection and Description 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]_. @@ -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) :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 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 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 -.. ocv:function:: void SIFT::operator()(InputArray image, InputArray mask, vector& keypoints, OutputArray descriptors, bool useProvidedKeypoints=false) +.. ocv:function:: void SIFT::operator()(InputArray img, InputArray mask, vector& keypoints, OutputArray descriptors, bool useProvidedKeypoints=false) :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. - + 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: .. ocv:member:: int extended - + * 0 means that the basic descriptors (64 elements each) shall be computed * 1 means that the extended descriptors (128 elements each) shall be computed - + .. ocv:member:: int upright - + * 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``. - + .. 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. - + .. 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. - + .. ocv:member:: int nOctaveLayers - + 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(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]]]]) -> +.. ocv:pyfunction:: cv2.SURF([hessianThreshold[, nOctaves[, nOctaveLayers[, extended[, upright]]]]]) -> :param hessianThreshold: Threshold for hessian keypoint detector used in SURF. - + :param nOctaves: Number of pyramid octaves the keypoint detector will use. - + :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 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. -.. ocv:function:: void SURF::operator()(InputArray image, InputArray mask, vector& keypoints) const -.. ocv:function:: void SURF::operator()(InputArray image, InputArray mask, vector& keypoints, OutputArray descriptors, bool useProvidedKeypoints=false) +.. ocv:function:: void SURF::operator()(InputArray img, InputArray mask, vector& keypoints) const +.. ocv:function:: void SURF::operator()(InputArray img, InputArray mask, vector& keypoints, OutputArray descriptors, bool useProvidedKeypoints=false) .. 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:pyoldfunction:: cv.ExtractSURF(image, mask, storage, params)-> (keypoints, descriptors) :param image: Input 8-bit grayscale image - + :param mask: Optional input mask that marks the regions where we should detect features. - + :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 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 params: SURF algorithm parameters in OpenCV 1.x API. The function is parallelized with the TBB library. diff --git a/modules/nonfree/include/opencv2/nonfree/features2d.hpp b/modules/nonfree/include/opencv2/nonfree/features2d.hpp index f5c6e7d..074b9af 100644 --- a/modules/nonfree/include/opencv2/nonfree/features2d.hpp +++ b/modules/nonfree/include/opencv2/nonfree/features2d.hpp @@ -58,9 +58,9 @@ namespace cv class CV_EXPORTS_W SIFT : public Feature2D { public: - explicit SIFT( int _nfeatures=0, int _nOctaveLayers=3, - double _contrastThreshold=0.04, double _edgeThreshold=10, - double _sigma=1.6); + explicit SIFT( int nfeatures=0, int nOctaveLayers=3, + double contrastThreshold=0.04, double edgeThreshold=10, + double sigma=1.6); //! returns the descriptor size in floats (128) int descriptorSize() const; @@ -108,23 +108,23 @@ class CV_EXPORTS_W SURF : public Feature2D { public: //! the default constructor - SURF(); + CV_WRAP SURF(); //! the full constructor taking all the necessary parameters - explicit SURF(double _hessianThreshold, - int _nOctaves=4, int _nOctaveLayers=2, - bool _extended=true, bool _upright=false); + explicit CV_WRAP SURF(double hessianThreshold, + int nOctaves=4, int nOctaveLayers=2, + bool extended=true, bool upright=false); //! returns the descriptor size in float's (64 or 128) - int descriptorSize() const; + CV_WRAP int descriptorSize() const; //! returns the descriptor type - int descriptorType() const; + CV_WRAP int descriptorType() const; //! 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& keypoints) const; //! 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& keypoints, OutputArray descriptors, bool useProvidedKeypoints=false) const; diff --git a/modules/objdetect/doc/cascade_classification.rst b/modules/objdetect/doc/cascade_classification.rst index 9cd360f..5a02095 100644 --- a/modules/objdetect/doc/cascade_classification.rst +++ b/modules/objdetect/doc/cascade_classification.rst @@ -131,7 +131,7 @@ FeatureEvaluator::create ---------------------------- Constructs the feature evaluator. -.. ocv:function:: static Ptr FeatureEvaluator::create(int type) +.. ocv:function:: Ptr FeatureEvaluator::create(int type) :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:pyfunction:: cv2.CascadeClassifier(filename) -> +.. ocv:pyfunction:: cv2.CascadeClassifier([filename]) -> :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, 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)``. @@ -222,7 +222,7 @@ Sets an image for detection. .. ocv:function:: bool CascadeClassifier::setImage( Ptr& 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. @@ -241,7 +241,7 @@ Runs the detector at the specified point. .. ocv:function:: int CascadeClassifier::runAt( Ptr& 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. diff --git a/modules/objdetect/doc/latent_svm.rst b/modules/objdetect/doc/latent_svm.rst index a22fe8d..3eab55c 100644 --- a/modules/objdetect/doc/latent_svm.rst +++ b/modules/objdetect/doc/latent_svm.rst @@ -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 location. -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 -working with this structure (see :ocv:func:`cvLoadLatentSvmDetector`, +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 +working with this structure (see :ocv:func:`cvLoadLatentSvmDetector`, :ocv:func:`cvReleaseLatentSvmDetector`, :ocv:func:`cvLatentSvmDetectObjects`). -C++ version is the class :ocv:class:`LatentSvmDetector` and has slightly different -functionality in contrast with C version - it supports loading and detection -of several models. +C++ version is the class :ocv:class:`LatentSvmDetector` and has slightly different +functionality in contrast with C version - it supports loading and detection +of several models. There are two examples of Latent SVM usage: ``samples/c/latentsvmdetect.cpp`` and ``samples/cpp/latentsvm_multidetect.cpp``. @@ -48,18 +48,18 @@ CvLSVMFilterPosition Structure describes the position of the filter in the feature pyramid. .. ocv:member:: unsigned int l - + level in the feature pyramid - + .. ocv:member:: unsigned int x - + x-coordinate in level l - + .. ocv:member:: unsigned int y - + y-coordinate in level l - - + + CvLSVMFilterObject ------------------ .. ocv:struct:: CvLSVMFilterObject @@ -67,31 +67,31 @@ CvLSVMFilterObject Description of the filter, which corresponds to the part of the object. .. ocv:member:: CvLSVMFilterPosition V - + ideal (penalty = 0) position of the partial filter from the root filter position (V_i in the paper) - + .. ocv:member:: float fineFunction[4] - + vector describes penalty function (d_i in the paper) pf[0] * x + pf[1] * y + pf[2] * x^2 + pf[3] * y^2 - + .. ocv:member:: int sizeX .. ocv:member:: int sizeY - + Rectangular map (sizeX x sizeY), every cell stores feature vector (dimension = p) - + .. ocv:member:: int numFeatures - + number of features - + .. ocv:member:: float *H - - matrix of feature vectors to set and get - feature vectors (i,j) used formula H[(j * sizeX + i) * p + k], + + matrix of feature vectors to set and get + feature vectors (i,j) used formula H[(j * sizeX + i) * p + k], where k - component of feature vector in cell (i, j) - + CvLatentSvmDetector ------------------- .. ocv:struct:: CvLatentSvmDetector @@ -99,30 +99,30 @@ CvLatentSvmDetector Structure contains internal representation of trained Latent SVM detector. .. ocv:member:: int num_filters - + total number of filters (root plus part) in model - + .. ocv:member:: int num_components - + number of components in model - + .. ocv:member:: int* num_part_filters - + array containing number of part filters for each component - + .. ocv:member:: CvLSVMFilterObject** filters - + root and part filters for all model components - + .. ocv:member:: float* b - + biases for all model components - + .. ocv:member:: float score_threshold - + confidence level threshold - - + + CvObjectDetection ----------------- .. ocv:struct:: CvObjectDetection @@ -130,11 +130,11 @@ CvObjectDetection Structure contains the bounding box and confidence level for detected object. .. ocv:member:: CvRect rect - + bounding box for a detected object - + .. ocv:member:: float score - + confidence level @@ -145,7 +145,7 @@ Loads trained detector from a file. .. ocv:function:: CvLatentSvmDetector* cvLoadLatentSvmDetector(const char* filename) :param filename: Name of the file containing the description of a trained detector - + cvReleaseLatentSvmDetector -------------------------- @@ -158,46 +158,46 @@ Release memory allocated for CvLatentSvmDetector structure. 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. -.. ocv:function:: CvSeq* cvLatentSvmDetectObjects(IplImage* image, CvLatentSvmDetector* detector, CvMemStorage* storage, float overlap_threshold, int numThreads) - - :param image: image +.. ocv:function:: CvSeq* cvLatentSvmDetectObjects( IplImage* image, CvLatentSvmDetector* detector, CvMemStorage* storage, float overlap_threshold=0.5f, int numThreads=-1 ) + + :param image: image :param detector: LatentSVM detector in internal representation :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 numThreads: Number of threads used in parallel version of the algorithm - + .. highlight:: cpp LatentSvmDetector ----------------- .. ocv:class:: LatentSvmDetector -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 +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 using them. LatentSvmDetector::ObjectDetection ---------------------------------- -.. ocv:class:: LatentSvmDetector::ObjectDetection +.. ocv:struct:: LatentSvmDetector::ObjectDetection Structure contains the detection information. .. ocv:member:: Rect rect - + bounding box for a detected object - + .. ocv:member:: float score - + confidence level - + .. ocv:member:: int classID - - class (model or detector) ID that detect an object - - + + class (model or detector) ID that detect an object + + LatentSvmDetector::LatentSvmDetector ------------------------------------ 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". 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. -.. ocv:function:: bool LatentSvmDetector::load(const vector& filenames, const vector& classNames) - - :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/. - +.. ocv:function:: bool LatentSvmDetector::load( const vector& filenames, const vector& classNames=vector() ) + + :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". 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) and corresponding confidence levels. -.. ocv:function:: void LatentSvmDetector::detect( const Mat& image, vector& objectDetections, float overlapThreshold=0.5, int numThreads=-1 ) - +.. ocv:function:: void LatentSvmDetector::detect( const Mat& image, vector& objectDetections, float overlapThreshold=0.5f, int numThreads=-1 ) + :param image: An image. :param objectDetections: The detections: rectangulars, scores and class IDs. :param overlapThreshold: Threshold for the non-maximum suppression algorithm. :param numThreads: Number of threads used in parallel version of the algorithm. - + LatentSvmDetector::getClassNames -------------------------------- 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). .. 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 diff --git a/modules/objdetect/include/opencv2/objdetect/objdetect.hpp b/modules/objdetect/include/opencv2/objdetect/objdetect.hpp index 130cc1b..963f7dc 100644 --- a/modules/objdetect/include/opencv2/objdetect/objdetect.hpp +++ b/modules/objdetect/include/opencv2/objdetect/objdetect.hpp @@ -346,7 +346,7 @@ public: virtual Ptr clone() 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 double calcOrd(int featureIdx) const; diff --git a/modules/photo/doc/inpainting.rst b/modules/photo/doc/inpainting.rst index f37aa52..ef69ebc 100644 --- a/modules/photo/doc/inpainting.rst +++ b/modules/photo/doc/inpainting.rst @@ -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: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 :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 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 flags: Inpainting method that could be one of the following: diff --git a/modules/python/src2/api b/modules/python/src2/api index c760ec2..dc02e4a 100644 --- a/modules/python/src2/api +++ b/modules/python/src2/api @@ -1669,7 +1669,7 @@ ApproxPoly /doconly int method double parameter 0.0 int parameter2 0 -CalcEMD2 /doconly +CalcEMD2 float /doconly CvArr signature1 CvArr signature2 int distance_type @@ -1688,7 +1688,7 @@ CalcOpticalFlowPyrLK currFeatures,status,track_error /doconly int level CvTermCriteria criteria int flags - CvPoint2D32f* guesses + CvPoint2D32f* guesses NULL CvPoint2D32f currFeatures /O char status /O float track_error /O @@ -1726,7 +1726,7 @@ CreateMatND CvMatND /doconly ints dims int type CreateMemStorage CvMemStorage /doconly - int blockSize + int blockSize 0 CreateTrackbar /doconly char* trackbarName char* windowName @@ -1738,7 +1738,7 @@ FindChessboardCorners corners /doconly CvSize patternSize CvPoint2D32fs corners /O int flags CV_CALIB_CB_ADAPTIVE_THRESH -FindContours /doconly +FindContours CvSeq /doconly CvArr image CvMemStorage storage int mode CV_RETR_LIST @@ -1751,14 +1751,14 @@ FitLine line /doconly double reps double aeps PyObject* line /O -GetDims /doconly +GetDims dim1,dim2,... /doconly CvArr arr GetHuMoments hu /doconly CvMoments moments PyObject* hu /O -GetImage /doconly +GetImage iplimage /doconly CvMat arr -GetMat /doconly +GetMat CvMat /doconly IplImage arr int allowND 0 GetMinMaxHistValue min_value,max_value,min_idx,max_idx /doconly @@ -1780,14 +1780,14 @@ LoadImageM /doconly LoadImage /doconly char* filename int iscolor CV_LOAD_IMAGE_COLOR -ReshapeMatND /doconly +ReshapeMatND CvMat /doconly CvMat arr int newCn ints newDims -Reshape /doconly +Reshape CvMat /doconly CvArr arr int newCn - int newRows + int newRows 0 SetData /doconly CvArr arr PyObject* data @@ -1801,5 +1801,5 @@ Subdiv2DLocate loc,where /doconly CvPoint2D32f pt int loc /O edgeorpoint where /O -WaitKey /doconly +WaitKey int /doconly int delay 0 diff --git a/modules/python/src2/cv2.cv.hpp b/modules/python/src2/cv2.cv.hpp index c539f1f..151d4e5 100644 --- a/modules/python/src2/cv2.cv.hpp +++ b/modules/python/src2/cv2.cv.hpp @@ -3844,7 +3844,7 @@ static double cppKMeans(const CvArr* _samples, int cluster_count, CvArr* _labels static PyMethodDef old_methods[] = { #if PYTHON_USE_NUMPY - {"fromarray", (PyCFunction)pycvfromarray, METH_KEYWORDS, "fromarray(array) -> cvmatnd"}, + {"fromarray", (PyCFunction)pycvfromarray, METH_KEYWORDS, "fromarray(array [, allowND]) -> CvMat"}, #endif {"FindDataMatrix", pyfinddatamatrix, METH_VARARGS}, diff --git a/modules/stitching/doc/blenders.rst b/modules/stitching/doc/blenders.rst index f73fd68..93c3b1e 100644 --- a/modules/stitching/doc/blenders.rst +++ b/modules/stitching/doc/blenders.rst @@ -64,7 +64,7 @@ Blends and returns the final pano. detail::FeatherBlender ---------------------- -.. ocv:class:: detail::FeatherBlender +.. ocv:class:: detail::FeatherBlender : public Blender Simple blender which mixes images at its borders. :: @@ -93,7 +93,7 @@ Simple blender which mixes images at its borders. :: detail::MultiBandBlender ------------------------ -.. ocv:class:: detail::MultiBandBlender +.. ocv:class:: detail::MultiBandBlender : public Blender Blender which uses multi-band blending algorithm (see [BA83]_). :: diff --git a/modules/stitching/doc/camera.rst b/modules/stitching/doc/camera.rst index 5f7040b..dc0b99e 100644 --- a/modules/stitching/doc/camera.rst +++ b/modules/stitching/doc/camera.rst @@ -5,7 +5,7 @@ Camera detail::CameraParams -------------------- -.. ocv:class:: detail::CameraParams +.. ocv:struct:: detail::CameraParams Describes camera parameters. diff --git a/modules/stitching/doc/exposure_compensation.rst b/modules/stitching/doc/exposure_compensation.rst index 6c415a8..83acd1a 100644 --- a/modules/stitching/doc/exposure_compensation.rst +++ b/modules/stitching/doc/exposure_compensation.rst @@ -54,7 +54,7 @@ Compensate exposure in the specified image. detail::NoExposureCompensator ----------------------------- -.. ocv:class:: detail::NoExposureCompensator +.. ocv:class:: detail::NoExposureCompensator : public ExposureCompensator Stub exposure compensator which does nothing. :: @@ -70,7 +70,7 @@ Stub exposure compensator which does nothing. :: 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. :: @@ -90,7 +90,7 @@ Exposure compensator which tries to remove exposure related artifacts by adjusti 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. :: diff --git a/modules/stitching/doc/high_level.rst b/modules/stitching/doc/high_level.rst index dfab615..5834072 100644 --- a/modules/stitching/doc/high_level.rst +++ b/modules/stitching/doc/high_level.rst @@ -164,7 +164,7 @@ Image warper factories base class. :: PlaneWarper ----------- -.. ocv:class:: PlaneWarper +.. ocv:class:: PlaneWarper : public WarperCreator Plane warper factory class. :: @@ -178,7 +178,7 @@ Plane warper factory class. :: CylindricalWarper ----------------- -.. ocv:class:: CylindricalWarper +.. ocv:class:: CylindricalWarper : public WarperCreator Cylindrical warper factory class. :: @@ -192,7 +192,7 @@ Cylindrical warper factory class. :: SphericalWarper --------------- -.. ocv:class:: SphericalWarper +.. ocv:class:: SphericalWarper : public WarperCreator Spherical warper factory class. :: diff --git a/modules/stitching/doc/matching.rst b/modules/stitching/doc/matching.rst index d5a68cd..99be6af 100644 --- a/modules/stitching/doc/matching.rst +++ b/modules/stitching/doc/matching.rst @@ -5,7 +5,7 @@ Features Finding and Images Matching detail::ImageFeatures ----------------------- -.. ocv:struct:: detail::ImageFeatures +.. ocv:struct:: detail::ImageFeatures Structure containing image keypoints and descriptors. :: @@ -47,10 +47,10 @@ Finds features in the given image. :param image: Source image :param features: Found features - + :param rois: Regions of interest -.. seealso:: :ocv:struct:`detail::ImageFeatures`, :ocv:class:`Rect_` +.. seealso:: :ocv:struct:`detail::ImageFeatures`, :ocv:class:`Rect_` 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) :param image: Source image - + :param features: Found features .. seealso:: :ocv:struct:`detail::ImageFeatures` detail::SurfFeaturesFinder -------------------------- -.. ocv:class:: detail::SurfFeaturesFinder +.. ocv:class:: detail::SurfFeaturesFinder : public FeaturesFinder SURF features finder. :: @@ -92,14 +92,14 @@ SURF features finder. :: detail::OrbFeaturesFinder ------------------------- -.. ocv:class:: detail::OrbFeaturesFinder +.. ocv:class:: detail::OrbFeaturesFinder : public FeaturesFinder ORB features finder. :: class CV_EXPORTS OrbFeaturesFinder : public FeaturesFinder { 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)); private: @@ -139,10 +139,10 @@ Feature matchers base class. :: public: 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); } - void operator ()(const std::vector &features, std::vector &pairwise_matches, + void operator ()(const std::vector &features, std::vector &pairwise_matches, const Mat &mask = cv::Mat()); bool isThreadSafe() const { return is_thread_safe_; } @@ -152,7 +152,7 @@ Feature matchers base class. :: protected: 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; bool is_thread_safe_; @@ -172,7 +172,7 @@ Performs images matching. :param matches_info: Found matches .. ocv:function:: void detail::FeaturesMatcher::operator ()(const std::vector &features, std::vector &pairwise_matches, const Mat &mask) - + :param features: Features of the source images :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) :param features1: First image features - + :param features2: Second image features :param matches_info: Found matches 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``. :: class CV_EXPORTS BestOf2NearestMatcher : public FeaturesMatcher { 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); void collectGarbage(); @@ -239,7 +239,7 @@ detail::BestOf2NearestMatcher::BestOf2NearestMatcher 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 diff --git a/modules/stitching/doc/motion_estimation.rst b/modules/stitching/doc/motion_estimation.rst index 123ddd7..0d35f72 100644 --- a/modules/stitching/doc/motion_estimation.rst +++ b/modules/stitching/doc/motion_estimation.rst @@ -55,7 +55,7 @@ This method must implement camera parameters estimation logic in order to make t detail::HomographyBasedEstimator -------------------------------- -.. ocv:class:: detail::HomographyBasedEstimator +.. ocv:class:: detail::HomographyBasedEstimator : public Estimator Homography based rotation estimator. :: @@ -71,7 +71,7 @@ Homography based rotation estimator. :: detail::BundleAdjusterBase -------------------------- -.. ocv:class:: detail::BundleAdjusterBase +.. ocv:class:: detail::BundleAdjusterBase : public Estimator Base class for all camera parameters refinement methods. :: @@ -187,7 +187,7 @@ Gets the refined camera parameters. 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. :: @@ -204,7 +204,7 @@ Implementation of the camera parameters refinement algorithm which minimizes sum 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. :: diff --git a/modules/stitching/doc/seam_estimation.rst b/modules/stitching/doc/seam_estimation.rst index 0aacdb9..27657cf 100644 --- a/modules/stitching/doc/seam_estimation.rst +++ b/modules/stitching/doc/seam_estimation.rst @@ -33,7 +33,7 @@ Estimates seams. detail::NoSeamFinder -------------------- -.. ocv:class:: detail::NoSeamFinder +.. ocv:class:: detail::NoSeamFinder : public SeamFinder Stub seam estimator which does nothing. :: @@ -47,7 +47,7 @@ Stub seam estimator which does nothing. :: detail::PairwiseSeamFinder -------------------------- -.. ocv:class:: detail::PairwiseSeamFinder +.. ocv:class:: detail::PairwiseSeamFinder : public SeamFinder Base class for all pairwise seam estimators. :: @@ -84,7 +84,7 @@ Resolves masks intersection of two specified images in the given ROI. detail::VoronoiSeamFinder ------------------------- -.. ocv:class:: detail::VoronoiSeamFinder +.. ocv:class:: detail::VoronoiSeamFinder : public PairwiseSeamFinder Voronoi diagram-based seam estimator. :: @@ -113,7 +113,7 @@ Base class for all minimum graph-cut-based seam estimators. :: detail::GraphCutSeamFinder -------------------------- -.. ocv:class:: detail::GraphCutSeamFinder +.. ocv:class:: detail::GraphCutSeamFinder : public GraphCutSeamFinderBase, public SeamFinder Minimum graph cut-based seam estimator. See details in [V03]_. :: diff --git a/modules/stitching/doc/warpers.rst b/modules/stitching/doc/warpers.rst index 5cfd194..9db717a 100644 --- a/modules/stitching/doc/warpers.rst +++ b/modules/stitching/doc/warpers.rst @@ -172,7 +172,7 @@ Base class for rotation-based warper using a `detail::ProjectorBase`_ derived cl detail::PlaneWarper ------------------- -.. ocv:class:: detail::PlaneWarper +.. ocv:class:: detail::PlaneWarper : public RotationWarperBase Warper that maps an image onto the z = 1 plane. :: @@ -209,7 +209,7 @@ Construct an instance of the plane warper class. detail::SphericalWarper ----------------------- -.. ocv:class:: detail::SphericalWarper +.. ocv:class:: detail::SphericalWarper : public RotationWarperBase 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 ------------------------- -.. ocv:class:: detail::CylindricalWarper +.. ocv:class:: detail::CylindricalWarper : public RotationWarperBase Warper that maps an image onto the x*x + z*z = 1 cylinder. :: diff --git a/modules/video/doc/motion_analysis_and_object_tracking.rst b/modules/video/doc/motion_analysis_and_object_tracking.rst index 09a0481..f56e6dc 100644 --- a/modules/video/doc/motion_analysis_and_object_tracking.rst +++ b/modules/video/doc/motion_analysis_and_object_tracking.rst @@ -8,12 +8,12 @@ calcOpticalFlowPyrLK ------------------------ 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: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:pyoldfunction:: cv.CalcOpticalFlowPyrLK( prev, curr, prevPyr, currPyr, prevFeatures, winSize, level, criteria, flags, guesses=None) -> (currFeatures, status, trackError) +.. 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, track_error) :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 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: - + * **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. :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. buildOpticalFlowPyramid @@ -73,11 +73,11 @@ calcOpticalFlowFarneback ---------------------------- 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. @@ -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 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: * **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 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: .. 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 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:: @@ -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: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 :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 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 .. math:: @@ -241,13 +241,13 @@ Calculates a global motion orientation in a selected region. .. ocv:pyoldfunction:: cv.CalcGlobalOrientation(orientation, mask, mhi, timestamp, duration)-> float :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 mhi: Motion history image calculated by :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` . 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:cfunction:: CvSeq* cvSegmentMotion( const CvArr* mhi, CvArr* segMask, CvMemStorage* storage, double timestamp, double segThresh ) -.. ocv:pyoldfunction:: cv.SegmentMotion(mhi, segMask, storage, timestamp, segThresh)-> None +.. ocv:cfunction:: CvSeq* cvSegmentMotion( const CvArr* mhi, CvArr* seg_mask, CvMemStorage* storage, double timestamp, double seg_thresh ) +.. ocv:pyoldfunction:: cv.SegmentMotion(mhi, seg_mask, storage, timestamp, seg_thresh) -> boundingRects :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 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. @@ -294,17 +294,17 @@ Finds an object center, size, and orientation. .. 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 window: Initial search window. :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 [Bradski98]_. @@ -323,11 +323,11 @@ Finds an object on a back projection image. .. ocv:pyfunction:: cv2.meanShift(probImage, window, criteria) -> retval, window -.. ocv:cfunction:: int cvMeanShift( const CvArr* probImage, CvRect window, CvTermCriteria criteria, CvConnectedComp* comp ) -.. ocv:pyoldfunction:: cv.MeanShift(probImage, window, criteria)-> comp +.. ocv:cfunction:: int cvMeanShift( const CvArr* prob_image, CvRect window, CvTermCriteria criteria, CvConnectedComp* 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 window: Initial search window. :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:pyfunction:: cv2.KalmanFilter(dynamParams, measureParams[, controlParams[, type]]) -> +.. ocv:pyfunction:: cv2.KalmanFilter([dynamParams, measureParams[, controlParams[, type]]]) -> -.. ocv:cfunction:: CvKalman* cvCreateKalman( int dynamParams, int measureParams, int controlParams=0 ) -.. ocv:pyoldfunction:: cv.CreateKalman(dynamParams, measureParams, controlParams=0) -> CvKalman +.. ocv:cfunction:: CvKalman* cvCreateKalman( int dynam_params, int measure_params, int control_params=0 ) +.. ocv:pyoldfunction:: cv.CreateKalman(dynam_params, measure_params, control_params=0) -> CvKalman The full constructor. - + :param dynamParams: Dimensionality of the state. - + :param measureParams: Dimensionality of the measurement. - + :param controlParams: Dimensionality of the control vector. :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) :param dynamParams: Dimensionalityensionality of the state. - + :param measureParams: Dimensionality of the measurement. - + :param controlParams: Dimensionality of the control vector. :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: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:pyoldfunction:: cv.KalmanPredict(kalman, control=None) -> cvmat +.. ocv:pyoldfunction:: cv.KalmanPredict(kalman, control=None) -> mat :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:pyoldfunction:: cv.KalmanCorrect(kalman, measurement) -> cvmat +.. ocv:pyoldfunction:: cv.KalmanCorrect(kalman, measurement) -> mat :param measurement: The measured system parameters @@ -464,7 +464,7 @@ Computes a background image. .. ocv:function:: void BackgroundSubtractor::getBackgroundImage(OutputArray backgroundImage) const :param backgroundImage: The output background image. - + .. note:: Sometimes the background image can be very blurry, as it contain the average background statistics. BackgroundSubtractorMOG @@ -487,7 +487,7 @@ The constructors. .. ocv:function:: BackgroundSubtractorMOG::BackgroundSubtractorMOG(int history, int nmixtures, double backgroundRatio, double noiseSigma=0) -.. ocv:pyfunction:: cv2.BackgroundSubtractorMOG(history, nmixtures, backgroundRatio[, noiseSigma]) -> +.. ocv:pyfunction:: cv2.BackgroundSubtractorMOG([history, nmixtures, backgroundRatio[, noiseSigma]]) -> :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: .. ocv:member:: int nmixtures - + Maximum allowed number of mixture components. Actual number is determined dynamically per pixel. .. 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. .. 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. .. 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. - .. ocv:member:: float fVarMin - + .. ocv:member:: float fVarMin + Parameter used to further control the variance. .. ocv:member:: float fVarMax - + Parameter used to further control the variance. .. 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. .. ocv:member:: uchar nShadowDetection - + The value for marking shadow pixels in the output foreground mask. Default value is 127. .. 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. @@ -569,7 +569,7 @@ The constructors. .. 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. @@ -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 -.. [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. -- 2.7.4