PPG_Delattre_Dey/frames_RGBs.m

37 lines
789 B
Matlab

%%%%%%%%%%%%%%%%%%%%%
% function RGB_avg = RGB_traces (input1)
% ex. RGB_avgs = 2DRotationMatrix('frame0.jpg')
%
% Task: Extracting the average RGB values of a frame
%
% Inputs:
% - input1: frame adress on pc
%
% Output:
% -RGB_avg: a 1x3 matrix with the RGB average values, format -> [R, G, B]
%
% author: Loic Delattre (loic.delattre@ecam.fr)
% date: 06/02/2023
%%%%%%%%%%%%%%%%%%%%%
function RGB_data = frames_RGBs ()
%frames_num = 918;
j = 0;
RGB_data = [0, 0, 0];
while j <= 10000
try
image = strcat('frames/frame', int2str(j), '.jpg');
j = j + 1;
i = 3;
while i >= 1
RGB_data(i, j) = RGB_traces (image)(i);
i = i - 1;
endwhile
catch
disp('scanned all frames')
j = 10001;
end_try_catch
endwhile
endfunction