houghtransform
Class HoughLines

java.lang.Object
  extended by houghtransform.HoughLines

public class HoughLines
extends java.lang.Object

Houghtransformation (HT) for lines.

Author:
matze

Constructor Summary
HoughLines(ij.ImagePlus imp, int alphaBins, int dBins)
          Constructor.
 
Method Summary
 void accumulateHoughCurve(int x, int y)
          Draws one hough curve for a specified image pixel x,y in accumulator array.
 void fillHoughSpace()
          Fills the accumulator array,
 ij.ImagePlus getHoughSpaceImage()
          Returns a visual correct result of the houghspace.
 ij.ImagePlus getImageWithHoughLines(java.util.List<java.awt.Point> maxima)
          Builds an image with the input image in the background an the fitted red lines specified by the list of maximas.
 java.util.List<java.awt.Point> getMaximaByRelativeIntensity(double relInt)
          Gets a list of maximum votes in houghspace by relative intensity, that mean every point in houghspace which votecount is greater relInt * nr. maximal votes.
 ij.ImagePlus getMaximaImage(java.util.List<java.awt.Point> maxima)
          Returns an image with marked houspace maxima given by maxima.
 java.util.List<java.awt.Point> getNonBlackPixels()
          Returns a list of all non black pixel positions.
 java.util.List<java.awt.Point> nonMaximumSupression(java.util.List<java.awt.Point> maxima, ij.ImagePlus maximaImage, double maxThreshold)
          Suppress maxima in local neighborhood.
 java.util.List<java.awt.Point> reduceMaxima(java.util.List<java.awt.Point> maxima, ij.ImagePlus maximaImage, int count)
          Reduces the list of maximas to count elements.
 void stop()
          Stops filling the accumulator array, because computation can be expensive.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HoughLines

public HoughLines(ij.ImagePlus imp,
                  int alphaBins,
                  int dBins)
Constructor. Initialize HT for the image imp. The quantification of houghspace/ count of vote buckets/bins is given by alphaBins, dBins.

Parameters:
imp - Image to perform HT on, should be an binary image (at least 8-bit).
alphaBins - Number of bins in alpha direction.
dBins - Number of bins in d direction.
Method Detail

getNonBlackPixels

public java.util.List<java.awt.Point> getNonBlackPixels()
Returns a list of all non black pixel positions.

Returns:
List of point.

fillHoughSpace

public void fillHoughSpace()
Fills the accumulator array,


stop

public void stop()
Stops filling the accumulator array, because computation can be expensive. Useful to stop threads running this algorithm.


accumulateHoughCurve

public void accumulateHoughCurve(int x,
                                 int y)
Draws one hough curve for a specified image pixel x,y in accumulator array.

Parameters:
x - X Coordinate of image pixel.
y - Y Coordinate of image pixel.

getHoughSpaceImage

public ij.ImagePlus getHoughSpaceImage()
Returns a visual correct result of the houghspace.

Returns:
Houghspace as ImagePlus.

getMaximaByRelativeIntensity

public java.util.List<java.awt.Point> getMaximaByRelativeIntensity(double relInt)
Gets a list of maximum votes in houghspace by relative intensity, that mean every point in houghspace which votecount is greater relInt * nr. maximal votes.


getMaximaImage

public ij.ImagePlus getMaximaImage(java.util.List<java.awt.Point> maxima)
Returns an image with marked houspace maxima given by maxima.

Parameters:
maxima - List of maxima points.
Returns:
Image with maxima pixel.

nonMaximumSupression

public java.util.List<java.awt.Point> nonMaximumSupression(java.util.List<java.awt.Point> maxima,
                                                           ij.ImagePlus maximaImage,
                                                           double maxThreshold)
Suppress maxima in local neighborhood.

Parameters:
maxima - List of maxima.
maximaImage - Image consisting of maxima pixel.
maxThreshold - Suppress only maxima which where maxThreshold smaller.
Returns:
List of rest of maxima.

reduceMaxima

public java.util.List<java.awt.Point> reduceMaxima(java.util.List<java.awt.Point> maxima,
                                                   ij.ImagePlus maximaImage,
                                                   int count)
Reduces the list of maximas to count elements.

Parameters:
maxima - List of maximas.
maximaImage - Image consisting of maxima pixel.
count - Count of maximas remaining.
Returns:
Reduced maxima list.

getImageWithHoughLines

public ij.ImagePlus getImageWithHoughLines(java.util.List<java.awt.Point> maxima)
Builds an image with the input image in the background an the fitted red lines specified by the list of maximas.

Parameters:
maxima - List of maxima.
Returns:
Image visualizing result of houghtransformation.