seam_carver.py 文件源码

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

项目:seam_carving 作者: dharness 项目源码 文件源码
def compute_eng_color(img, rgb_weights):
    """
    Computes the energy of an image using its color properties

    Args:
        img4 (n,m,4 numpy matrix): RGB image with additional mask layer.
        rgb_weights (n,m numpy matrix): img-specific weights for RBG values

    Returns:
        n,m numpy matrix: Color energy map of the provided image
    """
    eng = np.dstack((
        img[:, :, 0] * rgb_weights[0],
        img[:, :, 1] * rgb_weights[1],
        img[:, :, 2] * rgb_weights[2]
    ))
    eng = np.sum(eng, axis=2)
    return eng
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号