python 3.x - Perceptual Hashing with Imagehash without saving matplotlib plots - Stack Overflow

I am creating matplotlib plots using data processed by a function. I would like to plot the data and co

I am creating matplotlib plots using data processed by a function. I would like to plot the data and compare the plot to another plot, albeit on different scales. I am using image hash library but unable to get the hash of an image without saving it first.

import hashlib
import numpy as np
import matplotlib.pyplot as plt
import imagehash
from io import BytesIO

X = np.linspace(0,100,1000)
Y = np.sin(0.5*X)
plt.plot(X,Y)
buffer1 = BytesIO()
plt.savefig(buffer1, format='png')
#canvas = plt.gcf().canvas
#canvas.draw()
#new_hash = hashlib.sha1(np.array(canvas.buffer_rgba())).hexdigest()
new_hash = imagehash.whash(buffer1)
print(str(new_hash))
plt.cla()

How can I do this. I saw a thread that uses hash lib but I would like to use image hash library.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742339381a4425309.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信