import numpy as np
import cv2
# 建立全黑的彩色画布
img1 = np.zeros([300, 300, 3], dtype=np.uint8)
cv2.imshow("img1", img1)
# 建立全黑的灰度
img2 = np.zeros([300, 300, 1], dtype=np.uint8)
cv2.imshow("img2", img2)
# 白色画布
img3 = np.ones([300, 300, 3], dtype=np.uint8)
img3 *= 255
cv2.imshow("img3", img3)
cv2.waitKey(0)
cv2.destroyAllWindows()
numpy.zeros()与numpy.ones()
于 2021-06-18 17:33:00 首次发布