Contents
Path Tracing
alfa='examp03.bmp';
[a b xc]=digis1(alfa);
Displaying results
figure;
image(imread(alfa)');colormap([0 0 0;1 1 1]);
title('Spot');axis xy;grid on
format short g
rp=repmat('_',1,26);
disp(' Coordinates')
disp(rp)
disp('Center of mass of contour')
disp(xc(1:2));
disp('Center of mass of spot ');
disp([xc(3:4)]);
disp(['Rectangle to crop ';...
'(ends of diagonal)'])
disp(xc(10:13))
disp('The most remote points')
disp([a(xc(7)),b(xc(7)),a(xc(8)),b(xc(8))])
disp(rp)
disp('Maximal distance between points')
disp(xc(9));
disp('Count of black pixels:')
disp([{'Border'},{xc(5)};{'Spot'},{xc(6)}])
disp(' Perimeter:')
disp(' count of external edges')
disp(' of border pixels ')
disp(xc(14))
disp(' length of line connected')
disp(' centers of border pixels')
disp(xc(15))
figure;
zx=plot(a,b,'-',xc(1),xc(2),'+',...
xc(3),xc(4),'*',[xc(10) xc(12)],[xc(11) xc(13)],'o',...
[a(xc(7)),a(xc(8))],[b(xc(7)),b(xc(8))],'p');grid on
set(zx,'linewidth',1)
legend('spot border',['center of '; 'curve mass'],...
['center of'; 'spot mass'],['rectangle vertices'],...
['the most ';'remote points'],'location', 'best');
title(['Measurement']);
Coordinates
__________________________
Center of mass of contour
308.43 232.64
Center of mass of spot
200.95 180.43
Rectangle to crop
(ends of diagonal)
10 1 430 558
The most remote points
36 47 407 553
__________________________
Maximal distance between points
627.44
Count of black pixels:
'Border' [ 3354]
'Spot' [61786]
Perimeter:
count of external edges
of border pixels
3560
length of line connected
centers of border pixels
3437.7
Series detection of spots
figure
subplot(2,3,1)
J=imread('examp05.bmp');
image(J');axis xy;title('Spots')
colormap([0 0 0;1 1 1]);
subplot(2,3,2)
[a b xc]=digis1(J);
plot(a,b,'-',xc(1),xc(2),'+',...
xc(3),xc(4),'*',[xc(10) xc(12)],[xc(11) xc(13)],'o',...
[a(xc(7)),a(xc(8))],[b(xc(7)),b(xc(8))],'p');
for rr=1:4
subplot(2,3,2+rr)
J1=J;
for i=1:length(a);
ii=0;
while ~J(a(i),b(i)+ii)
J(a(i),b(i)+ii)=1;
ii=ii+1;
end
end
[a b xc]=digis1(J);
plot(a,b,'-',xc(1),xc(2),'+',...
xc(3),xc(4),'*',[xc(10) xc(12)],[xc(11) xc(13)],'o',...
[a(xc(7)),a(xc(8))],[b(xc(7)),b(xc(8))],'p');
end