nail.py 文件源码

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

项目:Virtual-Makeup 作者: srivatsan-ramesh 项目源码 文件源码
def apply_texture(x, y):
    xmin, ymin = amin(x), amin(y)
    X = (x - xmin).astype(int)
    Y = (y - ymin).astype(int)
    val1 = color.rgb2lab((text[X, Y] / 255.).reshape(len(X), 1, 3)).reshape(len(X), 3)
    val2 = color.rgb2lab((im[x, y] / 255.).reshape(len(x), 1, 3)).reshape(len(x), 3)
    L, A, B = mean(val2[:, 0]), mean(val2[:, 1]), mean(val2[:, 2])
    val2[:, 0] = np.clip(val2[:, 0] - L + val1[:, 0], 0, 100)
    val2[:, 1] = np.clip(val2[:, 1] - A + val1[:, 1], -127, 128)
    val2[:, 2] = np.clip(val2[:, 2] - B + val1[:, 2], -127, 128)
    im[x, y] = color.lab2rgb(val2.reshape(len(x), 1, 3)).reshape(len(x), 3) * 255
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号