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

12 vues (au cours des 30 derniers jours)
ivosp
ivosp le 2 Sep 2023
Modifié(e) : DGM le 2 Sep 2023
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.

Réponse acceptée

DGM
DGM le 2 Sep 2023
Modifié(e) : DGM le 2 Sep 2023
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:

Plus de réponses (0)

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by