% Comapres the virtual view with orignal cmaera view
numFrames = 250;
height = 1088;
width = 1920;
camFileNameVirtual = 'org_synth_02.yuv';
camFileNameOrginal = 'D:\3DV\SEQUENCES\Dancer\Dancer_c_2_1920x1088.yuv';
% PSNRY = zeros(numFrames,1); PSNRU = zeros(numFrames,1);PSNRV = zeros(numFrames,1);
% MSEY = zeros(numFrames,1); MSEU = zeros(numFrames,1);MSEV = zeros(numFrames,1);

fileID1 = fopen('psnr.txt','w');
fileID2 = fopen('mse.txt','w');
fprintf(fileID1,'----------PSNR(Y, U, V)----------\n');
fprintf(fileID2,'----------MSE(Y, U, V)----------');

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

fclose(fileID1);
fclose(fileID2);