ContourFitting

Objective-C

@interface ContourFitting : Algorithm

Swift

class ContourFitting : Algorithm

Class for ContourFitting algorithms. ContourFitting match two contours

z_a
and
z_b
minimizing distance
d(z_a,z_b)=\sum (a_n - s b_n e^{j(n \alpha +\phi )})^2
where
a_n
and
b_n
are Fourier descriptors of
z_a
and
z_b
and s is a scaling factor and
\phi
is angle rotation and
\alpha
is starting point factor adjustement

Member of Ximgproc

Methods

  • Declaration

    Objective-C

    - (int)getCtrSize;

    Swift

    func getCtrSize() -> Int32

    Return Value

    number of fourier descriptors

  • Declaration

    Objective-C

    - (int)getFDSize;

    Swift

    func getFDSize() -> Int32

    Return Value

    number of fourier descriptors used for optimal curve matching

  • Fit two closed curves using fourier descriptors. More details in CITE: PersoonFu1977 and CITE: BergerRaghunathan1998

    Declaration

    Objective-C

    - (void)estimateTransformation:(nonnull Mat *)src
                               dst:(nonnull Mat *)dst
                        alphaPhiST:(nonnull Mat *)alphaPhiST
                              dist:(nonnull double *)dist
                         fdContour:(BOOL)fdContour;

    Swift

    func estimateTransformation(src: Mat, dst: Mat, alphaPhiST: Mat, dist: UnsafeMutablePointer<Double>, fdContour: Bool)

    Parameters

    src

    Contour defining first shape.

    dst

    Contour defining second shape (Target).

    alphaPhiST

    :

    \alpha
    =alphaPhiST(0,0),
    \phi
    =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.

  • Fit two closed curves using fourier descriptors. More details in CITE: PersoonFu1977 and CITE: BergerRaghunathan1998

    Declaration

    Objective-C

    - (void)estimateTransformation:(nonnull Mat *)src
                               dst:(nonnull Mat *)dst
                        alphaPhiST:(nonnull Mat *)alphaPhiST
                              dist:(nonnull double *)dist;

    Swift

    func estimateTransformation(src: Mat, dst: Mat, alphaPhiST: Mat, dist: UnsafeMutablePointer<Double>)

    Parameters

    src

    Contour defining first shape.

    dst

    Contour defining second shape (Target).

    alphaPhiST

    :

    \alpha
    =alphaPhiST(0,0),
    \phi
    =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.

  • set number of Fourier descriptors used in estimateTransformation

    Declaration

    Objective-C

    - (void)setCtrSize:(int)n;

    Swift

    func setCtrSize(n: Int32)

    Parameters

    n

    number of Fourier descriptors equal to number of contour points after resampling.

  • set number of Fourier descriptors when estimateTransformation used vector

    Declaration

    Objective-C

    - (void)setFDSize:(int)n;

    Swift

    func setFDSize(n: Int32)

    Parameters

    n

    number of fourier descriptors used for optimal curve matching.