2020
10-08
10-08
python利用蒙版抠图(使用PIL.Image和cv2)输出透明背景图
因为最近在做深度学习抠图,正好要用到蒙版进行抠图,所以我将抠图代码进行了封装注释,可以直接使用。可能走了弯路,若有高见请一定提出!主要代码importcv2fromPILimportImageimportnumpyasnpclassUnsupportedFormat(Exception):def__init__(self,input_type):self.t=input_typedef__str__(self):return"不支持'{}'模式的转换,请使用为图片地址(path)、PIL.Image(pil)或OpenCV(cv2)模式".format(self.t)cla...
继续阅读 >