boofcv.alg.shapes.polygon
Class RefinePolygonCornersToImage<T extends ImageGray>
- java.lang.Object
-
- boofcv.alg.shapes.polygon.RefinePolygonCornersToImage<T>
-
- All Implemented Interfaces:
- RefineBinaryPolygon<T>
public class RefinePolygonCornersToImage<T extends ImageGray> extends java.lang.Object implements RefineBinaryPolygon<T>
Given a contour and the index of corner points it will fit the corners individually to sub-pixel precision by locally fitting line segments near by each corner. The length of each line segment is specified by the number of pixels away it will traverse the contour. It makes sure that the end point does not go past the next corner.
-
-
Constructor Summary
Constructors Constructor and Description RefinePolygonCornersToImage(java.lang.Class<T> imageType)Provides reasonable default values for all parameters that it canRefinePolygonCornersToImage(int endPointDistance, double cornerOffset, int maxLineSamples, int sampleRadius, int maxIterations, double convergeTolPixels, double maxCornerChangePixels, java.lang.Class<T> imageType)Configures all parameters of the detector
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intgetPixelsAway()SnapToEdge<T>getSnapToEdge()booleanrefine(Polygon2D_F64 input, java.util.List<Point2D_I32> contour, GrowQueue_I32 splits, Polygon2D_F64 refined)Refines the corner estimates in the contour.voidsetImage(T input)Sets the input imagevoidsetLensDistortion(int width, int height, PixelTransform_F32 distToUndist, PixelTransform_F32 undistToDist)Specifies lens distortionvoidsetPixelsAway(int pixelsAway)
-
-
-
Constructor Detail
-
RefinePolygonCornersToImage
public RefinePolygonCornersToImage(int endPointDistance, double cornerOffset, int maxLineSamples, int sampleRadius, int maxIterations, double convergeTolPixels, double maxCornerChangePixels, java.lang.Class<T> imageType)Configures all parameters of the detector- Parameters:
endPointDistance- How many indexes away in the contour list should end points be.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-5maxCornerChangePixels- maximum change in corner location allowed from previous iteration in pixels. Try 2.0imageType- Type of input image.
-
RefinePolygonCornersToImage
public RefinePolygonCornersToImage(java.lang.Class<T> imageType)
Provides reasonable default values for all parameters that it can- Parameters:
imageType- Type of input image.
-
-
Method Detail
-
setImage
public void setImage(T input)
Sets the input image- Specified by:
setImagein interfaceRefineBinaryPolygon<T extends ImageGray>- Parameters:
input- Input image-
-
setLensDistortion
public void setLensDistortion(int width, int height, PixelTransform_F32 distToUndist, PixelTransform_F32 undistToDist)Description copied from interface:RefineBinaryPolygonSpecifies lens distortion- Specified by:
setLensDistortionin interfaceRefineBinaryPolygon<T extends ImageGray>
-
refine
public boolean refine(Polygon2D_F64 input, java.util.List<Point2D_I32> contour, GrowQueue_I32 splits, Polygon2D_F64 refined)
Refines the corner estimates in the contour.- Specified by:
refinein interfaceRefineBinaryPolygon<T extends ImageGray>- Parameters:
contour- (Input) Shape's contoursplits- (Input) index of corners in the contourrefined- (Output) Refined polygon with sub-pixel accurate cornersinput- 2D polygon version of contour polygon- Returns:
- Number of corners it successfully optimized.
-
getPixelsAway
public int getPixelsAway()
-
setPixelsAway
public void setPixelsAway(int pixelsAway)
-
getSnapToEdge
public SnapToEdge<T> getSnapToEdge()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG