Skip to main content

"Python bindings for Facebook's PDQ hash"

Project description

pdqhash-python

These are Python bindings to the PDQ perceptual hash released by Facebook. Note that the bindings are provided under the MIT license but the PDQ source code is licensed separately under its own license (see the ThreatExchange/hashing/pdq folder).

Installation

pip install pdqhash

Usage

import pdqhash

image = cv2.imread(os.path.join('tests', 'images', image_name))
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
hash_vector, quality = pdqhash.compute(image)

# Get all the rotations and flips in one pass.
# hash_vectors is a list of vectors in the following order
# - Original
# - Rotated 90 degrees
# - Rotated 180 degrees
# - Rotated 270 degrees
# - Flipped vertically
# - Flipped horizontally
# - Rotated 90 degrees and flipped vertically
# - Rotated 90 degrees and flipped horizontally
hash_vectors, quality = pdqhash.compute_dihedral(image)

# Get the floating point values of the hash.
hash_vector_float, quality = pdqhash.compute_float(image)

Contributing

  • Set up local development using make init (you need to have pipenv installed)
  • Run tests using make test
  • Run tests in Docker using make docker_test

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdqhash-0.2.3.tar.gz (668.5 kB view details)

Uploaded Source

Built Distributions

pdqhash-0.2.3-cp310-cp310-win_amd64.whl (39.7 kB view details)

Uploaded CPython 3.10 Windows x86-64

pdqhash-0.2.3-cp310-cp310-macosx_11_0_x86_64.whl (54.3 kB view details)

Uploaded CPython 3.10 macOS 11.0+ x86-64

pdqhash-0.2.3-cp39-cp39-win_amd64.whl (46.4 kB view details)

Uploaded CPython 3.9 Windows x86-64

pdqhash-0.2.3-cp39-cp39-macosx_11_0_x86_64.whl (53.5 kB view details)

Uploaded CPython 3.9 macOS 11.0+ x86-64

pdqhash-0.2.3-cp38-cp38-win_amd64.whl (46.0 kB view details)

Uploaded CPython 3.8 Windows x86-64

pdqhash-0.2.3-cp38-cp38-macosx_10_15_x86_64.whl (53.3 kB view details)

Uploaded CPython 3.8 macOS 10.15+ x86-64

pdqhash-0.2.3-cp37-cp37m-win_amd64.whl (45.2 kB view details)

Uploaded CPython 3.7m Windows x86-64

pdqhash-0.2.3-cp37-cp37m-macosx_10_15_x86_64.whl (52.9 kB view details)

Uploaded CPython 3.7m macOS 10.15+ x86-64

File details

Details for the file pdqhash-0.2.3.tar.gz.

File metadata

  • Download URL: pdqhash-0.2.3.tar.gz
  • Upload date:
  • Size: 668.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/21.8.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.12

File hashes

Hashes for pdqhash-0.2.3.tar.gz
Algorithm Hash digest
SHA256 71ffeede5a835ba7447f3e507f0afdeff26a25f8829739ee18ecdf8f3993961f
MD5 3e69d1f97f48563ef17b08413fe582c3
BLAKE2b-256 e18b7c4458eadda2a6224ea661bd835ecfe14b15f61feee2f7c2d08b06c1cdf9

See more details on using hashes here.

File details

Details for the file pdqhash-0.2.3-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pdqhash-0.2.3-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 39.7 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/21.8.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.12

File hashes

Hashes for pdqhash-0.2.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c7a31ed28369f28c301a0394c5efce415e65aee8d0901cc8630b8044258ff8d5
MD5 d9eeaebb75dbcddafeac1ece2e80035a
BLAKE2b-256 99a9f9a4ff46c1a328a30eae0a9a2b3477afa273cdc6b9a497cf712f3769309d

See more details on using hashes here.

File details

Details for the file pdqhash-0.2.3-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

  • Download URL: pdqhash-0.2.3-cp310-cp310-macosx_11_0_x86_64.whl
  • Upload date:
  • Size: 54.3 kB
  • Tags: CPython 3.10, macOS 11.0+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/21.8.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.12

