Hi,
I have some data taken from analysing circles in an image and want to be able to straighten the line as its being on a slope is an artefact of the scanning. I have fitted a best fit line and wanted to know if I could rotate the data until the best fit line was parallel with the x-axis? Any ideas or is this not possible?
Best regards,
Steve
close allclear allclccenters=[1296.28613359921,15.9423957420192;1244.60658858455,16.5186862922104;390.379594009879,19;775.563580322536,16.9590472427110;256.101009617993,18.7276757275163;658.253941157542,18.2915405544281;289.482449670956,18.5636285011201;507.304238398890,20.3078955046754;692.113672662873,16.6656418306859;976.498832075336,16.4348647865777;222.603443863265,19.4801906970668;591.449235930304,18.8160349909942;624.831583420586,18.8490766293560;122.251099674639,18.5291400151088;1077.71234033461,17.1523494179665;4.98592612631937,20.4982856165640;893.025740410572,15.8528339538963;1112,16;876.389956316530,16.7010325410232;675.391032220651,18.9364395893170];format short%%Data Analysis
%using the data in centers and radii
hFig2=figure('units','normalized','outerposition',[0 0 1 1]);set(0,'CurrentFigure',hFig2)subplot(4,1,1);%plot of centers position
SortedCenters=sortrows(centers,1)x=SortedCenters(:,1);y=SortedCenters(:,2);title('Centers x y')box ongrid minorhold on scatter(x,y)set(0,'CurrentFigure',hFig2)subplot(4,1,2);scatter(x,y);hold onp = polyfit(x,y,1)f = polyval(p,x) plot(x,f)xlabel('X pos')ylabel('Ypos')title('2.basic centers data with a least squares fit line')box ongrid minorhold onformat short% how to straighten the plot?
Best Answer