Advertisement
Guest User

Untitled

a guest
Jan 26th, 2020
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. import scipy as sp
  2. import matplotlib.pylab as plt
  3. import cv2
  4. import numpy as np
  5.  
  6. img1 = cv2.imread('bg.jpg')
  7. img2 = cv2.imread('sun1.jpg')
  8.  
  9. rows,cols,channels = img1.shape
  10. roi = img2[0:rows, 0:cols ]
  11.  
  12. dst = cv2.addWeighted(img1,0.5,roi,0.5,0)
  13.  
  14. #cv2.imshow('win',dst)
  15.  
  16. cv2.waitKey(0)
  17.  
  18.  
  19. def nothing(x):
  20. pass
  21.  
  22. cv2.namedWindow('win')
  23. cv2.createTrackbar('opacity','win',0,10,nothing)
  24.  
  25. while(1):
  26. cv2.imshow('win',dst)
  27. k = cv2.waitKey(1) & 0xFF
  28. if k == 27:
  29. break
  30. # get current positions of four trackbars
  31. r = cv2.getTrackbarPos('opacity','win')
  32. dst = cv2.addWeighted(img1,r/10.0,roi,1-(r/10.0),0)
  33.  
  34. cv2.destroyAllWindows()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement