# 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
```python
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`
Raw data
{
"_id": null,
"home_page": "https://github.com/faustomorales/pdqhash-python",
"name": "pdqhash",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Fausto Morales",
"author_email": "faustomorales@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/98/c1/29cd086b7f7472771fb4b207ed857aae71dc183b88f1f3471ec888faa911/pdqhash-0.2.5.tar.gz",
"platform": null,
"description": "# pdqhash-python\n\nThese 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).\n\n## Installation\n\n```\npip install pdqhash\n```\n\n## Usage\n\n```python\nimport pdqhash\n\nimage = cv2.imread(os.path.join('tests', 'images', image_name))\nimage = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)\nhash_vector, quality = pdqhash.compute(image)\n\n# Get all the rotations and flips in one pass.\n# hash_vectors is a list of vectors in the following order\n# - Original\n# - Rotated 90 degrees\n# - Rotated 180 degrees\n# - Rotated 270 degrees\n# - Flipped vertically\n# - Flipped horizontally\n# - Rotated 90 degrees and flipped vertically\n# - Rotated 90 degrees and flipped horizontally\nhash_vectors, quality = pdqhash.compute_dihedral(image)\n\n# Get the floating point values of the hash.\nhash_vector_float, quality = pdqhash.compute_float(image)\n```\n\n## Contributing\n\n- Set up local development using `make init` (you need to have `pipenv` installed)\n- Run tests using `make test`\n- Run tests in Docker using `make docker_test`\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "\"Python bindings for Facebook's PDQ hash\"",
"version": "0.2.5",
"project_urls": {
"Homepage": "https://github.com/faustomorales/pdqhash-python"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4818609052b1e0cb18007cc806b29b699ba84524366d272419e0db91786b6504",
"md5": "3f616f799b8aa59945eedcb535391a27",
"sha256": "1b3d4a6251033d8bfbb8d054fcdbcd0ea6b7a93c6a0b7433c9947c4fb4a3f5ef"
},
"downloads": -1,
"filename": "pdqhash-0.2.5-cp310-cp310-macosx_11_0_x86_64.whl",
"has_sig": false,
"md5_digest": "3f616f799b8aa59945eedcb535391a27",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": null,
"size": 57911,
"upload_time": "2023-08-22T20:51:08",
"upload_time_iso_8601": "2023-08-22T20:51:08.153474Z",
"url": "https://files.pythonhosted.org/packages/48/18/609052b1e0cb18007cc806b29b699ba84524366d272419e0db91786b6504/pdqhash-0.2.5-cp310-cp310-macosx_11_0_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "58775af0672350aa0850938516f3fa7aab8e7160bd61fa43fad5e317b0cc301d",
"md5": "c10954ee2e033ea3786b564ab4f7eb07",
"sha256": "211431c347e737ff247a39fb24924c93c853d793842961cf476d40fa9a586eca"
},
"downloads": -1,
"filename": "pdqhash-0.2.5-cp310-cp310-win_amd64.whl",
"has_sig": false,
"md5_digest": "c10954ee2e033ea3786b564ab4f7eb07",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": null,
"size": 45760,
"upload_time": "2023-08-22T20:51:09",
"upload_time_iso_8601": "2023-08-22T20:51:09.455327Z",
"url": "https://files.pythonhosted.org/packages/58/77/5af0672350aa0850938516f3fa7aab8e7160bd61fa43fad5e317b0cc301d/pdqhash-0.2.5-cp310-cp310-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ce19939fed7b0ef426ef31d20995d4ffa45a6ac6f184a3579f612c9ce8a48a70",
"md5": "3ccbd753f984aba6dca32f72f3596ca8",
"sha256": "70a905a777826293ab5e4eba0e05e8c44467d873959d336a0558d0f632a90133"
},
"downloads": -1,
"filename": "pdqhash-0.2.5-cp37-cp37m-macosx_11_0_x86_64.whl",
"has_sig": false,
"md5_digest": "3ccbd753f984aba6dca32f72f3596ca8",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 58641,
"upload_time": "2023-08-22T20:51:10",
"upload_time_iso_8601": "2023-08-22T20:51:10.947987Z",
"url": "https://files.pythonhosted.org/packages/ce/19/939fed7b0ef426ef31d20995d4ffa45a6ac6f184a3579f612c9ce8a48a70/pdqhash-0.2.5-cp37-cp37m-macosx_11_0_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8cf5f1273ebf926124bdb0a50b66a554eaee9998ea0d3b9783780618c27bea2f",
"md5": "c83db7f47ecc0e7e3e1134c0acfbcd26",
"sha256": "9f07f4e8482ec9eada19ea834c72c72df1159eba2d2a1761c4a00f70789f591d"
},
"downloads": -1,
"filename": "pdqhash-0.2.5-cp37-cp37m-win_amd64.whl",
"has_sig": false,
"md5_digest": "c83db7f47ecc0e7e3e1134c0acfbcd26",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 53993,
"upload_time": "2023-08-22T20:51:11",
"upload_time_iso_8601": "2023-08-22T20:51:11.970936Z",
"url": "https://files.pythonhosted.org/packages/8c/f5/f1273ebf926124bdb0a50b66a554eaee9998ea0d3b9783780618c27bea2f/pdqhash-0.2.5-cp37-cp37m-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4466485eca50c907d4b515127f54bcbe323f3bfc13324d098729906f6cb4f1ae",
"md5": "67a0d9739b2129a0510ecb8e54c52b45",
"sha256": "230694fab7b7f70fc494ee8bc3a0a5960ed82c4a78421a357e1312d933947854"
},
"downloads": -1,
"filename": "pdqhash-0.2.5-cp38-cp38-macosx_11_0_x86_64.whl",
"has_sig": false,
"md5_digest": "67a0d9739b2129a0510ecb8e54c52b45",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": null,
"size": 58027,
"upload_time": "2023-08-22T20:51:13",
"upload_time_iso_8601": "2023-08-22T20:51:13.101867Z",
"url": "https://files.pythonhosted.org/packages/44/66/485eca50c907d4b515127f54bcbe323f3bfc13324d098729906f6cb4f1ae/pdqhash-0.2.5-cp38-cp38-macosx_11_0_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1410b3ae29d73a21f3d7f028ea9c108e888b68913872448b933597037a9a1b66",
"md5": "496b9d6f1e19a0338302eca649bdac46",
"sha256": "e06e531c4fd204d6a9d58eef4a64354eaa62f2e3ca78ed1721ac571644f0c571"
},
"downloads": -1,
"filename": "pdqhash-0.2.5-cp38-cp38-win_amd64.whl",
"has_sig": false,
"md5_digest": "496b9d6f1e19a0338302eca649bdac46",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": null,
"size": 54587,
"upload_time": "2023-08-22T20:51:14",
"upload_time_iso_8601": "2023-08-22T20:51:14.679462Z",
"url": "https://files.pythonhosted.org/packages/14/10/b3ae29d73a21f3d7f028ea9c108e888b68913872448b933597037a9a1b66/pdqhash-0.2.5-cp38-cp38-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d0eb8dc19ba38dd0b4bd7f1235cb8e3e1a82cbab004a6b2a37b9b2e4a1283731",
"md5": "567ba85f6f6c63235eb1f2c134dab9fb",
"sha256": "a2daed23628cf58eb866bcef9731de6c159578e32e939a71939e0d8032b11a86"
},
"downloads": -1,
"filename": "pdqhash-0.2.5-cp39-cp39-macosx_11_0_x86_64.whl",
"has_sig": false,
"md5_digest": "567ba85f6f6c63235eb1f2c134dab9fb",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": null,
"size": 57920,
"upload_time": "2023-08-22T20:51:16",
"upload_time_iso_8601": "2023-08-22T20:51:16.122281Z",
"url": "https://files.pythonhosted.org/packages/d0/eb/8dc19ba38dd0b4bd7f1235cb8e3e1a82cbab004a6b2a37b9b2e4a1283731/pdqhash-0.2.5-cp39-cp39-macosx_11_0_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "591bb2c25b2cdba512f1a77e1dc7d002f21e50ce487cebb06e543b8a9c5e619f",
"md5": "7011421c551822364b4b3e3aa1055d8b",
"sha256": "2b0519a07551a753380cf76db24212b4db7c0ea30516b620a5c902d25b467e6a"
},
"downloads": -1,
"filename": "pdqhash-0.2.5-cp39-cp39-win_amd64.whl",
"has_sig": false,
"md5_digest": "7011421c551822364b4b3e3aa1055d8b",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": null,
"size": 54287,
"upload_time": "2023-08-22T20:51:17",
"upload_time_iso_8601": "2023-08-22T20:51:17.397259Z",
"url": "https://files.pythonhosted.org/packages/59/1b/b2c25b2cdba512f1a77e1dc7d002f21e50ce487cebb06e543b8a9c5e619f/pdqhash-0.2.5-cp39-cp39-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "98c129cd086b7f7472771fb4b207ed857aae71dc183b88f1f3471ec888faa911",
"md5": "d142d5aedf4a4b26bc0de703899f1c43",
"sha256": "c688f3f6ea65debb6213577f46ba2be9ebb7db7d23f96ad6ed2df05832de93c3"
},
"downloads": -1,
"filename": "pdqhash-0.2.5.tar.gz",
"has_sig": false,
"md5_digest": "d142d5aedf4a4b26bc0de703899f1c43",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 666496,
"upload_time": "2023-08-22T20:51:51",
"upload_time_iso_8601": "2023-08-22T20:51:51.126895Z",
"url": "https://files.pythonhosted.org/packages/98/c1/29cd086b7f7472771fb4b207ed857aae71dc183b88f1f3471ec888faa911/pdqhash-0.2.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-22 20:51:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "faustomorales",
"github_project": "pdqhash-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "pdqhash"
}