Unified handling of InputOutputArrays in Python wrapper generator

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
This commit is contained in:
Andrey Kamaev
2013-03-15 16:55:58 +04:00
parent a1c456b7c3
commit e75df56317
18 changed files with 51 additions and 47 deletions

View 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 )

View 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) )

View 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))