#๐ Mapping a grayscale image
17 messages ยท Page 1 of 1 (latest)
@obtuse orbit
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
I have a mapping whichs a 256 size array, I wish to map every pixel to it's new value according to their original values
like if original pixel value is 12, and mapping[12] is 138 new pixel value should be 138
how can I do this without iterating through
!e I suppose you want something like this
import numpy as np
mapping = np.array([4, 2, 3, 0, 1])
image = np.array([[0, 1, 1, 0], [2, 2, 2, 2], [0, 3, 3, 0]])
print(mapping[image])
:white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | [[4 2 2 4]
002 | [3 3 3 3]
003 | [4 0 0 4]]
ahhh i tried the other way around
was writing a hashmap instead, needlessly it appears
i love numpy
thank you
.close
yes
/close
!close
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.