def mark_boundaries(image, regions, color=(0,0,0), thin=False):
"""
Mark region boundaries in a given image.
Args:
image: numpy (H, W) array
RGB image
regions: numpy (H, W) array
Regions extracted from `image`
color: RGB tuple from 0 to 1
Color to mark boundaries. Default black.
thin: bool
Whether to skeletonize or not the boundaries.
Return:
result: numpy (H, W) array
Image with region boundaries overlaid on it.
"""
bounds = boundaries(regions, thin=thin)
result = image.copy()
result[bounds] = color
return result
评论列表
文章目录