intnst = 0.2989 * rgb[:,0] + 0.5870 * rgb[:,1] + 0.1140 * rgb[:,2] # get the intensity intensity = np.rint(intnst) # rounds up to nearest integer
Hi Matthias
AWESOME!!
This is a great example, thank you, it will come handy pretty soon, if you are going to share it officially, so I'd love to see the blog post about it.
In my current particular case, the problem is that I do not know the colormap of the original img to begin with. Someone from a slack group suggested to convert it to a paletted image format (PNG or GIF) using PIL, then grab the palette shared a solution involving quantization. I asked for their permission to share it in here, I'll keep you posted.
Back on your example of converting a bad colormap to a good one, I was working on adapting a Matlab tool by Peter Kovesi
http://peterkovesi.com/projects/colourmaps/index.html
My idea would be to make it into a web app called 'rainbowbot' which would automatically detect bad colormaps either form online images or user uploaded images, and then provide them with tools to either equalize the colormaps or replace with a perceptual version with same hue range, or.....
It is in here
https://github.com/mycarta/rainbowbot
I am open to suggestions, and offers to collaborate.
import Image
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
im = Image.open('Jupiter_new_hubble_view_above_pole.png')
imnew = im.convert("P", palette=Image.ADAPTIVE)#, dither=Image.NONE)
data = np.asarray(imnew)
palette = imnew.getpalette()
colors = np.array(palette).reshape(-1, 3) / 255.0
cmap = mcolors.ListedColormap(colors)
fig, axes = plt.subplots(nrows=3, figsize=(8, 15))
axes[0].imshow(im)
for cm, ax in zip(['gray_r', cmap], axes[1:]):
cax = ax.imshow(data, cmap=cm)
fig.colorbar(cax, ax=ax)
fig.tight_layout()
plt.show()
I was the one Matteo mentioned on the slack group. At first I thought Matteo was referring to exactly what you described: Take a colormapped single-band image and unmap/remap the color palette.
My idea would be to make it into a web app called 'rainbowbot' which would automatically detect bad colormaps either form online images or user uploaded images, and then provide them with tools to either equalize the colormaps or replace with a perceptual version with same hue range, or.....
It is in here
https://github.com/mycarta/rainbowbot
I am open to suggestions, and offers to collaborate.Hi Matthias
AWESOME!!
This is a great example, thank you, it will come handy pretty soon, if you are going to share it officially, so I'd love to see the blog post about it.
In my current particular case, the problem is that I do not know the colormap of the original img to begin with. Someone from a slack group suggested to convert it to a paletted image format (PNG or GIF) using PIL, then grab the palette shared a solution involving quantization. I asked for their permission to share it in here, I'll keep you posted.
Back on your example of converting a bad colormap to a good one, I was working on adapting a Matlab tool by Peter Kovesi
http://peterkovesi.com/projects/colourmaps/index.html
My idea would be to make it into a web app called 'rainbowbot' which would automatically detect bad colormaps either form online images or user uploaded images, and then provide them with tools to either equalize the colormaps or replace with a perceptual version with same hue range, or.....
It is in here
https://github.com/mycarta/rainbowbot
I am open to suggestions, and offers to collaborate.
On Thu, Jan 28, 2016 at 1:29 PM, Joe Kington <joferk...@gmail.com> wrote:I was the one Matteo mentioned on the slack group. At first I thought Matteo was referring to exactly what you described: Take a colormapped single-band image and unmap/remap the color palette.
In one of the threads here, I read
"""My idea would be to make it into a web app called 'rainbowbot' which would automatically detect bad colormaps either form online images or user uploaded images, and then provide them with tools to either equalize the colormaps or replace with a perceptual version with same hue range, or.....
It is in here
https://github.com/mycarta/rainbowbot
I am open to suggestions, and offers to collaborate.
"""
Otherwise, I guess the problem is as simple as:image = color.rgb2gray(io.imread('image.jpg'))plt.imshow(image, cmap='viridis')If it is about turning false color maps into true color maps, that would be hard, given the many mappings out there.Stéfan
--
You received this message because you are subscribed to a topic in the Google Groups "scikit-image" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scikit-image/jxD0GTK_8B4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to scikit-image...@googlegroups.com.
To post to this group, send email to scikit...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/scikit-image/CABDkGQm59%2BHikycM3uxJpEw_kcbQF8bCxozivT6Ujm%3DQ57Ke4g%40mail.gmail.com.