def _createMaskFromSelection(self):
img = self.display.widget.image
assert img is not None, 'need image defined'
out = np.zeros(img.shape[1:3], dtype=np.uint8)
for n, p in enumerate(self.paths):
assert isinstance(
p, FreehandItem), 'TODO: make work for other items as well'
cv2.fillPoly(out, np.array([p.elements()], dtype=np.int32), n + 1)
self.handleOutput([out.T], title='selection')
评论列表
文章目录