function nma_test_HW1_EECS_203A
% Matlab function to test output of HW1 computer problem
% for course EECS 203A, digital image processing, fall 2004. 
% UCI, California
%
% By Nasser Abbasi
%
% This function reads the raw images generated by matlab function
% nma_HW1_ece203A_UCI and displays them in matlab. This is to help
% me test the program.
%

fileName='cats4.raw';

k=4;
M=480/k;
N=640/k;
displayIt(fileName,M,N)


fileName='cats16.raw';

k=16;
M=480/k;
N=640/k;
displayIt(fileName,M,N);

fileName='triangles4.raw'

k=4;
M=480/k;
N=640/k;
displayIt(fileName,M,N);


fileName='triangles16.raw';

k=16;
M=480/k;
N=640/k;
displayIt(fileName,M,N);


M=480;
N=640;

displayIt('cati4.raw',M,N);
displayIt('cati16.raw',M,N);
displayIt('trianglei4.raw',M,N);
displayIt('trianglei16.raw',M,N);
 

%%%%%%%%%%%%%%%
%
%%%%%%%%%%%%%%%%
function displayIt(fname,M,N)

fid=fopen(fname,'r');
img=fread(fid,[N,M],'uint8');
fclose(fid);
img=img';
%img(1:5,:)
  
figure;
colormap gray;
imagesc(img,[1 256]);
colorbar;
title(sprintf('file %s',fname));

