How to create a colored grid of 3 matrices, representing the RGB-colors?
조회 수: 12 (최근 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.
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!