From cffd89f88fea3d603b323e93d044cb7e815c3fdb Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Sat, 6 Aug 2011 19:17:14 +0000 Subject: [PATCH] added some missing declarations of the functions, noticed in the ticket ##229 --- .../doc/reading_and_writing_images_and_video.rst | 12 ++++++++-- modules/imgproc/doc/feature_detection.rst | 4 ++++ .../imgproc/doc/miscellaneous_transformations.rst | 28 +++++++--------------- .../doc/motion_analysis_and_object_tracking.rst | 4 +++- 4 files changed, 26 insertions(+), 22 deletions(-) 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 ed66ce2..44e74b4 100644 --- a/modules/highgui/doc/reading_and_writing_images_and_video.rst +++ b/modules/highgui/doc/reading_and_writing_images_and_video.rst @@ -9,14 +9,18 @@ Reads an image from a buffer in memory. .. ocv:function:: Mat imdecode( InputArray buf, int flags ) +.. ocv:cfunction:: IplImage* cvDecodeImage( const CvMat* buf, int iscolor=CV_LOAD_IMAGE_COLOR) + +.. ocv:cfunction:: CvMat* cvDecodeImageM( const CvMat* buf, int iscolor=CV_LOAD_IMAGE_COLOR) + .. ocv:pyfunction:: cv2.imdecode(buf, flags) -> retval - :param buf: Input array of vector of bytes. + :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 is returned. +If the buffer is too short or contains invalid data, the empty matrix/image is returned. See :ocv:func:`imread` for the list of supported formats and flags description. @@ -27,6 +31,8 @@ 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:pyfunction:: cv2.imencode(ext, img, buf[, params]) -> retval :param ext: File extension that defines the output format. @@ -41,6 +47,8 @@ The function compresses the image and stores it in the memory buffer that is res See :ocv:func:`imwrite` for the list of supported formats and flags description. +.. note:: ``cvEncodeImage`` returns single-row matrix of type ``CV_8UC1`` that contains encoded image as array of bytes. + imread ---------- Loads an image from a file. diff --git a/modules/imgproc/doc/feature_detection.rst b/modules/imgproc/doc/feature_detection.rst index 21189d4..4b8b251 100644 --- a/modules/imgproc/doc/feature_detection.rst +++ b/modules/imgproc/doc/feature_detection.rst @@ -285,12 +285,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: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. diff --git a/modules/imgproc/doc/miscellaneous_transformations.rst b/modules/imgproc/doc/miscellaneous_transformations.rst index f6ea42b..6bc9767 100644 --- a/modules/imgproc/doc/miscellaneous_transformations.rst +++ b/modules/imgproc/doc/miscellaneous_transformations.rst @@ -758,33 +758,23 @@ Performs a marker-based image segmentation using the watershed algrorithm. .. ocv:function:: void watershed( InputArray image, InputOutputArray markers ) +.. ocv:cfunction:: void cvWatershed( const CvArr* image, CvArr* markers ) + .. ocv:pyfunction:: cv2.watershed(image, markers) -> None :param image: Input 8-bit 3-channel image. :param markers: Input/output 32-bit single-channel image (map) of markers. It should have the same size as ``image`` . -The function implements one of the variants -of watershed, non-parametric marker-based segmentation algorithm, -described in [Meyer92]_. Before passing the image to the -function, you have to roughly outline the desired regions in the image ``markers`` with positive ( -:math:`>0` ) indices. So, every region is -represented as one or more connected components with the pixel values -1, 2, 3, and so on. Such markers can be retrieved from a binary mask -using -:ocv:func:`findContours` and -:ocv:func:`drawContours` (see the ``watershed.cpp`` demo). -The markers are "seeds" of the future image -regions. All the other pixels in ``markers`` , whose relation to the -outlined regions is not known and should be defined by the algorithm, -should be set to 0's. In the function output, each pixel in -markers is set to a value of the "seed" components or to -1 at -boundaries between the regions. - -.. note:: Every two neighbor connected components are not necessarily separated by a watershed boundary (-1's pixels); for example, when such tangent components exist in the initial marker image. Visual demonstration and usage example of the function can be found in the OpenCV samples directory (see the ``watershed.cpp`` demo). +The function implements one of the variants of watershed, non-parametric marker-based segmentation algorithm, described in [Meyer92]_. -.. seealso:: :ocv:func:`findContours` +Before passing the image to the function, you have to roughly outline the desired regions in the image ``markers`` with positive (``>0``) indices. So, every region is represented as one or more connected components with the pixel values 1, 2, 3, and so on. Such markers can be retrieved from a binary mask using :ocv:func:`findContours` and :ocv:func:`drawContours` (see the ``watershed.cpp`` demo). The markers are "seeds" of the future image regions. All the other pixels in ``markers`` , whose relation to the outlined regions is not known and should be defined by the algorithm, should be set to 0's. In the function output, each pixel in markers is set to a value of the "seed" components or to -1 at boundaries between the regions. + +Visual demonstration and usage example of the function can be found in the OpenCV samples directory (see the ``watershed.cpp`` demo). +.. note:: Any two neighbor connected components are not necessarily separated by a watershed boundary (-1's pixels); for example, they can touch each other in the initial marker image passed to the function. + +.. seealso:: :ocv:func:`findContours` grabCut ------- diff --git a/modules/video/doc/motion_analysis_and_object_tracking.rst b/modules/video/doc/motion_analysis_and_object_tracking.rst index 2fa8e74..13cd9bb 100644 --- a/modules/video/doc/motion_analysis_and_object_tracking.rst +++ b/modules/video/doc/motion_analysis_and_object_tracking.rst @@ -51,7 +51,9 @@ 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:pyfunction:: cv2.calcOpticalFlowFarneback(prev, next, pyr_scale, levels, winsize, iterations, poly_n, poly_sigma, flags[, flow]) -> flow +.. 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:pyfunction:: cv2.calcOpticalFlowFarneback(prevImg, nextImg, pyr_scale, levels, winsize, iterations, poly_n, poly_sigma, flags[, flow]) -> flow :param prevImg: First 8-bit single-channel input image. -- 2.7.4