Matlab заливает формы белым цветом

Как видите, у меня есть формы и их белые границы. Я хочу заполнить фигуры белым цветом.

Ввод:: enter image description here

Я хотел бы получить этот вывод: http://s12.postimage.org/z3txnlb3f/untitled33.png

Может ли кто-нибудь помочь мне с этим кодом? он не меняет черные эллипсы на белые. Большое спасибо :]]

I = imread('untitled4.bmp');
Ibw = im2bw(I);
CC = bwconncomp(Ibw); %Ibw is my binary image
stats = regionprops(CC,'pixellist');

% pass all over the stats
for i=1:length(stats),
size = length(stats(i).PixelList);
% check only the relevant stats (the black ellipses)
if size >150 && size < 600 
    % fill the black pixel by white    
    x = round(mean(stats(i).PixelList(:,2)));
    y = round(mean(stats(i).PixelList(:,1)));
    Ibw = imfill(Ibw, [x, y]);
end;
end;

imshow(Ibw);
5
задан Alon Shmiel 7 April 2012 в 22:31
поделиться