python调用videocapture出错的问题

来源:互联网 发布:淘宝中国制造怎么申请 编辑:程序博客网 时间:2024/06/18 01:14

出现如下错误:

File "D:\Python34\lib\site-packages\VideoCapture__init__.py", line 234, in saveSnapshot
self.getImage(timestamp, boldfont, textpos).save(filename, **keywords)
File "D:\Python34\lib\site-packages\VideoCapture__init__.py", line 154, in getImage
'RGB', (width, height), buffer, 'raw', 'BGR', 0, -1)
File "D:\Python34\lib\site-packages\PIL\Image.py", line 2053, in fromstring
"Please call frombytes() instead.")
Exception: fromstring() has been removed. Please call frombytes() instead.

解决办法:

将init下153行的fromstring改成frombytes即可,程序运行成功

示例:

#coding=utf-8import VideoCapturecam = VideoCapture.Device(devnum=0)cam.saveSnapshot('test.jpg', quality=75, timestamp=3, boldfont=1)
结果:

0 0
原创粉丝点击