I am currently asked to compare certain images with each other (using nested for loops) and determine which images are closest to each other (NOT particularly exactly the same) and the 2 images that are most different, either by using linear correlation or convulution.
As all images are 2D matricies with the exact same dimensions, the only thing I can come up with now in (if using correlation) to do the following :
a = imread('image_1.jpg');
b = imread('image_2.jpg');
c = corr2(a,b);
if c==1
disp('The images are same')
The problem is that the above, only works when comparing the exact same image with it self, any other images that look similar dont work. How can I solve this problem. Thanks
corr2 is your correlation function and will give a value. The larger the value, the better match it will be. You could store the values of c in a separate matrix C and pick the pair with the largest c to get the two images that are closest to each other