function images = ReadIm(fname)
% fname = 'armD32im1'
% This function convert YUV images into RGB images
% fname: the file name of YUV data in string format
% images: the converted RGB data with size nrows*ncols*nchannels*nframes

load(fname)

% make into RGB
images = zeros([imSize,NrFrames]);
for count = 1:NrFrames

  data = double(mexVims(:,:,:,count));
  U=data(:,:,1);
  Y1=data(:,:,2);
  V=data(:,:,3);
  Y2=data(:,:,4);

  im(240,320,3)=0;
  im(:,:,1)=(resample(Y1,2,1,[1 0])+resample(Y2,2,1,[0 1]))';
  im(:,:,2)=resample(U,2,1,[1 1])';
  im(:,:,3)=resample(V,2,1,[1 1])';

  images(:,:,:,count) = YUVtoRGB(im);
end

% Show images
figure(2)
clf
for count = 1:NrFrames
    figure(2)
  imshow(images(:,:,:,count))
end
end
