How can I create an image in MATLAB by creating a 3D RGB matrix and display it in a MATLAB window?

6 次查看(过去 30 天)
The image should look like a red square above a blue square.

回答(1 个)

Bshara Murr
Bshara Murr 2017-11-27
new = 255 * ones(dimensions, dimensions, 3, 'uint8');
new(:,:,2) = 0;
imshow(new);
The second line sets the green channel to zero
  5 个评论
Bshara Murr
Bshara Murr 2017-11-27
编辑:Bshara Murr 2017-11-27
new = 255 * ones(100, 50, 3, 'uint8');
new(1:50,:,2) = 0;
new(1:50,:,3) = 0;
new(51:100,:,2) = 0;
new(51:100,:,1) = 0;
imshow(new);
Is this what you are looking for?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by