pip install opencv-python
app.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
import cv2 img1 = cv2.imread('gfg.png') img2 = cv2.imread('apple.jpeg') img2 = cv2.resize(img2, img1.shape[1::-1]) cv2.imshow("img 1",img1) cv2.waitKey(0) cv2.imshow("img 2",img2) cv2.waitKey(0) choice = 1 while (choice) : alpha = float(input("Enter alpha value")) dst = cv2.addWeighted(img1, alpha , img2, 1-alpha, 0) cv2.imwrite('alpha_mask_.png', dst) img3 = cv2.imread('alpha_mask_.png') cv2.imshow("alpha blending 1",img3) cv2.waitKey(0) choice = int(input("Enter 1 to continue and 0 to exit")) |