小编Mar*_*III的帖子

在 Windows 上使用 Python 从网络摄像头捕获图像

我现在使用的代码是:-

from VideoCapture import Device
cam = Device()
cam.saveSnapshot('image.jpg')
Run Code Online (Sandbox Code Playgroud)

使用 py 2.7 和导入的 pygame 以及 all 和 videocapture 我在 pycharm 中收到此错误:-

C:\Python27\python.exe F:/Xtraz/Orion/Key-Logger.py
Traceback (most recent call last):
  File "F:/Xtraz/Orion/Key-Logger.py", line 3, in <module>
    cam.saveSnapshot('image.jpg')
  File "C:\Python27\lib\VideoCapture.py", line 200, in saveSnapshot
    self.getImage(timestamp, boldfont, textpos).save(filename, **keywords)
  File "C:\Python27\lib\VideoCapture.py", line 138, in getImage
    im = Image.fromstring('RGB', (width, height), buffer, 'raw', 'BGR', 0, -1)
  File "C:\Users\admin\AppData\Roaming\Python\Python27\site-packages\PIL\Image.py", line 2080, in fromstring
    "Please call frombytes() instead.")
NotImplementedError: fromstring() has been removed. Please call frombytes() instead. …
Run Code Online (Sandbox Code Playgroud)

python webcam image save capture

1
推荐指数
1
解决办法
3594
查看次数

计算对象的哈希值,python

我有一个带有字符串数据的类,我应该使用hashlib.sha256(). 例如,我无法直接使用块 c 获取哈希

Hash = hashlib.sha256(c.encode()).digest()
Run Code Online (Sandbox Code Playgroud)

我想计算整个对象的散列,有人建议我在类中有一个函数,以便它返回其中的数据散列。它与整个块的相同吗?什么是更好的实施?

python hashlib python-3.x blockchain

0
推荐指数
1
解决办法
9087
查看次数

标签 统计

python ×2

blockchain ×1

capture ×1

hashlib ×1

image ×1

python-3.x ×1

save ×1

webcam ×1