[][src]Function opencv::imgproc::hough_lines_p

pub fn hough_lines_p(
    image: &dyn ToInputArray,
    lines: &mut dyn ToOutputArray,
    rho: f64,
    theta: f64,
    threshold: i32,
    min_line_length: f64,
    max_line_gap: f64
) -> Result<()>

Finds line segments in a binary image using the probabilistic Hough transform.

The function implements the probabilistic Hough transform algorithm for line detection, described in Matas00

See the line detection example below: @include snippets/imgproc_HoughLinesP.cpp This is a sample picture the function parameters have been tuned for:

image

And this is the output of the above program in case of the probabilistic Hough transform:

image

Parameters

  • image: 8-bit, single-channel binary source image. The image may be modified by the function.
  • lines: Output vector of lines. Each line is represented by a 4-element vector inline formula , where inline formula and inline formula are the ending points of each detected line segment.
  • rho: Distance resolution of the accumulator in pixels.
  • theta: Angle resolution of the accumulator in radians.
  • threshold: Accumulator threshold parameter. Only those lines are returned that get enough votes ( inline formula ).
  • minLineLength: Minimum line length. Line segments shorter than that are rejected.
  • maxLineGap: Maximum allowed gap between points on the same line to link them.

See also

LineSegmentDetector

C++ default parameters

  • min_line_length: 0
  • max_line_gap: 0