load 'train.mat';

class_num = 40;
img_per_class = 100;

obj_start_idx = 41;
obj_end_idx = 748;
pose_start_idx = 749;
pose_end_idx = 898;

data = [];
for i = 1 : class_num
    data(i).obj = mean(features((i-1)*img_per_class+1 : i*img_per_class, ...
        obj_start_idx:obj_end_idx));
    data(i).pose = mean(features((i-1)*img_per_class+1 : i*img_per_class, ...
        pose_start_idx:pose_end_idx));
end

for i = 1 : class_num
    for j = 1 : class_num
%         value(i, j) = sum(abs(data(i).obj - data(j).obj)) / 44.1928 * 2.5 ...
%             + sum(abs(data(i).pose - data(j).pose)) / 3.9930 * 2.5;
        value(i, j) = sum(abs(data(i).obj - data(j).obj)) * 2.5 ...
            + sum(abs(data(i).pose - data(j).pose)) * 2.5;
    end
end

class_label = {'applauding', 'blowing bubbles', 'brushing teeth', 'calling', 'cleaning the floor', ...
    'climbing wall', 'cooking', 'cutting trees', 'cutting vegetables', 'drinking', ...
    'feeding a horse', 'fishing', 'fixing a bike', 'gardening', 'holding an umbrella', ...
    'jumping', 'playing guitar', 'playing violin', 'pouring liquid', 'pushing a cart', ...
    'reading book', 'repairing a car', 'riding a bike', 'riding a horse', 'rowing a boat', ...
    'running', 'shooting an arrow', 'smoking cigarette', 'taking photos', 'texting message', ...
    'throwing a frisby', 'using a computer', 'using a microscope', 'using a telescope', 'walking a dog', ...
    'washing dishes', 'watching TV', 'waving hand', 'writing on a board', 'writing on a book'};
imagesc(value);
set(gca, 'ylim', [0.5 class_num+0.5]);
set(gca, 'YTick', 1:class_num);
set(gca, 'YTickLabel', class_label);
% set(gca, 'xlim', [0.5 class_num+0.5]);
% set(gca, 'XTick', 1:class_num);
% set(gca, 'XTickLabel', class_label);
% rotateTickLabel(gca, 45);


figure;
set(gca, 'xlim', [0.5 class_num+0.5]);
set(gca, 'XTick', 1:class_num);
set(gca, 'XTickLabel', class_label);
rotateTickLabel(gca, 45);


% set(gca,'ylim',[0 num_classes+1])
% set(gca,'YTick', 1:num_classes)
% set(gca,'YTickLabel', display_labels(orig_idx(sort_idx)))
% grid;












