【发布时间】:2015-04-07 00:04:58
【问题描述】:
我想实现 Photoshop 中可用的渐变映射效果。 There's already a post that explains the desired outcome. 另外,this answer 涵盖了我想要做的事情,但是
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 图形转换为图像。
另外,您能否指出如何规范化数组,因为我无法这样做并且在任何地方都找不到帮助。
【问题讨论】:
标签: python image-processing numpy python-imaging-library