

clear all
clc
%Ia=imread('real_pic.bmp');

Ia=vfm('grab',1);

Ia=imresize(Ia,0.5,'nearest');





% deteta_stop_ar = sum(sum(Ia(:,:,1)>240))
% deteta_stop_ag = sum(sum(Ia(:,:,2)>240))
% deteta_stop_ab = sum(sum(Ia(:,:,3)>240))

% DR = Ia(:,:,1)>254;
% DG = Ia(:,:,2)>254;
% DB = Ia(:,:,3)>254;

% Ib(:,:,1) = double(DR);
% Ib(:,:,2) = double(DG);
% Ib(:,:,3) = double(DB);

Ib=(double(Ia(:,:,1))>250).*(double(Ia(:,:,2))>250).*(double(Ia(:,:,3))>250);

Ibbb= bwmorph(Ib,'erode',5);

Ibb=bwmorph(Ib,'thicken',inf);



figure
subplot(2,2,1)
imshow(Ia)
subplot(2,2,2)
imshow(Ib)
subplot(2,2,3)
imshow(Ibb)
subplot(2,2,4)
imshow(Ibbb)
