202103-09 Python 图片转数组,二进制互转操作 前言需要导入以下包,没有的通过pip安装importmatplotlib.pyplotaspltimportcv2fromPILimportImagefromioimportBytesIOimportnumpyasnp1.图片和数组互转#图片转numpy数组img_path="images/1.jpg"img_data=cv2.imread(img_path)#numpy数组转图片img_data=np.linspace(0,255,100*100*3).reshape(100,100,-1).astype(np.uint8)cv2.imwrite("img.jpg",img_data)#在当前目录下会生成一张img.jpg的图片2.图片和二... 继续阅读 >