translation test
Contents
get images
clear
close all
load translation_pictures_storage
load translation_crop_rect
cyle through images
position_data= zeros(3,3,2,9);
for npic=1:9
positions;
position_data(:,:,:,npic)=pts;
end
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
374 54.4262 55.1194 -0.731169
420 54.4995 55.0653 -0.398734
467 54.48 55.1877 -0.0825302
mean width 54.7964 pixels, std dev 0.361944 pixels
col height 1 height 2 col angle
index mm mm degrees
296 46.6161 46.6443 0.0701406
350 47.0738 46.8384 0.102555
405 47.2522 47.2484 0.143196
mean height 46.9455 pixels, std dev 0.287392 pixels
center 350.89 420.321
row width 1 width 2 row angle
index mm mm degrees
372 55.2754 55.9622 -0.608249
419 55.2901 55.8804 -0.350406
466 55.2821 55.9575 -0.0946766
mean width 55.608 pixels, std dev 0.357665 pixels
col height 1 height 2 col angle
index mm mm degrees
355 46.9662 46.9473 0.0893477
411 47.3425 47.0863 0.0929457
467 47.4678 47.443 0.0896214
mean height 47.2089 pixels, std dev 0.23749 pixels
center 411.217 419.058
row width 1 width 2 row angle
index mm mm degrees
371 55.6789 56.2675 -0.579215
418 55.7122 56.2117 -0.332467
465 55.6669 56.3332 -0.109288
mean width 55.9784 pixels, std dev 0.322947 pixels
col height 1 height 2 col angle
index mm mm degrees
385 47.0676 47.1343 0.0785466
441 47.4643 47.2405 0.0709693
497 47.5504 47.5698 0.110168
mean height 47.3378 pixels, std dev 0.218575 pixels
center 441.771 418.482
row width 1 width 2 row angle
index mm mm degrees
367 57.3003 57.6271 -0.388749
415 57.3713 57.6116 -0.237424
463 57.4723 57.5886 -0.115553
mean width 57.4952 pixels, std dev 0.136755 pixels
col height 1 height 2 col angle
index mm mm degrees
570 47.6676 47.6838 0.0609423
627 47.974 47.6401 0.163875
685 47.9711 47.928 0.140372
mean height 47.8107 pixels, std dev 0.162408 pixels
center 628.135 415.398
row width 1 width 2 row angle
index mm mm degrees
366 57.6794 57.7905 -0.179315
414 57.7314 57.7302 -0.171964
461 57.7784 57.8234 -0.110864
mean width 57.7555 pixels, std dev 0.0517312 pixels
col height 1 height 2 col angle
index mm mm degrees
664 47.9252 47.906 0.131013
722 48.0329 47.8565 0.190134
780 47.9401 48.0289 0.209617
mean height 47.9482 pixels, std dev 0.0699472 pixels
center 722.654 413.893
row width 1 width 2 row angle
index mm mm degrees
365 57.7375 57.6314 -0.125413
413 57.7513 57.5331 -0.0863174
461 57.7736 57.7028 -0.117832
mean width 57.6883 pixels, std dev 0.090757 pixels
col height 1 height 2 col angle
index mm mm degrees
727 47.8768 48.0278 0.15364
785 48.1208 47.8174 0.175262
843 47.9555 47.9641 0.217842
mean height 47.9604 pixels, std dev 0.107458 pixels
center 785.805 413.109
row width 1 width 2 row angle
index mm mm degrees
365 57.73 57.643 -0.133494
413 57.6422 57.6491 -0.101835
461 57.7235 57.688 -0.117296
mean width 57.6793 pixels, std dev 0.0405095 pixels
col height 1 height 2 col angle
index mm mm degrees
729 47.9097 47.9868 0.170079
787 48.1299 47.825 0.166161
844 47.9736 47.9555 0.193027
mean height 47.9634 pixels, std dev 0.100476 pixels
center 787.297 413.086
row width 1 width 2 row angle
index mm mm degrees
363 57.2305 57.0114 -0.00755785
411 57.206 57.0753 -0.0718874
459 57.4053 56.9628 -0.13594
mean width 57.1485 pixels, std dev 0.164067 pixels
col height 1 height 2 col angle
index mm mm degrees
853 47.8718 47.9196 0.169653
911 47.9247 47.7548 0.274477
968 47.7433 47.7918 0.24576
mean height 47.8343 pixels, std dev 0.0815287 pixels
center 911.346 411.357
row width 1 width 2 row angle
index mm mm degrees
362 56.8551 56.4236 0.0971199
410 56.8455 56.486 -0.0201632
458 56.9455 56.4674 -0.122343
mean width 56.6705 pixels, std dev 0.235192 pixels
col height 1 height 2 col angle
index mm mm degrees
916 47.8698 47.8062 0.158407
973 47.896 47.574 0.212968
1029 47.6376 47.6043 0.239839
mean height 47.7313 pixels, std dev 0.142525 pixels
center 973.686 410.805
load translation_positions_storage
mean_width_pixels = 55.608;
mean_width_mm = 36.5066;
scale = mean_width_mm / mean_width_pixels;
fprintf('scale %g mm/pixel\n\n',scale);
actual = diff(positions_storage(:,2));
fprintf('%12s\t %12s\t %12s\n','actual','delta x','delta y');
for npic=2:9
change = position_data(:,:,:,npic) - position_data(:,:,:,npic-1);
delta = scale*mean(reshape(change,9,2));
fprintf('%12g\t %12g\t %12g\n',actual(npic-1), delta);
end
scale 0.656499 mm/pixel
actual delta x delta y
40 39.6174 -0.844341
20 20.0294 -0.375127
120 122.29 -2.05289
60 62.0168 -0.936677
40 41.4044 -0.545598
1 1.02067 -0.0240582
79 81.4178 -1.0904
40 40.8798 -0.410552
actual = positions_storage(:,2)-positions_storage(1,2);
pos = zeros(3,3,2,9);
for npic=1:9
pos(:,:,:,npic) = position_data(:,:,:,npic)-position_data(:,:,:,1);
end
vec = sqrt(pos(:,:,1,:).^2+pos(:,:,2,:).^2);
vec = scale*mean(reshape(vec,9,9))';
save positions_data scale actual vec
c = polyfit(actual,vec,1);
plot(actual,vec,'x',actual,polyval(c,actual),'k');
xlabel('actual (mm)');
ylabel('measured (mm)');
c = polyfit(actual,vec-actual,3);
x = linspace(0,400,401);
plot(actual,vec-actual,'x',x,polyval(c,x),'k','LineWidth',2,'MarkerSize',10);
xlabel('actual (mm)');
ylabel('error (mm)');