Convert 3 greyscale images representing RGB to RGB image

I have used the imread() function to read in three greyscale images , each image represents the same image but one where the illumination was red light then green light and finally blue. I would like to convert these 3 greyscale images that represent the 3 RGB channels into an RGB image but Im unsure how to do so and cannot find any documentation on this exact case. Any help would be much appreciated.

 Accepted Answer

Using the standard conventions:
RGB=cat(3,red(:,:,1),green(:,:,1),blue(:,:,1));
The indexing is in there in case your input images are stored as RGB.

5 Comments

Thanks Rik!!! This has worked perfectly and really helped me out! I was doing: RGB=cat(3,red,green,blue) then trying to use imshow() which obviously wasnt working.
thanks again!
@Claretconnor it would have worked had red, green, and blue really been grayscale images like you said, but evidently they were not gray scale, they were actually RGB images.
the images were taken using a monochrome camera.
Then that monochrome camera stores the images as RGB. Not uncommon, but technically not correct.
oh right I just assumed that they would be stored as grayscale images, my apologies.

Sign in to comment.

More Answers (0)

Products

Release

R2021a

Asked:

on 5 Feb 2022

Commented:

on 6 Feb 2022

Community Treasure Hunt

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

Start Hunting!