function [  ] = computePSNR( camFileNameVirtual, camFileNameOrginal, numFrames, height, width, expName )
%UNTITLED Summary of this function goes here

fileID1 = fopen(strcat('PSNR-', expName,datestr(now, '-mm-dd-yy-HHMMSS'), '.txt'),'w');
fileID2 = fopen(strcat('MSE-', expName,datestr(now, 'mm-dd-yy-HHMMSS'), '.txt'),'w');
fprintf(fileID1, strcat('Experiment:', expName, '\n'));
fprintf(fileID2, strcat('Experiment:', expName, '\n'));
fprintf(fileID1,'----------PSNR(Y, U, V)----------\n');
fprintf(fileID2,'----------MSE(Y, U, V)-----------\n');

PSNRY = zeros(1,numFrames); PSNRU = zeros(1,numFrames); PSNRV = zeros(1,numFrames);
MSEY = zeros(1,numFrames); MSEU = zeros(1,numFrames); MSEV = zeros(1,numFrames);

for i=0:numFrames-1
    [Ym, Um, Vm] = yuv_import(camFileNameVirtual, [width height], 1, i);
    [Yo, Uo, Vo] = yuv_import(camFileNameOrginal, [width height], 1, i);
    
    [MSEY(i+1), PSNRY(i+1)] = iq_measures(Yo{1},Ym{1});
    [MSEU(i+1), PSNRU(i+1)] = iq_measures(Uo{1},Um{1});
    [MSEV(i+1), PSNRV(i+1)] = iq_measures(Vo{1},Vm{1});
    
    fprintf(fileID1,'Frame %d: %4.4f, %4.4f, %4.4f \n',i+1, PSNRY(i+1), PSNRU(i+1), PSNRV(i+1));
    fprintf(fileID2,'Frame %d: %4.4f, %4.4f, %4.4f \n',i+1, MSEY(i+1), MSEU(i+1), MSEV(i+1));
    
    display(sprintf('Frame %d. Y:%4.4f, U:%4.4f, V:%4.4f',i+1, PSNRY(i+1), PSNRU(i+1), PSNRV(i+1)));
    
    
end

fprintf(fileID1,'Average: %4.4f, %4.4f, %4.4f \n', mean(PSNRY), mean(PSNRU), mean(PSNRV));
fprintf(fileID2,'Average: %4.4f, %4.4f, %4.4f \n', mean(MSEY), mean(MSEU), mean(MSEV));

fclose(fileID1);
fclose(fileID2);

display(sprintf('Average PSNR: %4.2f', mean(PSNRY)));
end

