1234567 |
- import numpy # 向量与矩阵运算阵(线性代数运算阵) 1.19.5
- import cv2 # opencv-python opencv-contrib-python:图像处理
- # 生成数组
- img_array = [[[0,255,0,128] for i in range(255)] for j in range(255)] # 255*255的图像,图像的像素[0,255,0,128]
- # cv2中只支持numpy的格式
- img_numpy = numpy.array(img_array)
- cv2.imwrite("1.jpg",img_numpy)
|