Roman
Roman

Reputation: 131268

How to display an image represented by three matrices in MATLAB?

I have 3 2D matrices of the same size (let say 200 rows and 300 columns). Every matrix represent the value of one of the three "basic" color (red, green and blue). The values of the matrix can be between 0 and 255. Now I want to combine these matrices to show them as a colored image (200 by 300 pixels). How can I do it in MATLAB?

Upvotes: 3

Views: 9953

Answers (1)

Jonas
Jonas

Reputation: 74940

Catenate the images along the 3rd dimension to create an m-by-n-by-3 RGB image. Assuming your red channel image is called red, you write

figure,
imshow(cat(3,red,green,blue))

Upvotes: 10

Related Questions