不点赞白嫖的都是流氓
import cv2
bgr_img = cv2.imread('../data/1.jpg', 1)
bgra_img = cv2.cvtColor(bgr_img, cv2.COLOR_BGR2BGRA)
b, g, r, a = cv2.split(bgra_img)
h, w, c = bgra_img.shape
for i in range(w):
v = (255/w)*i
print(v)
a[:, i] = v
new_bgra = cv2.merge([b, g, r, a])
cv2.imwrite('../data/new_bgra.png', new_bgra)
该方法可以处理图片抠图对象的生硬边缘的问题,使图片边缘过渡更加平滑
答应我,一直这么帅下去好吗?