public class RefineCornerLinesToImage<T extends boofcv.struct.image.ImageGray>
extends java.lang.Object
Refines the estimate of a corner. A corner is defined as the intersection of two straight edges. The inside
edge is either all darker or lighter than the background. The optimization function when refining the edge
seeks to maximize the difference between the inside and outside of the edge. Internally SnapToEdge is
used to perform this optimization.
The corner is defined using three points. One corner and two line end points. One is to the left of the right line. Left is defined as counter-clockwise. Optimization is done by fitting a line with that initial seed. It is then iteratively updated by finding new end points with the new line that are the same distance away. Pixels near the corner are excluded from the optimization because the edge is less clear at that point.
For input polygons which are in undistorted coordinates by with a distorted image call getSnapToEdge()
and invoke BaseIntegralEdge.setTransform(PixelTransform_F32)}.
| Constructor and Description |
|---|
RefineCornerLinesToImage(java.lang.Class<T> imageType)
Simplified constructor which uses reasonable default values for most variables
|
RefineCornerLinesToImage(double cornerOffset,
int maxLineSamples,
int sampleRadius,
int maxIterations,
double convergeTolPixels,
double maxCornerChange,
java.lang.Class<T> imageType)
Constructor which provides full access to all parameters.
|
| Modifier and Type | Method and Description |
|---|---|
georegression.struct.point.Point2D_F64 |
getRefinedCorner() |
georegression.struct.point.Point2D_F64 |
getRefinedEndLeft() |
georegression.struct.point.Point2D_F64 |
getRefinedEndRight() |
SnapToEdge<T> |
getSnapToEdge() |
protected boolean |
optimize(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.
|
boolean |
refine(georegression.struct.point.Point2D_F64 corner,
georegression.struct.point.Point2D_F64 endLeft,
georegression.struct.point.Point2D_F64 endRight)
Refines the fit a polygon by snapping it to the edges.
|
void |
setImage(T image)
Sets the image which is going to be processed.
|
protected T extends boofcv.struct.image.ImageGray image
public RefineCornerLinesToImage(double cornerOffset,
int maxLineSamples,
int sampleRadius,
int maxIterations,
double convergeTolPixels,
double maxCornerChange,
java.lang.Class<T> imageType)
cornerOffset - pixels this close to the corner will be ignored. Try 2maxLineSamples - Number of points along the line which will be sampled. try 10sampleRadius - How far away from the line will it sample pixels. ≥ 1maxIterations - Maximum number of iterations it will perform. Try 10convergeTolPixels - When the corner changes less than this amount it will stop iterating. Try 1e-5maxCornerChange - maximum change in corner location allowed from previous iteration in pixels. Try 2.0public RefineCornerLinesToImage(java.lang.Class<T> imageType)
imageType - Type of input image it processespublic void setImage(T image)
BaseIntegralEdge.setTransform(boofcv.struct.distort.PixelTransform_F32) should be called before this.public boolean refine(georegression.struct.point.Point2D_F64 corner,
georegression.struct.point.Point2D_F64 endLeft,
georegression.struct.point.Point2D_F64 endRight)
corner - (input) Initial estimate of polygon corner. Not modified.endLeft - (input) End point of left line. Not modified.endRight - (input) End point of right line. Not modified.protected boolean optimize(georegression.struct.point.Point2D_F64 a,
georegression.struct.point.Point2D_F64 b,
georegression.struct.line.LineGeneral2D_F64 found)
a - Corner point in image coordinates.b - Corner point in image coordinates.found - (output) Line in image coordinatespublic georegression.struct.point.Point2D_F64 getRefinedCorner()
public georegression.struct.point.Point2D_F64 getRefinedEndLeft()
public georegression.struct.point.Point2D_F64 getRefinedEndRight()
public SnapToEdge<T> getSnapToEdge()