Sie sind auf Seite 1von 1

% acquire and display input image

i = imread('hand.jpg');
figure(1); imshow(i); title ('input image')

%threshold the image file


igray = rgb2gray(i);
imthr = graythresh(igray);
bw = im2bw(igray,imthr);
figure(2); imshow(bw) ; title ('thresolded binary image')

% remove all object containing fewer than 30 pixels


bw = bwareaopen(bw,2000);
figure(3);imshow(bw); title ('cleaned image');

% fill gaps
se = strel('disk',2);
bw = imclose(bw,se);

% fill holes
bw = imfill(bw,'holes');
figure(4);imshow(bw); title ('holes removed');
[b,l] = bwboundaries(bw,'noholes');

Das könnte Ihnen auch gefallen