-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathcombine_frames.m
32 lines (28 loc) · 1.06 KB
/
combine_frames.m
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
%=== Set directory of frames ===%
workingDir = 'frames';
mkdir(workingDir,'embeddedFramesRGB');
% Unscramble each of the frames Y, U, V
unscramble(key, height, width, noOfFrames, workingDir, 'framesY', 'framesU', 'framesV');
% read Y, U, V frames, convert and combine them into single RGB frame
for i = 1:noOfFrames
% Get Y component
filename = [sprintf('%d',i) '.bmp'];
fullname = fullfile(workingDir,'framesY',filename);
Y = imread(fullname);
% Get U component
filename = [sprintf('%d',i) '.bmp'];
fullname = fullfile(workingDir,'framesU',filename);
U = imread(fullname);
% Get V component
filename = [sprintf('%d',i) '.bmp'];
fullname = fullfile(workingDir,'framesV',filename);
V = imread(fullname);
% convert and combine Y, U, V components into RGB frame
% YCbCr = cat(3, Y, U, V);
% RGB = ycbcr2rgb(YCbCr);
RGB = yuv2rgb(Y, U, V);
% store the RGB frame
filename = [sprintf('%d',i) '.bmp'];
fullname = fullfile(workingDir, 'embeddedFramesRGB', filename);
imwrite(RGB,fullname);
end