How to create a colored grid of 3 matrices, representing the RGB-colors?
5 views (last 30 days)
Show older comments
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.
0 Comments
Accepted Answer
DGM
on 2 Sep 2023
Edited: DGM
on 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:
0 Comments
More Answers (0)
See Also
Categories
Find more on Blue in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!