function img=readIml(fileName) %Function img=readIml(fileName) is used to read .iml files from the natural image database at % http://hlab.phys.rug.nl/imlib/ % % Inputs: fileName - Name of the .iml file to read % % Outputs: img - An image in standard MATLAB usable format % % %2/23/02 - Leo Grady %Note: Requires standard MATALB release function "freadu8.m" to be copied from a "private" directory to a path %directory %Read bytes imlBytes=freadu8(fileName); index=2*(1:(length(imlBytes)/2)); bigEnd=imlBytes(index-1); lilEnd=imlBytes(index); clear imlBytes index; %Create matrix imgValues=256*double(bigEnd)+double(lilEnd); img=reshape(imgValues,1536,1024)'; %Scale to make use of full dynamic range img=img-min(min(img)); img=img/max(max(img));