Nahid8195

Addition of two image

Nov 30th, 2021 (edited)
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. # Python programe to illustrate
  2. # arithmetic operation of
  3. # addition of two images
  4.  
  5. # organizing imports
  6. import cv2
  7. import numpy as np
  8.  
  9. # path to input images are specified and
  10. # images are loaded with imread command
  11. image1 = cv2.imread('1-500x250-3.jpg')
  12. image2 = cv2.imread('2-500x250-2.jpg')
  13.  
  14. # cv2.addWeighted is applied over the
  15. # image inputs with applied parameters
  16. weightedSum = cv2.addWeighted(image1, 0.5, image2, 0.4, 0)
  17.  
  18. # the window showing output image
  19. # with the weighted sum
  20. cv2.imshow('Weighted Image', weightedSum)
  21.  
  22. # De-allocate any associated memory usage
  23. if cv2.waitKey(0) & 0xff == 27:
  24.     cv2.destroyAllWindows()
  25.  
Add Comment
Please, Sign In to add comment