Class SnapToEdge<T extends ImageGray>
- java.lang.Object
-
- boofcv.alg.shapes.edge.BaseIntegralEdge<T>
-
- boofcv.alg.shapes.edge.SnapToEdge<T>
-
public class SnapToEdge<T extends ImageGray> extends BaseIntegralEdge<T>
Snaps a line to an edge of an object. The refined line attempts to maximize the absolute value of the difference between the left and right sides of the line.
The algorithm works by sampling along the provided line segment. For each point along the line it also samples points tangential to it in the left and right direction. When a point is sampled it is actually the line integral between two points which are one pixel apart. The weight is found as the absolute value of difference the between two adjacent line integrals along the tangent.
Internally it will compute the solution in a local coordinate system to reduce numerical errors.
DISTORTED INPUT IMAGE: If the distortion is known it is possible to sample along a straight line in distorted image space. This can be accomplished through the use of
BaseIntegralEdge.setTransform(boofcv.struct.distort.PixelTransform_F32)where the provided transform goes from undistorted pixel coordinates into the distorted input image.
-
-
Constructor Summary
Constructors Constructor and Description SnapToEdge(int lineSamples, int tangentialSamples, java.lang.Class<T> imageType)Configures the algorithm.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.Class<T>getImageType()intgetLineSamples()intgetRadialSamples()booleanrefine(Point2D_F64 a, Point2D_F64 b, LineGeneral2D_F64 found)Fits a line defined by the two points.voidsetImageType(java.lang.Class<T> imageType)voidsetLineSamples(int lineSamples)voidsetRadialSamples(int radialSamples)-
Methods inherited from class boofcv.alg.shapes.edge.BaseIntegralEdge
setImage, setTransform
-
-
-
-
Constructor Detail
-
SnapToEdge
public SnapToEdge(int lineSamples, int tangentialSamples, java.lang.Class<T> imageType)Configures the algorithm.- Parameters:
lineSamples- Number of times it will sample along the line's axis. Try 19tangentialSamples- Radius along the tangent of what it will sample. Must be ≥ 1. Try 2.imageType- Type of image it's going to process
-
-
Method Detail
-
refine
public boolean refine(Point2D_F64 a, Point2D_F64 b, LineGeneral2D_F64 found)
Fits a line defined by the two points. When fitting the line the weight of the edge is used to determine. how influential the point is. Multiple calls might be required to get a perfect fit.- Parameters:
a- Start of lineb- End of line..found- (output) Fitted line to the edge- Returns:
- true if successful or false if it failed
-
getLineSamples
public int getLineSamples()
-
setLineSamples
public void setLineSamples(int lineSamples)
-
getRadialSamples
public int getRadialSamples()
-
setRadialSamples
public void setRadialSamples(int radialSamples)
-
getImageType
public java.lang.Class<T> getImageType()
-
setImageType
public void setImageType(java.lang.Class<T> imageType)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG