
% clean workspace etc.
clear;clc;

% load the images
load t1.mat;
load t2.mat;

%% part1: construct the joint histogram

% calculate joint-histogram
myJointHist = myJointHistogram(t1,t2);
% visualize joint histogram
imagesc(myJointHist); colormap(gray);

%% part2: compute mutual information

% calculate mutual information
myMI = myMutualInformation(t1,t2);

%% part3.1: graph mutual information against translation where t_x = [-5,5]
myMIArray = [];
for i = -5:1:5
   tmpt2 = myTranslation(t2,i);
   myMIArray = [myMIArray myMutualInformation(t1,tmpt2)];
end
plot([-5:1:5],myMIArray);

%% part3.2: graph mutual information against rotation where myTheta = [-10,10]
myMIArray = [];
for i = -10:1:10
   tmpt2 = myRotation(t2,i);
   myMIArray = [myMIArray myMutualInformation(t1,tmpt2)];
end
plot([-10:1:10],myMIArray);
























