"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 havepipenv
installed) - 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
File details
Details for the file pdqhash-0.2.7.tar.gz
.
File metadata
- Download URL: pdqhash-0.2.7.tar.gz
- Upload date:
- Size: 668.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df6375fef513089191cadcbf07c90715d40e882867141e04360a39d8a0861cb5 |
|
MD5 | f2f74e75f0a80e96fdbe2a26b0a76217 |
|
BLAKE2b-256 | daf89a01a3fdf24bfb74576f8632423d93bbc823c22d559cb877ae4f5a3af9a9 |
File details
Details for the file pdqhash-0.2.7-cp313-cp313-win_amd64.whl
.
File metadata
- Download URL: pdqhash-0.2.7-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 43.8 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d63886b1edea4134eaa9862987393391e8958f35569918b91804b528f23c5e6c |
|
MD5 | 89cdd82c29cb464877082d7f4ade681b |
|
BLAKE2b-256 | c749e5cb8f29032d262ebceb40b99ee1d8c0cba49a6af5815f08a86416458366 |
File details
Details for the file pdqhash-0.2.7-cp313-cp313-macosx_10_13_universal2.whl
.
File metadata
- Download URL: pdqhash-0.2.7-cp313-cp313-macosx_10_13_universal2.whl
- Upload date:
- Size: 104.2 kB
- Tags: CPython 3.13, macOS 10.13+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7d943874df8b2ca8c97755f60d1b6ae66e654fe8b2bb6ac8e8be216cae7d130 |
|
MD5 | b45de0a883a0203b5cc6f54bcb08497b |
|
BLAKE2b-256 | c62b9ab348319f33ec17f31d3ec98b2b8ac95f576e8ab32685893b37a4acae33 |
File details
Details for the file pdqhash-0.2.7-cp312-cp312-win_amd64.whl
.
File metadata
- Download URL: pdqhash-0.2.7-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 44.7 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 262ec2881b80877a4005f408000f27e492d08b0d4e84269e1cfcc8a31e96c3bf |
|
MD5 | 38d486308ac5c9649121f957c9d46ec8 |
|
BLAKE2b-256 | a6e81e2da3617ffa3c488529fc5fe89c0718e239f0df0c0d8913880c3ae4abff |
File details
Details for the file pdqhash-0.2.7-cp312-cp312-macosx_10_13_universal2.whl
.
File metadata
- Download URL: pdqhash-0.2.7-cp312-cp312-macosx_10_13_universal2.whl
- Upload date:
- Size: 106.0 kB
- Tags: CPython 3.12, macOS 10.13+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6eab8a3112853f18adfaf1482b48bff8003d822de927b7397a421c5e7f0f76d7 |
|
MD5 | dbc41ef941e15bedf7f1230d635fe31e |
|
BLAKE2b-256 | c1e76d109af7af65547e82b90fe24e624e65e86d7528d4c260bec0b48449e682 |
File details
Details for the file pdqhash-0.2.7-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: pdqhash-0.2.7-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 45.2 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68549e2071499a5a19748505eb00f52384f24830fe14a437f982d046a8edb498 |
|
MD5 | 24367e9d0d81ca37a1bccd50ad105a58 |
|
BLAKE2b-256 | 770b9ac968ad32102fe1694089f6f34a18de1c9916d4cd6efa2cf5e22fc63a29 |
File details
Details for the file pdqhash-0.2.7-cp311-cp311-macosx_10_9_universal2.whl
.
File metadata
- Download URL: pdqhash-0.2.7-cp311-cp311-macosx_10_9_universal2.whl
- Upload date:
- Size: 105.7 kB
- Tags: CPython 3.11, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91652e70d017c8fd60003ea0bfcf4eefeceb3896b93deb2dec43a2ae896da6cd |
|
MD5 | d1ef774774e97fae3e7e1d3168cf16c4 |
|
BLAKE2b-256 | 08c26e8f320de2a8fb949c98fb37c2b7982e4b230d278110caddff7fa46cf9f4 |
File details
Details for the file pdqhash-0.2.7-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: pdqhash-0.2.7-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 45.0 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33bc5d22c458e5245c2649c0e54968d13e7b5940f6ace268f4a05016481b2253 |
|
MD5 | 8a29b3a488a99882033e97fa93db0e4f |
|
BLAKE2b-256 | 15efb16e397e8bd7b98b1fc6c6c07d2d368ad83f44e47bd683a2c552a6e67432 |
File details
Details for the file pdqhash-0.2.7-cp310-cp310-macosx_10_9_universal2.whl
.
File metadata
- Download URL: pdqhash-0.2.7-cp310-cp310-macosx_10_9_universal2.whl
- Upload date:
- Size: 105.7 kB
- Tags: CPython 3.10, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7efd5b4e1ded44ec2a32ea2d32c29fef37d1adca03ce0867975526aea0ffe7fe |
|
MD5 | 63aa3fd6129acc57504367903865a430 |
|
BLAKE2b-256 | e20933e0cb410c0f95717d28aaeb8a429648337a208292f822dd694866587736 |
File details
Details for the file pdqhash-0.2.7-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: pdqhash-0.2.7-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 53.5 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9648abdfdbccb5edfc55fa2a61183766e51d140080fe08213f5daa885c3d5c66 |
|
MD5 | c75e65ea45a14a568839e443fd0ac3ce |
|
BLAKE2b-256 | c671cea0b8992cf3b41eb049a16f0121b125f43eca202f0f29e51159998ea1e7 |
File details
Details for the file pdqhash-0.2.7-cp39-cp39-macosx_10_9_universal2.whl
.
File metadata
- Download URL: pdqhash-0.2.7-cp39-cp39-macosx_10_9_universal2.whl
- Upload date:
- Size: 105.7 kB
- Tags: CPython 3.9, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc6c53cdc395f5421c857e4e30a92862cc918e18f91d7e4452bb5eb746e454f2 |
|
MD5 | de8c807645526186086a5c672764cd27 |
|
BLAKE2b-256 | 829e822734d4a7e25049c9c0e80ae5b378b372144ad1d3c2da1ebea83199a440 |