Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import scipy as sp
- import matplotlib.pylab as plt
- import cv2
- import numpy as np
- img1 = cv2.imread('bg.jpg')
- img2 = cv2.imread('sun1.jpg')
- rows,cols,channels = img1.shape
- roi = img2[0:rows, 0:cols ]
- dst = cv2.addWeighted(img1,0.5,roi,0.5,0)
- #cv2.imshow('win',dst)
- cv2.waitKey(0)
- def nothing(x):
- pass
- cv2.namedWindow('win')
- cv2.createTrackbar('opacity','win',0,10,nothing)
- while(1):
- cv2.imshow('win',dst)
- k = cv2.waitKey(1) & 0xFF
- if k == 27:
- break
- # get current positions of four trackbars
- r = cv2.getTrackbarPos('opacity','win')
- dst = cv2.addWeighted(img1,r/10.0,roi,1-(r/10.0),0)
- cv2.destroyAllWindows()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement