📄 project1.m
字号:
function result = project1();
per_sum=10; % 10 persons in the dataset in all
cam_sum=4; % 4 viewpoints in all
act_sum=13; % 13 actions in all
Dir='result';
M = 10;
N = 100;
image1 = zeros(M, N);
% image2 = zeros(4, M*N);
image2 = zeros(1, M*N);
image3 = zeros(130, M*N);
%image3 = zeros(130, 4*M*N);
count1 = 1;
count2 = 1;
for act=1:1:act_sum
for per=1:1:per_sum
count1 = 1;
image2 = zeros(1, M*N);
for cam=1:2:7
filename=sprintf('%s/Action%02d_Per%d_View%d%d.mat', Dir, act,per,cam,cam+1);
load(filename); % load二维图像,变量名为yy
%%% === processing === %处理图像,提取特征
image1 = imresize(yy, [M, N], 'nearest');
%image2(count1, :) = reshape(image1, 1, M*N);
for i=1:1:M
for j=1:1:N
if (cam == 1)
image2(1,(i-1)*N+j) = image1(i,j);
else
if (image2(1, (i-1)*N+j) < image1(i,j))
image2(1, (i-1)*N+j) = image1(i,j);
end;
end;
% if (image1(i,j) > 4)
% image2(1, (i-1)*N+j) = image2(1, (i-1)*N+j) + 2*image1(i,j);
% else
% if (image1(i,j) < 2)
% image2(1, (i-1)*N+j) = image2(1, (i-1)*N+j) + 0*image1(i,j);
% else
% image2(1, (i-1)*N+j) = image2(1, (i-1)*N+j) + image1(i,j);
% end
% end
end;
end;
count1 = count1 + 1;
end;
%image3(count2, :) = reshape(image2, 1, 4*M*N);
image3(count2, :) = reshape(image2, 1, M*N);
count2 = count2 + 1;
end;
end;
[PC, score, result] = princomp(image3);
hold on;
%show the result of classification by two demensions
plot(score(1:10, 1), score(1:10, 3), 'bo');
plot(score(11:20, 1), score(11:20, 3), 'gx');
plot(score(21:30, 1), score(21:30, 3), 'r+');
plot(score(31:40, 1), score(31:40, 3), 'c*');
plot(score(41:50, 1), score(41:50, 3), 'ms');
plot(score(51:60, 1), score(51:60, 3), 'yd');
plot(score(61:70, 1), score(61:70, 3), 'kv');
plot(score(71:80, 1), score(71:80, 3), 'b^');
plot(score(81:90, 1), score(81:90, 3), 'g<');
plot(score(91:100, 1), score(91:100, 3), 'r>');
plot(score(101:110, 1), score(101:110, 3), 'cp');
plot(score(111:120, 1), score(111:120, 3), 'mh');
plot(score(121:130, 1), score(121:130, 3), 'y:');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -