Unified handling of InputOutputArrays in Python wrapper generator
authorAndrey Kamaev <andrey.kamaev@itseez.com>
Fri, 15 Mar 2013 12:55:58 +0000 (16:55 +0400)
committerAndrey Kamaev <andrey.kamaev@itseez.com>
Fri, 15 Mar 2013 13:44:49 +0000 (17:44 +0400)
This makes arguments of type InputOutputArray required in python unless they
have a default value in C++.

As result following python functions changes signatures in non-trivial way:

* calcOpticalFlowFarneback
* calcOpticalFlowPyrLK
* calibrateCamera
* findContours
* findTransformECC
* floodFill
* kmeans
* PCACompute
* stereoCalibrate

And the following functions become return their modified inputs as a return
value:

* accumulate
* accumulateProduct
* accumulateSquare
* accumulateWeighted
* circle
* completeSymm
* cornerSubPix
* drawChessboardCorners
* drawContours
* drawDataMatrixCodes
* ellipse
* fillConvexPoly
* fillPoly
* filterSpeckles
* grabCut
* insertChannel
* line
* patchNaNs
* polylines
* randn
* randShuffle
* randu
* rectangle
* setIdentity
* updateMotionHistory
* validateDisparity
* watershed

18 files changed:
modules/calib3d/doc/camera_calibration_and_3d_reconstruction.rst
modules/core/doc/clustering.rst
modules/core/doc/drawing_functions.rst
modules/core/doc/operations_on_arrays.rst
modules/imgproc/doc/feature_detection.rst
modules/imgproc/doc/miscellaneous_transformations.rst
modules/imgproc/doc/motion_analysis_and_object_tracking.rst
modules/imgproc/doc/structural_analysis_and_shape_descriptors.rst
modules/python/src2/gen2.py
modules/softcascade/doc/softcascade_detector.rst
modules/video/doc/motion_analysis_and_object_tracking.rst
samples/python2/calibrate.py
samples/python2/contours.py
samples/python2/digits_video.py
samples/python2/floodfill.py
samples/python2/kmeans.py
samples/python2/opt_flow.py
samples/python2/squares.py

index 1759dc5..26c73f1 100644 (file)
@@ -117,7 +117,7 @@ Finds the camera intrinsic and extrinsic parameters from several views of a cali
 
 .. ocv:function:: double calibrateCamera( InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints, Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, int flags=0, TermCriteria criteria=TermCriteria( TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON) )
 
