public class SnapToEdge<T extends boofcv.struct.image.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.
| Modifier and Type | Field and Description |
|---|---|
protected georegression.struct.point.Point2D_F64 |
center |
protected int |
lineSamples |
protected double |
localScale |
protected int |
radialSamples |
protected org.ddogleg.struct.FastQueue<georegression.struct.point.Point2D_F64> |
samplePts |
protected org.ddogleg.struct.GrowQueue_F64 |
weights |
integral, integralImage| Constructor and Description |
|---|
SnapToEdge(int lineSamples,
int tangentialSamples,
java.lang.Class<T> imageType)
Configures the algorithm.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
computePointsAndWeights(double slopeX,
double slopeY,
double x0,
double y0,
double tanX,
double tanY)
Computes the location of points along the line and their weights
|
java.lang.Class<T> |
getImageType() |
int |
getLineSamples() |
int |
getRadialSamples() |
protected void |
localToGlobal(georegression.struct.line.LineGeneral2D_F64 line)
Converts the line from local to global image coordinates
|
boolean |
refine(georegression.struct.point.Point2D_F64 a,
georegression.struct.point.Point2D_F64 b,
georegression.struct.line.LineGeneral2D_F64 found)
Fits a line defined by the two points.
|
void |
setImageType(java.lang.Class<T> imageType) |
void |
setLineSamples(int lineSamples) |
void |
setRadialSamples(int radialSamples) |
setImage, setTransformprotected int lineSamples
protected int radialSamples
protected org.ddogleg.struct.GrowQueue_F64 weights
protected org.ddogleg.struct.FastQueue<georegression.struct.point.Point2D_F64> samplePts
protected georegression.struct.point.Point2D_F64 center
protected double localScale
public SnapToEdge(int lineSamples,
int tangentialSamples,
java.lang.Class<T> imageType)
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 processpublic boolean refine(georegression.struct.point.Point2D_F64 a,
georegression.struct.point.Point2D_F64 b,
georegression.struct.line.LineGeneral2D_F64 found)
a - Start of lineb - End of line..found - (output) Fitted line to the edgeprotected void computePointsAndWeights(double slopeX,
double slopeY,
double x0,
double y0,
double tanX,
double tanY)
protected void localToGlobal(georegression.struct.line.LineGeneral2D_F64 line)
public int getLineSamples()
public void setLineSamples(int lineSamples)
public int getRadialSamples()
public void setRadialSamples(int radialSamples)
public java.lang.Class<T> getImageType()
public void setImageType(java.lang.Class<T> imageType)