【发布时间】:2018-12-17 17:36:06
【问题描述】:
我想截取屏幕截图并将其作为照片保存到缓冲区 (X.jpg),然后我可以使用 cv2(opencv) 从缓冲区中读取相同的图像。
我的行为如下:
编辑我的代码:
from PIL import ImageGrab
from io import BytesIO
ii = ImageGrab.grab()
with BytesIO() as output:
ii.save(output,format="JPEG")# This line has an error
cam = output.getvalue()
result, frame = cv2.imencode('.jpg', cam, encode_param)
我得到这个错误:
TypeError: img is not a numpy array, neither a scalar
谢谢
【问题讨论】:
标签: python opencv buffer python-imaging-library screenshot