Class ConnectLinesGrid


public class ConnectLinesGrid
extends Object

Given a grid of detected line segments connect line segments together if they appear to be apart of the same line. First lines inside the same segment are considered and connected together then lines in neighboring segments are linked together. Connectivity rules are inspired by [1] with a couple of departures and optimizations.

Two lines are considered to belong to the same line if:

  1. Line slopes are similar to within tolerance.
  2. If the closest point on each line are within tangential and longitudinal distance tolerances.
    • Orientation is determined by the first line segment's slope.
When searching for matches for a line segment which is the closest to the line is the one in which it is merged with. Two lines are merged together by creating a new line segment whose end points are the two points in each line which are farthest apart from each other.

[1] M. Hirzer, "Marker Detection for Augmented Reality Applications" Seminar/Project Image Analysis Graz, October 27, 2008.

  • Constructor Details

    • ConnectLinesGrid

      public ConnectLinesGrid​(double lineSlopeAngleTol, double tangentTol, double parallelTol)
      Specify line connecting parameters.
      lineSlopeAngleTol - How similar the slope two lines need to be in radians. Try 0.062.
      tangentTol - Tolerance along tangential axis. Try 1.
      parallelTol - Tolerance along longitudinal axis. Try 8.
  • Method Details