Blend Red,Blue,Green squares

11 ビュー (過去 30 日間)
TaeGeun
TaeGeun 2019 年 3 月 18 日
回答済み: DGM 2023 年 12 月 6 日
I want to see the mixed colors as the three overlapping squares are filled with red, green, and blue. It is a Venn diagram, but it is square. I know that there is white in the center and yellow, pink and sky blue in the overlapping part. I want to use basic MATLAB, so let me know the basic code. I do not know any code, but I know I need to use 255. The left square is blue, the right square is green, and the bottom one is red. PLEASE Use MATLAB to represent a picture of mixed squares of different colors
RGB.jpg
  1 件のコメント
John D'Errico
John D'Errico 2019 年 3 月 18 日
編集済み: John D'Errico 2019 年 3 月 18 日
Please stop asking the same question. Your last question on this got responses, so why did you feel it necessary to ask again? If anything, as for clarification on the last one.

サインインしてコメントする。

回答 (2 件)

Geoff Hayes
Geoff Hayes 2019 年 3 月 18 日
TaeGun - this seems like homework so without giving too much away, how would you draw just one square? Suppose that each square is 128x128. To account for overlap, that means we need an image that is (128+64)x(128+64)...so 192x192. We can create this matrix (image) as
myImage = uint8(zeros(192,192,3));
Now let's put the red image in the top left corner. We do this as
myImage(1:128,1:128,1) = 255;
where we set the first channel (1) to 255 since red corresponds to first channel being non-zero and the other two being zero. You can show this image as
image(myImage);
Now how would you set the blue image? And the green?
  2 件のコメント
TaeGeun
TaeGeun 2019 年 3 月 18 日
編集済み: TaeGeun 2019 年 3 月 18 日
Thank you for your reply. It is my homework. but I am very nervous because I do not hear any information. My homework is to look at the colors that appear when you combine three squares of different colors like the picture. Sorry for not giving much information.
Geoff Hayes
Geoff Hayes 2019 年 3 月 18 日
So how would you update the above code to add the blue and green squares?

サインインしてコメントする。


DGM
DGM 2023 年 12 月 6 日

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by