segmentation_GMM.py 文件源码

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

项目:intel-cervical-cancer 作者: wangg12 项目源码 文件源码
def Ra_space(img, Ra_ratio, a_threshold):
    '''
    Extract the Ra features by converting RGB to LAB space.
    The higher is a value, the "redder" is the pixel.
    '''
    imgLab = cv2.cvtColor(img, cv2.COLOR_RGB2LAB);
    w = img.shape[0]
    h = img.shape[1]
    Ra = np.zeros((w*h, 2))
    for i in range(w):
        for j in range(h):
            R = math.sqrt((w/2-i)*(w/2-i) + (h/2-j)*(h/2-j))
            Ra[i*h+j, 0] = R
            Ra[i*h+j, 1] = min(imgLab[i][j][1], a_threshold)

    Ra[:,0] /= max(Ra[:,0])
    Ra[:,0] *= Ra_ratio
    Ra[:,1] /= max(Ra[:,1])

    return Ra
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号