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

Class RefinePolygonLineToImage<T extends ImageGray>

  • All Implemented Interfaces:
    RefineBinaryPolygon<T>


    public class RefinePolygonLineToImage<T extends ImageGray>
    extends java.lang.Object
    implements RefineBinaryPolygon<T>

    Improves the fits of a polygon's which is darker or lighter than the background. Polygon's edges are assumed to be perfectly straight lines. The edges are processed individually and fit to a line using weighted regression. Both black squares with white backgrounds and white shapes with black backgrounds can be found. The edges are selected to maximize the difference between light and dark regions.

    For example, assume an image axis aligned rectangle has a lower extent of 1,2 and a upper extent of 12,15, is entirely filled, excluding the upper extent pixels (as is typical). Then the found lower and upper extends of the found polygon will also be 1,2 and 12,15.

    If a line lies entirely along the image border it is not modified. If part of it lies along the image then only points not near the border are used to optimize its location.

    For input polygons which are in undistorted coordinates by with a distorted image call getSnapToEdge() and invoke BaseIntegralEdge.setTransform(PixelTransform_F32).

    • Constructor Summary

      Constructors 
      Constructor and Description
      RefinePolygonLineToImage(double cornerOffset, int lineSamples, int sampleRadius, int maxIterations, double convergeTolPixels, double maxCornerChangePixel, java.lang.Class<T> imageType)
      Constructor which provides full access to all parameters.
      RefinePolygonLineToImage(int numSides, java.lang.Class<T> imageType)
      Simplified constructor which uses reasonable default values for most variables
    • Constructor Detail

      • RefinePolygonLineToImage

        public RefinePolygonLineToImage(double cornerOffset,
                                        int lineSamples,
                                        int sampleRadius,
                                        int maxIterations,
                                        double convergeTolPixels,
                                        double maxCornerChangePixel,
                                        java.lang.Class<T> imageType)
        Constructor which provides full access to all parameters. See code documents value a description of these variables.
      • RefinePolygonLineToImage

        public RefinePolygonLineToImage(int numSides,
                                        java.lang.Class<T> imageType)
        Simplified constructor which uses reasonable default values for most variables
        Parameters:
        numSides - Number of sides on the polygon
        imageType - Type of input image it processes
    • Method Detail

      • refine

        public boolean refine(Polygon2D_F64 input,
                              java.util.List<Point2D_I32> contour,
                              GrowQueue_I32 splits,
                              Polygon2D_F64 output)
        Refines the fit a polygon by snapping it to the edges.
        Specified by:
        refine in interface RefineBinaryPolygon<T extends ImageGray>
        Parameters:
        input - (input) Initial estimate for the polygon. CW or CCW ordering doesn't matter.
        output - (output) the fitted polygon
        contour - List of pixels in the contour
        splits - Indexes in the contour where the initial polygon was found
        Returns:
        true if successful or false if it failed
      • setTransform

        public void setTransform(PixelTransform_F32 undistToDist)
        Used to specify a transform that is applied to pixel coordinates to bring them back into original input image coordinates. For example if the input image has lens distortion but the edge were found in undistorted coordinates this code needs to know how to go from undistorted back into distorted image coordinates in order to read the pixel's value.
        Parameters:
        undistToDist - Pixel transformation from undistorted pixels into the actual distorted input image..

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.