"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 havepipenvinstalled) - Run tests using
make test - Run tests in Docker using
make docker_test
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb9a9de36745937ce3e481a02ce933fe907c84e0b1748c9dfea52c12ca5c1e35
|
|
| MD5 |
b6dfcdbc6a5b913b260288be1a3f9dca
|
|
| BLAKE2b-256 |
9883258f070fbe134c2bd6f20dc0a9b142842ff35bc1369a98e7df30b496177b
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3f892a767708eb63a7b3498e23582a34890a0f2a31833d28fd16c355e1f0d4d
|
|
| MD5 |
077e0b5dd503f58fd8dd609c25cfbd2f
|
|
| BLAKE2b-256 |
6cfcc67fb57a2769c24ef7bbe65cee4b579edc3d1370024216215787af57a5a9
|
File details
Details for the file pdqhash-0.2.8-cp313-cp313-macosx_10_13_universal2.whl.
File metadata
- Download URL: pdqhash-0.2.8-cp313-cp313-macosx_10_13_universal2.whl
- Upload date:
- Size: 107.2 kB
- Tags: CPython 3.13, macOS 10.13+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7f50d8382a8850917a77232e00bc649b63db8e018423e6175842a226b01fad8
|
|
| MD5 |
791c61e8e57ab4fe43e8405fad8590a6
|
|
| BLAKE2b-256 |
1a849f84cb99db5d558ac0d81f6f71dc9ac8c0483a2b539ca19c63d7e3b5bec8
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe082d83432583eaf7938fade50ec14e2ecc597b648dbca3419703b7a36f07f0
|
|
| MD5 |
ba228d0bbe7beb29960daa7321c8a469
|
|
| BLAKE2b-256 |
28e980bd1f68066f6ce4ae06cfdc48fe4ca454d6868b16de878cdb8fed434b04
|
File details
Details for the file pdqhash-0.2.8-cp312-cp312-macosx_10_13_universal2.whl.
File metadata
- Download URL: pdqhash-0.2.8-cp312-cp312-macosx_10_13_universal2.whl
- Upload date:
- Size: 108.5 kB
- Tags: CPython 3.12, macOS 10.13+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13f106595b566677b0a125d96c6910fd1f1bbf2e86aae3a36ca8e0ed67ded02c
|
|
| MD5 |
8183ea8f741c795c9257c8eb3c6365fe
|
|
| BLAKE2b-256 |
ce768411975e8d0b5b4d7aeeedfff55101074c96d7b842377e9eb2f02181f0ea
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7b3a626413bad245e3cdd815a4d644a68736982c4b9eb130b52d74dcb48f8e5
|
|
| MD5 |
4bf6602f3ef6788958848a5dec4a8662
|
|
| BLAKE2b-256 |
56490257d03b2c369e196b042c8873db6a81be9c83659b29dc08dcf5533950df
|
File details
Details for the file pdqhash-0.2.8-cp311-cp311-macosx_10_9_universal2.whl.
File metadata
- Download URL: pdqhash-0.2.8-cp311-cp311-macosx_10_9_universal2.whl
- Upload date:
- Size: 108.3 kB
- Tags: CPython 3.11, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5459e57ae2c432429bc2ee1077cd2973a0c24d491f54777d5b4bf249bef35f48
|
|
| MD5 |
3ec440fbc21ad3cc9c29c14c7cd4d5a3
|
|
| BLAKE2b-256 |
8fd793d9a4086118140c9679f6cce782ba1cdec48c722ca04dd620bbca980f94
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa49dfeb82b1549318bd3743ae112e4a1feb3dfeb8a6bb859d7f0cbdc5b7c0be
|
|
| MD5 |
6647b703598e9969e517852b49ac5016
|
|
| BLAKE2b-256 |
3f2cfe50e4c4524bb29360d1330965ca9578a4344d3c3614148d953b7fd09f12
|
File details
Details for the file pdqhash-0.2.8-cp310-cp310-macosx_10_9_universal2.whl.
File metadata
- Download URL: pdqhash-0.2.8-cp310-cp310-macosx_10_9_universal2.whl
- Upload date:
- Size: 107.5 kB
- Tags: CPython 3.10, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01e615089a7a22067627e97c383e371d6db363aca9587f4080a6e43cb6228fff
|
|
| MD5 |
6876be0da5c3f8d5d0129fb86928d7c2
|
|
| BLAKE2b-256 |
4d437b73c0e6169ba9e2ff1a6d6f3de6657a2b006a988f2e5d18a1789d0c8bbe
|