Class Contour2DPtr


  • public class Contour2DPtr
    extends java.lang.Object
    Ptr stores a pointer and optionally takes ownership of the value.
    • Constructor Detail

      • Contour2DPtr

        public Contour2DPtr​(long cPtr,
                            boolean cMemoryOwn)
      • Contour2DPtr

        public Contour2DPtr()
        Default constructor yielding a NULL-pointer.
      • Contour2DPtr

        public Contour2DPtr​(Contour2D ptr)
        Do not take ownership of ptr.

        ptr can be null.

        The constructor is implicit on purpose.
    • Method Detail

      • getCPtr

        public static long getCPtr​(Contour2DPtr obj)
      • delete

        public void delete()
      • deref

        public Contour2D deref()
        The pointer stored in the object.
      • __ref__

        public Contour2D __ref__()
        Dereferencing operator.
      • getDeref

        public Contour2D getDeref()
        Member access operator.
      • equals

        public boolean equals​(Contour2D p)
      • isShared

        public boolean isShared()
        check if this Ptr has shared ownership or none
        ownership
        Returns:
        true if Ptr has shared ownership, false if it has no ownership.
      • isNull

        public boolean isNull()
        checks if the pointer is null
        Returns:
        Returns true if the pointer is null
      • 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 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 Contour2D read​(java.lang.String file)
        reads a contour from file
        Parameters:
        file -
        Returns:
        a contour
      • calcSequenceMoment

        public 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 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 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 Vector2D calcCentroid​(Contour2D contour)
        calculates the centroid or the mean of the points in the contour.
      • getCurvature

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

        public 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 Vector2D calcNormal​(int idx,
                                   int pixelStep,
                                   Contour2D contour)
        calculate normals of a contour
        Parameters:
        idx -
        pixelStep -
        contour -

        Returns:
        contour normal
      • recalcNormal

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

        public 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.