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

心已入冬 提交于 2019-12-23 20:08:03

问题


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?


回答1:


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))


来源:https://stackoverflow.com/questions/5341304/how-to-display-an-image-represented-by-three-matrices-in-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!