rgb_to_frame.m 916 Bytes
clear all;

width = 768;
height = 768;
channel = 3;
numFrame = 50;
bitDepth=8;
imageSize=width*height*channel;
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"];

sequence=sequence{6};
Target_folder = sequence+".rgb";
% Target_folder="output2.rgb";
Save_folder = "output";
% ---- setting ---- 
finID = fopen(Target_folder,'r');
for frame = 1:1
   % 해당 frame의 data 읽어오기
%    if (bitDepth >= 9) && (bitDepth <= 16)
%       Data = fread(finID,[imageSize,1],'uint16=>uint16');
%    else
    Data = fread(finID,[imageSize,1],'uint8=>uint8');
%    end
   
%    Data=Data(768, 768,:);
   foutID = fopen(sequence+"_frame0"+".rgb",'w');
   
   % 해당 frame의 data를 출력 파일에 쓰기
   fwrite(foutID, Data);
   fclose(foutID);
  
end
fclose(finID);