exports all of the avg RGB values for all frames of a video

This commit is contained in:
Loic Delattre 2023-02-06 15:33:27 +01:00
parent e847f2f25e
commit ad6a1e013f
1 changed files with 36 additions and 0 deletions

36
frames_RGBs.m Normal file
View File

@ -0,0 +1,36 @@
%%%%%%%%%%%%%%%%%%%%%
% 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_RBGs ()
%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