Documentation of 'boofcv.alg.shapes.polygon.BinaryPolygonDetector' Java class
BinaryPolygonDetector
boofcv.alg.shapes.polygon

Class BinaryPolygonDetector<T extends ImageGray>



  • public class BinaryPolygonDetector<T extends ImageGray>
    extends java.lang.Object

    Detects convex polygons with the specified number of sides in an image. Shapes are assumed to be black shapes against a white background, allowing for thresholding to be used. Subpixel refinement is done using the provided implementation of RefineBinaryPolygon.

    Processing Steps:
    1. First the input a gray scale image and a binarized version of it.
    2. The contours of black blobs are found.
    3. From the contours polygons are fitted and refined to pixel accuracy.
    4. (Optional) Sub-pixel refinement of the polygon's edges and/or corners.

    The returned polygons will encompass the entire black polygon. Here is a simple example in 1D. If all pixels are white, but pixels ranging from 5 to 10, inclusive, then the returned boundaries would be 5.0 to 11.0. This means that coordinates 5.0 ≤ x < 11.0 are all black. 11.0 is included, but note that the entire pixel 11 is white.

    • Constructor Detail

      • BinaryPolygonDetector

        public BinaryPolygonDetector(int minSides,
                                     int maxSides,
                                     SplitMergeLineFitLoop contourToPolygon,
                                     RefineBinaryPolygon<T> refinePolygon,
                                     double minContourFraction,
                                     boolean outputClockwise,
                                     boolean convex,
                                     boolean touchBorder,
                                     double splitPenalty,
                                     double edgeThreshold,
                                     java.lang.Class<T> inputType)
        Configures the detector.
        Parameters:
        minSides - minimum number of sides
        maxSides - maximum number of sides
        contourToPolygon - Fits a crude polygon to the shape's binary contour
        refinePolygon - (Optional) Refines the polygon's lines. Set to null to skip step
        minContourFraction - Size of minimum contour as a fraction of the input image's width. Try 0.23
        outputClockwise - If true then the order of the output polygons will be in clockwise order
        convex - If true it will only return convex shapes
        touchBorder - if true then shapes which touch the image border are allowed
        splitPenalty - Penalty given to a line segment while splitting. See MinimizeEnergyPrune
        edgeThreshold - Polygons with an edge intensity less than this are discarded.
        inputType - Type of input image it's processing
    • Method Detail

      • setLensDistortion

        public void setLensDistortion(int width,
                                      int height,
                                      PixelTransform_F32 distToUndist,
                                      PixelTransform_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.

        WARNING: The undistorted image must have the same bounds as the distorted input image. This is because several of the bounds checks use the image shape. This are simplified greatly by this assumption.

        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.
      • process

        public void process(T gray,
                            GrayU8 binary)
        Examines the undistorted gray scake input image for squares.
        Parameters:
        gray - Input image
      • isConvex

        public boolean isConvex()
      • setConvex

        public void setConvex(boolean convex)
      • getLabeled

        public GrayS32 getLabeled()
      • isOutputClockwise

        public boolean isOutputClockwise()
      • getUsedContours

        public java.util.List<Contour> getUsedContours()
      • getAllContours

        public java.util.List<Contour> getAllContours()
      • getInputType

        public java.lang.Class<T> getInputType()
      • setNumberOfSides

        public void setNumberOfSides(int min,
                                     int max)
      • getMinimumSides

        public int getMinimumSides()
      • getMaximumSides

        public int getMaximumSides()
      • setVerbose

        public void setVerbose(boolean verbose)
      • isCheckEdgeBefore

        public boolean isCheckEdgeBefore()
      • getEdgeThreshold

        public double getEdgeThreshold()
      • setEdgeThreshold

        public void setEdgeThreshold(double edgeThreshold)
      • setCheckEdgeBefore

        public void setCheckEdgeBefore(boolean checkEdgeBefore)
        If set to true it will prune using polygons using their edge intensity before sub-pixel optimization. This should only be set to false if the initial edge is known to be off by a bit, like with a chessboard.
        Parameters:
        checkEdgeBefore - true for checking before and false for after.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.