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.
我正在尝试使用以下代码读取图像的颜色图:
[X, map] = imread('D:\Eye.png');
但map被重新调整为[0,1]type double。如何获得uint8范围内的颜色图[0,255]?
map
[0,1]
double
uint8
[0,255]
这可以通过简单地重新缩放map并将其转换为来解决uint8:
uint8(255*map);
或者,您可以在强制转换之前对其进行舍入(如上所述,默认舍入方案是floor):
floor
uint8(round(255*map));