跳转到主要内容

"Python绑定Facebook的PDQ哈希"

项目描述

pdqhash-python

这是Facebook发布的PDQ感知哈希的Python绑定。请注意,绑定在MIT许可下提供,但PDQ源代码在其自己的许可下分别许可(见ThreatExchange/hashing/pdq文件夹)。

安装

pip install pdqhash

使用

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)

贡献

  • 使用make init设置本地开发(您需要已安装pipenv
  • 使用make test运行测试
  • 使用make docker_test在Docker中运行测试

项目详情


下载文件

下载适合您平台文件。如果您不确定选择哪个,请了解更多关于安装软件包的信息。

源分发

pdqhash-0.2.5.tar.gz (666.5 kB 查看哈希值)

上传时间:

构建分发

pdqhash-0.2.5-cp310-cp310-win_amd64.whl (45.8 kB 查看哈希值)

上传于 CPython 3.10 Windows x86-64

pdqhash-0.2.5-cp310-cp310-macosx_11_0_x86_64.whl (57.9 kB 查看哈希)

上传于 CPython 3.10 macOS 11.0+ x86-64

pdqhash-0.2.5-cp39-cp39-win_amd64.whl (54.3 kB 查看哈希)

上传于 CPython 3.9 Windows x86-64

pdqhash-0.2.5-cp39-cp39-macosx_11_0_x86_64.whl (57.9 kB 查看哈希)

上传于 CPython 3.9 macOS 11.0+ x86-64

pdqhash-0.2.5-cp38-cp38-win_amd64.whl (54.6 kB 查看哈希)

上传于 CPython 3.8 Windows x86-64

pdqhash-0.2.5-cp38-cp38-macosx_11_0_x86_64.whl (58.0 kB 查看哈希)

上传于 CPython 3.8 macOS 11.0+ x86-64

pdqhash-0.2.5-cp37-cp37m-win_amd64.whl (54.0 kB 查看哈希)

上传于 CPython 3.7m Windows x86-64

pdqhash-0.2.5-cp37-cp37m-macosx_11_0_x86_64.whl (58.6 kB 查看哈希)

上传于 CPython 3.7m macOS 11.0+ x86-64

由以下支持