org.jscience.computing.ai.vision
Class LineHoughTransformOp

java.lang.Object
  extended by org.jscience.computing.ai.vision.HoughTransformOp
      extended by org.jscience.computing.ai.vision.LineHoughTransformOp

public class LineHoughTransformOp
extends HoughTransformOp

This class implements a Line Hough transform. It is heavily based on code written by Timothy Sharman for the excellent HIPR2 resource site (http://homepages.inf.ed.ac.uk/rbf/HIPR2/hipr_top.htm).


Field Summary
protected  long[][] houghAccumulator
          The accumulator.
protected  java.awt.Color lineColor
          The line colour used for the superimposed image (default WHITE).
protected  int localPeakNeighbourhood
          The local peak neighbourhood.
protected  long maxAccValue
          The maximum accumulator value.
protected  double thetaStep
          The theta step.
 
Constructor Summary
LineHoughTransformOp()
          Creates a new instance of LineHoughTransformOp
 
Method Summary
 java.awt.image.BufferedImage getAccumulatorImage()
          Returns the accumulator as an image.
 java.awt.Color getLineColor()
          Get the line colour used.
 int getLocalPeakNeighbourhood()
          Get the local peak neighbourhood.
protected  long getMaximum()
          Get the maximum value in the accumulator.
 java.awt.image.BufferedImage getSuperimposed(java.awt.image.BufferedImage img, double threshold)
          Returns the superimposed image.
static void main(java.lang.String[] args)
          Simple test function.
 void run(java.awt.image.BufferedImage img)
          Runs the line Hough Transform.
 void setLineColor(java.awt.Color lc)
          Set the line colour used for the superimposed image.
 void setLocalPeakNeighbourhood(int lpn)
          Set the local peak neighbourhood.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

houghAccumulator

protected long[][] houghAccumulator
The accumulator.


maxAccValue

protected long maxAccValue
The maximum accumulator value.


localPeakNeighbourhood

protected int localPeakNeighbourhood
The local peak neighbourhood.


thetaStep

protected double thetaStep
The theta step.


lineColor

protected java.awt.Color lineColor
The line colour used for the superimposed image (default WHITE).

Constructor Detail

LineHoughTransformOp

public LineHoughTransformOp()
Creates a new instance of LineHoughTransformOp

Method Detail

setLineColor

public void setLineColor(java.awt.Color lc)
Set the line colour used for the superimposed image.

Parameters:
lc - the new line colour.

getLineColor

public java.awt.Color getLineColor()
Get the line colour used.

Returns:
the current line colour used.

setLocalPeakNeighbourhood

public void setLocalPeakNeighbourhood(int lpn)
Set the local peak neighbourhood.

Parameters:
lpn - the new local peak neighbourhood.

getLocalPeakNeighbourhood

public int getLocalPeakNeighbourhood()
Get the local peak neighbourhood.

Returns:
the current local peak neighbourhood.

getMaximum

protected long getMaximum()
Get the maximum value in the accumulator.

Returns:
the maximum value.

getAccumulatorImage

public java.awt.image.BufferedImage getAccumulatorImage()
Returns the accumulator as an image. Values are scaled linearly according to the maximum value.

Specified by:
getAccumulatorImage in class HoughTransformOp
Returns:
the accumulator image.

run

public void run(java.awt.image.BufferedImage img)
Runs the line Hough Transform. Note that the input image must be an edge-only, greyscale image (ie, must have been passed through an edge detector and thresholding filter).

Specified by:
run in class HoughTransformOp
Parameters:
img - input image.
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

getSuperimposed

public java.awt.image.BufferedImage getSuperimposed(java.awt.image.BufferedImage img,
                                                    double threshold)
Returns the superimposed image. This can be a full-colour version of the image the Hough transform has been run on.

Specified by:
getSuperimposed in class HoughTransformOp
Parameters:
img - the input image.
threshold - the accumulator threshold.
Returns:
the superimposed image.

main

public static void main(java.lang.String[] args)
Simple test function.

Parameters:
args - the command line arguments