Indeed, histograms are intended to represent recalculation of tonal values ββfor a single channel. Color images are often 3-channel images (red, green, blue in most cases).
The Gaul method should work correctly. If you want to be more precise, you can extract each channel and calculate its histogram:
Red1 = Im1(:, :, 1); Green1 = Im1(:, :, 2); Blue1 = Im1(:, :, 3); HnBlue1 = imhist(Blue1)./numel(Blue1);
Now you can define an estimate based on three Euclidean distances (1 for each channel):
FBlue = sum((HnBlue1 - HnBlue2).^2); FRed= sum((HnRed1 - HnRed2).^2); ... F = Alpha*FBlue + Beta*FRed + Gamma*FGreen
Thus, you can focus on one color or another in determining distance. This can be useful if the image you want to test has a specific color.
This is an alternative to the Gaul method, but its equivalent would be to set Alpha, Beta and Gamma as "0.2989 * R + 0.5870 * G + 0.1140 * B," as Andrei said.
ibanez
source share