tools.py 文件源码

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

项目:cancer 作者: yancz1989 项目源码 文件源码
def plot_img_with_mask(img,mask,mask2=None, line_size=2):
    kernel = np.ones((line_size,line_size),dtype=np.uint8)
    if np.max(img)<=1.0:
        img = np.array(img*255,dtype=np.uint8);
    mask = np.array(mask*255, dtype=np.uint8);
    color_img = np.dstack((img,img,img));
    edges = binary_dilation(canny(mask,sigma=1.0),kernel);
    color_img[edges,0] = 255;
    color_img[edges,1] = 0;
    color_img[edges,2] = 0;
    if mask2 is not None:
        mask2 = np.array(mask2*255,dtype=np.uint8);
        edges2 = binary_dilation(canny(mask2,sigma=1.0),kernel);
        color_img[edges2,2] = 255;
        color_img[edges2,0:2] = 0;
    plt.imshow(color_img)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号