angles test
Contents
get images
clear
close all
load rotation_pictures_storage
load rotation_positions_storage
load rotation_crop_rect
center = [ 663 423 ];
home orientation
npic = 6;
img = pictures_storage(:,:,npic);
imshow(img);
positions;
Warning: Image is too big to fit on screen; displaying at 67%
Warning: Image is too big to fit on screen; displaying at 67%
Warning: Image is too big to fit on screen; displaying at 67%
Warning: Image is too big to fit on screen; displaying at 67%
Warning: Image is too big to fit on screen; displaying at 67%
row width 1 width 2 row angle
index mm mm degrees
366 47.7034 47.8335 -0.274007
423 47.5782 48.0607 -0.26453
481 47.7142 47.9873 -0.0894861
mean width 47.8129 pixels, std dev 0.183899 pixels
col height 1 height 2 col angle
index mm mm degrees
615 57.5583 57.5122 0.087673
663 57.5954 57.6274 0.0929662
710 57.5738 57.8042 0.169169
mean height 57.6119 pixels, std dev 0.101732 pixels
center 663.175 423.583
actual = positions_storage(:,5);
actual
actual =
-70
-60
-40
-39
-15
0
20
45
60
75
do one image
npic = 2;
img = pictures_storage(:,:,npic);
img = im2double(img);
imshow(img);
hold on
plot(center(1),center(2),'x','LineWidth',2,'MarkerSize',10);
cycle through images
measured = zeros(10,1);
npic = 1;
for npic=1:10
img = pictures_storage(:,:,npic);
img = im2double(img);
orient;
measured(npic) = phi;
end
angle 52
gmax 30.4753
phi =
70.0510
angle 66
gmax 32.9026
phi =
60.1314
angle 96
gmax 35.5533
phi =
39.8995
angle 98
gmax 35.4502
phi =
39.2194
angle 142
gmax 29.781
phi =
15.1762
angle 92
gmax 27.5686
phi =
90.2480
angle 48
gmax 29.7125
phi =
70.2292
angle 88
gmax 35.0526
phi =
45.0167
angle 110
gmax 33.4781
phi =
30.1137
angle 114
gmax 30.6602
phi =
15.2406
disp([actual measured]);
disp('\nmanually adjust orientations\n');
ma = measured;
idx = 1:5;
ma(idx) = -ma(idx);
idx = 6:10;
ma(idx) = 90 - ma(idx);
disp([actual ma]);
c = polyfit(actual,ma,1);
plot(actual,polyval(c,actual),'k-',actual,ma,'ko','MarkerFaceColor','y');
grid
xlabel('actual angle (degrees)');
ylabel('measured angle (degrees)');
-70.0000 70.0510
-60.0000 60.1314
-40.0000 39.8995
-39.0000 39.2194
-15.0000 15.1762
0 90.2480
20.0000 70.2292
45.0000 45.0167
60.0000 30.1137
75.0000 15.2406
\nmanually adjust orientations\n
-70.0000 -70.0510
-60.0000 -60.1314
-40.0000 -39.8995
-39.0000 -39.2194
-15.0000 -15.1762
0 -0.2480
20.0000 19.7708
45.0000 44.9833
60.0000 59.8863
75.0000 74.7594
plot(actual,ma-actual,'ko','MarkerFaceColor','y');
axis([-80 80 -0.25 0.25]);
grid
xlabel('actual angle (degrees)');
ylabel('error (degrees)');
fprintf('mean error %g degrees\n',mean(ma-actual));
mean error -0.132568 degrees