1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| clear all
close all
clc
img= imread('img1.png');
%supprimer les poils
se=strel('disk',4);
im=imclose(img,se);
Ng=rgb2gray(im);
BW = im2bw(img, graythresh(img));
superposition = BW.*img;
[B,L] = bwboundaries(BW,'noholes');
imshow(label2rgb(L, @jet, [.2 .2 .2]))
hold on
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'w', 'LineWidth', 2)
end
subplot(4,3,1); imshow(img); title('image originale');
subplot(4,3,2); imshow(im); title('image sans poils');
subplot(4,3,3); imshow(Ng); title('image en Niveau de gris');
subplot(4,3,4); imshow(~BW); title('image binaire'); |
Partager