Skip to content

approxPolyDP

geometryfunctionOpenCV 5.0.0
import { approxPolyDP } from '@banou/opencv-wasm'

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

geometry_subdiv2d example: samples/python/snippets/squares.py A n example using approxPolyDP function in python. * Approximates a polygonal curve(s) with the specified precision.

T he function cv::approxPolyDP approximates a curve or a p*olygon with another curve/polygon with less vertices so that the distance between them is less or equal to the specified precision. It uses the Douglas-Peucker algorithm https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm

approxPolyDP(curve: Mat, approxCurve: Mat, epsilon: number, closed: boolean): void;
curve

Input vector of a 2D point stored in std::vector or Mat

approxCurve

Output destination, filled by the native operation. Result of the approximation. The type should match the type of the input curve.

epsilon

Parameter specifying the approximation accuracy. This is the maximum distance between the original curve and its approximation.

closed

If true, the approximated curve is closed (its first and last vertices are connected). Otherwise, it is not closed.

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.