Given two input i. original image & ii. mask image, what's the best way to remove to the background from the original image.
Original Image
Mask Image
The final output would contain just the dog without the background and look transparent. I have seen the mask images are also created with OpenCV. Is there a way to just the existing mask image and generate the output image?
Update I tried this
import cv2
# opencv loads the image in BGR, convert it to RGB
img = cv2.imread("originalImage.png")
mask = cv2.imread("maskImage.png")
final = cv2.bitwise_and(img, mask)
cv2.imwrite("final.png", final)
Final Image
Is there a way to set the background to be transparent?


