Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 MATLAB 中有一个 x*y*3 矩阵,我试图将其转换为图像(第一层是 R 强度,第二层是 G 强度,第三层是 B 强度。
我目前只使用 imwrite 函数对其进行转换,但生成的图像始终是黑白的。因为我的计算目前都依赖于 3 层的矩阵,所以我无法将其压缩为一层并使用 ind2rgb 函数和地图,可以吗?
我很迷茫,所以任何建议将不胜感激。谢谢,麻烦您了!
您的图像的值可能超出范围。
您可以尝试uint8():
imwrite(uint8(I), 'file.png');
或者,mat2gray():
imwrite(mat2gray(I),'file.png');
假设我是你的图像数据。