:param corners:Initial coordinates of the input corners as a list of (x, y) pairs
:type corners:sequence of (float, float)
:param win:Half of the side length of the search window. For example, if ``win`` =(5,5), then a :math:`5*2+1 \times 5*2+1 = 11 \times 11` search window would be used
:type win::class:`CvSize`
:param zero_zone:Half of the size of the dead region in the middle of the search zone over which the summation in the formula below is not done. It is used sometimes to avoid possible singularities of the autocorrelation matrix. The value of (-1,-1) indicates that there is no such size
:type zero_zone::class:`CvSize`
:param criteria:Criteria for termination of the iterative process of corner refinement. That is, the process of corner position refinement stops either after a certain number of iterations or when a required accuracy is achieved. The ``criteria`` may specify either of or both the maximum number of iteration and the required accuracy
:type criteria::class:`CvTermCriteria`
The function iterates to find the sub-pixel accurate location of corners, or radial saddle points, as shown in on the picture below.
It returns the refined coordinates as a list of (x, y) pairs.
..image:: ../pics/cornersubpix.png
Sub-pixel accurate corner locator is based on the observation that every vector from the center
:math:`q`
to a point
:math:`p`
located within a neighborhood of
:math:`q`
is orthogonal to the image gradient at
:math:`p`
subject to image and measurement noise. Consider the expression:
..math::
\epsilon _i = {DI_{p_i}}^T \cdot (q - p_i)
where
:math:`{DI_{p_i}}`
is the image gradient at the one of the points
:math:`p_i`
in a neighborhood of
:math:`q`
. The value of
:math:`q`
is to be found such that
:math:`\epsilon_i`
is minimized. A system of equations may be set up with
Finds lines in a binary image using a Hough transform.
:param image:The 8-bit, single-channel, binary source image. In the case of a probabilistic method, the image is modified by the function
:type image::class:`CvArr`
:param storage:The storage for the lines that are detected. It can
be a memory storage (in this case a sequence of lines is created in
the storage and returned by the function) or single row/single column
matrix (CvMat*) of a particular type (see below) to which the lines'
parameters are written. The matrix header is modified by the function
so its ``cols`` or ``rows`` will contain the number of lines
detected. If ``storage`` is a matrix and the actual number
of lines exceeds the matrix size, the maximum possible number of lines
is returned (in the case of standard hough transform the lines are sorted
by the accumulator value)
:type storage::class:`CvMemStorage`
:param method:The Hough transform variant, one of the following:
***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 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 ``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``
:type method:int
:param rho:Distance resolution in pixel-related units
:type rho:float
:param theta:Angle resolution measured in radians
:type theta:float
:param threshold:Threshold parameter. A line is returned by the function if the corresponding accumulator value is greater than ``threshold``
:type threshold:int
:param param1:The 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 the divisor for the distance resolution :math:`\rho` . (The coarse distance resolution will be :math:`\rho` and the accurate resolution will be :math:`(\rho / \texttt{param1})` ).
:type param1:float
:param param2:The 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 (i.e. to join them).
* For the multi-scale Hough transform it is the divisor for the angle resolution :math:`\theta` . (The coarse angle resolution will be :math:`\theta` and the accurate resolution will be :math:`(\theta / \texttt{param2})` ).
:type param2:float
The function implements a few variants of the Hough transform for line detection.