PPG_Delattre_Dey/matrix_avg.m

23 lines
538 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
%
% author: Maryne Dey and Loic Delattre (maryne.dey@ecam.fr, loic.delattre@ecam.fr)
% date: 06/02/2023
%%%%%%%%%%%%%%%%%%%%%
function Mavg = matrix_avg (M)
col = size(M,2);
row = size(M,1);
num_items = col*row;
Mavg = sum(sum(M))/num_items;
endfunction