Skip to content

Instantly share code, notes, and snippets.

@maheshmc2
Created February 20, 2011 05:26
Show Gist options
  • Save maheshmc2/835734 to your computer and use it in GitHub Desktop.
Save maheshmc2/835734 to your computer and use it in GitHub Desktop.
Just Check if this comparison code is working or not.. In my computer it was working yesterday night but now not :'(
clc;
clear all;
Hist1 = getHSVHistogram('C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpg');
Hist2 = getHSVHistogram('C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water lilies.jpg');
% decision thresholds:
t = 0.010;
t2 = 0.8;
range = 0.0:0.1:1.0;
rangeNew = 0.0:0.05:1.0;
[x,y,z] = meshgrid(range);
[x2,y2,z2] = meshgrid(rangeNew);
Hist1 = INTERP3(x,y,z,Hist1,x2,y2,z2);
Hist2 = INTERP3(x,y,z,Hist2,x2,y2,z2);
DIFF = abs(Hist1-Hist2) ./ Hist1;
DIFF = DIFF(Hist1>t);
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