% Script: EiffelFit.m % after generating [x y] vectors of curve location, % then compute a least squares fit of degree d using % matlab functions. % x0 and y0 are origin location % lenscale is normalization to physical scale clear all; close all; eiffel = imread('Eiffel.jpg'); imshow(eiffel) disp('Click on 6 input points on the curve') [x y] = ginput(6) % click 6 points on a curve, end is auto x0 = 321; y0 = 241; % origin at middle of VGA image lenscale = 12; % 12 pixels/meter? d = 2; % degree of xs = (x-x0)/lenscale; ys = (y-y0)/lenscale; c = polyfit(xs,ys,d); xvals = linspace(min(xs),max(xs)); yvals = polyval(c,xvals); figure plot(xvals,yvals,xs,ys,'o')