The OpenVX Specification  dba1aa3
HoughLinesP

## Detailed Description

Finds the Probabilistic Hough Lines detected in the input binary image.

The node implement the Progressive Probabilistic Hough Transform described in Matas, J. and Galambos, C. and Kittler, J.V., Robust Detection of Lines Using the Progressive Probabilistic Hough Transform. CVIU 78 1, pp 119-137 (2000) The linear Hough transform algorithm uses a two-dimensional array, called an accumulator, to detect the existence of a line described by $$r=x\cos \theta +y\sin \theta$$. The dimension of the accumulator equals the number of unknown parameters, i.e., two, considering quantized values of $$r$$ and $$\theta$$ in the pair $$(r,\theta)$$. For each pixel at (x,y) and its neighbourhood, the Hough transform algorithm determines if there is enough evidence of a straight line at that pixel. If so, it will calculate the parameters $$(r,\theta)$$ of that line, and then look for the accumulator's bin that the parameters fall into, and increment the value of that bin./n Algorithm Outline:

1. Check the input image; if it is empty then finish.
2. Update the accumulator with a single pixel randomly selected from the input image.
3. Remove the selected pixel from input image.
4. Check if the highest peak in the accumulator that was modified by the new pixel is higher than threshold. If not then goto 1.
5. Look along a corridor specified by the peak in the accumulator, and find the longest segment that either is continuous or exhibits a gap not exceeding a given threshold.
6. Remove the pixels in the segment from input image.
7. “Unvote” from the accumulator all the pixels from the line that have previously voted.
8. If the line segment is longer than the minimum length add it into the output list.
9. Goto 1 each line is stored in vx_line2d_t struct. Such that start_x<=end_x.

## Data Structures

struct  vx_hough_lines_p_t
Hough lines probability parameters. More...

## Functions

vx_node VX_API_CALL vxHoughLinesPNode (vx_graph graph, vx_image input, const vx_hough_lines_p_t *params, vx_array lines_array, vx_scalar num_lines)
[Graph] Finds the Probabilistic Hough Lines detected in the input binary image, each line is stored in the output array as a set of points (x1, y1, x2, y2) . More...

vx_status VX_API_CALL vxuHoughLinesP (vx_context context, vx_image input, const vx_hough_lines_p_t *params, vx_array lines_array, vx_scalar num_lines)
[Immediate] Finds the Probabilistic Hough Lines detected in the input binary image, each line is stored in the output array as a set of points (x1, y1, x2, y2) . More...

## Data Structure Documentation

 struct vx_hough_lines_p_t

Hough lines probability parameters.

Definition at line 1552 of file vx_types.h.

Data Fields
vx_float32 rho Distance resolution of the parameter in pixels.
vx_float32 theta Angle resolution of the parameter in radians.
vx_int32 threshold The minimum number of intersections to detect a line.
vx_int32 line_length The minimum number of points that can form a line. Line segments shorter than that are rejected.
vx_int32 line_gap The maximum allowed gap between points on the same line to link them.
vx_float32 theta_max Optional restriction on theta. The max allowed value.
vx_float32 theta_min Optional restriction on theta. The min allowed value.

## Function Documentation

 vx_node VX_API_CALL vxHoughLinesPNode ( vx_graph graph, vx_image input, const vx_hough_lines_p_t * params, vx_array lines_array, vx_scalar num_lines )

[Graph] Finds the Probabilistic Hough Lines detected in the input binary image, each line is stored in the output array as a set of points (x1, y1, x2, y2) .

Some implementations of the algorithm may have a random or non-deterministic element. If the target application is in a safety-critical environment this should be borne in mind and steps taken in the implementation, the application or both to achieve the level of determinism required by the system design.

Parameters
 [in] graph graph handle [in] input 8 bit, single channel binary source image [in] params parameters of the struct vx_hough_lines_p_t [out] lines_array lines_array contains array of lines, see vx_line2d_t The order of lines in implementation dependent [out] num_lines [optional] The total number of detected lines in image. Use a VX_TYPE_SIZE scalar
Returns
vx_node.
Return values
 vx_node A node reference. Any possible errors preventing a successful creation should be checked using vxGetStatus
 vx_status VX_API_CALL vxuHoughLinesP ( vx_context context, vx_image input, const vx_hough_lines_p_t * params, vx_array lines_array, vx_scalar num_lines )

[Immediate] Finds the Probabilistic Hough Lines detected in the input binary image, each line is stored in the output array as a set of points (x1, y1, x2, y2) .

Some implementations of the algorithm may have a random or non-deterministic element. If the target application is in a safety-critical environment this should be borne in mind and steps taken in the implementation, the application or both to achieve the level of determinism required by the system design.

Parameters
 [in] context The reference to the overall context. [in] input 8 bit, single channel binary source image [in] params parameters of the struct vx_hough_lines_p_t [out] lines_array lines_array contains array of lines, see vx_line2d_t The order of lines in implementation dependent [out] num_lines [optional] The total number of detected lines in image. Use a VX_TYPE_SIZE scalar
Returns
A vx_status_e enumeration.
Return values
 VX_SUCCESS Success * An error occurred. See vx_status_e.