Class ContourFitting


  • public class ContourFitting
    extends Algorithm
    Class for ContourFitting algorithms. ContourFitting match two contours za and zb minimizing distance d(za,zb)=(ansbnej(nα+ϕ))2 where an and bn are Fourier descriptors of za and zb and s is a scaling factor and ϕ is angle rotation and α is starting point factor adjustement
    • Constructor Detail

      • ContourFitting

        protected ContourFitting​(long addr)
    • Method Detail

      • __fromPtr__

        public static ContourFitting __fromPtr__​(long addr)
      • estimateTransformation

        public void estimateTransformation​(Mat src,
                                           Mat dst,
                                           Mat alphaPhiST,
                                           double[] dist,
                                           boolean fdContour)
        Fit two closed curves using fourier descriptors. More details in CITE: PersoonFu1977 and CITE: BergerRaghunathan1998
        Parameters:
        src - Contour defining first shape.
        dst - Contour defining second shape (Target).
        alphaPhiST - : α=alphaPhiST(0,0), ϕ=alphaPhiST(0,1) (in radian), s=alphaPhiST(0,2), Tx=alphaPhiST(0,3), Ty=alphaPhiST(0,4) rotation center
        dist - distance between src and dst after matching.
        fdContour - false then src and dst are contours and true src and dst are fourier descriptors.
      • estimateTransformation

        public void estimateTransformation​(Mat src,
                                           Mat dst,
                                           Mat alphaPhiST,
                                           double[] dist)
        Fit two closed curves using fourier descriptors. More details in CITE: PersoonFu1977 and CITE: BergerRaghunathan1998
        Parameters:
        src - Contour defining first shape.
        dst - Contour defining second shape (Target).
        alphaPhiST - : α=alphaPhiST(0,0), ϕ=alphaPhiST(0,1) (in radian), s=alphaPhiST(0,2), Tx=alphaPhiST(0,3), Ty=alphaPhiST(0,4) rotation center
        dist - distance between src and dst after matching.
      • setCtrSize

        public void setCtrSize​(int n)
        set number of Fourier descriptors used in estimateTransformation
        Parameters:
        n - number of Fourier descriptors equal to number of contour points after resampling.
      • setFDSize

        public void setFDSize​(int n)
        set number of Fourier descriptors when estimateTransformation used vector<Point>
        Parameters:
        n - number of fourier descriptors used for optimal curve matching.
      • getCtrSize

        public int getCtrSize()
        Returns:
        number of fourier descriptors
      • getFDSize

        public int getFDSize()
        Returns:
        number of fourier descriptors used for optimal curve matching
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class Algorithm
        Throws:
        java.lang.Throwable