Advertisement
Guest User

Untitled

a guest
Jan 26th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import cv2
  2. import numpy as np
  3. from matplotlib import pyplot as plt
  4.  
  5. def callback(dst):
  6. print(dst)
  7.  
  8. # Load two images
  9. img1 = cv2.imread('bg1.jpg')
  10. img2 = cv2.imread('bg2.jpg')
  11.  
  12. dst = cv2.addWeighted(img1,0.7,img2,0.3,0)
  13.  
  14. cv2.namedWindow('boss')
  15.  
  16.  
  17. cv2.createTrackbar('O', 'boss', 0, 10, callback)
  18.  
  19. while(1):
  20. cv2.imshow('boss',dst)
  21. k = cv2.waitKey(1) & 0xFF
  22. if k == 27:
  23. break
  24. # get current positions of four trackbars
  25. r = cv2.getTrackbarPos('O','boss')
  26. print(r)
  27. dst = cv2.addWeighted(img1,1,img2,1-(r/10),0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement