我正在做一個實現虛擬化妝的項目。我在實施眼線筆部分時遇到問題。我應該如何更改 alpha 值(alpha_s,alpha_l)?在 Python 中?我想調整 alpha 值,使人臉圖像上的眼線可能不可見,可能看起來模糊,或者我想看清楚。面部圖像來源是 YouTube 'Bom Bom Bom Bom'(Apink 的 Bomi)下面是python代碼,人臉的高度和寬度,img是一樣的。face = cv2.imread('./image/ex1.png')img = cv2.imread('./result_3.png',-1) ## It is shaped like a left eyeliner and has a transparent background.x_offset = y_offset = 0alpha_s = img[:, :, 3] / 255.0alpha_l = 1.0 - alpha_sfor c in range(0, 3): face[y_offset:y_offset+img.shape[0], x_offset:x_offset+img.shape[1], c] = \ (alpha_s * img[:, :, c] + alpha_l * face[y_offset:y_offset+img.shape[0], x_offset:x_offset+img.shape[1], c])cv2.imshow('result', face)cv2.waitKey(0)cv2.destroyAllWindows()“result_3.png”圖像看起來像這樣。->在此處輸入圖像描述部分代碼結果圖片(左眼)-> enter image description here請幫我。
添加回答
舉報
0/150
提交
取消