Blend Red,Blue,Green squares
11 ビュー (過去 30 日間)
古いコメントを表示
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
1 件のコメント
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
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 件のコメント
Geoff Hayes
2019 年 3 月 18 日
So how would you update the above code to add the blue and green squares?
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!