For example I have a 100 images in my directory of which 'x' images are same and I would like to know the value of x.
% Reference image
img_ref = imread('img_ref.jpg');
% Create an variable for alloc the path
img_path ='/your/dir/of/images/'
% Create an variable struct, for searching files with .jpg extension
names = dir(fullfile(img_path, '*.jpg'));
% Counts the number of images on the path
n_imgs = numel(names);
for n = 1:n_imgs
full_name = fullfile(img_path, names(n).name);
your_imgs = imread(full_name);
r = isMatch(img_ref,your_imgs);
disp(r)
end
You can use the function created above by Rob F.
function[result] = isMatch(RealImage, TestImage)
testImage = imread(TestImage);
if (sum(sum(sum(RealImage == testImage))) == size(RealImage,1) * size(RealImage,2) * size(RealImage,3))
result = true;
else
result = false;
end