frame_to_png.m 1001 Bytes
clear all

numFrame = 1;
width = 768;
height = 768;
sequence=["CrowdRun_768x768_50_8bit_444","DucksTakeOff_768x768_50_8bit_444",
    "OldTownCross_768x768_50_8bit_444","ParkJoy_768x768_50_8bit_444",
    "ArenaOfValor_768x768_60_8bit_444","GlassHalf_768x768_24_8bit_444"];
for i=1:6
    seq=sequence{i};
    % Target_folder = "ArenaOfValor_1920x1080_60_8bit_444.rgb";
    Target_folder=seq+"_frame0.rgb";
    Save_folder = "output";
    %---- setting ---- 

    fileID = fopen(Target_folder,'r');

    R8 = uint8(zeros(height,width));
    G8 = uint8(zeros(height,width));
    B8 = uint8(zeros(height,width));

    for j = 1:height
      R8(j,:) = fread(fileID,width); 
    end
    for j = 1:height
      G8(j,:) = fread(fileID,width); 
    end
    for j = 1:height
      B8(j,:) = fread(fileID,width); 
    end
    fclose(fileID);

    RGB(:,:,1) = im2double(R8);
    RGB(:,:,2) = im2double(G8);
    RGB(:,:,3) = im2double(B8);
    saveFileName = seq + "_frame0.png";
    imwrite(RGB,saveFileName);
end