nail.py 文件源码

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

项目:Virtual-Makeup 作者: badarsh2 项目源码 文件源码
def applyNailPolish(x , y , r = Rg, g = Gg, b = Bg):
    val = color.rgb2lab((im[x, y]/255.).reshape(len(x), 1, 3)).reshape(len(x), 3)
    L, A, B = mean(val[:,0]), mean(val[:,1]), mean(val[:,2])
    L1, A1, B1 = color.rgb2lab(np.array((r/255., g/255., b/255.)).reshape(1, 1, 3)).reshape(3,)
    ll, aa, bb = L1 - L, A1 - A, B1 - B
    val[:, 0] = np.clip(val[:, 0] + ll, 0, 100)
    val[:, 1] = np.clip(val[:, 1] + aa, -127, 128)
    val[:, 2] = np.clip(val[:, 2] + bb, -127, 128)
    im[x, y] = color.lab2rgb(val.reshape(len(x), 1, 3)).reshape(len(x), 3)*255
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号