Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = np.array([[ 3, 0, 2, -1],
- [ 1, 255, 1, 2],
- [ 0, 3, 2, 2]])
- d = {0: 1, 1: 2, 2: 3, 3:4, -1: 0, 255: 0}
- >>> a.astype(np.uint8) + 1
- array([[4, 1, 3, 0],
- [2, 0, 2, 3],
- [1, 4, 3, 3]], dtype=uint8)
Add Comment
Please, Sign In to add comment