How to create a colored grid of 3 matrices, representing the RGB-colors?

13 次查看(过去 30 天)
So I have 3 matrices, combined they represent a RGB-color in each cell. So the first matrix is the R-part, the second the G-part and the last one the B-part. I hope this is understandable.
Now I would like to create a colored grid where each cell is colored according to the RGB-color represented by the combination of the 3 matrices.
I tried using pcolor(). It works perfectly with only one matrix, but I don't know how or if it is even possible to use all 3 matrices for this.
Does anybody know how to do this?
------ An easy example: ----
Matrix1 = [1]
Matrix2 = [0]
Matrix3 = [0]
=> I want a grid with only one cell, colored in [1 0 0], so in red.

采纳的回答

DGM
DGM 2023-9-2
编辑:DGM 2023-9-2
If you want an RGB image, why not just make an RGB image and display it using image() or imshow()?
R = rand(3);
G = rand(3);
B = rand(3);
RGB = cat(3,R,G,B);
image(RGB)
I don't know why you're creating everything in separate arrays to begin with. I find that it's rarely necessary to split an RGB image.
See also:

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by