frame_to_png.m
1001 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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