File hashes

Hashes for pdqhash-0.2.3-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 b55115d016d712ac9b16a8e357f159f4f8d44fb630e1bd63fe028a295c0fbd14
MD5 1ac4b7ffcd1ab2c67b4669b5bf703ed4
BLAKE2b-256 6777bbcfc9ad15ee79e68a16f4977dbe2c02689255d6e75f79e6eebf15bb7782

See more details on using hashes here.

File details

Details for the file pdqhash-0.2.3-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pdqhash-0.2.3-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 46.4 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/21.8.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.12

File hashes

Hashes for pdqhash-0.2.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 8cbdf8b8e5c52bd74b7eaf1c4d285a830c4ec5bdf4cffe62dea8faa2510752ef
MD5 3c63ec8b5d3d1ed85e43e76651646960
BLAKE2b-256 c7694af24424915f860a320d93f8472ed1c3cbc053e69bc386625cc551c89f28

See more details on using hashes here.

File details

Details for the file pdqhash-0.2.3-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

  • Download URL: pdqhash-0.2.3-cp39-cp39-macosx_11_0_x86_64.whl
  • Upload date:
  • Size: 53.5 kB
  • Tags: CPython 3.9, macOS 11.0+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/21.8.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.12

File hashes

Hashes for pdqhash-0.2.3-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 575486b4b7ac51407bb9ce1c66e280dffbe3a47c201b6f91e21fdd7dc74b7a2f
MD5 5fbf8843c45ce2ab8f7015b35845393d
BLAKE2b-256 b5bde28bec6b2f855be9ca6c1f18d475e883656088e2f360bb501f02348bd848

See more details on using hashes here.

File details

Details for the file pdqhash-0.2.3-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: pdqhash-0.2.3-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 46.0 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/21.8.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.12

File hashes

Hashes for pdqhash-0.2.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 ca419869cff56e634a2407683184ec1587e102376de2a8a8cd444ef96c3fd539
MD5 88ea094786bd27bd95e7dbcf4825b483
BLAKE2b-256 321d105c6d801f1d268d6a118a47560ca01c8c0043770a974a7093f7a79a3679

See more details on using hashes here.

File details

Details for the file pdqhash-0.2.3-cp38-cp38-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: pdqhash-0.2.3-cp38-cp38-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 53.3 kB
  • Tags: CPython 3.8, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/21.8.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.12

File hashes

Hashes for pdqhash-0.2.3-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 b52ebfb47d89c9b9e8da1846c408b5dff4348a4288a42b571d1caa828aaad4c6
MD5 1ffe34329ef710656c6794d99653c1a7
BLAKE2b-256 7621797dace4df61f9e0968b8b20705de72b1e1ed6606db62078da8cf57ef13f

See more details on using hashes here.

File details

Details for the file pdqhash-0.2.3-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: pdqhash-0.2.3-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 45.2 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/21.8.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.12

File hashes

Hashes for pdqhash-0.2.3-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 080998103b5b239a19d45e438e2b94643000b2354e0e9cd3d28ae9ac9424f258
MD5 07b37f3042b6d7b9837adc90f2471fe6
BLAKE2b-256 9032505fb5175c1f38577a3640cd53db62bde9478ec67163c4df015f6a5eae1c

See more details on using hashes here.

File details

Details for the file pdqhash-0.2.3-cp37-cp37m-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: pdqhash-0.2.3-cp37-cp37m-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 52.9 kB
  • Tags: CPython 3.7m, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/21.8.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.12

File hashes

Hashes for pdqhash-0.2.3-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 f1e57d278e5ecd7eece217efd4143e2f26d0d2aaed0f4f5cac6f993586e6ba00
MD5 726d432d4e4f7fde87ce71259014f271
BLAKE2b-256 4f4948431b8d1013b96d8581245e2c5461050223aea6751048b6e7cbb07fbcd6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page