4
我想要实现Photoshop中可用的渐变映射效果。 There's already a post that explains the desired outcome.此外,this answer占地面积正是我想做的事,但Python - 将彩色贴图应用于灰度numpy阵列并将其转换为图像
im = Image.fromarray(np.uint8(cm.gist_earth(myarray)*255))
工作不适合我,因为我不知道该怎么阵列正常化的1.0的值。
下面是我的代码,因为我打算它的工作。
im = Image.open(filename).convert('L') # Opening an Image as Grayscale
im_arr = numpy.asarray(im) # Converting the image to an Array
# TODO - Grayscale Color Mapping Operation on im_arr
im = Image.fromarray(im_arr)
任何人都可以指出可能的选项和理想的方式来应用颜色映射到这个数组吗?我不想绘制它,因为似乎没有简单的方法将pyplot数字转换为图像。
另外,你能指出如何正常化数组,因为我无法这样做,并且无法在任何地方找到帮助。
谢谢!但对于这个问题,你是否也可以建议一种应用颜色图的方法? –
您发布的代码不适用于我建议的添加规范化? – jnovacho
它的确如此。我只想知道是否有办法在功能上应用自定义颜色映射。 –