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

조회 수: 12 (최근 30일)
ivosp
ivosp 2023년 9월 2일
편집: DGM 2023년 9월 2일
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