python numpy,PIL,opencv 操作总结
base64解码
# 参数支持bytes或str
img_bytes = base64.b64decode('image')
将bytes转为bgr图片
import cv2
import numpy as np
img_bgr = cv2.imdecode(np.asarray(bytearray(img_bytes), dtype="uint8"), cv2.IMREAD_COLOR)
img_bgr:nparray 多维数组
用cv2读取图片并转为bytes
import cv2
img = cv
原创
2022-04-25 17:34:19 ·
408 阅读 ·
0 评论