![greenwhite.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/218246/greenwhite.png)
How can I make a random RGB array of either White Cells or Green Cells (or any two colours)?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hey, I wish to create a random array of size R x C, and wish to have that array consist of either green or white cells.
My thoughts were to take the script for making a random Black and White image:
BnW = rand(R,C) < p;
Where p is some number between 0 and 1.
Then taking this image and somehow replacing all cells that have a value of 1 (black) and replace with a value of 255 in the second channel (green channel) in a RGB image. But a problem occurs with switching from a logical array to a uint8 array.
Any ideas?
댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!