convert from to binary
a=imread('coin.png'); #read th image b=double(a); # convert into double s=size(a); # store size of image in a cc=zeros(s(1),s(2)); #new empty image acc=0; #sum for i=1:s(1) for j=1:s(2) acc=acc+b(i, j); #calculate the accumaltion number endfor endfor th=acc/(s(1)*s(2)); # threshould > 1 white mmm < 0 black for i=1:s(1) for j=1:s(2) if b(i, j)>=th cc(i, j) = 1; else cc(i, j)=0; endif endfor endfor imshow(cc)