function [m1,m2]=calculate_mean
%This function calculates the mean (a,b) components of the whole template
%set.

%Obtain all template names.
template_names=dir('../caras/*.jpg');
T=zeros(400,300,3);
M=makecform('srgb2lab');

for k=1:length(template_names)
    %Read image and convert it to Lab color space. Then add all of the
    %images.
    
    temp=imread(['../caras/',template_names(k).name]);
    temp=applycform(temp,M);
    k
    T=T+double(temp);
end

%Calculate the "average template"

T=T./length(template_names);

%Calculate the average values of (a,b) components of the "average
%template".

m1=mean(mean(T(:,:,2)));
m2=mean(mean(T(:,:,3)));