Code Monkey home page Code Monkey logo

blockhash-js's Introduction

blockhash-js

This is a perceptual image hash calculation tool based on algorithm descibed in Block Mean Value Based Image Perceptual Hashing by Bian Yang, Fan Gu and Xiamu Niu.

Installation

This module is installed via npm:

  $ npm install blockhash

Use in the browser

To use this library in the browser, you can build it with Browserify with something like browserify index.js --standalone blockhashjs > blockhash.js

Include it and zlib.js on your page:

<!DOCTYPE html>
<html>
  <head>
    <title>Blockhash</title>
  </head>
  <body>
    <script src="node_modules/png-js/zlib.js"></script>
    <script src="blockhash.js"></script>
    <script>
      var blockhash = blockhashjs.blockhash;
    </script>
  </body>
</html>

Call blockhash(src, bits, method, callback), where src is an image URL, bits is the number of bits in a row, method is a number 1-2 (see below), and callback is a function with (error, result) signature. On success, result will be array of binary values.

The available methods are:

  1. Quick and crude, non-overlapping blocks
  2. Precise but slower, non-overlapping blocks

Method 2 is recommended as a good tradeoff between speed and good matches on any image size. The quick ones are only advisable when the image width and height are an even multiple of the number of blocks used.

License

Copyright 2014 Commons Machinery http://commonsmachinery.se/

Distributed under an MIT license, please see LICENSE in the top dir.

Contact: [email protected]

blockhash-js's People

Contributors

artfwo avatar petli avatar jonasob avatar denisnazarov avatar

Watchers

 avatar

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.