Created
February 20, 2011 08:52
-
-
Save maheshmc2/835833 to your computer and use it in GitHub Desktop.
I've checked it.. It is working fine.. Check if its not working then plz let me know... Low Similarity means more similarity...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [Similarity] = HSVcomp(Hist1, Hist2) | |
range = 0.0:0.1:1.0; | |
rangeNew = 0.0:0.05:1.0; | |
[x,y,z] = meshgrid(range); | |
[x2,y2,z2] = meshgrid(rangeNew); | |
% decision thresholds: | |
t = 0.010; | |
t2 = 0.8; | |
Hist1 = interp3(x,y,z,Hist1,x2,y2,z2); | |
Hist2 = interp3(x,y,z,Hist2,x2,y2,z2); | |
DIFF = abs(Hist1-Hist2) ./ Hist2; | |
DIFF(isnan(DIFF)) = 0; | |
DIFF(isinf(DIFF)) = 1; | |
% keep distance values for which the corresponding query image's values | |
% are larger than the predefined threshold: | |
DIFF = DIFF(Hist1>t); | |
% keep error values which are smaller than 1: | |
DIFF2 = DIFF(DIFF<t2); | |
L2 = length(DIFF2); | |
Similarity = length(DIFF) * mean(DIFF2)/ (L2^2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment