HoughLinesP
import { HoughLinesP } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
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:
This is a sample picture the function parameters have been tuned for:

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

See: LineSegmentDetector
HoughLinesP(image: Mat, lines: Mat, rho: number, theta: number, threshold: number, minLineLength: number, maxLineGap: number): void;3 available overloads
HoughLinesP(image: Mat, lines: Mat, rho: number, theta: number, threshold: number): void;HoughLinesP(image: Mat, lines: Mat, rho: number, theta: number, threshold: number, minLineLength: number): void;HoughLinesP(image: Mat, lines: Mat, rho: number, theta: number, threshold: number, minLineLength: number, maxLineGap: number): void;image8-bit, single-channel binary source image. The image may be modified by the function.
linesOutput destination, filled by the native operation. Output vector of lines. Each line is represented by a 4-element vector
(x_1, y_1, x_2, y_2), where(x_1,y_1)and(x_2, y_2)are the ending points of each detected line segment.rhoDistance resolution of the accumulator in pixels.
thetaAngle resolution of the accumulator in radians.
threshold%Accumulator threshold parameter. Only those lines are returned that get enough votes (
>\texttt{threshold}).minLineLengthMinimum line length. Line segments shorter than that are rejected.
maxLineGapMaximum allowed gap between points on the same line to link them.
These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.