Blend Red,Blue,Green squares

11 vues (au cours des 30 derniers jours)
TaeGeun
TaeGeun le 18 Mar 2019
Réponse apportée : DGM le 6 Déc 2023
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 commentaire
John D'Errico
John D'Errico le 18 Mar 2019
Modifié(e) : John D'Errico le 18 Mar 2019
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.

Connectez-vous pour commenter.

Réponses (2)

Geoff Hayes
Geoff Hayes le 18 Mar 2019
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 commentaires
TaeGeun
TaeGeun le 18 Mar 2019
Modifié(e) : TaeGeun le 18 Mar 2019
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 le 18 Mar 2019
So how would you update the above code to add the blue and green squares?

Connectez-vous pour commenter.


DGM
DGM le 6 Déc 2023

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by