B-spline fitting to 2D discrete data points (pixels of contour image)
Show older comments
I am trying to fit a B-spline to a set of ordered discrete data points which represent pixels of a contour extracted from a image.
The below code works fine for some simple shapes, but not for others (please see image here http://imgur.com/5IOVmEt

for examples). Why does this happen, and what would be a better way to approach this problem?
I am quite new to differential geometry and MATLAB in general, appreciate any insights or inputs. Thanks.
x = data(:, 1); y = data(:, 2); % data contains two columns representing x,y coordinates
plot(x, y, 'bo');
fittedmodel = fit(x, y, 'cubicinterp');
plot(fittedmodel, 'r-');
Accepted Answer
More Answers (1)
korakuti hanumanth
on 2 Jan 2017
0 votes
Hi community,
I have two vectors and I would like to fit a B spline curve to:
y=[18.93000031 19.42000008 19.51000023 19.67000008 19.68000031 19.71999931];
x=[58.61111111 67.32055556 70.56194444 74.22694444 78.39388889 85.11555556];
I would also like to save the parameters of the fit at every point to use in regression analysis and also explain how to find the coefficients of b spline curve and some error techniques to satisfie the fitting.
Categories
Find more on Splines in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!