Skip to content

ximgproc_ContourFitting

Extended image processingclassOpenCV 5.0.0
import { ximgproc_ContourFitting } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSConstructor or factory
CLASSximgproc_ContourFitting
RETURN TYPEOwned native handle
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Native object: release it with using or delete(). Factories can return null; check before calling methods. Inherits 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

Constructors and members

clone

Create another handle to the same native object. This retains the object without copying its pixels or algorithm state; dispose both handles separately.

clone(): this;
Returns

The this result.

estimateTransformation

Fit two closed curves using fourier descriptors. More details in [PersoonFu1977] and [BergerRaghunathan1998]

estimateTransformation(src: Mat, dst: Mat, alphaPhiST: Mat, fdContour: boolean): ximgproc_ContourFitting_estimateTransformationResult;
2 available overloads
estimateTransformation(src: Mat, dst: Mat, alphaPhiST: Mat): ximgproc_ContourFitting_estimateTransformationResult;
estimateTransformation(src: Mat, dst: Mat, alphaPhiST: Mat, fdContour: boolean): ximgproc_ContourFitting_estimateTransformationResult;
src

Contour defining first shape.

dst

Contour defining second shape (Target).

alphaPhiST

Output destination, filled by the native operation. : \alpha=alphaPhiST(0,0), \phi=alphaPhiST(0,1) (in radian), s=alphaPhiST(0,2), Tx=alphaPhiST(0,3), Ty=alphaPhiST(0,4) rotation center

fdContour

false then src and dst are contours and true src and dst are fourier descriptors.

Returns

The ximgproc_ContourFitting_estimateTransformationResult result. Scalar output parameters are returned as named fields in this object. Release returned native handles with using or delete(), including handles nested in results.

setCtrSize

set number of Fourier descriptors used in estimateTransformation

setCtrSize(n: number): void;
n

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

setFDSize

set number of Fourier descriptors when estimateTransformation used vector<Point>

setFDSize(n: number): void;
n

number of fourier descriptors used for optimal curve matching.

getCtrSize

Read the ctr size.

set number of Fourier descriptors used in estimateTransformation

getCtrSize(): number;
Returns

number of fourier descriptors

getFDSize

Read the fdsize.

set number of Fourier descriptors when estimateTransformation used vector<Point>

getFDSize(): number;
Returns

number of fourier descriptors used for optimal curve matching

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.