Skip to main content

approx_poly_dp

Function approx_poly_dp 

Source
pub fn approx_poly_dp(
    curve: &impl ToInputArray,
    approx_curve: &mut impl ToOutputArray,
    epsilon: f64,
    closed: bool,
) -> Result<()>
Expand description

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

ยงParameters

  • curve: Input vector of a 2D point stored in std::vector or Mat
  • approxCurve: 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.