rgb_to_png.m
1.08 KB
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
39
40
clear all
numFrame = 48;
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=6:6
seq=sequence{i};
% Target_folder = "ArenaOfValor_1920x1080_60_8bit_444.rgb";
Target_folder=seq+".rgb";
%---- setting ----
fileID = fopen(Target_folder,'r');
for f = 1:numFrame
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
RGB(:,:,1) = im2double(R8);
RGB(:,:,2) = im2double(G8);
RGB(:,:,3) = im2double(B8);
saveFileName = "GlassHalf\\"+seq + "_frame"+(f-1)+".png";
imwrite(RGB,saveFileName);
end
fclose(fileID);
end