Spread image by predefined color channels
Hi. I'm using opencv and reading a grascale image with specified color values. How can I spread / split by chosen colors so I will have not matrix as image, but new feature map and every channel will be responsible for the corresponding color.
Here is an example. I've got an image mask, where I have 3 color values: 0, 1, 2. How can I get a matrix with the shape of (width, hight, 3) and every channel will be responsible for its color and will be 1 if the pixel had that value? I want something like one hot vector for each pixel but only for predifined color values.