Package boofcv.alg.shapes.polygon
Class DetectPolygonBinaryGrayRefine<T extends ImageGray<T>>
java.lang.Object
boofcv.alg.shapes.polygon.DetectPolygonBinaryGrayRefine<T>
Detects polygons using contour of blobs in a binary image. The contours can then have their edges refined as a
whole or on an individual basis. Lens distortion can be specified. Lens distortion is handled in a sparse way
along the contour of shapes.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
-
Constructor Summary
ConstructorDescriptionDetectPolygonBinaryGrayRefine
(DetectPolygonFromContour<T> detector, @Nullable RefinePolygonToContour refineContour, @Nullable RefinePolygonToGray<T> refineGray, double minimumRefineEdgeIntensity, boolean adjustForThresholdBias) Configures the polygon detector -
Method Summary
Modifier and TypeMethodDescriptionvoid
Discard previously set lens distortion modelsint
double
int
getPolygons
(@Nullable List<Polygon2D_F64> storage, @Nullable List<DetectPolygonFromContour.Info> storageInfo) Returns a list of all polygons with an edge threshold above the minimumboolean
void
Detects polygons inside the grayscale image and its thresholded versionboolean
Refines the fit to the specified polygon.void
Refines all the detected polygons and places them into the provided list.void
void
void
setHelper
(PolygonHelper helper) Specify a helper used to inject specialized code into the polygon detectorvoid
setLensDistortion
(int width, int height, @Nullable PixelTransform<Point2D_F32> distToUndist, @Nullable PixelTransform<Point2D_F32> undistToDist) Specifies transforms which can be used to change coordinates from distorted to undistorted and the opposite coordinates.void
setVerbose
(boolean verbose) Turn on and off verbose output to standard out
-
Constructor Details
-
DetectPolygonBinaryGrayRefine
public DetectPolygonBinaryGrayRefine(DetectPolygonFromContour<T> detector, @Nullable @Nullable RefinePolygonToContour refineContour, @Nullable @Nullable RefinePolygonToGray<T> refineGray, double minimumRefineEdgeIntensity, boolean adjustForThresholdBias) Configures the polygon detector- Parameters:
detector
- Fits a polygon to a contourrefineContour
- Refines the polygon produce a better fit against the contourrefineGray
- Refine the edges to the input gray scale imageminimumRefineEdgeIntensity
- Threshold for pruning shapes. Must have this edge intensity. Try 6adjustForThresholdBias
- Should it adjust contour polygons for the bias caused by thresholding?
-
-
Method Details
-
setHelper
Specify a helper used to inject specialized code into the polygon detector -
setVerbose
public void setVerbose(boolean verbose) Turn on and off verbose output to standard out -
setLensDistortion
public void setLensDistortion(int width, int height, @Nullable @Nullable PixelTransform<Point2D_F32> distToUndist, @Nullable @Nullable PixelTransform<Point2D_F32> undistToDist) Specifies transforms which can be used to change coordinates from distorted to undistorted and the opposite coordinates. The undistorted image is never explicitly created.
- Parameters:
width
- Input image width. Used in sanity check only.height
- Input image height. Used in sanity check only.distToUndist
- Transform from distorted to undistorted image.undistToDist
- Transform from undistorted to distorted image.
-
clearLensDistortion
public void clearLensDistortion()Discard previously set lens distortion models -
resetRuntimeProfiling
public void resetRuntimeProfiling() -
process
Detects polygons inside the grayscale image and its thresholded version- Parameters:
gray
- Gray scale imagebinary
- Binary version of grayscale image
-
refine
Refines the fit to the specified polygon. Only info.polygon is modified- Parameters:
info
- The polygon and related info- Returns:
- true if successful or false if not
-
refineAll
public void refineAll()Refines all the detected polygons and places them into the provided list. Polygons which fail the refinement step are not added. -
getPolygons
public List<Polygon2D_F64> getPolygons(@Nullable @Nullable List<Polygon2D_F64> storage, @Nullable @Nullable List<DetectPolygonFromContour.Info> storageInfo) Returns a list of all polygons with an edge threshold above the minimum- Parameters:
storageInfo
- Optional storage for info associated with polygons. Pruning is done so the info list and the returned polygon list are not in synch with each other
-
getPolygonInfo
-
getInputType
-
getMinimumSides
public int getMinimumSides() -
getMaximumSides
public int getMaximumSides() -
isOutputClockwise
public boolean isOutputClockwise() -
getDetector
-
getAllContours
-
setFunctionAdjust
-
getMilliAdjustBias
public double getMilliAdjustBias()
-