ex01.py 266 B

12345
  1. import numpy #向量与矩阵运算库
  2. import cv2 #poencv-python:图像处理
  3. img_array = [[[0,255,0,128]for i in range(50)]for j in range(50)] #255*255的图像像素是[0,255,0,128]
  4. img_numpy = numpy.array(img_array)
  5. cv2.imwrite("1.jpg", img_numpy)