Advertisement
dan-masek

Untitled

Jul 9th, 2020
1,194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. import numpy as np
  2.  
  3. din = np.arange(64, dtype=np.uint8).reshape(8,8)
  4.  
  5. left = din[1:-1,0:-2]
  6. right = din[1:-1,2:]
  7. top = din[0:-2,1:-1]
  8. bottom = din[2:,1:-1]
  9. out = din[1:-1,1:-1]
  10.  
  11. result = np.dstack([left,top,right,bottom,out])
  12.  
  13. print(din)
  14. print(result.reshape(-1, 5))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement