Im1 = imread('Eeye1.jpg'); Im2 = imread('Eeye.jpg');
Im1 = rgb2gray(Im1); Im2 = rgb2gray(Im2);
% convert images to type double (range from from 0 to 1 instead of from 0 to 255) Im1 = im2double(Im1); Im2 = im2double(Im2);
% Calculate the Normalized Histogram of Image 1 and Image 2 hn1 = imhist(Im1)./numel(Im1); hn2 = imhist(Im2)./numel(Im2);
% Calculate the histogram error f = sum((hn1 - hn2).^2); f; %display the result to console subplot(3,4,[9 10 11 12]); plot(1:size(hn1,1),mean(hn1,2),'b'); hold on plot(1:size(hn2,1),mean(hn2,2),'r');
this is the code i use it for histogram