From ad6a1e013f83b8f4ba4f4f4523bd77547ad6aef1 Mon Sep 17 00:00:00 2001 From: Loic Delattre Date: Mon, 6 Feb 2023 15:33:27 +0100 Subject: [PATCH] exports all of the avg RGB values for all frames of a video --- frames_RGBs.m | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 frames_RGBs.m diff --git a/frames_RGBs.m b/frames_RGBs.m new file mode 100644 index 0000000..101d242 --- /dev/null +++ b/frames_RGBs.m @@ -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