def outline_polygons(self, width=EDGE_WIDTH, color=LABEL_EDGE):
from skimage.morphology import binary_dilation, disk
im = np.asarray(self.image).copy()
outset = binary_dilation(im == LABEL_POSITIVE, disk(width / 2))
inset = binary_dilation(im != LABEL_POSITIVE, disk(width - width / 2))
boundary = outset & inset
im[boundary] = color
self.image = Image.fromarray(im)
self.artist = ImageDraw.Draw(self.image)
评论列表
文章目录