Smoothing a hand-drawn curve

You can reduce the number of points using the Ramer–Douglas–Peucker algorithm there is a C# implementation here. I gave this a try using WPFs PolyQuadraticBezierSegment and it showed a small amount of improvement depending on the tolerance. After a bit of searching sources (1,2) seem to indicate that using the curve fitting algorithm from Graphic … Read more

How to plot line (polygonal chain) with numpy/scipy/matplotlib with minimal smoothing

For that type of graph, you want monotonic interpolation. The PchipInterpolator class (which you can refer to by its shorter alias pchip) in scipy.interpolate can be used: import numpy as np from scipy.interpolate import pchip import matplotlib.pyplot as plt # Data to be interpolated. x = np.arange(10.0) y = np.array([5.0, 10.0, 20.0, 15.0, 13.0, 22.0, … Read more

how to draw smooth curve through N points using javascript HTML5 canvas?

The problem with joining subsequent sample points together with disjoint “curveTo” type functions, is that where the curves meet is not smooth. This is because the two curves share an end point but are influenced by completely disjoint control points. One solution is to “curve to” the midpoints between the next 2 subsequent sample points. … Read more