📄 calculate_mean.m
字号:
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)));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -