【问题标题】:Is there any way by which I can apply imagehash function in online images in Python有什么方法可以在 Python 的在线图像中应用 imagehash 函数
【发布时间】:2021-06-24 03:42:01
【问题描述】:

我想借助 Python 中的 imagehash 函数获取图像的指纹,但为了应用

hash = imagehash.average_hash(Image.open(path))

图像需要存储。有没有什么方法可以通过提供图片的 URL 来获取图片的指纹?

【问题讨论】:

  • 我觉得没办法。
  • 永远不要失去希望 :)

标签: python imagehash


【解决方案1】:

你可以使用requests:

url = 'https://commons.wikimedia.org/wiki/File:Example.png'

import requests
response = requests.get(url, stream=True)
ihash = imagehash.average_hash(Image.open(response.raw))

【讨论】:

  • 替换后, response = requests.get(url, stream = True) 它起作用了。顺便说一句,谢谢它的工作
  • @JagdishPal 很高兴为您提供帮助!如果我的回答对您有帮助,您可以通过点击大勾号将其选为已接受的答案来接受它,这样回答的人就可以专注于仍然没有答案的旧问题。
猜你喜欢
  • 1970-01-01
  • 2017-12-01
  • 2020-04-29
  • 1970-01-01
  • 1970-01-01
  • 2015-11-26
  • 1970-01-01
  • 2012-06-23
  • 2022-08-05
相关资源
最近更新 更多