-.. ocv:pyfunction:: cv2.calibrateCamera(objectPoints, imagePoints, imageSize[, cameraMatrix[, distCoeffs[, rvecs[, tvecs[, flags[, criteria]]]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs
+.. ocv:pyfunction:: cv2.calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs[, rvecs[, tvecs[, flags[, criteria]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs
 
 .. ocv:cfunction:: double cvCalibrateCamera2( const CvMat* 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) )
 
@@ -433,7 +433,7 @@ Renders the detected chessboard corners.
 
 .. ocv:function:: void drawChessboardCorners( InputOutputArray image, Size patternSize, InputArray corners, bool patternWasFound )
 
-.. ocv:pyfunction:: cv2.drawChessboardCorners(image, patternSize, corners, patternWasFound) -> None
+.. ocv:pyfunction:: cv2.drawChessboardCorners(image, patternSize, corners, patternWasFound) -> image
 
 .. 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
@@ -923,7 +923,7 @@ Filters off small noise blobs (speckles) in the disparity map
 
 .. ocv:function:: void filterSpeckles( InputOutputArray img, double newVal, int maxSpeckleSize, double maxDiff, InputOutputArray buf=noArray() )
 
-.. ocv:pyfunction:: cv2.filterSpeckles(img, newVal, maxSpeckleSize, maxDiff[, buf]) -> None
+.. ocv:pyfunction:: cv2.filterSpeckles(img, newVal, maxSpeckleSize, maxDiff[, buf]) -> img, buf
 
     :param img: The input 16-bit signed disparity image
 
@@ -1362,7 +1362,7 @@ 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 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, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize[, R[, T[, E[, F[, criteria[, flags]]]]]]) -> retval, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, R, T, E, F
 
 .. 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 )
 
index 5b00d04..60fb189 100644 (file)
@@ -9,7 +9,7 @@ Finds centers of clusters and groups input samples around the clusters.
 
 .. ocv:function:: double kmeans( InputArray data, int K, InputOutputArray bestLabels, TermCriteria criteria, int attempts, int flags, OutputArray centers=noArray() )
 
-.. ocv:pyfunction:: cv2.kmeans(data, K, criteria, attempts, flags[, bestLabels[, centers]]) -> retval, bestLabels, centers
+.. ocv:pyfunction:: cv2.kmeans(data, K, bestLabels, criteria, attempts, flags[, centers]) -> retval, bestLabels, centers
 
 .. ocv:cfunction:: int cvKMeans2( const CvArr* samples, int cluster_count, CvArr* labels, CvTermCriteria termcrit, int attempts=1, CvRNG* rng=0, int flags=0, CvArr* _centers=0, double* compactness=0 )
 
index 8884f19..6c0ac4b 100644 (file)
@@ -32,7 +32,7 @@ Draws a circle.
 
 .. ocv:function:: void circle(Mat& img, Point center, int radius, const Scalar& color, int thickness=1, int lineType=8, int shift=0)
 
-.. ocv:pyfunction:: cv2.circle(img, center, radius, color[, thickness[, lineType[, shift]]]) -> None
+.. ocv:pyfunction:: cv2.circle(img, center, radius, color[, thickness[, lineType[, shift]]]) -> img
 
 .. ocv:cfunction:: void cvCircle( CvArr* img, CvPoint center, int radius, CvScalar color, int thickness=1, int line_type=8, int shift=0 )
 
@@ -83,12 +83,13 @@ ellipse
 -----------
 Draws a simple or thick elliptic arc or fills an ellipse sector.
 
-.. ocv:function:: void ellipse(Mat& img, Point center, Size axes,             double angle, double startAngle, double endAngle,             const Scalar& color, int thickness=1,             int lineType=8, int shift=0)
+.. ocv:function:: void ellipse(Mat& img, Point center, Size axes, double angle, double startAngle, double endAngle, const Scalar& color, int thickness=1, int lineType=8, int shift=0)
 
-.. ocv:function:: void ellipse(Mat& img, const RotatedRect& box, const Scalar& color,             int thickness=1, int lineType=8)
+.. ocv:function:: void ellipse(Mat& img, const RotatedRect& box, const Scalar& color, int thickness=1, int lineType=8)
 
-.. ocv:pyfunction:: cv2.ellipse(img, center, axes, angle, startAngle, endAngle, color[, thickness[, lineType[, shift]]]) -> None
-.. ocv:pyfunction:: cv2.ellipse(img, box, color[, thickness[, lineType]]) -> None
+.. ocv:pyfunction:: cv2.ellipse(img, center, axes, angle, startAngle, endAngle, color[, thickness[, lineType[, shift]]]) -> img
+
+.. ocv:pyfunction:: cv2.ellipse(img, box, color[, thickness[, lineType]]) -> img
 
 .. ocv:cfunction:: void cvEllipse( CvArr* img, CvPoint center, CvSize axes, double angle, double start_angle, double end_angle, CvScalar color, int thickness=1, int line_type=8, int shift=0 )
 
@@ -163,7 +164,7 @@ Fills a convex polygon.
 
 .. ocv:function:: void fillConvexPoly(Mat& img, const Point* pts, int npts, const Scalar& color, int lineType=8, int shift=0)
 
-.. ocv:pyfunction:: cv2.fillConvexPoly(img, points, color[, lineType[, shift]]) -> None
+.. ocv:pyfunction:: cv2.fillConvexPoly(img, points, color[, lineType[, shift]]) -> img
 
 .. ocv:cfunction:: void cvFillConvexPoly( CvArr* img, const CvPoint* pts, int npts, CvScalar color, int line_type=8, int shift=0 )
 
@@ -193,7 +194,7 @@ Fills the area bounded by one or more polygons.
 
 .. ocv:function:: void fillPoly(Mat& img, const Point** pts,               const int* npts, int ncontours,              const Scalar& color, int lineType=8,              int shift=0, Point offset=Point() )
 
-.. ocv:pyfunction:: cv2.fillPoly(img, pts, color[, lineType[, shift[, offset]]]) -> None
+.. ocv:pyfunction:: cv2.fillPoly(img, pts, color[, lineType[, shift[, offset]]]) -> img
 
 .. ocv:cfunction:: void cvFillPoly( CvArr* img, CvPoint** pts, const int* npts, int contours, CvScalar color, int line_type=8, int shift=0 )
 
@@ -331,7 +332,7 @@ Draws a line segment connecting two points.
 
 .. ocv:function:: void line(Mat& img, Point pt1, Point pt2, const Scalar& color,          int thickness=1, int lineType=8, int shift=0)
 
-.. ocv:pyfunction:: cv2.line(img, pt1, pt2, color[, thickness[, lineType[, shift]]]) -> None
+.. ocv:pyfunction:: cv2.line(img, pt1, pt2, color[, thickness[, lineType[, shift]]]) -> img
 
 .. ocv:cfunction:: void cvLine( CvArr* img, CvPoint pt1, CvPoint pt2, CvScalar color, int thickness=1, int line_type=8, int shift=0 )
 
@@ -421,7 +422,7 @@ Draws a simple, thick, or filled up-right rectangle.
 
 .. ocv:function:: void rectangle( Mat& img, Rect rec, const Scalar& color, int thickness=1, int lineType=8, int shift=0 )
 
-.. ocv:pyfunction:: cv2.rectangle(img, pt1, pt2, color[, thickness[, lineType[, shift]]]) -> None
+.. ocv:pyfunction:: cv2.rectangle(img, pt1, pt2, color[, thickness[, lineType[, shift]]]) -> img
 
 .. ocv:cfunction:: void cvRectangle( CvArr* img, CvPoint pt1, CvPoint pt2, CvScalar color, int thickness=1, int line_type=8, int shift=0 )
 
@@ -455,7 +456,7 @@ Draws several polygonal curves.
 
 .. ocv:function:: void polylines( InputOutputArray img, InputArrayOfArrays pts, bool isClosed, const Scalar& color, int thickness=1, int lineType=8, int shift=0 )
 
-.. ocv:pyfunction:: cv2.polylines(img, pts, isClosed, color[, thickness[, lineType[, shift]]]) -> None
+.. ocv:pyfunction:: cv2.polylines(img, pts, isClosed, color[, thickness[, lineType[, shift]]]) -> img
 
 .. ocv:cfunction:: void cvPolyLine( CvArr* img, CvPoint** pts, const int* npts, int contours, int is_closed, CvScalar color, int thickness=1, int line_type=8, int shift=0 )
 
@@ -488,7 +489,7 @@ Draws contours outlines or filled contours.
 
 .. ocv:function:: void drawContours( InputOutputArray image, InputArrayOfArrays contours, int contourIdx, const Scalar& color, int thickness=1, int lineType=8, InputArray hierarchy=noArray(), int maxLevel=INT_MAX, Point offset=Point() )
 
-.. ocv:pyfunction:: cv2.drawContours(image, contours, contourIdx, color[, thickness[, lineType[, hierarchy[, maxLevel[, offset]]]]]) -> None
+.. ocv:pyfunction:: cv2.drawContours(image, contours, contourIdx, color[, thickness[, lineType[, hierarchy[, maxLevel[, offset]]]]]) -> image
 
 .. ocv:cfunction:: void cvDrawContours( CvArr * img, CvSeq* contour, CvScalar external_color, CvScalar hole_color, int max_level, int thickness=1, int line_type=8, CvPoint offset=cvPoint(0,0) )
 
index 59b319d..64ca686 100644 (file)
@@ -592,7 +592,7 @@ Copies the lower or the upper half of a square matrix to another half.
 
 .. ocv:function:: void completeSymm(InputOutputArray mtx, bool lowerToUpper=false)
 
-.. ocv:pyfunction:: cv2.completeSymm(mtx[, lowerToUpper]) -> None
+.. ocv:pyfunction:: cv2.completeSymm(mtx[, lowerToUpper]) -> mtx
 
     :param mtx: input-output floating-point square matrix.
 
@@ -2299,7 +2299,9 @@ Performs Principal Component Analysis of the supplied dataset.
 
 .. ocv:function:: PCA& PCA::operator()(InputArray data, InputArray mean, int flags, double retainedVariance)
 
-.. ocv:pyfunction:: cv2.PCACompute(data[, mean[, eigenvectors[, maxComponents]]]) -> mean, eigenvectors
+.. ocv:pyfunction:: cv2.PCACompute(data, mean[, eigenvectors[, maxComponents]]) -> mean, eigenvectors
+
+.. ocv:pyfunction:: cv2.PCACompute(data, mean, retainedVariance[, eigenvectors]) -> mean, eigenvectors
 
     :param data: input samples stored as the matrix rows or as the matrix columns.
 
@@ -2670,7 +2672,7 @@ Generates a single uniformly-distributed random number or an array of random num
 
 .. ocv:function:: void randu( InputOutputArray dst, InputArray low, InputArray high )
 
-.. ocv:pyfunction:: cv2.randu(dst, low, high) -> None
+.. ocv:pyfunction:: cv2.randu(dst, low, high) -> dst
 
     :param dst: output array of random numbers; the array must be pre-allocated.
 
@@ -2701,7 +2703,7 @@ Fills the array with normally distributed random numbers.
 
 .. ocv:function:: void randn( InputOutputArray dst, InputArray mean, InputArray stddev )
 
-.. ocv:pyfunction:: cv2.randn(dst, mean, stddev) -> None
+.. ocv:pyfunction:: cv2.randn(dst, mean, stddev) -> dst
 
     :param dst: output array of random numbers; the array must be pre-allocated and have 1 to 4 channels.
 
@@ -2724,7 +2726,7 @@ Shuffles the array elements randomly.
 
 .. ocv:function:: void randShuffle( InputOutputArray dst, double iterFactor=1., RNG* rng=0 )
 
-.. ocv:pyfunction:: cv2.randShuffle(dst[, iterFactor]) -> None
+.. ocv:pyfunction:: cv2.randShuffle(dst[, iterFactor]) -> dst
 
     :param dst: input/output numerical 1D array.
 
@@ -2864,7 +2866,7 @@ Initializes a scaled identity matrix.
 
 .. ocv:function:: void setIdentity( InputOutputArray mtx, const Scalar& s=Scalar(1) )
 
-.. ocv:pyfunction:: cv2.setIdentity(mtx[, s]) -> None
+.. ocv:pyfunction:: cv2.setIdentity(mtx[, s]) -> mtx
 
 .. ocv:cfunction:: void cvSetIdentity(CvArr* mat, CvScalar value=cvRealScalar(1))
 
index c705842..5098ba1 100644 (file)
@@ -162,7 +162,7 @@ Refines the corner locations.
 
 .. ocv:function:: void cornerSubPix( InputArray image, InputOutputArray corners, Size winSize, Size zeroZone, TermCriteria criteria )
 
-.. ocv:pyfunction:: cv2.cornerSubPix(image, corners, winSize, zeroZone, criteria) -> None
+.. ocv:pyfunction:: cv2.cornerSubPix(image, corners, winSize, zeroZone, criteria) -> corners
 
 .. ocv:cfunction:: void cvFindCornerSubPix( const CvArr* image, CvPoint2D32f* corners, int count, CvSize win, CvSize zero_zone, CvTermCriteria criteria )
 
index 4ebf6d5..a82923f 100644 (file)
@@ -488,7 +488,7 @@ Fills a connected component with the given color.
 
 .. ocv:function:: int floodFill( InputOutputArray image, InputOutputArray mask, Point seedPoint, Scalar newVal, Rect* rect=0, Scalar loDiff=Scalar(), Scalar upDiff=Scalar(), int flags=4 )
 
-.. ocv:pyfunction:: cv2.floodFill(image, mask, seedPoint, newVal[, loDiff[, upDiff[, flags]]]) -> retval, rect
+.. ocv:pyfunction:: cv2.floodFill(image, mask, seedPoint, newVal[, loDiff[, upDiff[, flags]]]) -> retval, image, mask, rect
 
 .. 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
@@ -731,7 +731,7 @@ Performs a marker-based image segmentation using the watershed algorithm.
 
 .. ocv:cfunction:: void cvWatershed( const CvArr* image, CvArr* markers )
 
-.. ocv:pyfunction:: cv2.watershed(image, markers) -> None
+.. ocv:pyfunction:: cv2.watershed(image, markers) -> markers
 
     :param image: Input 8-bit 3-channel image.
 
@@ -753,7 +753,7 @@ Runs the GrabCut algorithm.
 
 .. ocv:function:: void grabCut( InputArray img, InputOutputArray mask, Rect rect, InputOutputArray bgdModel, InputOutputArray fgdModel, int iterCount, int mode=GC_EVAL )
 
-.. ocv:pyfunction:: cv2.grabCut(img, mask, rect, bgdModel, fgdModel, iterCount[, mode]) -> None
+.. ocv:pyfunction:: cv2.grabCut(img, mask, rect, bgdModel, fgdModel, iterCount[, mode]) -> mask, bgdModel, fgdModel
 
     :param img: Input 8-bit 3-channel image.
 
index 8083481..bcc372a 100644 (file)
@@ -9,7 +9,7 @@ Adds an image to the accumulator.
 
 .. ocv:function:: void accumulate( InputArray src, InputOutputArray dst, InputArray mask=noArray() )
 
-.. ocv:pyfunction:: cv2.accumulate(src, dst[, mask]) -> None
+.. ocv:pyfunction:: cv2.accumulate(src, dst[, mask]) -> dst
 
 .. ocv:cfunction:: void cvAcc( const CvArr* image, CvArr* sum, const CvArr* mask=NULL )
 
@@ -45,7 +45,7 @@ Adds the square of a source image to the accumulator.
 
 .. ocv:function:: void accumulateSquare( InputArray src, InputOutputArray dst,  InputArray mask=noArray() )
 
-.. ocv:pyfunction:: cv2.accumulateSquare(src, dst[, mask]) -> None
+.. ocv:pyfunction:: cv2.accumulateSquare(src, dst[, mask]) -> dst
 
 .. ocv:cfunction:: void cvSquareAcc( const CvArr* image, CvArr* sqsum, const CvArr* mask=NULL )
 
@@ -79,7 +79,7 @@ Adds the per-element product of two input images to the accumulator.
 
 .. ocv:function:: void accumulateProduct( InputArray src1, InputArray src2, InputOutputArray dst, InputArray mask=noArray() )
 
-.. ocv:pyfunction:: cv2.accumulateProduct(src1, src2, dst[, mask]) -> None
+.. ocv:pyfunction:: cv2.accumulateProduct(src1, src2, dst[, mask]) -> dst
 
 .. ocv:cfunction:: void cvMultiplyAcc( const CvArr* image1, const CvArr* image2, CvArr* acc, const CvArr* mask=NULL )
 
@@ -115,7 +115,7 @@ Updates a running average.
 
 .. ocv:function:: void accumulateWeighted( InputArray src, InputOutputArray dst, double alpha, InputArray mask=noArray() )
 
-.. ocv:pyfunction:: cv2.accumulateWeighted(src, dst, alpha[, mask]) -> None
+.. ocv:pyfunction:: cv2.accumulateWeighted(src, dst, alpha[, mask]) -> dst
 
 .. 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
index 9647a76..4c1911a 100644 (file)
@@ -159,7 +159,7 @@ Finds contours in a binary image.
 
 .. ocv:function:: void findContours( InputOutputArray image, OutputArrayOfArrays contours, int mode, int method, Point offset=Point())
 
-.. ocv:pyfunction:: cv2.findContours(image, mode, method[, contours[, hierarchy[, offset]]]) -> contours, hierarchy
+.. ocv:pyfunction:: cv2.findContours(image, mode, method[, contours[, hierarchy[, offset]]]) -> image, contours, hierarchy
 
 .. 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) )
 
index 93ab5ec..c7aa725 100755 (executable)
@@ -354,6 +354,7 @@ class ArgInfo(object):
             elif m == "/IO":
                 self.inputarg = True
                 self.outputarg = True
+                self.returnarg = True
             elif m.startswith("/A"):
                 self.isarray = True
                 self.arraylen = m[2:].strip()
@@ -427,7 +428,7 @@ class FuncVariant(object):
                 continue
             if a.returnarg:
                 outlist.append((a.name, argno))
-            if (not a.inputarg or a.returnarg) and a.isbig():
+            if (not a.inputarg) and a.isbig():
                 outarr_list.append((a.name, argno))
                 continue
             if not a.inputarg:
index 763e862..49d1ab0 100644 (file)
@@ -131,7 +131,7 @@ Destructor for ChannelFeatureBuilder.
 
 .. ocv:function:: softcascade::ChannelFeatureBuilder::~ChannelFeatureBuilder()
 
-.. ocv:pyfunction:: cv2.softcascade_ChannelFeatureBuilder_create() -> retval
+.. ocv:pyfunction:: cv2.softcascade_ChannelFeatureBuilder_create(featureType) -> retval
 
 
 softcascade::ChannelFeatureBuilder::operator()
index 53922a5..a193c23 100644 (file)
@@ -10,7 +10,7 @@ Calculates an optical flow for a sparse feature set using the iterative Lucas-Ka
 
 .. ocv:function:: void calcOpticalFlowPyrLK( InputArray prevImg, InputArray nextImg, InputArray prevPts, InputOutputArray nextPts, OutputArray status, OutputArray err, Size winSize=Size(21,21), int maxLevel=3, TermCriteria criteria=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 0.01), int flags=0, double minEigThreshold=1e-4 )
 
-.. ocv:pyfunction:: cv2.calcOpticalFlowPyrLK(prevImg, nextImg, prevPts[, nextPts[, status[, err[, winSize[, maxLevel[, criteria[, flags[, minEigThreshold]]]]]]]]) -> nextPts, status, err
+.. ocv:pyfunction:: cv2.calcOpticalFlowPyrLK(prevImg, nextImg, prevPts, nextPts[, status[, err[, winSize[, maxLevel[, criteria[, flags[, minEigThreshold]]]]]]]) -> nextPts, status, err
 
 .. ocv:cfunction:: void cvCalcOpticalFlowPyrLK( const CvArr* prev, const CvArr* curr, CvArr* 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)
@@ -77,7 +77,7 @@ Computes a dense optical flow using the Gunnar Farneback's algorithm.
 
 .. 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(prev, next, pyr_scale, levels, winsize, iterations, poly_n, poly_sigma, flags[, flow]) -> flow
+.. ocv:pyfunction:: cv2.calcOpticalFlowFarneback(prev, next, flow, pyr_scale, levels, winsize, iterations, poly_n, poly_sigma, flags) -> flow
 
     :param prev: first 8-bit single-channel input image.
 
@@ -204,7 +204,7 @@ Updates the motion history image by a moving silhouette.
 
 .. ocv:function:: void updateMotionHistory( InputArray silhouette, InputOutputArray mhi, double timestamp, double duration )
 
-.. ocv:pyfunction:: cv2.updateMotionHistory(silhouette, mhi, timestamp, duration) -> None
+.. ocv:pyfunction:: cv2.updateMotionHistory(silhouette, mhi, timestamp, duration) -> mhi
 
 .. ocv:cfunction:: void cvUpdateMotionHistory( const CvArr* silhouette, CvArr* mhi, double timestamp, double duration )
 .. ocv:pyoldfunction:: cv.UpdateMotionHistory(silhouette, mhi, timestamp, duration)-> None
index 37d3de2..e23cc32 100755 (executable)
@@ -27,7 +27,7 @@ if __name__ == '__main__':
         img_mask = img_mask[0]
     except:
         img_mask = '../cpp/left*.jpg'
-    
+
     img_names = glob(img_mask)
     debug_dir = args.get('--debug')
     square_size = float(args.get('--square_size', 1.0))
@@ -46,7 +46,7 @@ if __name__ == '__main__':
         if img is None:
           print "Failed to load", fn
           continue
-        
+
         h, w = img.shape[:2]
         found, corners = cv2.findChessboardCorners(img, pattern_size)
         if found:
@@ -65,7 +65,7 @@ if __name__ == '__main__':
 
         print 'ok'
 
-    rms, camera_matrix, dist_coefs, rvecs, tvecs = cv2.calibrateCamera(obj_points, img_points, (w, h))
+    rms, camera_matrix, dist_coefs, rvecs, tvecs = cv2.calibrateCamera(obj_points, img_points, (w, h), None, None)
     print "RMS:", rms
     print "camera matrix:\n", camera_matrix
     print "distortion coefficients: ", dist_coefs.ravel()
index f8cc12c..f81f212 100755 (executable)
@@ -46,7 +46,7 @@ if __name__ == '__main__':
     img = make_image()
     h, w = img.shape[:2]
 
-    contours0, hierarchy = cv2.findContours( img.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
+    _, contours0, hierarchy = cv2.findContours( img.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
     contours = [cv2.approxPolyDP(cnt, 3, True) for cnt in contours0]
 
     def update(levels):
index 2aa9c16..ca72a93 100755 (executable)
@@ -14,9 +14,9 @@ from common import mosaic
 from digits import *
 
 def main():
-    try: 
+    try:
         src = sys.argv[1]
-    except: 
+    except:
         src = 0
     cap = video.create_capture(src)
 
@@ -35,7 +35,7 @@ def main():
 
         bin = cv2.adaptiveThreshold(gray, 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY_INV, 31, 10)
         bin = cv2.medianBlur(bin, 3)
-        contours, heirs = cv2.findContours( bin.copy(), cv2.RETR_CCOMP, cv2.CHAIN_APPROX_SIMPLE)
+        _, contours, heirs = cv2.findContours( bin.copy(), cv2.RETR_CCOMP, cv2.CHAIN_APPROX_SIMPLE)
         try:
             heirs = heirs[0]
         except:
index 16c6470..ef19141 100755 (executable)
@@ -29,7 +29,7 @@ if __name__ == '__main__':
     if img is None:
         print 'Failed to load image file:', fn
         sys.exit(1)
-    
+
     h, w = img.shape[:2]
     mask = np.zeros((h+2, w+2), np.uint8)
     seed_pt = None
index 0656fa7..ecf8c6f 100755 (executable)
@@ -32,7 +32,7 @@ if __name__ == '__main__':
         points, _ = make_gaussians(cluster_n, img_size)
 
         term_crit = (cv2.TERM_CRITERIA_EPS, 30, 0.1)
-        ret, labels, centers = cv2.kmeans(points, cluster_n, term_crit, 10, 0)
+        ret, labels, centers = cv2.kmeans(points, cluster_n, None, term_crit, 10, 0)
 
         img = np.zeros((img_size, img_size, 3), np.uint8)
         for (x, y), label in zip(np.int32(points), labels.ravel()):
index 0dba85f..14efbfa 100755 (executable)
@@ -63,7 +63,7 @@ if __name__ == '__main__':
     while True:
         ret, img = cam.read()
         gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
-        flow = cv2.calcOpticalFlowFarneback(prevgray, gray, 0.5, 3, 15, 3, 5, 1.2, 0)
+        flow = cv2.calcOpticalFlowFarneback(prevgray, gray, None, 0.5, 3, 15, 3, 5, 1.2, 0)
         prevgray = gray
 
         cv2.imshow('flow', draw_flow(gray, flow))
index 36676b4..c12b884 100755 (executable)
@@ -24,7 +24,7 @@ def find_squares(img):
                 bin = cv2.dilate(bin, None)
             else:
                 retval, bin = cv2.threshold(gray, thrs, 255, cv2.THRESH_BINARY)
-            contours, hierarchy = cv2.findContours(bin, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
+            bin, contours, hierarchy = cv2.findContours(bin, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
             for cnt in contours:
                 cnt_len = cv2.arcLength(cnt, True)
                 cnt = cv2.approxPolyDP(cnt, 0.02*cnt_len, True)