I'm developing an image processing program in MATLAB. One part of it involves sampling some points at fixed intervals from the input image (which is basically a binary line drawing with 1-pixel-wide edges, similar to those made by the "pencil" tool in Paint / GIMP / Photoshop), and then generating a cubic spline with the sampled pixels as its knots.
Now, I know how to generate a cubic spline in MATLAB given a set of (x, y)
points, but the problem is this: an image is not a true function of x
(say x
is the row number of the pixel), because it may have multiple "values" at each x - the values being the numbers of all columns in that row that are black. Because of this MATLAB's spline()
function complains that "the data sites should be distinct."
How do I get around this?