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.8.tar.gz (696.7 kB view details)

Uploaded Source

Built Distributions

pdqhash-0.2.8-cp313-cp313-win_amd64.whl (42.6 kB view details)

Uploaded CPython 3.13Windows x86-64

pdqhash-0.2.8-cp313-cp313-macosx_10_13_universal2.whl (107.2 kB view details)

Uploaded CPython 3.13macOS 10.13+ universal2 (ARM64, x86-64)

pdqhash-0.2.8-cp312-cp312-win_amd64.whl (43.4 kB view details)

Uploaded CPython 3.12Windows x86-64

pdqhash-0.2.8-cp312-cp312-macosx_10_13_universal2.whl (108.5 kB view details)

Uploaded CPython 3.12macOS 10.13+ universal2 (ARM64, x86-64)

pdqhash-0.2.8-cp311-cp311-win_amd64.whl (43.7 kB view details)

Uploaded CPython 3.11Windows x86-64

pdqhash-0.2.8-cp311-cp311-macosx_10_9_universal2.whl (108.3 kB view details)

Uploaded CPython 3.11macOS 10.9+ universal2 (ARM64, x86-64)

pdqhash-0.2.8-cp310-cp310-win_amd64.whl (43.6 kB view details)

Uploaded CPython 3.10Windows x86-64

pdqhash-0.2.8-cp310-cp310-macosx_10_9_universal2.whl (107.5 kB view details)

Uploaded CPython 3.10macOS 10.9+ universal2 (ARM64, x86-64)

File details

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

File metadata

  • Download URL: pdqhash-0.2.8.tar.gz
  • Upload date:
  • Size: 696.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pdqhash-0.2.8.tar.gz
Algorithm Hash digest
SHA256 eb9a9de36745937ce3e481a02ce933fe907c84e0b1748c9dfea52c12ca5c1e35
MD5 b6dfcdbc6a5b913b260288be1a3f9dca
BLAKE2b-256 9883258f070fbe134c2bd6f20dc0a9b142842ff35bc1369a98e7df30b496177b

See more details on using hashes here.

File details

Details for the file pdqhash-0.2.8-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pdqhash-0.2.8-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 42.6 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pdqhash-0.2.8-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b3f892a767708eb63a7b3498e23582a34890a0f2a31833d28fd16c355e1f0d4d
MD5 077e0b5dd503f58fd8dd609c25cfbd2f
BLAKE2b-256 6cfcc67fb57a2769c24ef7bbe65cee4b579edc3d1370024216215787af57a5a9

See more details on using hashes here.

File details

Details for the file pdqhash-0.2.8-cp313-cp313-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for pdqhash-0.2.8-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 e7f50d8382a8850917a77232e00bc649b63db8e018423e6175842a226b01fad8
MD5 791c61e8e57ab4fe43e8405fad8590a6
BLAKE2b-256 1a849f84cb99db5d558ac0d81f6f71dc9ac8c0483a2b539ca19c63d7e3b5bec8

See more details on using hashes here.

File details

Details for the file pdqhash-0.2.8-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pdqhash-0.2.8-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 43.4 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pdqhash-0.2.8-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 fe082d83432583eaf7938fade50ec14e2ecc597b648dbca3419703b7a36f07f0
MD5 ba228d0bbe7beb29960daa7321c8a469
BLAKE2b-256 28e980bd1f68066f6ce4ae06cfdc48fe4ca454d6868b16de878cdb8fed434b04

See more details on using hashes here.

File details

Details for the file pdqhash-0.2.8-cp312-cp312-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for pdqhash-0.2.8-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 13f106595b566677b0a125d96c6910fd1f1bbf2e86aae3a36ca8e0ed67ded02c
MD5 8183ea8f741c795c9257c8eb3c6365fe
BLAKE2b-256 ce768411975e8d0b5b4d7aeeedfff55101074c96d7b842377e9eb2f02181f0ea

See more details on using hashes here.

File details

Details for the file pdqhash-0.2.8-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pdqhash-0.2.8-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 43.7 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pdqhash-0.2.8-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a7b3a626413bad245e3cdd815a4d644a68736982c4b9eb130b52d74dcb48f8e5
MD5 4bf6602f3ef6788958848a5dec4a8662
BLAKE2b-256 56490257d03b2c369e196b042c8873db6a81be9c83659b29dc08dcf5533950df

See more details on using hashes here.

File details

Details for the file pdqhash-0.2.8-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for pdqhash-0.2.8-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 5459e57ae2c432429bc2ee1077cd2973a0c24d491f54777d5b4bf249bef35f48
MD5 3ec440fbc21ad3cc9c29c14c7cd4d5a3
BLAKE2b-256 8fd793d9a4086118140c9679f6cce782ba1cdec48c722ca04dd620bbca980f94

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pdqhash-0.2.8-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 43.6 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pdqhash-0.2.8-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 fa49dfeb82b1549318bd3743ae112e4a1feb3dfeb8a6bb859d7f0cbdc5b7c0be
MD5 6647b703598e9969e517852b49ac5016
BLAKE2b-256 3f2cfe50e4c4524bb29360d1330965ca9578a4344d3c3614148d953b7fd09f12

See more details on using hashes here.

File details

Details for the file pdqhash-0.2.8-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for pdqhash-0.2.8-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 01e615089a7a22067627e97c383e371d6db363aca9587f4080a6e43cb6228fff
MD5 6876be0da5c3f8d5d0129fb86928d7c2
BLAKE2b-256 4d437b73c0e6169ba9e2ff1a6d6f3de6657a2b006a988f2e5d18a1789d0c8bbe

See more details on using hashes here.

Supported by

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