Class EdgeIntensityPolygon<T extends ImageGray<T>>


public class EdgeIntensityPolygon<T extends ImageGray<T>>
extends Object
Looks at the difference in pixel values along the edge of a polygon and decides if its a false positive or not. The average difference along the polygons edge is the score. Note that the abs is only taken after the sum is finished, so objects which are entirely dark/light along the edge will have an advantage.
  • Constructor Details

    • EdgeIntensityPolygon

      public EdgeIntensityPolygon​(double cornerOffset, double tangentDistance, int numSamples, Class<T> imageType)
      Constructor which configures scoring.
      cornerOffset - Number of pixels away from corner it will start sampling
      tangentDistance - How far from the line it will sample tangentially
      numSamples - Number of points it will sample along an edge
      imageType - Type of image it will process
  • Method Details

    • setTransform

      public void setTransform​(@Nullable @Nullable PixelTransform<Point2D_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.
      undistToDist - Pixel transformation from undistorted pixels into the actual distorted input image..
    • setImage

      public void setImage​(T image)
      Sets the image which is going to be processed.
    • computeEdge

      public boolean computeEdge​(Polygon2D_F64 polygon, boolean ccw)
      Checks to see if its a valid polygon or a false positive by looking at edge intensity
      polygon - The polygon being tested
      ccw - True if the polygon is counter clockwise
      true if it could compute the edge intensity, otherwise false
    • checkIntensity

      public boolean checkIntensity​(boolean insideDark, double threshold)
      Checks the edge intensity against a threshold. dark: outside-inside ≥ threshold light: inside-outside ≥ threshold
      insideDark - is the inside of the polygon supposed to be dark or light?
      threshold - threshold for average difference
      true if the edge intensity is significant enough
    • getCornerOffset

      public double getCornerOffset()
    • setCornerOffset

      public void setCornerOffset​(double cornerOffset)
    • getTangentDistance

      public double getTangentDistance()
    • setTangentDistance

      public void setTangentDistance​(double tangentDistance)
    • getAverageInside

      public double getAverageInside()
    • getAverageOutside

      public double getAverageOutside()