scanned target calibration
clear
close all
rgb = imread('Scan_Pic0003.jpg');
load pix2
I3 = imcrop(rgb,RECT3);
imshow(I3);
im = im2double(rgb2gray(I3));
zm = 0.5;
Warning: Image is too big to fit on screen; displaying at 50%
find_edges;
Warning: Image is too big to fit on screen; displaying at 50%
Warning: Image is too big to fit on screen; displaying at 50%
n a b len
1 79 368 298
2 384 654 286
3 669 955 289
4 658 666 9
5 661 668 5
6 67 70 10
7 1 4 4
8 5 5 1
9 16 17 2
10 56 60 6
11 41 42 15
12 29 33 3
13 7 26 19
14 45 54 10
15 allocated segments
957 total edgels
ans =
3
Warning: Image is too big to fit on screen; displaying at 50%
dpi = 599.406;
dpmm = dpi/25.4;
xpos = ones(1,3);
for n = 1:3
subplot(3,1,n);
[x y] = getseg(seg(n),u,v,next);
npts = length(y);
xmean = mean(x);
xpos(n) = xmean;
x = x - xmean;
c = polyfit(y,x,1);
fprintf('n %d slope %g intercept %g\n',n,c);
fprintf('mean x %g rms %g\n',xmean,std(x));
ydx = [min(y) max(y)];
plot(y,x,ydx,polyval(c,ydx));
end
n 1 slope 0.000606112 intercept -0.086293
mean x 234.185 rms 0.422997
n 2 slope -0.000249657 intercept 0.0355994
mean x 1095.93 rms 0.220096
n 3 slope 0.00101544 intercept -0.143787
mean x 1955.58 rms 0.347632
cal = diff(xpos)/dpmm;
fprintf('white square width %g mm, black square width %g mm\n',cal);
white square width 36.5166 mm, black square width 36.4281 mm