facebook pdq散列的python绑定
pdqhash的Python项目详细描述
pdqhash python
这些是facebook发布的pdq感知散列的python绑定。请注意,绑定是在mit许可证下提供的,但是pdq源代码是在其自己的许可证下单独许可的(请参见ThreatExchange/hashing/pdq
文件夹)。
安装
pip install pdqhash
用法
importpdqhashimage=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 horizontallyhash_vectors,quality=pdqhash.compute_dihedral(image)
贡献
- 使用
make init
设置本地开发(您需要安装pipenv
) - 使用
make test
运行测试
- 在Docker中使用
make docker_test
运行测试