Class Contour2D


  • public class Contour2D
    extends java.lang.Object

    class representing a 2d contour
    • Method Detail

      • getCPtr

        public static long getCPtr​(Contour2D obj)
      • delete

        public void delete()
      • size

        public long size()
        get nr of conout points on this contour
        Returns:
        number of points
      • calcArea

        public double calcArea()
        calculates the area of this contour
      • center

        public Vector2D center()
        get contour center
      • write

        public static void write​(Contour2D objC,
                                 java.lang.String file)
        writes a contour to file
        Parameters:
        objC - [in] contour to write to file
        file - [in] name of file
      • read

        public static Contour2D read​(java.lang.String file)
        reads a contour from file
        Parameters:
        file -
        Returns:
        a contour
      • calcSequenceMoment

        public static double calcSequenceMoment​(Contour2D contour,
                                                Vector2D c,
                                                int r)
        calculates the r'th sequence moment of an ordered contour
        Parameters:
        contour - [in]
        c - [in] center
        r - [in]
      • calcCentralMoments

        public static double calcCentralMoments​(Contour2D contour,
                                                Vector2D c,
                                                int r)
        calculates the r'th central moments of the contour
        Parameters:
        contour -
        c - [in] center
        r - [in]
        Returns:
        the moment
      • calcCovarianceMatrix

        public static Covariance calcCovarianceMatrix​(Contour2D contour,
                                                      Vector2D c)
        Calculates the covariance of the contour "contour" with mean coordinate
        c
        Parameters:
        contour - [in] the contour
        c - [in] the mean of the contour points/coordinates
        Returns:
        the 2x2 covariance matrix of the contour
      • calcCentroid

        public static Vector2D calcCentroid​(Contour2D contour)
        calculates the centroid or the mean of the points in the contour.
      • getCurvature

        public static double getCurvature​(int idx,
                                          int pixelStep,
                                          Contour2D contour)
        extracts the local curvature around the contour point
        defined by idx.
      • calcNormal

        public static Vector2D calcNormal​(int idx,
                                          int pixelStep,
                                          Contour2D contour,
                                          boolean counterClock)
        calculate normals of a contour
        Parameters:
        idx -
        pixelStep -
        contour -
        counterClock -
        Returns:
        contour normal
      • calcNormal

        public static Vector2D calcNormal​(int idx,
                                          int pixelStep,
                                          Contour2D contour)
        calculate normals of a contour
        Parameters:
        idx -
        pixelStep -
        contour -

        Returns:
        contour normal
      • recalcNormal

        public static void recalcNormal​(Contour2D contour)
        recalculate normals of a contour
        Parameters:
        contour -
      • getOuterContour

        public static Contour2DPtr getOuterContour​(Contour2D contour,
                                                   double resolution)
        extracts the outer contour of a contour
        Parameters:
        contour - [in] contour to find outer contour of.
        resolution - [in] the resolution.
        Returns:
        new contour
      • toTriMesh

        public TriMeshPtr toTriMesh​(double height)
        A 3D geometry for a 2D contour of height height.

        2D points (x,y) end up as (x, y, 0) in 3D.