Created
June 6, 2020 02:33
-
-
Save hideack/00a343d11d3d3b2a6cf4242570d69cd5 to your computer and use it in GitHub Desktop.
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 pHash = require("phash"); | |
| var samples = [ | |
| "samples/lena.jpg", | |
| "samples/lena-small.jpg", | |
| "samples/lena-sepia.jpg", | |
| "samples/lena-mosaic.jpg", | |
| "samples/lena-cut.jpg", | |
| "samples/lena-cut2.jpg", | |
| "samples/lena-horizonal-flip.jpg" | |
| ]; | |
| var hash = []; | |
| samples.forEach(function(sample) { | |
| hash.push(pHash.imageHashSync(sample)); | |
| }); | |
| for(var i=0; i<hash.length; i++) { | |
| console.log("Hash No." + i + " : " + parseInt(hash[i]).toString(16)); | |
| console.log("File:" + samples[i]); | |
| console.log("Haming distance (vs hash[0]) = " + pHash.hammingDistance(hash[0], hash[i])); | |
| console.log("-----"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment