Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hey It NOT ISSUES But i need colormap Add cubehelix #2191

Closed
KristapsSDRSharp opened this issue Jun 30, 2024 · 4 comments
Closed

Hey It NOT ISSUES But i need colormap Add cubehelix #2191

KristapsSDRSharp opened this issue Jun 30, 2024 · 4 comments
Milestone

Comments

@KristapsSDRSharp
Copy link

Colormap

@f4exb
Copy link
Owner

f4exb commented Jun 30, 2024

It is pretty difficult to retrieve values from a picture. In SDRangel color maps are stored as 256 (R,G,B) floating point values (0.0 to 1.0) from lower (left on the picture) to higher (right on the picture). If you can provide these values it will be no big deal to add this color map.

@f4exb
Copy link
Owner

f4exb commented Jul 25, 2024

This can be done in Python...
Firstly install pillow:

pip install pillow

Then this snippet should print out the colormap structure to be inserted in sdrbase/util/colormap.cpp:

from PIL import Image

im = Image.open('cubehelix.png') 
pix = im.load()
xsize = im.size[0]

print("const float ColorMap::m_cubehelix[m_size] =")
print("{")

for xi in range(256):
    x = int((xsize/256)*xi)
    colortuple = pix[x, 0][:-1]
    rf = colortuple[0] / 256
    gf = colortuple[1] / 256
    bf = colortuple[2] / 256
    print(f"    {rf:.4f},   {gf:.4f},   {bf:.4f},")

print("};")

@f4exb
Copy link
Owner

f4exb commented Jul 25, 2024

The explanation that goes with this palette seems to be here: https://people.phy.cam.ac.uk/dag9/CUBEHELIX/ Could be nice indeed.

Alternatively it has a link to a Javascript page that can also print out the RGB values: https://people.phy.cam.ac.uk/dag9/CUBEHELIX/cubetry.html

@f4exb
Copy link
Owner

f4exb commented Jul 26, 2024

Two new colormaps:

  • cubehelix: derived from the attached image which has linear grayscale progression
  • cubegamma: calculated with the javascript app applying a gamma factor of 0.4 to accentuate weak signals

@f4exb f4exb closed this as completed in 78b73ae Jul 26, 2024
f4exb added a commit that referenced this issue Aug 13, 2024
@f4exb f4exb added this to the v7.22.0 milestone Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants