methods.py 文件源码

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

项目:qtim_ROP 作者: QTIM-Lab 项目源码 文件源码
def kaggle_BG(img, scale):

    # Create a mask from which the approximate retinal center can be calculated
    guide_mask = create_mask(img)
    retina_center = tuple((np.mean(np.argwhere(guide_mask), axis=0)).astype(np.uint8))[::-1]

    # Generate a circle of the approximate size, centered based on the guide mask
    cf = 1.2
    circular_mask = np.zeros(img.shape)
    cv2.circle(circular_mask, retina_center, int(scale * cf), (1, 1, 1), -1, 8, 0)

    # Compute weight sum of image, blurred image and mask it
    w_sum = cv2.addWeighted(img, 4, cv2.GaussianBlur(img, (0, 0), scale / 30), -4, 128) * circular_mask + 128 * (1 - circular_mask)
    return w_sum.astype(np.uint8)


# https://github.com/btgraham/SparseConvNet/blob/kaggle_Diabetic_Retinopathy_competition/Data/
# kaggleDiabeticRetinopathy/preprocessImages.py
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号