java.lang.Object
imagingbook.common.geometry.line.AlgebraicLine
imagingbook.common.geometry.line.HessianLine
imagingbook.common.hough.HoughLine
- All Implemented Interfaces:
Primitive2d
,ShapeProducer
,Comparable<HoughLine>
This class represents a straight line of the form (x - xRef) * cos(angle) + (y - yRef) * sin(angle) = radius. It is
used by the Hough transform (see HoughTransformLines
). It inherits from
HessianLine
which is, in turn, a subclass of AlgebraicLine
. It adds an arbitrary reference point
(xRef, yRef) and a counter (count) for pixel votes. Instances are immutable. See Sec. 12.2 of [1] for additional
details.
[1] W. Burger, M.J. Burge, Digital Image Processing – An Algorithmic Introduction, 3rd ed, Springer (2022).
- Version:
- 2022/08/24
-
Field Summary
Fields inherited from class imagingbook.common.geometry.line.AlgebraicLine
A, B, C
-
Constructor Summary
ConstructorsConstructorDescriptionHoughLine
(double angle, double radius, double xRef, double yRef, int count) Constructor, creates a newHoughLine
instance from the specifiedHessianLine
parameters (angle, radius), an arbitrary reference point (xRef, yRef) and count.HoughLine
(AlgebraicLine line) Convenience constructor, creates a newHoughLine
instance from a givenAlgebraicLine
(or any subclass) instance with the same reference point as the original line and zero count.HoughLine
(AlgebraicLine line, double xRef, double yRef, int count) Constructor, creates a newHoughLine
instance from a givenAlgebraicLine
(or any subclass) instance. -
Method Summary
Modifier and TypeMethodDescriptionint
Required by theComparable
interface, used for sorting lines by their point count (in descending order, i.e., strong lines come first).static HoughLine
int
getCount()
double
getXref()
Returns the x-coordinate of the reference point.double
getYref()
Returns the y-coordinate of the reference point.toString()
Methods inherited from class imagingbook.common.geometry.line.HessianLine
from, getAngle, getRadius
Methods inherited from class imagingbook.common.geometry.line.AlgebraicLine
equals, equals, from, from, from, getClosestLinePoint, getDistance, getDistance, getParameters, getShape, getShape, getSignedDistance, getSignedDistance, getSquareError, intersect
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface imagingbook.common.geometry.shape.ShapeProducer
getShape, getShapes, getShapes
-
Constructor Details
-
HoughLine
Constructor, creates a newHoughLine
instance from the specifiedHessianLine
parameters (angle, radius), an arbitrary reference point (xRef, yRef) and count.- Parameters:
angle
- the line's normal angle (seeHessianLine
)radius
- the line's radius (distance to reference point)xRef
- reference point x-coordinateyRef
- reference point y-coordinatecount
- pixel votes for this line
-
HoughLine
Constructor, creates a newHoughLine
instance from a givenAlgebraicLine
(or any subclass) instance. The line parameters are adjusted to the specified reference point (actually only parameter c is modified, since a change of reference point effects only a shift of the line). The two lines are equivalent, i.e., contain the same points (x,y). Thus the distance from a given point (x,y) is the same from the original line and the new line.- Parameters:
line
- an existing line (AlgebraicLine
or subclass)xRef
- reference point x-coordinateyRef
- reference point y-coordinatecount
- pixel votes for this line
-
HoughLine
Convenience constructor, creates a newHoughLine
instance from a givenAlgebraicLine
(or any subclass) instance with the same reference point as the original line and zero count.- Parameters:
line
- aAlgebraicLine
instance
-
-
Method Details
-
from
-
getXref
Description copied from class:AlgebraicLine
Returns the x-coordinate of the reference point. For aAlgebraicLine
, the result is always zero. Inheriting classes (likeHoughLine
) override this method.- Overrides:
getXref
in classAlgebraicLine
- Returns:
- the x-coordinate reference
-
getYref
Description copied from class:AlgebraicLine
Returns the y-coordinate of the reference point. For aAlgebraicLine
, the result is always zero. Inheriting classes (likeHoughLine
) override this method.- Overrides:
getYref
in classAlgebraicLine
- Returns:
- the y-coordinate reference
-
getCount
-
compareTo
Required by theComparable
interface, used for sorting lines by their point count (in descending order, i.e., strong lines come first).- Specified by:
compareTo
in interfaceComparable<HoughLine>
- Parameters:
other
- anotherHoughLine
instance.
-
toString
- Overrides:
toString
in classHessianLine
-