Class GridRansacLineDetector<D extends ImageGray<D>>

Direct Known Subclasses:
ImplGridRansacLineDetector_F32, ImplGridRansacLineDetector_S16

public abstract class GridRansacLineDetector<D extends ImageGray<D>>
extends Object

Line segment feature detector. The image is broken up into several regions of constant size. Inside each region pixels that have been flaged as belonging to edges are connected into lines using RANSAC or another ModelMatcher. The output is a list of detected lines in a grid of lists. This algorithm is inspired by [1], but has several differences in how the image is processed and how the output is produced.

The image is segmented into square regions of homogeneous size. Inside each region pixels which have been flagged as belonging to an edge are identified. Flagged edge pixels are referred to as "edgels" and have the image gradient at that point stored in their data structure. Gradient information is used to prune incompatible points from each other. RANSAC or similar algorithms are used to estimate and detect lines inside each region. Ones a line has been identified it is removed from the list of candidate points and more lines are searched for.

[1] J.C. Clarke, S. Carlsson, and A. Zisserman. "Detecting and tracking linear features efficiently" In. BMVC. British Machine Vision Association, 1996. 4,5,7.

  • Field Details

    • regionSize

      protected int regionSize
    • minInlierSize

      protected int minInlierSize
    • edgels

      protected DogArray<Edgel> edgels
    • maxDetectLines

      protected int maxDetectLines
  • Constructor Details

    • GridRansacLineDetector

      protected GridRansacLineDetector​(int regionSize, int maxDetectLines, ModelMatcher<LinePolar2D_F32,​Edgel> robustMatcher)
      Specifies major configuration parameters.
      regionSize - Length of each side in a square region. Try 40.
      maxDetectLines - Maximum number of lines which can be detected in a region. Try 10.
      robustMatcher - Robust model matcher for line detection.
  • Method Details

    • process

      public void process​(D derivX, D derivY, GrayU8 binaryEdges)
      Detects line segments through the image inside of grids.
      derivX - Image derivative along x-axis. Not modified.
      derivY - Image derivative along x-axis. Not modified.
      binaryEdges - True values indicate that a pixel is an edge pixel. Not modified.
    • getFoundLines

      public MatrixOfList<LineSegment2D_F32> getFoundLines()
      Returns all the found line segments contained in a grid.
      Grid of detected lines.
    • detectEdgels

      protected abstract void detectEdgels​(int index0, int x0, int y0, D derivX, D derivY, GrayU8 binaryEdges)
      Computes edgel information for pixels which have been flagged inside a region
      x0 - offset of region top left corner
      y0 - offset of region top left corner
      derivX - contains image derivative x-axis
      derivY - contains image derivative y-axis
      binaryEdges - Mark indicting which pixels are edges along a line