helpers.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:iterative_inference_segm 作者: adri-romsor 项目源码 文件源码
def my_label2rgboverlay(labels, colors, image, alpha=0.2):
    """
    Generates image with segmentation labels on top

    Parameters
    ----------
    labels:  labels of one image (0, 1)
    colors:  colormap
    image:   image (0, 1, c), where c=3 (rgb)
    alpha: transparency
    """
    image_float = gray2rgb(img_as_float(rgb2gray(image) if
                                        image.shape[2] == 3 else
                                        np.squeeze(image)))
    label_image = my_label2rgb(labels, colors)
    output = image_float * alpha + label_image * (1 - alpha)
    return output
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号