ex01.py 201 B

12345
  1. import numpy
  2. import cv2
  3. img_array=[[[123,0,0,50] for i in range(300)]for j in range(260)]#255*255的图像,图像的像素[0,255,0,128]
  4. img_numpy=numpy.array(img_array)
  5. cv2.imwrite("1.jpg",img_numpy)