Last active
August 29, 2015 14:07
-
-
Save spolu/75e6ab00d651df1b96b2 to your computer and use it in GitHub Desktop.
Hash Distance
This file contains hidden or 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
var LIBRARY = ...; | |
var THRESHOLD = ...; | |
function compare(image_1, image_2) { | |
/* h1 and/or h2 can be stored in database. */ | |
var h1 = LIBRARY.hash(image_1); | |
var h2 = LIBRARY.hash(image_2); | |
var d = LIBRARY.distance(h1, h2); | |
return (d < THRESHOLD); | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment