Guest User

Untitled

a guest
Oct 21st, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. a = np.array([[ 3, 0, 2, -1],
  2. [ 1, 255, 1, 2],
  3. [ 0, 3, 2, 2]])
  4.  
  5. d = {0: 1, 1: 2, 2: 3, 3:4, -1: 0, 255: 0}
  6.  
  7. >>> a.astype(np.uint8) + 1
  8. array([[4, 1, 3, 0],
  9. [2, 0, 2, 3],
  10. [1, 4, 3, 3]], dtype=uint8)
Add Comment
Please, Sign In to add comment