• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest May 27th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. import cv2
2. import numpy as np
3.
6.
9.
10. hsep = np.full((img1.shape[0], 5), 127, np.uint8)
11. hsep2 = np.full((lenna.shape[0], 5), 127, np.uint8)
12.
13. add1 = img1 + img2
14. sub1 = img1 - img2
15. mul1 = img1 * img2
16. and1 = img1 & img2
17. or1 = img1 | img2
18. not1 = 255 - img1
19.
20. add2 = img1 + img1
21. sub2 = img1 - img1
22. mul2 = img1 * img1
23. and2 = img1 & img1
24. or2 = img1 | img1
25. not2 = 255 - img1
26.
27. add3 = lenna + lenna
28. sub3 = lenna - lenna
29. mul3 = lenna * lenna
30. and3 = lenna & lenna
31. or3 = lenna | lenna
32. not3 = 255 - lenna
33.
34. add4 = lenna + lenna2
35. sub4 = lenna - lenna2
36. mul4 = lenna * lenna2
37. and4 = lenna & lenna2
38. or4 = lenna | lenna2
39. not4 = 255 - lenna
40.
43.     np.hstack((img1, hsep, img2)),
44.     np.full((5,np.hstack((img1, hsep, img2)).shape[1]), 127, np.uint8),
46.     np.full((5,np.hstack((img1, hsep, img2)).shape[1]), 127, np.uint8),
47.     np.hstack((mul1, hsep, and1)),
48.     np.full((5,np.hstack((img1, hsep, img2)).shape[1]), 127, np.uint8),
49.     np.hstack((or1, hsep, not1))
50. )))
51.
54.     np.hstack((img1, hsep, img1)),
55.     np.full((5,np.hstack((img1, hsep, img1)).shape[1]), 127, np.uint8),
57.     np.full((5,np.hstack((img1, hsep, img1)).shape[1]), 127, np.uint8),
58.     np.hstack((mul2, hsep, and2)),
59.     np.full((5,np.hstack((img1, hsep, img1)).shape[1]), 127, np.uint8),
60.     np.hstack((or2, hsep, not2))
61. )))
62.
63. cv2.waitKey(0)
64.
67.     np.hstack((lenna, lenna)),
69.     np.hstack((mul3, and3)),
70.     np.hstack((or3, not3))
71. )))
72.
75.     np.hstack((lenna, lenna2)),
77.     np.hstack((mul4, and4)),
78.     np.hstack((or4, not4))
79. )))
80.
81. cv2.waitKey(0)
82. cv2.destroyAllWindows()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Not a member of Pastebin yet?