import cv2
img = cv2.cvtColor(cv2.imread("alphaimg.png", -1), cv2.COLOR_BGRA2RGBA)
img, mask = img[...,:3], img[...,3:] / 255.
img = (img * mask + np.ones(img.shape)*255 * (1. - mask)).astype(np.uint8)
More than 1 year has passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme