We can't say for sure which approach would work best in the general case. If you have domain knowledge, you can make a better guess. You'll basically want to answer the question: which information is important for learning an optimal policy?
In my environment i have for each pixel 4 possible states which are represented in black, white, blue, red and green.
Generally, if you have an environment like this, I would (without any other information) guess that each of the 4 (or 5? you mentioned 5 colours?) have some meaning that may be relevant for your agent. That's just what I would guess though. In theory, it might be possible that white means one thing (e.g. "empty"), and every other colour means the same other thing (e.g. "not empty"). If you had domain knowledge like that, and knew that it is only important whether or not any given pixel is white, you could of course binarise your input.
But in general, if the colours might be important, I'd recommend including them. If you really only have a few distinct colours like that though, I would not recommend encoding them in some format like RGB where values can range from 0 to 1 or 0 to 255. I would recommend having 4 (or 5?) binary channels in your input:
- Binary channel containing 1s for pixels that are black, and 0s for all other pixels.
- Binary channel containing 1s for pixels that are white, and 0s for all other pixels.
- Binary channel containing 1s for pixels that are blue, and 0s for all other pixels.
The reason for this is that deep neural networks often tend to have an easier time learning with binary inputs, and here you can completely binarise your inputs without requiring an excessively high number of channels. If you had hundreds or thousands of different possible colours, this would probably no longer be a good idea.