【发布时间】:2018-06-05 17:02:19
【问题描述】:
我正在为学校项目编写脚本/函数,它将在 matlab 中生成所有 24 位 RGB 颜色图像。
我写了这样的东西,但它很慢(而且 matlab 不喜欢我并且经常崩溃)。上次崩溃前它工作了 5 天。 代码如下:
a = 1;
for r = 0:255
for g = 0:255
for b = 0:255
colors(a,:) = [r g b];
a = a + 1;
end
end
end
colors = reshape(colors, [4096, 4096, 3]);
colors = uint8(colors);
imshow(colors);
imwrite(colors, 'generated.png');
有没有更快的方法来做到这一点?
【问题讨论】:
标签: image matlab image-processing rgb