Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- din = np.arange(64, dtype=np.uint8).reshape(8,8)
- left = din[1:-1,0:-2]
- right = din[1:-1,2:]
- top = din[0:-2,1:-1]
- bottom = din[2:,1:-1]
- out = din[1:-1,1:-1]
- result = np.dstack([left,top,right,bottom,out])
- print(din)
- print(result.reshape(-1, 5))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement