Comments (4)
@dsoprea Thanks for reporting this here too :) Does the linked PR fix the problem?
from blockhash-js.
Seems like it should, but I'm unable to test simply using Node.
- Your package.json uses "devDependencies" instead of "dependencies", so the dependencies won't automatically install unless you pass "--dev" to npm-install.
- When I adjusted this so that I could get the dependencies installed, I got an error about browser-specific functions missing (yes; I realize this might always require a URL, though I tried this with a local file first):
> b = require('blockhash')
{ hammingDistance: [Function: hammingDistance],
blockhash: [Function: blockhash],
blockhashData: [Function: blockhashData] }
> b.blockhash('test_assets/20170618_155330.jpg')
ReferenceError: XMLHttpRequest is not defined
at Object.blockhash (/home/local/MAGICLEAP/doprea/development/node/testproject/node_modules/blockhash/index.js:217:15)
at repl:1:3
at sigintHandlersWrap (vm.js:22:35)
...
It seems like this project is singularly meant for use in webpages and not via Node. I'd remove any references to Node/NPM (including package.json; you'll have to make sure that all dependencies are represented properly in the webpage example) from the project/documentation while these issues exist, if indeed it was ever your intent for this to work in NPM, in order to mitigate confusion.
from blockhash-js.
By the way, I could use some insight from you.
I had quickly translated the algorithm to Go based on your Python and C implementations (which is how I had noticed the median discrepancy). There is a subtle image-processing difference that might mean that all hashes produced using the standard Go image package will always differ from your hashes.
Send me an email, if you have a chance, to discuss.
from blockhash-js.
Right, the library is mostly for browsers, but it also works with node (one use case for that is running the tests outside of a browser). I am currently able to run the tests locally using:
npm install
npm install mocha (or add --dev to the above command)
./node_modules/mocha/bin/mocha
This should be probably documented. Mocha provides XMLHttpRequest, Date and other browser-specific stuff in the global namespace. The hashes currently match those from blockhash-python test data, so if you have no objections, I'd merge this change immediately. I'll send a follow-up email regarding your image processing differences ASAP.
from blockhash-js.
Related Issues (19)
- Incorrect calculation of median HOT 4
- Local Image Files?
- How to decide/determine # of bits? HOT 1
- Do you guys own blockhash.com? HOT 1
- Update the NPM version HOT 4
- one_bits variable HOT 1
- Blockhash or perceptual hash? HOT 1
- png-js not found HOT 11
- Java implementation of blockhash
- "Flipping" hash? HOT 1
- blockhash.js file is missing
- Detect image type from arrayBuffer
- Your domain is for sale HOT 1
- ReferenceError: XMLHttpRequest is not defined
- blockhash-js module not registered with NPM HOT 6
- Change package name to "blockhash" before publishing on npm HOT 2
- Incorrect hashing of png HOT 3
- Implement support for GIF HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blockhash-js.