【发布时间】:2019-09-05 05:40:03
【问题描述】:
我想在 Python 中使用 OpenCV 的 perceptual hashing functions。
这行不通。
import cv2
a_1 = cv2.imread('a.jpg')
cv2.img_hash_BlockMeanHash.compute(a_1)
我明白了:
TypeError: descriptor 'compute' requires a 'cv2.img_hash_ImgHashBase' object but received a 'numpy.ndarray'
这也失败了
a_1_base = cv2.img_hash_ImgHashBase(a_1)
cv2.img_hash_BlockMeanHash.compute(a_1_base)
我明白了:
TypeError: Incorrect type of self (must be 'img_hash_ImgHashBase' or its derivative)
显示此内容的 Colab 笔记本:
https://colab.research.google.com/drive/1x5ZxMBD3wFts2WKS4ip3rp4afDx0lGhi
【问题讨论】: