GithubHelp home page GithubHelp logo

Comments (4)

artfwo avatar artfwo commented on May 28, 2024

@dsoprea Thanks for reporting this here too :) Does the linked PR fix the problem?

from blockhash-js.

dsoprea avatar dsoprea commented on May 28, 2024

Seems like it should, but I'm unable to test simply using Node.

  1. Your package.json uses "devDependencies" instead of "dependencies", so the dependencies won't automatically install unless you pass "--dev" to npm-install.
  2. 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.

dsoprea avatar dsoprea commented on May 28, 2024

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.

artfwo avatar artfwo commented on May 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.