How to turn gray layers into RGB layers?

1 回表示 (過去 30 日間)
Lucius
Lucius 2015 年 5 月 18 日
回答済み: Image Analyst 2015 年 5 月 18 日
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

回答 (1 件)

Image Analyst
Image Analyst 2015 年 5 月 18 日
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.

カテゴリ

Help Center および File ExchangeModify Image Colors についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by