int cvCreateTrackbar( \par const char* trackbarName, \par const char* windowName,
\par int* value, \par int count, \par CvTrackbarCallback onChange );
}
-\cvdefPy{CreateTrackbar(trackbarName, windowName, value, count, onChange)}
+\cvdefPy{CreateTrackbar(trackbarName, windowName, value, count, onChange) -> None}
\begin{lstlisting}
CV_EXTERN_C_FUNCPTR( void (*CvTrackbarCallback)(int pos) );
\end{lstlisting}
\cvdefC{
IplImage* cvLoadImage( \par const char* filename, \par int iscolor=CV\_LOAD\_IMAGE\_COLOR );}
-\cvdefPy{LoadImage(filename, iscolor=CV\_LOAD\_IMAGE\_COLOR)}
+\cvdefPy{LoadImage(filename, iscolor=CV\_LOAD\_IMAGE\_COLOR)->None}
\begin{lstlisting}
#define CV_LOAD_IMAGE_COLOR 1
Sets video capturing properties.
\cvdefC{int cvSetCaptureProperty( \par CvCapture* capture, \par int property\_id, \par double value );}
-\cvdefPy{SetCaptureProperty(capture, property\_id,double)}
+\cvdefPy{SetCaptureProperty(capture, property\_id,double)->None}
\begin{description}
\cvarg{capture}{video capturing structure.}
\cvdefC{
void cvCalcImageHomography( \par float* line,\par CvPoint3D32f* center,\par float* intrinsic,\par float* homography );
-}\cvdefPy{CalcImageHomography(line,points)-> intrinsic,homography}
+}
+\cvdefPy{CalcImageHomography(line,points)-> (intrinsic,homography)}
\begin{description}
\cvarg{line}{the main object axis direction (vector (dx,dy,dz))}
\fi
-\cvFunc{CalibrateCamera2}{calibrateCamera}
+\cvfunc{CalibrateCamera2}{calibrateCamera}
Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.
\cvdefC{double cvCalibrateCamera2( \par const CvMat* objectPoints,\par const CvMat* imagePoints,\par const CvMat* pointCounts,\par CvSize imageSize,\par CvMat* cameraMatrix,\par CvMat* distCoeffs,\par CvMat* rvecs=NULL,\par CvMat* tvecs=NULL,\par int flags=0 );}
\fi
-\cvFunc{ComputeCorrespondEpilines}{computeCorrespondEpilines}
+\cvfunc{ComputeCorrespondEpilines}{computeCorrespondEpilines}
For points in one image of a stereo pair, computes the corresponding epilines in the other image.
\cvdefC{void cvComputeCorrespondEpilines( \par const CvMat* points,\par int whichImage,\par const CvMat* F, \par CvMat* lines);}
Line coefficients are defined up to a scale. They are normalized, such that $a_i^2+b_i^2=1$.
-\cvFunc{ConvertPointsHomogeneous}{convertPointsHomogeneous}
+\cvfunc{ConvertPointsHomogeneous}{convertPointsHomogeneous}
Convert points to/from homogeneous coordinates.
\cvdefC{void cvConvertPointsHomogeneous( \par const CvMat* src,\par CvMat* dst );}
CvStereoBMState* cvCreateStereoBMState( int preset=CV\_STEREO\_BM\_BASIC,
int numberOfDisparities=0 );
-}\cvdefPy{CreateStereoBMState(preset=CV\_STEREO\_BM\_BASIC,numberOfDisparities=0)-> StereoBMState}
+}
+\cvdefPy{CreateStereoBMState(preset=CV\_STEREO\_BM\_BASIC,numberOfDisparities=0)-> StereoBMState}
\begin{description}
\cvarg{preset}{ID of one of the pre-defined parameter sets. Any of the parameters can be overridden after creating the structure.}
CvStereoGCState* cvCreateStereoGCState( int numberOfDisparities,
int maxIters );
-}\cvdefPy{CreateStereoGCState(numberOfDispaities,maxIters)-> StereoGCState}
+}
+\cvdefPy{CreateStereoGCState(numberOfDispaities,maxIters)-> StereoGCState}
\begin{description}
\cvarg{numberOfDisparities}{The number of disparities. The disparity search range will be $\texttt{state->minDisparity} \le disparity < \texttt{state->minDisparity} + \texttt{state->numberOfDisparities}$}
\fi
-\cvFunc{DecomposeProjectionMatrix}{decomposeProjectionMatrix}
+\cvfunc{DecomposeProjectionMatrix}{decomposeProjectionMatrix}
Decomposes the projection matrix into a rotation matrix and a camera matrix.
\cvdefC{
The function is based on \cvCross{RQDecomp3x3}{RQDecomp3x3}.
-\cvFunc{DrawChessboardCorners}{drawChessboardCorners}
+\cvfunc{DrawChessboardCorners}{drawChessboardCorners}
Renders the detected chessboard corners.
\cvdefC{
The function draws the individual chessboard corners detected as red circles if the board was not found or as colored corners connected with lines if the board was found.
-\cvFunc{FindChessboardCorners}{findChessboardCorners}
+\cvfunc{FindChessboardCorners}{findChessboardCorners}
Finds the positions of the internal corners of the chessboard.
\cvdefC{int cvFindChessboardCorners( \par const void* image,\par CvSize patternSize,\par CvPoint2D32f* corners,\par int* cornerCount=NULL,\par int flags=CV\_CALIB\_CB\_ADAPTIVE\_THRESH );}
\textbf{Note:} the function requires some white space (like a square-thick border, the wider the better) around the board to make the detection more robust in various environment (otherwise if there is no border and the background is dark, the outer black squares could not be segmented properly and so the square grouping and ordering algorithm will fail).
-\cvFunc{FindExtrinsicCameraParams2}{solvePnP}
+\cvfunc{FindExtrinsicCameraParams2}{solvePnP}
Finds the object pose from the 3D-2D point correspondences
\cvdefC{void cvFindExtrinsicCameraParams2( \par const CvMat* objectPoints,\par const CvMat* imagePoints,\par const CvMat* cameraMatrix,\par const CvMat* distCoeffs,\par CvMat* rvec,\par CvMat* tvec );}
The function estimates the object pose given a set of object points, their corresponding image projections, as well as the camera matrix and the distortion coefficients. This function finds such a pose that minimizes reprojection error, i.e. the sum of squared distances between the observed projections \texttt{imagePoints} and the projected (using \cvCross{ProjectPoints2}{projectPoints}) \texttt{objectPoints}.
-\cvFunc{FindFundamentalMat}{findFundamentalMat}
+\cvfunc{FindFundamentalMat}{findFundamentalMat}
Calculates the fundamental matrix from the corresponding points in two images.
\cvdefC{
int cvFindFundamentalMat( \par const CvMat* points1,\par const CvMat* points2,\par CvMat* fundamentalMatrix,\par int method=CV\_FM\_RANSAC,\par double param1=1.,\par double param2=0.99,\par CvMat* status=NULL);
}
-\cvdefPy{FindFundamentalMat(points1, points2, fundamentalMatrix, method=CV\_FM\_RANSAC, param1=1., double param2=0.99, status = None) -> None}
+\cvdefPy{FindFundamentalMat(points1, points2, fundamentalMatrix, method=CV\_FM\_RANSAC, param1=1., param2=0.99, status = None) -> None}
\cvdefCpp{Mat findFundamentalMat( const Mat\& points1, const Mat\& points2,\par
vector<uchar>\& status, int method=FM\_RANSAC,\par
double param1=3., double param2=0.99 );\newline
\end{lstlisting}
\fi
-\cvFunc{FindHomography}{findHomography}
+\cvfunc{FindHomography}{findHomography}
Finds the perspective transformation between two planes.
\cvdefC{void cvFindHomography( \par const CvMat* srcPoints,\par const CvMat* dstPoints,\par CvMat* H \par
\par CvStereoGCState* state,
\par int useDisparityGuess = CV\_DEFAULT(0) );
-}\cvdefPy{FindStereoCorrespondenceGC(\par left,\par right,\par dispLeft,\par dispRight,\par state,\par useDisparityGuess=CV\_DEFAULT(0))-> None}
+}
+\cvdefPy{FindStereoCorrespondenceGC( left, right, dispLeft, dispRight, state, useDisparityGuess=(0))-> None}
\begin{description}
\cvarg{left}{The left single-channel, 8-bit image.}
\fi
-\cvFunc{GetOptimalNewCameraMatrix}{getOptimalNewCameraMatrix}
+\cvfunc{GetOptimalNewCameraMatrix}{getOptimalNewCameraMatrix}
Returns the new camera matrix based on the free scaling parameter
\cvdefC{void cvGetOptimalNewCameraMatrix(
\par CvMat* newCameraMatrix,
\par CvSize newImageSize=cvSize(0,0),
\par CvRect* validPixROI=0 );}
-\cvdefPy{getOptimalNewCameraMatrix(cameraMatrix, distCoeffs, imageSize, alpha, newImgSize=cvSize(0,0), validPixROI=0)}
+\cvdefPy{GetOptimalNewCameraMatrix(cameraMatrix, distCoeffs, imageSize, alpha, newImgSize=(0,0), validPixROI=0) -> None}
\cvdefCpp{Mat getOptimalNewCameraMatrix(
\par const Mat\& cameraMatrix, const Mat\& distCoeffs,
\par Size imageSize, double alpha, Size newImgSize=Size(),
The function computes \cvCpp{and returns} the optimal new camera matrix based on the free scaling parameter. By varying this parameter the user may retrieve only sensible pixels \texttt{alpha=0}, keep all the original image pixels if there is valuable information in the corners \texttt{alpha=1}, or get something in between. When \texttt{alpha>0}, the undistortion result will likely have some black pixels corresponding to "virtual" pixels outside of the captured distorted image. The original camera matrix, distortion coefficients, the computed new camera matrix and the \text{newImageSize} should be passed to \cvCross{InitUndistortRectifyMap}{initUndistortRectifyMap} to produce the maps for \cvCross{Remap}{remap}.
-\cvFunc{InitIntrinsicParams2D}{initCameraMatrix2D}
+\cvfunc{InitIntrinsicParams2D}{initCameraMatrix2D}
Finds the initial camera matrix from the 3D-2D point correspondences
\cvdefC{void cvInitIntrinsicParams2D(\par const CvMat* objectPoints,
\par const CvMat* npoints, CvSize imageSize,
\par CvMat* cameraMatrix,
\par double aspectRatio=1.);}
-\cvdefPy{initCameraMatrix2D( objectPoints, imagePoints, npoints, imageSize, cameraMatrix, aspectRatio=1.) -> None}
+\cvdefPy{InitCameraMatrix2D( objectPoints, imagePoints, npoints, imageSize, cameraMatrix, aspectRatio=1.) -> None}
\cvdefCpp{Mat initCameraMatrix2D( const vector<vector<Point3f> >\& objectPoints,\par
const vector<vector<Point2f> >\& imagePoints,\par
Size imageSize, double aspectRatio=1.);}
Currently, the function only supports planar calibration patterns, i.e. patterns where each object point has z-coordinate =0.
\ifCPy
-\cvFunc{InitUndistortMap}
+\cvfunc{InitUndistortMap}
Computes an undistortion map.
\cvdefC{void cvInitUndistortMap( \par const CvMat* cameraMatrix,\par const CvMat* distCoeffs,\par CvArr* map1,\par CvArr* map2 );}
\fi
-\cvFunc{InitUndistortRectifyMap}{initUndistortRectifyMap}
+\cvfunc{InitUndistortRectifyMap}{initUndistortRectifyMap}
Computes the undistortion and rectification transformation map.
\cvdefC{void cvInitUndistortRectifyMap( \par const CvMat* cameraMatrix,
\cvdefC{
void cvPOSIT( \par CvPOSITObject* posit\_object,\par CvPoint2D32f* imagePoints,\par double focal\_length,\par CvTermCriteria criteria,\par CvMatr32f rotationMatrix,\par CvVect32f translation\_vector );
-}\cvdefPy{POSIT(posit\_object,imagePoints,focal\_length,criteria)-> rotationMatrix,translation\_vector}
+}
+\cvdefPy{POSIT(posit\_object,imagePoints,focal\_length,criteria)-> (rotationMatrix,translation\_vector)}
\begin{description}
\cvarg{posit\_object}{Pointer to the object structure}
\fi
-\cvFunc{ProjectPoints2}{projectPoints}
+\cvfunc{ProjectPoints2}{projectPoints}
Project 3D points on to an image plane.
\cvdefC{void cvProjectPoints2( \par const CvMat* objectPoints,\par const CvMat* rvec,\par const CvMat* tvec,\par const CvMat* cameraMatrix,\par const CvMat* distCoeffs,\par CvMat* imagePoints,\par CvMat* dpdrot=NULL,\par CvMat* dpdt=NULL,\par CvMat* dpdf=NULL,\par CvMat* dpdc=NULL,\par CvMat* dpddist=NULL );}
Note, that by setting \texttt{rvec=tvec=(0,0,0)}, or by setting \texttt{cameraMatrix} to 3x3 identity matrix, or by passing zero distortion coefficients, you can get various useful partial cases of the function, i.e. you can compute the distorted coordinates for a sparse set of points, or apply a perspective transformation (and also compute the derivatives) in the ideal zero-distortion setup etc.
-\cvFunc{ReprojectImageTo3D}{reprojectImageTo3D}
+\cvfunc{ReprojectImageTo3D}{reprojectImageTo3D}
Reprojects disparity image to 3D space.
\cvdefC{void cvReprojectImageTo3D( const CvArr* disparityImage,\par
The matrix \texttt{Q} can be arbitrary $4 \times 4$ matrix, e.g. the one computed by \cvCross{StereoRectify}{stereoRectify}. To reproject a sparse set of points {(x,y,d),...} to 3D space, use \cvCross{PerspectiveTransform}{perspectiveTransform}.
-\cvFunc{RQDecomp3x3}{RQDecomp3x3}
+\cvfunc{RQDecomp3x3}{RQDecomp3x3}
Computes the 'RQ' decomposition of 3x3 matrices.
\cvdefC{
\fi
-\cvFunc{Rodrigues2}{Rodrigues}
+\cvfunc{Rodrigues2}{Rodrigues}
Converts a rotation matrix to a rotation vector or vice versa.
\cvdefC{int cvRodrigues2( \par const CvMat* src,\par CvMat* dst,\par CvMat* jacobian=0 );}
\fi
-\cvFunc{StereoCalibrate}{stereoCalibrate}
+\cvfunc{StereoCalibrate}{stereoCalibrate}
Calibrates stereo camera.
\cvdefC{double cvStereoCalibrate( \par const CvMat* objectPoints, \par const CvMat* imagePoints1,
\par CV\_TERMCRIT\_ITER+CV\_TERMCRIT\_EPS,30,1e-6),
\par int flags=CV\_CALIB\_FIX\_INTRINSIC );}
-\cvdefPy{StereoCalibrate(\par objectPoints,\par imagePoints1,\par imagePoints2,\par pointCounts,\par cameraMatrix1,\par distCoeffs1,\par cameraMatrix2,\par distCoeffs2,\par imageSize,\par R,\par T,\par E=NULL,\par F=NULL,\par term\_crit=cvTermCriteria(CV\_TERMCRIT\_ITER+CV\_TERMCRIT\_EPS,30,1e-6),\par flags=CV\_CALIB\_FIX\_INTRINSIC)-> None}
+\cvdefPy{StereoCalibrate( objectPoints, imagePoints1, imagePoints2, pointCounts, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, R, T, E=NULL, F=NULL, term\_crit=(CV\_TERMCRIT\_ITER+CV\_TERMCRIT\_EPS,30,1e-6), flags=CV\_CALIB\_FIX\_INTRINSIC)-> None}
\cvdefCpp{double stereoCalibrate( const vector<vector<Point3f> >\& objectPoints,\par
const vector<vector<Point2f> >\& imagePoints1,\par
The function returns the final value of the re-projection error.
\fi
-\cvFunc{StereoRectify}{stereoRectify}
+\cvfunc{StereoRectify}{stereoRectify}
Computes rectification transforms for each head of a calibrated stereo camera.
\cvdefC{void cvStereoRectify( \par const CvMat* cameraMatrix1, const CvMat* cameraMatrix2,
\par CvMat* Q=0, int flags=CV\_CALIB\_ZERO\_DISPARITY,
\par double alpha=-1, CvSize newImageSize=cvSize(0,0),
\par CvRect* roi1=0, CvRect* roi2=0);}
-\cvdefPy{StereoRectify(\par cameraMatrix1,\par cameraMatrix2,\par distCoeffs1,\par distCoeffs2,\par imageSize,\par R,\par T,\par R1,\par R2,\par P1,\par P2,\par Q=NULL,\par flags=CV\_CALIB\_ZERO\_DISPARITY,\par alpha=-1, newImageSize=(0,0))-> None}
+\cvdefPy{StereoRectify( cameraMatrix1, cameraMatrix2, distCoeffs1, distCoeffs2, imageSize, R, T, R1, R2, P1, P2, Q=NULL, flags=CV\_CALIB\_ZERO\_DISPARITY, alpha=-1, newImageSize=(0,0))-> None}
\cvdefCpp{void stereoRectify( const Mat\& cameraMatrix1, const Mat\& distCoeffs1,\par
const Mat\& cameraMatrix2, const Mat\& distCoeffs2,\par
\includegraphics[width=0.8\textwidth]{pics/stereo_undistort.jpg}
-\cvFunc{StereoRectifyUncalibrated}{stereoRectifyUncalibrated}
+\cvfunc{StereoRectifyUncalibrated}{stereoRectifyUncalibrated}
Computes rectification transform for uncalibrated stereo camera.
\cvdefC{void cvStereoRectifyUncalibrated( \par const CvMat* points1, \par const CvMat* points2,
Note that while the algorithm does not need to know the intrinsic parameters of the cameras, it heavily depends on the epipolar geometry. Therefore, if the camera lenses have significant distortion, it would better be corrected before computing the fundamental matrix and calling this function. For example, distortion coefficients can be estimated for each head of stereo camera separately by using \cvCross{CalibrateCamera2}{calibrateCamera} and then the images can be corrected using \cvCross{Undistort2}{undistort}, or just the point coordinates can be corrected with \cvCross{UndistortPoints}{undistortPoints}.
-\cvFunc{Undistort2}{undistort}
+\cvfunc{Undistort2}{undistort}
Transforms an image to compensate for lens distortion.
\cvdefC{void cvUndistort2( \par const CvArr* src,\par CvArr* dst,\par const CvMat* cameraMatrix,
\cvCross{CalibrateCamera2}{calibrateCamera}. If the resolution of images is different from the used at the calibration stage, $f_x, f_y, c_x$ and $c_y$ need to be scaled accordingly, while the distortion coefficients remain the same.
-\cvFunc{UndistortPoints}{undistortPoints}
+\cvfunc{UndistortPoints}{undistortPoints}
Computes the ideal point coordinates from the observed point coordinates.
\cvdefC{void cvUndistortPoints( \par const CvMat* src, \par CvMat* dst,
\cvdefC{
void cvExtractSURF( \par const CvArr* image,\par const CvArr* mask,\par CvSeq** keypoints,\par CvSeq** descriptors,\par CvMemStorage* storage,\par CvSURFParams params );
-}\cvdefPy{ExtractSURF(image,mask,storage,params)-> keypoints,descriptors}
+}
+\cvdefPy{ExtractSURF(image,mask,storage,params)-> (keypoints,descriptors)}
\begin{description}
\cvarg{image}{The input 8-bit grayscale image}
Each new image is measured and then converted into an \texttt{image} image array over a chosen ROI. Histograms are taken from this \texttt{image} image in an area covered by a "patch" with an anchor at center as shown in the picture below. The histogram is normalized using the parameter \texttt{norm\_factor} so that it may be compared with \texttt{hist}. The calculated histogram is compared to the model histogram; \texttt{hist} uses The function \texttt{cvCompareHist} with the comparison method=\texttt{method}). The resulting output is placed at the location corresponding to the patch anchor in the probability image \texttt{dst}. This process is repeated as the patch is slid over the ROI. Iterative histogram update by subtracting trailing pixels covered by the patch and adding newly covered pixels to the histogram can save a lot of operations, though it is not implemented yet.
-\cvfunc{Back Project Calculation by Patches}
+Back Project Calculation by Patches
\includegraphics[width=0.5\textwidth]{pics/backprojectpatch.png}
\cvdefC{
void cvCalcHist( \par IplImage** image,\par CvHistogram* hist,\par int accumulate=0,\par const CvArr* mask=NULL );
-}\cvdefPy{CalcHist(image,hist,ccumulate=0,mask=NULL)-> None}
+}
+\cvdefPy{CalcHist(image,hist,accumulate=0,mask=NULL)-> None}
\begin{description}
\cvarg{image}{Source images (though you may pass CvMat** as well)}
and \cvCPyCross{CalcBackProject} may process 8-bit images without setting
bin ranges, they assume thy are equally spaced in 0 to 255 bins.
+\ifC % {
\cvCPyFunc{GetHistValue*D}
Returns a pointer to the histogram bin.
\end{description}
The macros \texttt{GetHistValue} return a pointer to the specified bin of the 1D, 2D, 3D or N-D histogram. In the case of a sparse histogram the function creates a new bin and sets it to 0, unless it exists already.
-
+\fi % }
\cvCPyFunc{GetMinMaxHistValue}
Finds the minimum and maximum histogram bins.
\cvdefC{
void cvGetMinMaxHistValue( \par const CvHistogram* hist,\par float* min\_value,\par float* max\_value,\par int* min\_idx=NULL,\par int* max\_idx=NULL );
-}\cvdefPy{GetMinMaxHistValue(hist)-> min\_val,max\_val,min\_loc,max\_loc}
+}
+\cvdefPy{GetMinMaxHistValue(hist)-> (min\_val,max\_val,min\_loc,max\_loc)}
\begin{description}
\cvarg{hist}{Histogram}
\cvdefC{
void cvThreshHist( CvHistogram* hist, double threshold );
-}\cvdefPy{ThreshHist(hist,threshold)-> None}
+}
+\cvdefPy{ThreshHist(hist,threshold)-> None}
\begin{description}
\cvarg{hist}{Pointer to the histogram}
\par CvPoint offset,
\par int bordertype,
\par CvScalar value=cvScalarAll(0) );}
-\cvdefPy{CopyMakeBorder(src,dst,offset,bordrtype,value=cvScalarAll(0))-> None}
+\cvdefPy{CopyMakeBorder(src,dst,offset,bordrtype,value=(0,0,0,0))-> None}
\begin{description}
\cvarg{src}{The source image}
\cvdefC{IplConvKernel* cvCreateStructuringElementEx(\par int cols,
\par int rows, \par int anchorX, \par int anchorY, \par int shape, \par int* values=NULL );}
-\cvdefPy{CreateStructuringElementEx(cols,rows,anchorX,anchorY,shape,values={NULL,0})-> kernel}
+\cvdefPy{CreateStructuringElementEx(cols,rows,anchorX,anchorY,shape,values=None)-> kernel}
\begin{description}
\cvarg{cols}{Number of columns in the structuring element}
\cvdefC{
void cvDistTransform( \par const CvArr* src,\par CvArr* dst,\par int distance\_type=CV\_DIST\_L2,\par int mask\_size=3,\par const float* mask=NULL,\par CvArr* labels=NULL );
-}\cvdefPy{DistTransform(src,dst,distance\_type=CV\_DIST\_L2,mask\_size=3,mask={NULL,0},labels=NULL)-> None}
+}
+\cvdefPy{DistTransform(src,dst,distance\_type=CV\_DIST\_L2,mask\_size=3,mask=None,labels=NULL)-> None}
\begin{description}
\cvarg{src}{8-bit, single-channel (binary) source image}
CvScalar lo\_diff=cvScalarAll(0),\par CvScalar up\_diff=cvScalarAll(0),\par
CvConnectedComp* comp=NULL,\par int flags=4,\par CvArr* mask=NULL );
-}\cvdefPy{FloodFill(image,seed\_point,new\_val,lo\_diff=cvScalarAll(0),up\_diff=cvScalarAll(0),flags=4,mask=NULL)-> comp}
+}
+\cvdefPy{FloodFill(image,seed\_point,new\_val,lo\_diff=(0,0,0,0),up\_diff=(0,0,0,0),flags=4,mask=NULL)-> comp}
\ifC
\begin{lstlisting}
\par double sp, \par double sr, \par int max\_level=1,
\par CvTermCriteria termcrit=\par cvTermCriteria(CV\_TERMCRIT\_ITER+CV\_TERMCRIT\_EPS,5,1));
-}\cvdefPy{PyrMeanShiftFiltering(src,dst,sp,sr,max\_level=1,
- termcrit=\par (CV\_TERMCRIT\_ITER+CV\_TERMCRIT\_EPS,5,1))-> None}
+}\cvdefPy{PyrMeanShiftFiltering(src,dst,sp,sr,max\_level=1,termcrit=(CV\_TERMCRIT\_ITER+CV\_TERMCRIT\_EPS,5,1))-> None}
\begin{description}
\cvarg{src}{The source 8-bit, 3-channel image.}
\par const CvArr* mapy,
\par int flags=CV\_INTER\_LINEAR+CV\_WARP\_FILL\_OUTLIERS,
\par CvScalar fillval=cvScalarAll(0) );}
-\cvdefPy{Remap(src,dst,mapx,mapy,flags=CV\_INNER\_LINEAR+CV\_WARP\_FILL\_OUTLIERS,fillval=cvScalarAll0))-> None}
+\cvdefPy{Remap(src,dst,mapx,mapy,flags=CV\_INNER\_LINEAR+CV\_WARP\_FILL\_OUTLIERS,fillval=(0,0,0,0))-> None}
\begin{description}
\cvarg{src}{Source image}
\par int flags=CV\_INTER\_LINEAR+CV\_WARP\_FILL\_OUTLIERS,
\par CvScalar fillval=cvScalarAll(0) );
}
-\cvdefPy{WarpAffine(src,dst,mapMatrix,flags=CV\_INTER\_LINEAR+CV\_WARP\_FILL\_OUTLIERS,fillval=cvScalarAll(0))-> None}
+\cvdefPy{WarpAffine(src,dst,mapMatrix,flags=CV\_INTER\_LINEAR+CV\_WARP\_FILL\_OUTLIERS,fillval=(0,0,0,0))-> None}
\begin{description}
\cvarg{src}{Source image}
\par const CvMat* mapMatrix,
\par int flags=CV\_INTER\_LINEAR+CV\_WARP\_FILL\_OUTLIERS,
\par CvScalar fillval=cvScalarAll(0) );
-}\cvdefPy{WarpPerspective(src,dst,mapMatrix,flags=CV\_I
-NNER\_LINEAR+CV\_WARP\_FILL\_OUTLIERS,fillval=cvScalarAll(0
-))-> None}
+}
+\cvdefPy{WarpPerspective(src,dst,mapMatrix,flags=CV\_INNER\_LINEAR+CV\_WARP\_FILL\_OUTLIERS,fillval=(0,0,0,0))-> None}
\begin{description}
\cvarg{src}{Source image}
\cvdefC{
void cvCalcOpticalFlowPyrLK( \par const CvArr* prev,\par const CvArr* curr,\par CvArr* prevPyr,\par CvArr* currPyr,\par const CvPoint2D32f* prevFeatures,\par CvPoint2D32f* currFeatures,\par int count,\par CvSize winSize,\par int level,\par char* status,\par float* track\_error,\par CvTermCriteria criteria,\par int flags );
-}\cvdefPy{
-CalcOpticalFlowPyrLK( prev, curr, prevPyr, currPyr, prevFeatures, CvSize winSize, int level, criteria, flags, guesses = None) -> (currFeatures, status, track\_error)
+}
+\cvdefPy{
+CalcOpticalFlowPyrLK( prev, curr, prevPyr, currPyr, prevFeatures, winSize, level, criteria, flags, guesses = None) -> (currFeatures, status, track\_error)
}
\begin{description}
const CvMat* cvKalmanPredict( \par CvKalman* kalman, \par const CvMat* control=NULL );
}
\cvdefPy{
-cvKalmanPredict(kalman, control=None) -> cvmat
+KalmanPredict(kalman, control=None) -> cvmat
}
\begin{lstlisting}
#define cvKalmanUpdateByTime cvKalmanPredict
\cvdefC{
void cvMultiplyAcc( \par const CvArr* image1,\par const CvArr* image2,\par CvArr* acc,\par const CvArr* mask=NULL );
-}\cvdefPy{MulitplyAcc(image1,image2,acc,mask=NULL)-> None}
+}
+\cvdefPy{MultiplyAcc(image1,image2,acc,mask=NULL)-> None}
\begin{description}
\cvarg{image1}{First input image, 1- or 3-channel, 8-bit or 32-bit floating point (each channel of multi-channel image is processed independently)}
\fi % }
+\ifC % {
+
\cvCPyFunc{ReleaseKalman}
Deallocates the Kalman filter structure.
-\ifC % {
-
\cvdefC{
void cvReleaseKalman( \par CvKalman** kalman );
}
\cvdefC{
void cvRunningAvg( \par const CvArr* image,\par CvArr* acc,\par double alpha,\par const CvArr* mask=NULL );
-}\cvdefPy{RunningAvg(image,acc,alpha,mask=NULL)-> None}
+}
+\cvdefPy{RunningAvg(image,acc,alpha,mask=NULL)-> None}
\begin{description}
\cvarg{image}{Input image, 1- or 3-channel, 8-bit or 32-bit floating point (each channel of multi-channel image is processed independently)}
CvSubdiv2DPoint;
\end{lstlisting}
-\begin{description}
-\cvarg{id}{This integer can be used to index auxillary data associated with each vertex of the planar subdivision }
-\end{description}
+\begin{itemize}
+\item[id] This integer can be used to index auxillary data associated with each vertex of the planar subdivision
+\end{itemize}
\cvCPyFunc{CalcSubdivVoronoi2D}
Calculates the coordinates of Voronoi diagram cells.
\cvdefC{
void cvCalcSubdivVoronoi2D( \par CvSubdiv2D* subdiv );
-}\cvdefPy{CalcSubdivVoronoi2D(subdiv)-> None}
+}
+\cvdefPy{CalcSubdivVoronoi2D(subdiv)-> None}
\begin{description}
\cvarg{subdiv}{Delaunay subdivision, in which all the points are already added}
\cvdefC{
CvSubdiv2DPoint* cvSubdiv2DEdgeDst( \par CvSubdiv2DEdge edge );
-}\cvdefPy{Subdiv2DEdgeDist(edge)-> point}
+}
+\cvdefPy{Subdiv2DEdgeDst(edge)-> point}
\begin{description}
\cvarg{edge}{Subdivision edge (not a quad-edge)}
The function inserts a single point into a subdivision and modifies the subdivision topology appropriately. If a point with the same coordinates exists already, no new point is added. The function returns a pointer to the allocated point. No virtual point coordinates are calculated at this stage.
-\fi
\ No newline at end of file
+\fi
\cvdefC{
CvSeq* cvApproxPoly( \par const void* src\_seq,\par int header\_size,\par CvMemStorage* storage,\par int method,\par double parameter,\par int parameter2=0 );
-}\cvdefPy{
-ApproxPoly(src\_seq, storage, method, parameter=0, parameter2=0)
+}
+\cvdefPy{
+ApproxPoly(src\_seq, storage, method, parameter=0, parameter2=0) -> sequence
}
\begin{description}
\cvdefC{
double cvContourArea( \par const CvArr* contour, \par CvSlice slice=CV\_WHOLE\_SEQ );
-}\cvdefPy{ContourAres(contour,slice=CV\_WHOLE\_SEQ)-> double}
+}
+\cvdefPy{ContourArea(contour,slice=CV\_WHOLE\_SEQ)-> double}
\begin{description}
\cvarg{contour}{Contour (sequence or array of vertices)}
\cvdefC{
CvContourTree* cvCreateContourTree( \par const CvSeq* contour,\par CvMemStorage* storage,\par double threshold );
-}\cvdefPy{CreateCountourTree(contour,storage,threshold)-> contour\_tree}
+}
+\cvdefPy{CreateContourTree(contour,storage,threshold)-> contour\_tree}
\begin{description}
\cvarg{contour}{Input contour}
\fi % }
-\cvCPyFunc{FitEllipse}
+\cvCPyFunc{FitEllipse2}
Fits an ellipse around a set of 2D points.
\cvdefC{
CvBox2D cvFitEllipse2( \par const CvArr* points );
-}\cvdefPy{FitEllipse2(points)-> Box2D}
+}
+\cvdefPy{FitEllipse2(points)-> Box2D}
\begin{description}
\cvarg{points}{Sequence or array of points}
Calculates the seven Hu invariants.
\cvdefC{void cvGetHuMoments( const CvMoments* moments,CvHuMoments* hu );}
-\cvdefPy{cvGetHuMoments(moments) -> hu}
+\cvdefPy{GetHuMoments(moments) -> hu}
\begin{description}
\cvarg{moments}{The input moments, computed with \cvCPyCross{Moments}}
The function finds a circumscribed rectangle of the minimal area for a 2D point set by building a convex hull for the set and applying the rotating calipers technique to the hull.
-\cvfunc{Picture. Minimal-area bounding rectangle for contour}
+Picture. Minimal-area bounding rectangle for contour
\includegraphics[width=0.5\textwidth]{pics/minareabox.png}
\cvdefC{
int cvMinEnclosingCircle( \par const CvArr* points,\par CvPoint2D32f* center,\par float* radius );
-}\cvdefPy{MinEnclosingCircle(points)-> int,center,radius}
+}
+\cvdefPy{MinEnclosingCircle(points)-> (int,center,radius)}
\begin{description}
\cvarg{points}{Sequence or array of 2D points}
Calculates average (mean) of array elements.
\cvdefC{void cvAvgSdv(const CvArr* arr, CvScalar* mean, CvScalar* stdDev, const CvArr* mask=NULL);}
-\cvdefPy{AvgSdv(arr,mask=NULL)-> mean, stdDev}
+\cvdefPy{AvgSdv(arr,mask=NULL)-> (mean, stdDev)}
\begin{description}
\cvarg{arr}{The array}
\end{description}
-The function calculates the cubic root of the argument, and normally it is faster than \texttt{pow(value,1./3)}. In addition, negative arguments are handled properly. Special values ($ \pm \infty $, NaN) are not handled.
+The function calculates the cubic root of the argument, and normally it is faster than \texttt{pow(value,1./3)}. In addition, negative arguments are handled properly. Special values ($\pm \infty $, NaN) are not handled.
\cvCPyFunc{ClearND}
Clears a specific array element.
Allocates array data
\cvdefC{void cvCreateData(CvArr* arr);}
-\cvdefPy{CreateData(arr)}
+\cvdefPy{CreateData(arr) -> None}
\begin{description}
\cvarg{arr}{Array header}
Creates the header and allocates the data for a multi-dimensional dense array.
\cvdefC{CvMatND* cvCreateMatND(\par int dims,\par const int* sizes,\par int type);}
-\cvdefPy{CreateMatND(dims, type)}
+\cvdefPy{CreateMatND(dims, type) -> None}
\begin{description}
\ifPy
Creates a new matrix header but does not allocate the matrix data.
\cvdefC{CvMatND* cvCreateMatNDHeader(\par int dims,\par const int* sizes,\par int type);}
-\cvdefPy{CreateMatNDHeader(dims, type)}
+\cvdefPy{CreateMatNDHeader(dims, type) -> None}
\begin{description}
\ifPy
\fi % }
+\ifC % {
\cvCPyFunc{GetCol(s)}
Returns array column or column span.
cvGetCol(arr, submat, col); // ~ cvGetCols(arr, submat, col, col + 1);
\end{lstlisting}
+\else % }{
+
+\cvCPyFunc{GetCol}
+Returns array column.
+
+\cvdefPy{GetCol(arr,col)-> submat}
+
+\begin{description}
+\cvarg{arr}{Input array}
+\cvarg{col}{Zero-based index of the selected column}
+\cvarg{submat}{resulting single-column array}
+\end{description}
+
+The function \texttt{GetCol} returns a single column from the input array.
+
+\cvCPyFunc{GetCols}
+Returns array column span.
+
+\cvdefPy{GetCols(arr,startCol,endCol)-> submat}
+
+\begin{description}
+\cvarg{arr}{Input array}
+\cvarg{startCol}{Zero-based index of the starting column (inclusive) of the span}
+\cvarg{endCol}{Zero-based index of the ending column (exclusive) of the span}
+\cvarg{submat}{resulting multi-column array}
+\end{description}
+
+The function \texttt{GetCols} returns a column span from the input array.
+
+\fi % }
+
\cvCPyFunc{GetDiag}
Returns one of array diagonals.
\fi
+\ifC %{
\cvCPyFunc{GetRow(s)}
Returns array row or row span.
cvGetRow(arr, submat, row ) ~ cvGetRows(arr, submat, row, row + 1, 1);
\end{lstlisting}
+\else % }{
+
+\cvCPyFunc{GetRow}
+Returns array row.
+
+\cvdefPy{GetRow(arr,row)-> submat}
+
+\begin{description}
+\cvarg{arr}{Input array}
+\cvarg{row}{Zero-based index of the selected row}
+\cvarg{submat}{resulting single-row array}
+\end{description}
+
+The function \texttt{GetRow} returns a single row from the input array.
+
+\cvCPyFunc{GetRows}
+Returns array row span.
+
+\cvdefPy{GetRows(arr,startRow,endRow)-> submat}
+
+\begin{description}
+\cvarg{arr}{Input array}
+\cvarg{startRow}{Zero-based index of the starting row (inclusive) of the span}
+\cvarg{endRow}{Zero-based index of the ending row (exclusive) of the span}
+\cvarg{submat}{resulting multi-row array}
+\end{description}
+
+The function \texttt{GetRows} returns a row span from the input array.
+
+\fi % }
\cvCPyFunc{GetSize}
Returns size of matrix or image ROI.
\end{description}
-The function calculates the inverse square root of the argument, and normally it is faster than \texttt{1./sqrt(value)}. If the argument is zero or negative, the result is not determined. Special values ($ \pm \infty $ , NaN) are not handled.
+The function calculates the inverse square root of the argument, and normally it is faster than \texttt{1./sqrt(value)}. If the argument is zero or negative, the result is not determined. Special values ($\pm \infty $ , NaN) are not handled.
\cvCPyFunc{Invert}
Finds the inverse or pseudo-inverse of a matrix.
\cvarg{value}{The input floating-point value}
\end{description}
-The function returns 1 if the argument is $ \pm \infty $ (as defined by IEEE754 standard), 0 otherwise.
+The function returns 1 if the argument is $\pm \infty $ (as defined by IEEE754 standard), 0 otherwise.
\cvCPyFunc{IsNaN}
Determines if the argument is Not A Number.
\cvdefC{void cvMinMaxLoc(const CvArr* arr, double* minVal, double* maxVal,
CvPoint* minLoc=NULL, CvPoint* maxLoc=NULL, const CvArr* mask=NULL);}
-\cvdefPy{MinMaxLoc(arr,mask=NULL)-> minVal,maxVal,minLoc,maxLoc}
+\cvdefPy{MinMaxLoc(arr,mask=NULL)-> (minVal,maxVal,minLoc,maxLoc)}
\begin{description}
\cvarg{arr}{The source array, single-channel or multi-channel with COI set}
Performs per-element multiplication of two Fourier spectrums.
\cvdefC{void cvMulSpectrums(\par const CvArr* src1,\par const CvArr* src2,\par CvArr* dst,\par int flags);}
-\cvdefPy{MulSpectrums(src1,src2,dst,flags)-> None)}
+\cvdefPy{MulSpectrums(src1,src2,dst,flags)-> None}
\begin{description}
\cvarg{src1}{The first source array}
Calculates absolute array norm, absolute difference norm, or relative difference norm.
\cvdefC{double cvNorm(const CvArr* arr1, const CvArr* arr2=NULL, int normType=CV\_L2, const CvArr* mask=NULL);}
-\cvdefPy{Norm(arr1,arr2,normType+CV\_L2,mask=NULL)-> double}
+\cvdefPy{Norm(arr1,arr2,normType=CV\_L2,mask=NULL)-> double}
\begin{description}
\cvarg{arr1}{The first source image}
\fi
\ifC
-\subsection{cvRound, cvFloor, cvCeil}\label{cvRound}
-\fi
-\ifPy
-\subsection{cv.Round, cv.Floor, cv.Ceil}\label{cv.Round}
-\fi
+\cvfunc{cvRound, cvFloor, cvCeil}\label{cvRound}
+
Converts a floating-point number to an integer.
\cvdefC{
value that is not smaller than the argument. On some architectures the
functions work much faster than the standard cast
operations in C. If the absolute value of the argument is greater than
-$2^{31}$, the result is not determined. Special values ($ \pm \infty$ , NaN)
+$2^{31}$, the result is not determined. Special values ($\pm \infty$ , NaN)
+are not handled.
+
+\else
+
+\cvfunc{Round}
+
+Converts a floating-point number to the nearest integer value.
+
+\cvdefPy{Round(value) -> int}
+
+\begin{description}
+\cvarg{value}{The input floating-point value}
+\end{description}
+
+On some architectures this function is much faster than the standard cast
+operations. If the absolute value of the argument is greater than
+$2^{31}$, the result is not determined. Special values ($\pm \infty$ , NaN)
+are not handled.
+
+\cvfunc{Floor}
+
+Converts a floating-point number to the nearest integer value that is not larger than the argument.
+
+\cvdefPy{Floor(value) -> int}
+
+\begin{description}
+\cvarg{value}{The input floating-point value}
+\end{description}
+
+On some architectures this function is much faster than the standard cast
+operations. If the absolute value of the argument is greater than
+$2^{31}$, the result is not determined. Special values ($\pm \infty$ , NaN)
are not handled.
+\cvfunc{Ceil}
+
+Converts a floating-point number to the nearest integer value that is not smaller than the argument.
+
+\cvdefPy{Ceil(value) -> int}
+
+\begin{description}
+\cvarg{value}{The input floating-point value}
+\end{description}
+
+On some architectures this function is much faster than the standard cast
+operations. If the absolute value of the argument is greater than
+$2^{31}$, the result is not determined. Special values ($\pm \infty$ , NaN)
+are not handled.
+
+\fi
+
\cvCPyFunc{ScaleAdd}
Calculates the sum of a scaled array and another array.
\cvdefC{void cvScaleAdd(const CvArr* src1, CvScalar scale, const CvArr* src2, CvArr* dst);}
\cvdefPy{ScaleAdd(src1,sclae,src2,dst)-> None}
-\begin{lstlisting}
-#define cvMulAddS cvScaleAdd
-\end{lstlisting}
\begin{description}
\cvarg{src1}{The first source array}
\cvarg{dst}{The destination array}
\end{description}
+\begin{lstlisting}
+#define cvMulAddS cvScaleAdd
+\end{lstlisting}
+
The function calculates the sum of a scaled array and another array:
\[
\cvarg{value}{The value to assign to the element}
\end{description}
-Sets a specific array element. Array must have dimension 3.
+Sets a specific array element. Array must have dimension 1.
\cvCPyFunc{Set2D}
Set a specific array element.
Initializes a scaled identity matrix.
\cvdefC{void cvSetIdentity(CvArr* mat, CvScalar value=cvRealScalar(1));}
-\cvdefPy{SetIdentity(mat,value=cvRealScalar(1))-> None}
+\cvdefPy{SetIdentity(mat,value=1)-> None}
\begin{description}
\cvarg{arr}{The matrix to initialize (not necesserily square)}
Most OpenCV functions support the use of ROI and treat the image rectangle as a separate image. For example, all of the pixel coordinates are counted from the top-left (or bottom-left) corner of the ROI, not the original image.
+\if % {
\cvCPyFunc{SetReal?D}
Change a specific array element.
In the case of a sparse array the functions create the node if it does not yet exist.
+\else % }{
+
+\cvCPyFunc{SetReal1D}
+Set a specific array element.
+
+\cvdefPy{ SetReal1D(arr, idx, value) -> None }
+
+\begin{description}
+\cvarg{arr}{Input array}
+\cvarg{idx}{Zero-based element index}
+\cvarg{value}{The value to assign to the element}
+\end{description}
+
+Sets a specific array element. Array must have dimension 1.
+
+\cvCPyFunc{SetReal2D}
+Set a specific array element.
+
+\cvdefPy{ SetReal2D(arr, idx0, idx1, value) -> None }
+
+\begin{description}
+\cvarg{arr}{Input array}
+\cvarg{idx0}{Zero-based element row index}
+\cvarg{idx1}{Zero-based element column index}
+\cvarg{value}{The value to assign to the element}
+\end{description}
+
+Sets a specific array element. Array must have dimension 2.
+
+\cvCPyFunc{SetReal3D}
+Set a specific array element.
+
+\cvdefPy{ SetReal3D(arr, idx0, idx1, idx2, value) -> None }
+
+\begin{description}
+\cvarg{arr}{Input array}
+\cvarg{idx0}{Zero-based element index}
+\cvarg{idx1}{Zero-based element index}
+\cvarg{idx2}{Zero-based element index}
+\cvarg{value}{The value to assign to the element}
+\end{description}
+
+Sets a specific array element. Array must have dimension 3.
+
+\cvCPyFunc{SetRealND}
+Set a specific array element.
+
+\cvdefPy{ SetRealND(arr, indices, value) -> None }
+
+\begin{description}
+\cvarg{arr}{Input array}
+\cvarg{indices}{List of zero-based element indices}
+\cvarg{value}{The value to assign to the element}
+\end{description}
+
+Sets a specific array element. The length of array indices must be the same as the dimension of the array.
+\fi % }
+
\cvCPyFunc{SetZero}
Clears the array.
Performs singular value decomposition of a real floating-point matrix.
\cvdefC{void cvSVD(\par CvArr* A, \par CvArr* W, \par CvArr* U=NULL, \par CvArr* V=NULL, \par int flags=0);}
-\cvdefPy{SVD(A,flags=0)-> W,U,V}
+\cvdefPy{SVD(A,flags=0)-> (W,U,V)}
\begin{description}
\cvarg{A}{Source $\texttt{M} \times \texttt{N}$ matrix}
\end{description}
The functions \texttt{checkRange} check that every array element is
-neither NaN nor $ \pm \infty $. When \texttt{minVal < -DBL\_MAX} and \texttt{maxVal < DBL\_MAX}, then the functions also check that
+neither NaN nor $\pm \infty $. When \texttt{minVal < -DBL\_MAX} and \texttt{maxVal < DBL\_MAX}, then the functions also check that
each value is between \texttt{minVal} and \texttt{maxVal}. in the case of multi-channel arrays each channel is processed independently.
If some values are out of range, position of the first outlier is stored in \texttt{pos} (when $\texttt{pos}\ne0$), and then the functions either return false (when \texttt{quiet=true}) or throw an exception.
\cvdefC{
void cvDrawContours( \par CvArr *img,\par CvSeq* contour,\par CvScalar external\_color,\par CvScalar hole\_color,\par int max\_level,\par int thickness=1,\par int lineType=8 );
}
-\cvdefPy{DrawContours(img,contour,external\_color,hole\_color,max\_level,thickness=1,lineType=8,offset=(0,0)-> None}
+\cvdefPy{DrawContours(img,contour,external\_color,hole\_color,max\_level,thickness=1,lineType=8,offset=(0,0))-> None}
\begin{description}
\cvarg{img}{Image where the contours are to be drawn. As with any other drawing function, the contours are clipped with the ROI.}
\cvdefC{
void cvGetTextSize( \par const char* textString,\par const CvFont* font,\par CvSize* textSize,\par int* baseline );}
-\cvdefPy{GetTextSize(textString,font)-> textSize,baseline}
+\cvdefPy{GetTextSize(textString,font)-> (textSize,baseline)}
\begin{description}
\cvarg{font}{Pointer to the font structure}
\cvdefC{
int cvInitLineIterator( \par const CvArr* image,\par CvPoint pt1,\par CvPoint pt2,\par CvLineIterator* line\_iterator,\par int connectivity=8,\par int left\_to\_right=0 );
}
-\cvdefPy{InitLineIterator(image, pt1, pt2, connectivity=8, left\_to\_right=0)}
+\cvdefPy{InitLineIterator(image, pt1, pt2, connectivity=8, left\_to\_right=0) -> None}
\begin{description}
\cvarg{image}{Image to sample the line from}
Symbols that can not be rendered using the specified font are
replaced question marks. See \cvCppCross{getTextSize} for a text rendering code example.
-\fi
\ No newline at end of file
+\fi
self.write(' ')
def doplain(self, s):
- if (len(s) > 1) and (s[0] == '$' and s[-1] == '$'):
+ if (len(s) > 1) and (s[0] == '$' and s[-1] == '$') and self.state != 'math':
s = ":math:`%s`" % s[1:-1]
elif self.state != 'math':
s.replace('\\_', '_')
def cmd_cvCPyCross(self, c):
self.write(":ref:`%s`" % str(c.params[0]))
+ def cmd_cvfunc(self, c):
+ self.cmd_cvCPyFunc(c)
+
def cmd_cvCPyFunc(self, c):
self.indent = 0
nm = self.render(c.params[0].str)
self.state = None
self.function_props['defpy'] = s
+ pp.ParserElement.setDefaultWhitespaceChars(" \n\t")
+ ident = pp.Word(pp.alphanums + "_.+-")
+ ident_or_tuple = ident | ('(' + ident + pp.ZeroOrMore(',' + ident) + ')')
+ initializer = ident_or_tuple
+ arg = ident + pp.Optional('=' + initializer)
+ decl = ident + '(' + pp.Optional(arg + pp.ZeroOrMore(',' + arg)) + ')' + pp.Literal("->") + ident_or_tuple + pp.StringEnd()
+
+ try:
+ l = decl.parseString(s)
+ if str(l[0]) != self.function_props['name']:
+ self.report_error(c, 'Decl "%s" does not match function name "%s"' % (str(l[0]), self.function_props['name']))
+ except pp.ParseException, pe:
+ self.report_error(c, str(pe))
+ print s
+ print pe
+
def report_error(self, c, msg):
print >>self.errors, "%s:%d: Error %s" % (c.filename, c.lineno, msg)
def cmd_targetlang(self, c): pass
def cmd_usepackage(self, c): pass
def cmd_title(self, c): pass
+ def cmd_par(self, c): pass
def cmd_href(self, c):
self.write("`%s <%s>`_" % (str(c.params[1]), str(c.params[0])))