question about how to red-shift images - simulating high velocity

I’m trying to ‘red shift’ images, to simulate what an object would look like if it were moving away from a camera at a sizable fraction of the speed of light.

So, for example if everything were red-shifted by 100nm (this would vary with speed), 400nm moves to 500nm (violet becomes cyan / green), 600nm move to 700nm (orange becomes red) and 700nm moves to 800nm (red becomes infrared, i.e., is no longer visible).

Knowing what to do and knowing how to do it aren’t the same - and I haven’t a clue as to where to start with GIMP. It can’t be just dragging RGB curves around.

Once this is figured out I can ‘red shift’ photographs to different simulated velocities. Practical? I’m sure a scientist somewhere has a use for it. Fun, interesting? Absolutely.

So - any takers?

Hi! I’m no expert whatsoever on this, but my suggestion would be the Hue slider - I’ve forgotten which dialog this is in - think it might be with saturation. Thinking aloud, maybe that wouldn’t be right though. I think Hue would move red back round to blue. Not right. Hopefully someone else will have a better idea!

You can do something close probably using simple color curves. Just keep in mind a little bit about how they work:

I talk about it a little bit here:
https://patdavid.net/2012/06/getting-around-in-gimp-color-curves/

Perhaps some combination of the RGB channels might be a good start?

Experimenting with an RGB spectrum, the Hue slider ( colours / Hue-Chroma / Hue ) can certainly turn Violet into Green… but then Red becomes Blue and Yellow goes to Light Blue. Thanks for the idea - worth a try!

Pat! Pleasure to meet you - I’ve enjoyed your Gimp tutorials over the years. The wavelet decomposition tutorial revolutionized my ability to produce realistic portrait results that more mature women like, aka will pay for.

Not sure how adjusting the intensity of the channels at various tones (inputs and outputs, as you say) will shift the colours, I did try this, and perhaps I am not an expert, but I’m not able to shift the colours up the spectrum. Mostly tried adding blue and green and reducing red with a mid-tone adjustment.

For everyone, the test sample I’m working with is

1 Like

The problem is that no axis of RGB or HSL is really aligned with the spectrum (and hue loops around at 360°). You need something that moves along the black body locus. Maybe changing white balance?

1 Like

I just tried fiddling with white balance in darktable on the test image above… no luck really. It doesn’t really seem to correspond. Maybe we need a new color space! (I don’t know much about color really so do take my input with a grain of salt)

Likely Colors > Map > Rotate colors: This allows you to map a range of contiguous hues to another range. For instance, [red,blue] to [ purple,cyan]:

You would also want to dim the part if the spectrum that has no visible equivalent (here, the purple, which is standing for infrared).

I’ve found some mapping Hue to wavelength on science blogs. While I know what ‘black body’ is, don’t know “black body locus”. WB changes don’t work, but thanks for suggesting.

1 Like

This is interesting, I’ll be experimenting. Early results are promising.

Alternately, I can write a c++ program to scan each pixel in HSV, convert Hue to wavelength, then bump the wavelength 100nm and convert back to Hue and write the pixel back to the file. In theory this could be done with the ImageMagick API, but I haven’t written code in decades.

So hoping that rotation will do it!

3 Likes

I was referring to this: Planckian locus - Wikipedia

However, as you quickly discovered, I was wrong: that line is not the maximum of the black body radiation, but the apparent color seen by a human subject (spectral integral plus color sensitivity), so white balance does not simply “shift wavelengths” as you need. Sorry for the wrong lead.

What you need is to move along the edge of the color diagram on that page, and effectively hue might be an approximate proxy for this, taking into account two caveats:

  • the mapping hue <-> wavelength is not linear (the diagram is not a circle)
  • you have to take care of the transitions purple → blue and red → purple, which are not physical

Hello! I’m not familiar in image manipulation nor physics, but I’d like to help.
I think you can make a script that apply Fourier Transformation on each pixel, to get the strength of all wave length, then make a offset to all wave length to simulate the red shift, then transform it back.
I also think it’s in fact not possible to red-shift images via gimp tools, because the tools only do modifications on visible light, however red-shift makes some color shift to infared and makes them invisible.

So you all know I’m not giving up:

  • I’ve asked a similar question in several astronomy forums, and quora
  • I’ve tried the rotate method, which gives results similar to a global hue adjustment. As below, notice that, while it does push the colours to the left (red-shifting), it spreads oiut the greens and oranges, quite unlike actual redshift.

Top is the spectrum. Bottom is rotated or a hue-saturation adjustment (they are identical in effect as far as I can tell):

image

Here is what redshift would look like (ignoring the spectrum gaps that are used to measure it):

In theory, I think, one could:

  • Convert a pixel’s elements (R,G,B) to wavelength
  • Shift wavelengths of each element a set amount
  • Convert wavelengths back to pixel elements
  • Put the pixel back in place

But I’m not sure that would work and moreover am not up to that kind of programming.

Partial answer here.

And as I read it, it could be fairly complicated because something, say, orange, could be either a monochromatic orange or a one of many mixes of monochromatic red and monochromatic green. And the combination of the frequency-shifted red and green waves is likely not seen by our eyes as equal to the same color as the frequency-shifted monochromatic orange.

2 Likes

Agreed re: complexity. Any given colour on the CIE 1931 chart can be made of multiple frequencies, except for the edges (not the bottom edge) where I believe a single frequency is involved. So while I think one can safely shift R, G, and B separately, and convert back (accommodating for things like ultraviolet now being in the visible range and red now being shifted out of it), I’m not sure.

Or maybe convert hue to wavelength, as in the link you provided, shift wavelength and convert back as the function provided is reversible. But here again I’m not a programmer (any more).

But surely this has been done somewhere in the scientific community? Eventually I’ll find it :slight_smile:

Well done! Sorry I’m not much help. Interested though :slightly_smiling_face: