Quiero encontrar el histograma de dos imágenes y encontrar la similitud usando la distancia euclidiana. Estoy tratando de utilizar el comando imhist
pero está dando el siguiente error:comparando dos imágenes usando el histograma
Error using ==> iptcheckinput
Function IMHIST expected its first input, I or X, to be two-dimensional.
mi código es el siguiente:
% read two images
Im1 = imread('1.jpg');
Im2 = imread('2.jpg');
% 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
¡Buena publicación! Pero rgb2gray no trata a todos los canales como iguales. - "0.2989 * R + 0.5870 * G + 0.1140 * B" –
¡Bien, editado! – ibanez