Class RefinePolygonToGrayLine<T extends ImageGray<T>>

  • All Implemented Interfaces:

    public class RefinePolygonToGrayLine<T extends ImageGray<T>>
    extends java.lang.Object
    implements RefinePolygonToGray<T>

    Improves the fits of a polygon's which is darker or lighter than the background. Info'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 SnapToLineEdge#setTransform(PixelTransform).

    • Constructor Detail

      • RefinePolygonToGrayLine

        public RefinePolygonToGrayLine​(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.
      • RefinePolygonToGrayLine

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