HoughLines
import { HoughLines } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
example: samples/cpp/tutorial_code/ImgTrans/houghlines.cpp
An example using the Hough line detector
example: samples/python/snippets/houghlines.py
An example using the Hough line detector in python
Finds lines in a binary image using the standard Hough transform.
The function implements the standard or standard multi-scale Hough transform algorithm for line detection. See https://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm for a good explanation of Hough transform.
HoughLines(image: Mat, lines: Mat, rho: number, theta: number, threshold: number, srn: number, stn: number, min_theta: number, max_theta: number, use_edgeval: boolean): void;6 available overloads
HoughLines(image: Mat, lines: Mat, rho: number, theta: number, threshold: number): void;HoughLines(image: Mat, lines: Mat, rho: number, theta: number, threshold: number, srn: number): void;HoughLines(image: Mat, lines: Mat, rho: number, theta: number, threshold: number, srn: number, stn: number): void;HoughLines(image: Mat, lines: Mat, rho: number, theta: number, threshold: number, srn: number, stn: number, min_theta: number): void;HoughLines(image: Mat, lines: Mat, rho: number, theta: number, threshold: number, srn: number, stn: number, min_theta: number, max_theta: number): void;HoughLines(image: Mat, lines: Mat, rho: number, theta: number, threshold: number, srn: number, stn: number, min_theta: number, max_theta: number, use_edgeval: boolean): 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 2 or 3 element vector
(\rho, \theta)or(\rho, \theta, \textrm{votes}), where\rhois the distance from the coordinate origin(0,0)(top-left corner of the image),\thetais the line rotation angle in radians (0 \sim \textrm{vertical line}, \pi/2 \sim \textrm{horizontal line}), and\textrm{votes}is the value of accumulator.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}).srnFor the multi-scale Hough transform, it is a divisor for the distance resolution rho. The coarse accumulator distance resolution is rho and the accurate accumulator resolution is rho/srn. If both srn=0 and stn=0, the classical Hough transform is used. Otherwise, both these parameters should be positive.
stnFor the multi-scale Hough transform, it is a divisor for the distance resolution theta.
min_thetaFor standard and multi-scale Hough transform, minimum angle to check for lines. Must fall between 0 and max_theta.
max_thetaFor standard and multi-scale Hough transform, an upper bound for the angle. Must fall between min_theta and CV_PI. The actual maximum angle in the accumulator may be slightly less than max_theta, depending on the parameters min_theta and theta.
use_edgevalTrue if you want to use weighted Hough transform.
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.