Class HoughTransformLinePolar
- java.lang.Object
-
- boofcv.alg.feature.detect.line.HoughTransformLinePolar
-
public class HoughTransformLinePolar extends java.lang.ObjectHough 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
Constructors Constructor and Description HoughTransformLinePolar(NonMaxSuppression extractor, int numBinsRange, int numBinsAngle)Specifies parameters of transform.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description FastQueue<LineParametric2D_F32>extractLines()Searches for local maximas and converts into lines.float[]getFoundIntensity()Returns the intensity/edge count for each returned line.intgetNumBinsAngle()intgetNumBinsRange()GrayF32getTransform()// * Returns the Hough transform image.voidlineToCoordinate(LineParametric2D_F32 line, Point2D_F64 coordinate)Compute the parameterized coordinate for the linevoidparameterize(int x, int y)Converts the pixel coordinate into a line in parameter spacevoidtransform(GrayU8 binary)Computes the Hough transform of the image.
-
-
-
Constructor Detail
-
HoughTransformLinePolar
public HoughTransformLinePolar(NonMaxSuppression extractor, int numBinsRange, int numBinsAngle)
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.numBinsRange- How many bins are be used for line range.numBinsAngle- How many bins are used for angle.
-
-
Method Detail
-
getNumBinsRange
public int getNumBinsRange()
-
getNumBinsAngle
public int getNumBinsAngle()
-
transform
public void transform(GrayU8 binary)
Computes the Hough transform of the image.- Parameters:
binary- Binary image that indicates which pixels lie on edges.
-
extractLines
public FastQueue<LineParametric2D_F32> extractLines()
Searches for local maximas and converts into lines.- Returns:
- Found lines in the image.
-
lineToCoordinate
public void lineToCoordinate(LineParametric2D_F32 line, Point2D_F64 coordinate)
Compute the parameterized coordinate for the line
-
parameterize
public void parameterize(int x, int y)Converts the pixel coordinate into a line in parameter space
-
getTransform
public GrayF32 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.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG