我完截图,不想让他保存在本地。
我想直接用 print()输出截完图得字节集内容过后可以直接给cv调用
麻烦各位帮帮忙
麻烦各位帮帮忙
试试这个
import cv2
import numpy as np
# 图片转为字节流
img_src = cv2.imread("E:/result_data/1.jpg")
img_byte = img_src.tobytes()
# 字节流转为图片
nparr = np.frombuffer(img_byte, dtype=np.uint8)
img_shape = int(math.sqrt(nparr.shape[0]/3))
img_dst= nparr.reshape(img_shape,img_shape,3)
cv2.imshow("dst", img_dst)
cv2.waitKey(0)