Guest User

Untitled

a guest
Jun 23rd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. radius = 3
  2. x,y = np.ogrid[-3:3:5j, -3:3:5j]
  3. dist = ((x**2+y**2)**0.5)
  4. mask = dist-radius).clip(0,None)
  5. print(mask)
  6.  
  7. array([[1.24264069, 0.35410197, 0. , 0.35410197, 1.24264069],
  8. [0.35410197, 0. , 0. , 0. , 0.35410197],
  9. [0. , 0. , 0. , 0. , 0. ],
  10. [0.35410197, 0. , 0. , 0. , 0.35410197],
  11. [1.24264069, 0.35410197, 0. , 0.35410197, 1.24264069]])
  12.  
  13. mask = mask/np.max(mask)
  14. mask = 1 - mask
  15. print(mask)
  16.  
  17. array([[0. , 0.71504074, 1. , 0.71504074, 0. ],
  18. [0.71504074, 1. , 1. , 1. , 0.71504074],
  19. [1. , 1. , 1. , 1. , 1. ],
  20. [0.71504074, 1. , 1. , 1. , 0.71504074],
  21. [0. , 0.71504074, 1. , 0.71504074, 0. ]])
Add Comment
Please, Sign In to add comment