我想创建一个小脚本,用于创建没有背景的png图像。我已经阅读了一些信息,但不确定是否可以使用opencv
实现这一点(如果这是一个愚蠢的问题,对不起,因为我对这个库很陌生)。
创建一张图片很容易,
import cv2
import numpy as np
# Create a black image
img = np.zeros((512,512,3), np.uint8)
# Drawing a circle
circle = cv2.circle(img,(256,256), 63, (0,0,255), -1)
#
cv2.imwrite('circle.png',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
但是,有没有可能去掉背景只保存圆形?
非常感谢!!!