Detect linesđź”—

Detects line segments. This tool can be used to locate any line-like features in input images. As a result, it produces a coordinate frame that is attached to the end of a line segment and rotated so that the x axis points towards the other end. In addition, the length and end points of each line segment are given.

There is no generally applicable way to decide which of the end points is the “correct” starting point. This tool uses the one that is closer to the upper left corner of the line segment’s axis-aligned bounding box in world coordinates.

Inputsđź”—

  • image: Input image.

  • frame: A coordinate frame that defines the location and orientation of the rectangle in which line segments will be detected, in the world coordinate system.

  • size: The size of the search area.

  • maxLineCount: The maximum number of line segments to detect.

  • maxAngleDiff: The maximum absolute angle between the x axis of the input frame and a detected line segment, in degrees. This parameter makes it possible to filter out line segments that don’t have the expected orientation.

  • minLength: Minimum length of a line segment, in world units.

  • maxLength: Maximum length of a line segment, in world units.

  • fittingTolerance: The maximum allowed distance between a line segment and a detected edge point, in world units. The detection algorithm will stop joining edge points once the distance from the currently estimated line to a detected edge point exceeds this value. The remaining edge points will form a new line segment.

  • maxGapLength: The maximum distance between the end points of two colinear line segments that can be jointed into a single detection, in world units. If maxGapLength is non-zero, the detection algorithm will try to find broken, colinear line segments and join them.

  • smoothness: The standard deviation of the of the Gaussian smoothing filter. Bigger value means better tolerance against noise, less sensitivity and worse localization. The Gaussian filter is cut at approximately 1.5 times the standard deviation of the Gaussian function. If smoothness is zero, no smoothing filter will be applied.

  • gradientThreshold: The minimum absolute gradient that can still be regarded as an edge. If this value is zero, a suitable threshold will be selected automatically.

  • anchorThreshold: The minimum absolute difference to neighboring gradient values an anchor point must have. If this value is zero, a suitable threshold will be selected automatically.

Outputsđź”—

  • image: A binary image in which the detected lines are ones.

  • frame: The location of a line segment’s start point and the orientation of the line segment expressed as a coordinate frame. Each detected line segment will produce a 4-by-4 matrix, resulting in a 4N-by-4 output matrix (N is the number of detected line segments).

  • length: The length of each detected line segment as an N-by-1 matrix.

  • magnitude: A value describing the relative prominence or strength of each line segment as and N-by-1 matrix. The magnitude depends on the length of a line segment and the absolute value of local gray-level gradient along the line segment.

  • startPoint: The start point (x, y) of each detected line segment as an N-by-2 matrix.

  • endPoint: The end point (x, y) of each detected line segment as an N-by-2 matrix.