原文章排版有问题,我整理了下 get_cm,记录在这
def get_cm(name='jet'):
colormap_int = np.zeros((256, 3), np.uint8)
colormap_float = np.zeros((256, 3), np.float)
for i in range(0, 256, 1):
colormap_float[i, 0] = cm.__dict__[name](i)[0]
colormap_float[i, 1] = cm.__dict__[name](i)[1]
colormap_float[i, 2] = cm.__dict__[name](i)[2]
colormap_int[i, 0] = np.int_(np.round(cm.__dict__[name](i)[0] * 255.0))
colormap_int[i, 1] = np.int_(np.round(cm.__dict__[name](i)[1] * 255.0))
colormap_int[i, 2] = np.int_(np.round(cm.__dict__[name](i)[2] * 255.0))
return colormap_int, colormap_float