jjil.algorithm
Class LinefitHough

java.lang.Object
  extended by jjil.algorithm.LinefitHough

public class LinefitHough
extends java.lang.Object

Finds a line in an array of points using Hough transform. Not a pipeline stage. Returns the most likely line as slope and Y-intercept through member access functions.

Author:
webb

Constructor Summary
LinefitHough(int cMinY, int cMaxY, int cMinSlope, int cMaxSlope, int cSteps)
          Creates a new instance of LinefitHough
 
Method Summary
 int getCount()
          Returns the count of points on the line that was found.
 int getSlope()
          Returns the slope of the line that was found.
 int getY()
          Returns the y-intercept of the line that was found.
 void push(java.util.Vector points)
          Finds the most likely line passing through the points in the Vector.
 java.lang.String toString()
          Return a string describing the current instance, giving the values of the constructor parameters.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LinefitHough

public LinefitHough(int cMinY,
                    int cMaxY,
                    int cMinSlope,
                    int cMaxSlope,
                    int cSteps)
             throws Error
Creates a new instance of LinefitHough

Parameters:
cMinY - minimum Y value
cMaxY - maximum Y value
cMinSlope - minimum slope (multiplied by 256)
cMaxSlope - maximum slope (multiplied by 256)
cSteps - steps taken in Hough accumulator between minimum and maximum slope.
Throws:
Error - if Y or slope range is empty, or cSteps is not positive.
Method Detail

getCount

public int getCount()
Returns the count of points on the line that was found.

Returns:
the point count.

getSlope

public int getSlope()
Returns the slope of the line that was found.

Returns:
the line slope (*256)

getY

public int getY()
Returns the y-intercept of the line that was found.

Returns:
the y-intercept.

push

public void push(java.util.Vector points)
          throws Error
Finds the most likely line passing through the points in the Vector.

Parameters:
points - the input Vector of point positions
Throws:
Error - if points is not a Vector of point objects.

toString

public java.lang.String toString()
Return a string describing the current instance, giving the values of the constructor parameters.

Overrides:
toString in class java.lang.Object
Returns:
the string describing the current instance.