Class RefineCornerLinesToImage<T extends ImageGray>
- java.lang.Object
-
- boofcv.alg.shapes.corner.RefineCornerLinesToImage<T>
-
public class RefineCornerLinesToImage<T extends ImageGray> extends java.lang.ObjectRefines 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
SnapToEdgeis 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 invokeBaseIntegralEdge.setTransform(PixelTransform_F32)}.
-
-
Constructor Summary
Constructors Constructor and Description RefineCornerLinesToImage(java.lang.Class<T> imageType)Simplified constructor which uses reasonable default values for most variablesRefineCornerLinesToImage(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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description Point2D_F64getRefinedCorner()Point2D_F64getRefinedEndLeft()Point2D_F64getRefinedEndRight()SnapToEdge<T>getSnapToEdge()booleanrefine(Point2D_F64 corner, Point2D_F64 endLeft, Point2D_F64 endRight)Refines the fit a polygon by snapping it to the edges.voidsetImage(T image)Sets the image which is going to be processed.
-
-
-
Constructor Detail
-
RefineCornerLinesToImage
public 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. See code documents value a description of these variables.- Parameters:
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.0
-
RefineCornerLinesToImage
public RefineCornerLinesToImage(java.lang.Class<T> imageType)
Simplified constructor which uses reasonable default values for most variables- Parameters:
imageType- Type of input image it processes
-
-
Method Detail
-
setImage
public void setImage(T image)
Sets the image which is going to be processed. If a transform is to be usedBaseIntegralEdge.setTransform(boofcv.struct.distort.PixelTransform_F32)should be called before this.
-
refine
public boolean refine(Point2D_F64 corner, Point2D_F64 endLeft, Point2D_F64 endRight)
Refines the fit a polygon by snapping it to the edges.- Parameters:
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.
-
getRefinedCorner
public Point2D_F64 getRefinedCorner()
-
getRefinedEndLeft
public Point2D_F64 getRefinedEndLeft()
-
getRefinedEndRight
public Point2D_F64 getRefinedEndRight()
-
getSnapToEdge
public SnapToEdge<T> getSnapToEdge()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG