% thresh.m converts an image to black and white using threshholds F = 'party_72.png'; % specify the file name P = imread(F); % read image into M by N by 3 matrix size(P) class(P) NT = 40; % number of threshholds for i=0:NT, PBW = im2bw(P,i/NT); imshow(PBW) drawnow pause end