Class FitLinesToContour


public class FitLinesToContour extends Object
Refines a set of corner points along a contour by fitting lines to the points between the corners using a least-squares technique. It then refines the corners estimates by interesting the lines and finding the closest point on the contour. A surprising number of things can go wrong and there are a lot of adhoc rules in this class and probably valid shapes are rejected. It's well tested but wouldn't be shocked if it contains bugs that are compensated for else where in the code.
  • Constructor Details

    • FitLinesToContour

      public FitLinesToContour()
  • Method Details

    • setContour

      public void setContour(List<Point2D_I32> contour)
    • fitAnchored

      public boolean fitAnchored(int anchor0, int anchor1, DogArray_I32 corners, DogArray_I32 output)
      Fits line segments along the contour with the first and last corner fixed at the original corners. The output will be a new set of corner indexes. Since the corner list is circular, it is assumed that anchor1 comes after anchor0. The same index can be specified for an anchor, it will just go around the entire circle
      anchor0 - corner index of the first end point
      anchor1 - corner index of the second end point.
      corners - Initial location of the corners
      output - Optimized location of the corners