Skip to content

Instantly share code, notes, and snippets.

@ilketunali
Created June 28, 2011 11:29
Show Gist options
  • Save ilketunali/1050948 to your computer and use it in GitHub Desktop.
Save ilketunali/1050948 to your computer and use it in GitHub Desktop.
I=imread('CIMG0017.JPG');
GR=rgb2gray(I);
I3=GR>150;
imshow(I3)
K = medfilt2(I3);
L=bwlabel(K);
s = regionprops(L, 'Area');
alan = cat(1, s.Area);
imshow(L)
q=find(alan>1500); %1500 pikselden küçük olanlar seçilir.
zar_sayisi=length(q);
K=(L==q(2));
Q=K==0;
K = medfilt2(Q);
L1=bwlabel(K);
imshow(L)
zar_degeri(2)=max(L1(:))-1;
K=(L==q(1));
Q=K==0;
K = medfilt2(Q);
L=bwlabel(K);
imshow(L)
zar_degeri(1)=max(L(:))-1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment