All All 'Scan0016.jpg'
All All 'Scan0016.jpg'
close all;
clc;
img = imread('scan0016.jpg');
figure;
imshow(img);
[img,rect]= imcrop(img);%imtool(img,[]);
%img=imrotate(img,-3);
img = medfilt2(img);
img = imadjust(img);
figure;
imshow(img)
I = im2bw(img);
figure
imshow(I)
I = ~I;
I=imfill(I,'holes');
se = strel('disk',1);
I = imerode(I,se);
figure;
imshow(I)
[B,L] = bwboundaries(I,'noholes');
imshow(label2rgb(L, @jet, [.5 .5 .5]));
hold on
p_size = 210/2480;
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'w', 'LineWidth', 2)
end
stats = regionprops(L,'Area','Centroid','EquivDiameter','BoundingBox');
threshold = 0.85;
d = 1;
e = 1;
for k = 1:length(B)