Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. import numpy as np
  2.  
  3. arr = np.random.randint(0, 256, (200, 200), dtype=np.uint8)
  4.  
  5. def func(arr1d):
  6. kernel = np.ones(3) / 3
  7. return np.convolve(arr1d, kernel, mode='same')
  8.  
  9. first_pass = np.apply_along_axis(func, axis=0, arr=arr)
  10. final_result = np.apply_along_axis(func, axis=1, arr=first_pass)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement