Orpington Astronomical Society

Astronomy => Technical => Topic started by: Ivor on Nov 18, 2013, 15:54:09

Title: Paper on image stretching
Post by: Ivor on Nov 18, 2013, 15:54:09
Mark,

You once directed me to to a science paper on image processing which explained the maths behind arcsinh(), could you point me to it again please?

Thanks
Title: Re: Paper on image stretching
Post by: MarkS on Nov 18, 2013, 16:21:41
It was by Lupton et al:
http://web.ipac.caltech.edu/staff/fmasci/home/astro_refs/OptimumColorLupton.pdf

The colour examples are not very pretty (by today's standards) but the important principles are there.

Mark
Title: Re: Paper on image stretching
Post by: mickw on Nov 18, 2013, 17:39:50
Why oh why did I look at that link  :roll:  :oops:
Title: Re: Paper on image stretching
Post by: Ivor on Nov 18, 2013, 23:57:02
Cheers Mark.

I've been searching for the similar documents for the other stretch functions to little avail other than some MATLAB code.

f(x) = arcsinh(aQ[x- m])/Q

I'm assuming I can apply the equation to LOG and EXP but I'm not sure how to apply it to power and root functions. Could you shed some light please?



Title: Re: Paper on image stretching
Post by: MarkS on Nov 19, 2013, 06:50:51
Quote from: Ivor
I'm assuming I can apply the equation to LOG and EXP but I'm not sure how to apply it to power and root functions. Could you shed some light please?

I don't understand what you mean.  The equation is applied to the raw "luminance" i.e. it adjusts pixel intensity without adjusting pixel colour balance.  I don't know what you mean about applying it to LOG, EXP, power and root functions.

Mark
Title: Re: Paper on image stretching
Post by: Ivor on Nov 19, 2013, 07:50:54
Sorry to clarify, using FITS Liberator you have the ability to use asinh(), log(), exp(), X1.5 - X5, X1/2 - X1/5 as stretch functions. What I wanted to do is plot these in Excel to understand the different characteristics of the stretches.

Both asinh(), log() have logarithmic curves so the applied formula an be the same.

The root and exp() functions are parabolic curves so I wanted to understand how they would be applied to bring out the low level detail.
Title: Re: Paper on image stretching
Post by: MarkS on Nov 19, 2013, 08:05:34
I'm not familiar with FITS liberator.  I can't see how exp() or Xn (where n >1) can ever be used to bring out low level detail - they're fundamentally the wrong shape.  X1/n is OK though (n>1)

There's one very important point to remember.  Whatever non-linear function is applied the the image, if it is applied separately to the R,G,B channels then it will alter the colour balance of each pixel.  The functions need to be applied to the intensity if you want the colour balance left intact.

Mark
Title: Re: Paper on image stretching
Post by: Ivor on Nov 19, 2013, 09:06:30
FITS Liberator offers quite a few different stretch function include some compound ones which appear to handling white clipping better.

(http://farm8.staticflickr.com/7383/10941110524_356806dd11_z.jpg)

Further reading of the manual states The Xn (where N > 1) should be used for compression but in the native form they appear quite aggressive.

QuoteThere's one very important point to remember.  Whatever non-linear function is applied the the image, if it is applied separately to the R,G,B channels then it will alter the colour balance of each pixel.  The functions need to be applied to the intensity if you want the colour balance left intact.

Where you process the individual channels in FITS Liberator it possible to lock the settings to ensure consistancy.
Title: Re: Paper on image stretching
Post by: MarkS on Nov 19, 2013, 09:41:29
Quote from: Ivor
Where you process the individual channels in FITS Liberator it possible to lock the settings to ensure consistancy.

You'll probably find that means the same settings are applied to each channel.  Hence it will shift the colour balance because it is not separating out the "intensity channel" and applying the function to the "intensity channel" alone.  So it's not doing the same as Lupton's approach (if that is what you are trying to achieve).

Mark

Title: Re: Paper on image stretching
Post by: Ivor on Nov 19, 2013, 13:51:20
I think you are probably right, but I've not actively tried to test FITS Liberator for any negative colour balance. To date I've always found keeping the black and white points the same keeps the colour balance.

How to you think IRIS approaches it?

The reason behind this is I've finished most of my cloudy night projects now (and I want to avoid watching "zz list in the jungle" my daughter watches) and FITS Liberator is open source so I wanted to do some analysis to see if there were other functions or enhancements such as Lupton's approach which could be added. To work out whether it is worth the effort I wanted to build out a spreadsheet with the various image functions in and have a play.
Title: Re: Paper on image stretching
Post by: MarkS on Nov 19, 2013, 14:57:44
I reverse engineered what IRIS was doing.  It was like this:

If the initial pixel values are (R,G,B)

Intensity = (R+G+B)/3

colour components are then R/I, G/I, B/I

scale Intensity using arcsinh function

final pixel values are:
(R,G,B) x Intensity_scaled/Intensity

By construction the ratios of R:G:B remain fixed
Title: Re: Paper on image stretching
Post by: MarkS on Nov 20, 2013, 23:53:05
Another stretching technique is here:
http://www.progressiveastroimaging.com/viewtopic.php?f=28&t=7564

But I find it gives an oddly saturated look, possibly because of how the H channel is used instead of "intensity".

I prefer the centre of bright stars to be slightly saturated rather than filled with block colour.

Mark
Title: Re: Paper on image stretching
Post by: RobertM on Nov 24, 2013, 19:01:54
Just got around to this thread and both links make very interesting reads.  Beauty is in the eyes of the beholder as they say.