Fit lines🔗
Fits lines to a point set. This tool can detect an arbitrary number of lines in boundary curves or other point sets. It can be used to accurately detect the location of a line even in the presence of outliers.
The input to this tool can come from any tool that finds point sets in images, such as DetectBoundariesTool, DrawEdgesTool or DetectCornersTool.
Inputs🔗
points
: The (x, y) coordinates of detected points (an N-by-2 matrix). The points may be in arbitrary order.maximumLineCount
: The maximum number of detections. If this value is exceeded, strongest detections will be kept.maximumDistance
: The maximum distance between a detected line and a point that can belong to that line. If set to zero, a perfect fit is required.minimumPointCount
: The minimum number of points to trigger line detection.angle
: The assumed angle between a line and the X axis, in degrees. The fitting algorithm will only consider lines whose angle with respect to the X axis is at most angleTolerance degrees different from angle. Note that since a line has no orientation, angle should be in [0, 180).angleTolerance
: The number of degrees the orientation of a fitted line can differ from angle. Setting angleTolerance to 90 means that no limit will be applied. (The angle between two lines can never be more than 90°.) Note that due to geometric fitting of the output lines, the angle of an output line may be outside of angle ± angleTolerance.
Outputs🔗
lineCount
: The number of lines found (N).startPoints
: The start points of found lines, if any. An N-by-2 matrix.endPoints
: The end points of found lines, if any. An N-by-2 matrix.