numpy学习笔记:np.zeros应用——生成三通道全黑Mask(蒙板)
np.zeros官方文档:np.zeros官方文档
下面是一段生成256*256三通道全黑mask的demo
>>> import numpy as np
>>> import cv2
>>> mask = np.zeros([256,256,3],dtype="uint8")
>>> sava = 'G:/Desktop/1.png'
>>> cv2.imwrite(sava,mask)
返回True,查看生成图片
cv2.imwrite官方文档:https://www.geeksforgeeks.org/python-opencv-cv2-imwrite-method/