ImageTools
ProbabilisticHoughLine
detect lines segments using Probabilistic Hough Transform
Calling Sequence
Parameters
Description
Examples
Compatibility
ProbabilisticHoughLine(img, rho, theta, threshold, lineLength, lineGap)
img
-
Image
rho
algebraic , radial increment
theta
algebraic , angular increment in radian
threshold
posint , minimum number of points required to detect a line
lineLength
posint , minimum length of the line
lineGap
posint , maximum length of the gap between lines
The ProbabilisticHoughLine command detects line segments in img, and returns the detected line segments as an m by 4 Array, lines. Each line segment corresponds to a row of lines: linesi=xi1,yi1,xi2,yi2, where xi1,yi1 and xi2,yi2 are the two end points of the ith line segment.
This command is implemented by a call to the Intel Integrated Performance Primitives (IPP) library; in particular, its ippiHoughProbLine_8u32f_C1R command. For more details, see its documentation.
This command interprets integer coordinate values to represent the corners of pixels, like the commands in the ImageTools[Draw] package do. It always returns coordinates for the centers of pixels, so the coordinates returned are always half integers.
img should be a binary image, so calling EdgeDetect and Threshold are usually necessary before calling ProbabilisticHoughLine.
with⁡ImageTools:
img≔Read⁡cat⁡kernelopts⁡datadir,/images/Maplesoft.png
img≔0.9686274509803920.9647058823529410.9647058823529410.9568627450980390.9568627450980390.9607843137254900.9686274509803920.9725490196078430.9725490196078430.972549019607843…0.9568627450980390.9529411764705880.9529411764705880.9568627450980390.9568627450980390.9568627450980390.9607843137254900.9647058823529410.9647058823529410.968627450980392…0.9568627450980390.9529411764705880.9529411764705880.9529411764705880.9529411764705880.9529411764705880.9568627450980390.9568627450980390.9568627450980390.956862745098039…0.9490196078431370.9490196078431370.9529411764705880.9529411764705880.9529411764705880.9529411764705880.9529411764705880.9529411764705880.9529411764705880.952941176470588…0.9490196078431370.9490196078431370.9490196078431370.9490196078431370.9490196078431370.9490196078431370.9529411764705880.9529411764705880.9529411764705880.952941176470588…0.9450980392156860.9450980392156860.9450980392156860.9490196078431370.9450980392156860.9490196078431370.9490196078431370.9490196078431370.9490196078431370.952941176470588…0.9411764705882350.9411764705882350.9411764705882350.9411764705882350.9411764705882350.9450980392156860.9411764705882350.9411764705882350.9411764705882350.945098039215686…0.9333333333333330.9333333333333330.9333333333333330.9333333333333330.9333333333333330.9333333333333330.9333333333333330.9333333333333330.9372549019607840.941176470588235…0.9254901960784310.9254901960784310.9254901960784310.9294117647058820.9294117647058820.9294117647058820.9411764705882350.9411764705882350.9411764705882350.941176470588235…0.9254901960784310.9215686274509800.9215686274509800.9215686274509800.9215686274509800.9215686274509800.9294117647058820.9333333333333330.9294117647058820.933333333333333…⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋱slice of 592 × 1330 × 4 Array
edge≔Threshold⁡EdgeDetect⁡img,1.5
edge≔0.0.0.0.0.0.0.0.0.0.…0.0.0.0.0.0.0.0.0.0.…0.0.0.0.0.0.0.0.0.0.…0.0.0.0.0.0.0.0.0.0.…0.0.0.0.0.0.0.0.0.0.…0.0.0.0.0.0.0.0.0.0.…0.0.0.0.0.0.0.0.0.0.…0.0.0.0.0.0.0.0.0.0.…0.0.0.0.0.0.0.0.0.0.…0.0.0.0.0.0.0.0.0.0.…⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮592 × 1330 Array
Embed⁡edge
line≔ProbabilisticHoughLine⁡edge,1,π1800,80,50,10
line≔303.500000000000298.500000000000445.500000000000303.50000000000015.5000000000000324.500000000000719.500000000000506.500000000000510.500000000000305.500000000000855.500000000000317.500000000000622.500000000000347.500000000000855.500000000000359.500000000000580.500000000000470.500000000000836.500000000000535.500000000000387.500000000000331.500000000000468.500000000000335.500000000000757.500000000000280.500000000000855.500000000000281.500000000000511.500000000000307.500000000000855.500000000000320.500000000000951.500000000000238.5000000000001053.50000000000238.500000000000791.500000000000239.500000000000855.500000000000239.500000000000⋮⋮⋮⋮165 × 4 Array
DrawLine := proc(img, line) local i; for i to upperbound(line, 1) do Draw:-Line(img, line[i, 1], line[i, 2], line[i, 3], line[i, 4], [255, 0, 0]); end do; end proc:
DrawLine⁡img,line
Embed⁡img
The ImageTools[ProbabilisticHoughLine] command was introduced in Maple 2020.
For more information on Maple 2020 changes, see Updates in Maple 2020.
See Also
ImageTools[Draw][Line]
ImageTools[HoughLine]
Download Help Document