PixNyanNyan / postgres-phash-hamming

PostgreSQL extension for pHash hamming distance

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

postgres-phash-hamming

What's this?

It's a postgresql extension providing ph_hamming_distance function from pHash.org.

How to install?

  1. Clone the repo and make sure you have correct version of postgres-server-dev installed.

  2. Verify PG_CONFIG in Makefile has correct path to pg_config, then make && make install to install it.

  3. Log into the database, run CREATE EXTENSION pg_phash; to activate the extension.

How to use?

The phash_hamming function accepts two base-10 number strings as parameters.

Valid return value range is 0~255, and it returns null if null is supplied as input.

For example, if you have two images and their hashes are '13121266429874464083' and '10869537466045227287'.

SELECT phash_hamming('13121266429874464083', '10869537466045227287');

 phash_hamming
---------------
            16
(1 row)

Testing

We offer a script to be used in .travis.yml, see the code below.

sudo: required
install:
  - curl --silent --location https://github.com/PixNyanNyan/postgres-phash-hamming/raw/master/travis/setup.sh | sh
addons:
  postgresql: 9.6

License

GPL 3.0 license as restricted by pHash.

About

PostgreSQL extension for pHash hamming distance

License:GNU General Public License v3.0


Languages

Language:C 81.0%Language:Shell 12.5%Language:Makefile 6.4%