Class HoughTransformGradient<D extends ImageGray<D>>

java.lang.Object
boofcv.alg.feature.detect.line.HoughTransformGradient<D>
Direct Known Subclasses:
HoughTransformGradient_MT

public class HoughTransformGradient<D extends ImageGray<D>> extends Object

Base class for Hough transforms which use a pixel coordinate and the gradient to describe a line.

[1] Section 9.3 of E.R. Davies, "Machine Vision Theory Algorithms Practicalities," 3rd Ed. 2005

  • Constructor Details

    • HoughTransformGradient

      public HoughTransformGradient(NonMaxSuppression extractor, HoughTransformParameters parameters, Class<D> derivType)
      Specifies parameters of transform.
      Parameters:
      extractor - Extracts local maxima from transform space. A set of candidates is provided, but can be ignored.
  • Method Details

    • transform

      public <TD extends ImageGray<TD>> void transform(TD derivX, TD derivY, GrayU8 binary)
      Computes the Hough transform using the image gradient and a binary image which flags pixels as being edges or not.
      Parameters:
      derivX - (Input) Image derivative along x-axis.
      derivY - (Input) Image derivative along y-axis.
      binary - (Input) Non-zero pixels are considered to be line pixels.
    • extractLines

      protected void extractLines()
      Searches for local maximas and converts into lines.
    • mergeLines

      protected void mergeLines(int width, int height)
    • parameterize

      protected final void parameterize(ListIntPoint2D candidates, int x, int y, float derivX, float derivY)
      Takes the detected point along the line and its gradient and converts it into transform space.
      Parameters:
      x - point in image.
      y - point in image.
      derivX - gradient of point.
      derivY - gradient of point.
    • addParameters

      protected final void addParameters(ListIntPoint2D candidates, int x, int y, float amount)
    • getTransform

      public GrayF32 getTransform()
      Returns the Hough transform image.
      Returns:
      Transform image.
    • getLinesAll

      public DogArray<LineParametric2D_F32> getLinesAll()
    • getFoundIntensity

      public float[] getFoundIntensity()
      Returns the intensity/edge count for each returned line. Useful when doing post processing pruning.
      Returns:
      Array containing line intensities.
    • setRefineRadius

      public void setRefineRadius(int radius)
    • getRefineRadius

      public int getRefineRadius()
    • getMergeAngle

      public double getMergeAngle()
    • setMergeAngle

      public void setMergeAngle(double mergeAngle)
    • getMergeDistance

      public double getMergeDistance()
    • setMergeDistance

      public void setMergeDistance(double mergeDistance)
    • getMaxLines

      public int getMaxLines()
    • setMaxLines

      public void setMaxLines(int maxLines)
    • getLinesMerged

      public List<LineParametric2D_F32> getLinesMerged()
      Lines after merging/pruning has occurred
    • getExtractor

      public NonMaxSuppression getExtractor()
    • getRefine

      public MeanShiftPeak<GrayF32> getRefine()
    • getParameters

      public HoughTransformParameters getParameters()