在OpenCV中将多项式除以相等的长度

时间:2016-05-11 09:21:20

标签: c++ opencv polynomial-math polynomials

我有三阶多项式的方程和位于该多边形上的两个点。我还可以使用opencv arcLength函数计算这些点之间的多边形长度。

如何获得这些均匀分布的点,将多边形划分为具有相同长度的N个部分?

Problem visualization

1 个答案:

答案 0 :(得分:1)

让我们看看这是否有帮助。以下是:

 f = polynomial
 f' = derivative of f
 N = Number of subdivisions
 D = length of each subdivisions
 a = x coordinate of f for the first end of the curve.
 M = max of f' in the interval [a, b] where the curve is to be drawn.
 k = an integer such that an error of M/k would be negligible

<强>算法

  • 对于每个1 <= j <= N - 1,请找到n(j),以使以下sum(j)接近jD的时间少于M/k

    sum(j) = sum from i=1 to n(j) of sqrt(1 + f'(a + (i-1)/k)^2)/k
    

算法的想法

数量:

1/k * sqrt(1 + f'(a + (i-1)/k)^2)

a + (i-1)/ka + i/k之间曲线的近似长度。

算法的想法是总结这些小曲线段的长度,试图找出哪些曲线段足够接近D2D3D等。