ImageLines

ImageLines[image]
finds line segments in image and returns the coordinates of their endpoints.

ImageLines[image, t]
uses the threshold t for selecting image lines.

ImageLines[image, t, d]
uses the parameter d to control the distinctness of the detected lines.

Details and OptionsDetails and Options

  • ImageLines returns a list of line segments where the are expressed in the standard image coordinates .
  • ImageLines[image, t] finds lines in the image whose normalized strength is larger than the specified threshold t.
  • In ImageLines[image, t, d], the parameter d controls how close lines are suppressed. If the value is set to zero, all detected lines are returned. With d set to , only the strongest line may be returned.
  • By default, ImageLines computes lines based on the Hough transform of the image, using the setting Method->"Hough".
  • Lines are detected by iteratively selecting the strongest peaks in the Hough transform. Using the distinctness parameter, peaks that are within a rectangular range from the already selected peaks are excluded from the set of line candidates.
  • With Method->"RANSAC", lines are detected using random sampling. For each sampling, pixels that are within a distance specified by the distinctness parameter d are used for computing the strength of the line. The pixels on the selected line are not used in the following iterations.
  • By default, ImageLines returns lines that span from border to border. With a setting "Segmented"->True, detected lines may be divided into smaller segments.
  • ImageLines accepts a MaxFeatures option. The default setting is MaxFeatures->All. With a setting MaxFeatures->n, at most n lines with largest normalized strength are returned.

ExamplesExamplesopen allclose all

Basic Examples (2)Basic Examples (2)

Detect and visualize straight trajectories in a bubble chamber image:

In[1]:=
Click for copyable input
Out[1]=

Detect the line going through the foreground pixels:

In[1]:=
Click for copyable input
Out[1]=
New in 8 | Last modified in 9
New to Mathematica? Find your learning path »
Have a question? Ask support »