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
评论列表
文章目录