How to create a 7*9 black and white image by using 0 and 1?
1 次查看(过去 30 天)
显示 更早的评论
回答(1 个)
Jan
2021-5-12
编辑:Jan
2021-5-12
T = [0, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 1, 1, 1, 0, 1, 1, 1, 0; ...
0, 0, 1, 0, 0, 1, 0, 1, 0; ...
0, 0, 1, 0, 0, 1, 0, 1, 0; ...
0, 0, 1, 0, 0, 1, 0, 1, 0; ...
0, 0, 1, 0, 0, 1, 1, 1, 0; ...
0, 0, 0, 0, 0, 0, 0, 0, 0];
figure;
colormap([0,0,0; 1,1,1])
imagesc(T)
% Or:
figure;
image(cat(3, T, T, T)); % Using RGB colors
2 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Red 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!