Class HoughTransformBinary
- Direct Known Subclasses:
HoughTransformBinary_MT
Hough transform which uses a polar line representation, distance from origin and angle (0 to 180 degrees). Standard implementation of a hough transform. 1) Gradient intensity image is used to find edge pixels. 2) All possible lines passing through that point are found. 3) Line parameters are summed up in the line image, in which each pixel represents a coordinate in parameter space. 3) Local maximums are found.
By the nature of this algorithms, lines are forced to be discretized into parameter space. The range can vary from +- the maximum range inside the image and the angle from 0 to PI radians. How finely discretized an image is effects line detection accuracy. If too fine lines might not be detected or it will be too noisy.
In the line image, the transform from line parameter coordinate to pixel coordinate is as follow:
x = r*cos(theta) + centerX
y = r*sin(theta) + centerY
USAGE NOTE: Duplicate/very similar lines are possible due to angles being cyclical. What happens is that if a line's orientation lies along a boundary point its angles will be split up between top and bottom of the transform. When lines are extracted using non-maximum it will detects peaks at the top and bottom.
-
Constructor Summary
ConstructorDescriptionHoughTransformBinary
(NonMaxSuppression extractor, HoughTransformParameters parameters) Specifies parameters of transform. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Searches for local maximals and converts into lines.float[]
Returns the intensity/edge count for each returned line.int
double
double
// * Returns the Hough transform image.protected void
mergeLines
(int width, int height) void
setMaxLines
(int maxLines) void
setMergeAngle
(double mergeAngle) void
setMergeDistance
(double mergeDistance) void
setNumberOfCounts
(ConfigLength counts) void
Computes the Hough transform of the image.
-
Constructor Details
-
HoughTransformBinary
Specifies parameters of transform. The minimum number of points specified in the extractor is an important tuning parameter.- Parameters:
extractor
- Extracts local maxima from transform space.
-
-
Method Details
-
transform
Computes the Hough transform of the image.- Parameters:
binary
- Binary image that indicates which pixels lie on edges.
-
extractLines
protected void extractLines()Searches for local maximals and converts into lines. -
mergeLines
protected void mergeLines(int width, int height) -
getTransform
// * Returns the Hough transform image.- Returns:
- Transform image.
-
getFoundIntensity
public float[] getFoundIntensity()Returns the intensity/edge count for each returned line. Useful when doing post processing pruning.- Returns:
- Array containing line intensities.
-
getLinesAll
-
getLinesMerged
-
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) -
getParameters
-
setNumberOfCounts
-