function y = readbin(filename)
%READBIN read in binary image file.
%	Y = READBIN(FILENAME) reads in a binary image stored in FILENAME.
%	It is assumed that the FILENAME consists of two ascii numbers
%	corresponding to the number of rows and columns followed by
%	an array of unsigned char listed row-wise.

fid = fopen(filename,'r');
n = fscanf(fid,'%d',2);
fread(fid,1,'uchar');
y = fread(fid,fliplr(n'),'uchar');
y = y';
fclose(fid);
