public class HoughTransformLinePolar
extends java.lang.Object
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 and Description |
|---|
HoughTransformLinePolar(NonMaxSuppression extractor,
int numBinsRange,
int numBinsAngle)
Specifies parameters of transform.
|
| Modifier and Type | Method and Description |
|---|---|
org.ddogleg.struct.FastQueue<georegression.struct.line.LineParametric2D_F32> |
extractLines()
Searches for local maximas and converts into lines.
|
float[] |
getFoundIntensity()
Returns the intensity/edge count for each returned line.
|
int |
getNumBinsAngle() |
int |
getNumBinsRange() |
boofcv.struct.image.GrayF32 |
getTransform()
// * Returns the Hough transform image.
|
void |
lineToCoordinate(georegression.struct.line.LineParametric2D_F32 line,
georegression.struct.point.Point2D_F64 coordinate)
Compute the parameterized coordinate for the line
|
void |
parameterize(int x,
int y)
Converts the pixel coordinate into a line in parameter space
|
void |
transform(boofcv.struct.image.GrayU8 binary)
Computes the Hough transform of the image.
|
public HoughTransformLinePolar(NonMaxSuppression extractor, int numBinsRange, int numBinsAngle)
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.public int getNumBinsRange()
public int getNumBinsAngle()
public void transform(boofcv.struct.image.GrayU8 binary)
binary - Binary image that indicates which pixels lie on edges.public org.ddogleg.struct.FastQueue<georegression.struct.line.LineParametric2D_F32> extractLines()
public void lineToCoordinate(georegression.struct.line.LineParametric2D_F32 line,
georegression.struct.point.Point2D_F64 coordinate)
public void parameterize(int x,
int y)
public boofcv.struct.image.GrayF32 getTransform()
public float[] getFoundIntensity()