Find the points that belong to each of the three lines in scan1from problem 4
manually.
We know that for each line n we have the xn, yn, where n=1..4:
y1 = 1;
y2 = -1;
x3 = 4;
x4 = 5;
For finding the lines we have segmented the points from the scanner (Cartesian form) as belonging to one of the 4 lines:
line1=zeros(2,1); %first the lines are initialized
line2=zeros(2,1);
line3=zeros(2,1);
line4=zeros(2,1);
useScan = carthScan1; %we tell which set of points to use
for i=1:length(useScan)
if (useScan(2,i) == y1)
line1 = [line1 useScan(:,i)];
elseif(useScan(2,i) == y2)
line2 = [line2 useScan(:,i)];
elseif(useScan(1,i) == x3)
line3 = [line3 useScan(:,i)];
elseif(useScan(1,i) == x4)
line4 = [line4 useScan(:,i)];
end
end
Use the lsqline function to estimate the line parameters.
The code is the same as in Problem 5, with only the lines modified. The results are:
estimatedn = alpha r
estimated1 = 1.5708 1.0000
estimated2 = -1.5708 1.0000
No comments:
Post a Comment