How to turn gray layers into RGB layers?

1 view (last 30 days)
Lucius
Lucius on 18 May 2015
Answered: Image Analyst on 18 May 2015
I have a normal image that I split into its RGB layers, where I make some magic with them. In order to show how the magic influences the normal image, I concatenate the RGB layers. Unfortunately, I only receive a gray image instead of a coloured image. I was told to write mat2gray*255 and then uint8. Whitout this I only received a nonsense all-white image with strange axes.
Img_R = uint8(255 * mat2gray(abs(Img_x2(:,:,1))));
Img_G = uint8(255 * mat2gray(abs(Img_x2(:,:,2))));
Img_B = uint8(255 * mat2gray(abs(Img_x2(:,:,3))));
pertImgRGB = cat(3,Img_R,Img_G,Img_B);
So, what commands do I have to add to the lines in order to get coloured single layers, and so get a coloured concatenated new image pertImgRGB? Thanks

Answers (1)

Image Analyst
Image Analyst on 18 May 2015
That looks right (it's not a display problem), so in that case you need to go back to the original Img_x2 and figure out why all color channels are the same.

Categories

Find more on Modify Image Colors in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!