Generalized Hyperbolic Stretch

@jdc the menu workaround seems to work OK. However there doesn’t seem to be any change in the zoom behaviour. It’s as if the graduated filter is only applied to whatever is in the preview window and not to the image in its entirety. Clicking on the zoomed preview shows the correct display but it reverts to the incorrect preview as soon as the mouse button is released…

@Wayne_Sutton

Thank you for your evaluation.

After examining the algorithm, it seems almost obvious that it can only work in 100% image mode.
Indeed, as I will explain in the documentation, the system is extremely sensitive to white point and black point, as well as Symmetric point (SP). Obviously these values ​​will be different on a partial image in the preview. So inconsistent results depending on the zoom.

So I added in the label the sign for 100% = > 1:1

But these questions led me to improve (a little) the quality of the RGB mode.
Now you have 5 methods to choose from:

  • RGB luminance = > new default
  • RGB standard ==> Old default setting
  • Luminance (hsl)
  • Saturation (hsl)
  • Hue (hsl).

Running executables
ghs

Thank you again

Jacques

1 Like

I’m not sure I described the problem clearly enough. It occurs when the image is zoomed to 100% with the graduated filter activated. In this case the filter range seems to extend right to the bottom of the image and darkens the foreground considerably. Clicking on the image with the mouse lightens the foreground such that it corresponds to the lower zoom values (there may be some slight variation but not enough to make a noticeable difference). When the image is exported, the foreground appears normal also, so the problem seems to be when the image is zoomed to 100%.

@Wayne_Sutton

Can you send me your raw and pp3 so that I can see the differences, because for me, with my test images, no (or very little) differences between Zoom 100% and TIF/JPG

Thank you

Or maybe because of the RT pipeline ( which is really a handicap) the whole image needs to appear in the Preview to get the same results as TIF/JPG ?

Jacques

1 Like

Hello Jacques,

the new function of GHS is a helpful tool, and i really appreciate your effort.
I agree, the curve shows very well, what youre doing when moving the sliders.
But i have some questions:

  • Since the left dropdown “GHS S Curve”, doesnt have any alternatives, it could be skipped?
  • In the right dropdown, I dont see whats GHS and linear, there is no visible difference, when altering. If “linear” you could hide the whole curve isn’t it? Then this dropdown could be some kind of “show/hide”
  • When moving some sliders, the curve is following. But the curve doesnt reset when the sliders are reset to default one by one.
  • the nurbs points of the curve are irritating. Even I understand, they dont have a function, they can be grabbed and moved, which will be corrected after using a slider.

So, my proposal is to use one dropdown or checkbox for “show/hide” the curve. If posible either hide the nurbs or the curve-area could be greyed out, sso its easy to understand, that you can not drag the nurbs.

I know, it’s GUI but i hope my feedback can help a little bit.

1 Like

Thank you for the review.
I’ll try to pick up on the points you mention. Excuse my bad english.

As I said, I’m not a GUI specialist at all, or computer code for that matter. I’m a scientist, and for a lot of code, I work like a monkey, copying what’s out there.
For me, GHS is a remarkable tool, probably the most complete I’ve seen. It’s complex, difficult to use and will require an explanatory tutorial. But I can’t do everything at once.

As far as I know, RT doesn’t have a way of representing a function, a process, in other words, of making a graph that shows the function. Whether it’s Log encoding, Sigmoid, TRC, etc.
I felt it was important to be able to visualize the GHS function (it would be nice to have it for the others too…), hence this workaround. Better than nothing. Making a graph in a window… I don’t know how.
So I took an existing function “a diagonal curve” and tinkered around with it. I spent more time with this than with all the GUI and engine code. I’ve received several comments, which I’m trying to address, but within the limits of my knowledge of code and GUI. There are still some “curves” functionalities that I don’t know how to deactivate…

“Since the left dropdown “GHS S Curve”, doesnt have any alternatives, it could be skipped?”
Of course, if I knew how to do it, it would be done :wink:

"In the right dropdown, I dont see whats GHS and linear, there is no visible difference, when altering. If “linear” you could hide the whole curve isn’t it? Then this dropdown could be some kind of “show/hide”"
As I said before, the system is not reversible. It’s not a curve. The word “Linear” here won’t reset the sliders to 0. It’s only there to show the curve (for those new to using software) when there’s no action, but honestly it’s useless. But as I have no other alternative, I’ve left this choice, because a choice is needed for the GUI.

“When moving some sliders, the curve is following. But the curve doesnt reset when the sliders are reset to default one by one.”
The representation of the GHS function is an exact copy of the code applied to the data. It’s not reversible, but the curve behaves exactly - except that there are only 20 points with a Béziers curve between each point, instead of a continuous curve - like the system. The only way to cancel is with the “D” slider.

“The nurbs points of the curve are irritating. Even I understand, they dont have a function, they can be grabbed and moved, which will be corrected after using a slider.”
Do not touch them, these are the points used to draw the representation. Each of these points is calculated exactly. I couldn’t find in the GUI how to make them totally inactive, or how to delete them. One comment, however: they allow you to see the action of the local intensity slider (b) much better than a simple curve, by showing stretch and compression. From my point of view, this shows one of the strengths of GHS.

As for graying out the curve, I don’t know how to do that either.

So, to sum up, this representation is a stopgap until it can be improved by someone competent. But before making a request for something complex, it’s essential to evaluate GHS.

But if other developers know how to do it: either by making what I’ve done work better, or by creating a function representation system, they’re more than welcome. :smiley:

Apart from this point on “the curve”, I’ve provided some help with setting the Blacks points and White points. When you move the sliders, you can change (if necessary) the number of clipped pixels.
image

It is very important to settle these 2 points before starting GHS.

I hope I haven’t been too boring or disturbing. :wink:

Executable
ghs
Jacques

1 Like

Hello Jacques,

thanks a lot for your explanations. I understand, my points are GUI-related and will be difficult to realize.

May be, i was unclear in my description. Moving the D-slider works well and the curve is changed as it should, but:
Using the arrow for reset the “D” slider to 0.000, the preview will darken a lot, but the curve will show the same as before.
If you then set the the slider only to 0.001, the curve reacts as designed.

Means, the curve reacts on the sliders, but not on the “reset-arrows”

hth

@marter

This is a small and easy modification. I just did it. Just wait (unless you compile) for the executables to build (about 20 minutes)

Jacques

1 Like

@Wayne_Sutton
I removed the choice of the graduated filter when GHS is selected. This avoids erratic operation

I made 2 more changes:

  • set a logarithmic scale for the ‘Stretch factor (D)’ slider. This allows to better select low stretch values,
  • I added another method to apply GHS. It is ‘Lab Luminance’.

you now have 5 choices:

  • RGB Luminance - the equivalent luminance is calculated from the XYZ matrix function of the Working profile (default Prophoto);
  • RGB Standard - each R, G, B channel is treated identically;
  • Luminance Lab - the luminance is that of Lab mode;
  • Luminance HSL - the luminance is that of HSL mode;
  • Saturation HSL - the saturation is that of HSL mode - allows you to restore saturation if you use high values ​​of ‘Stretch factor (D)’ and 'Local Intensity (b) - with a second RT-spot;
  • Hue (HSL) - allows you to vary the hue in a differentiated way, a sort of Color toning.

Executables
ghs

Jacques

1 Like

Jacques, out of curiosity, I tried the graduated filter in Selective Editing > Color & Light and it seems that the problem exists there also. I haven’t tried the other selective-editing tools. To reproduce, open an image at a zoom level of say 16% and apply the graduated filter. Then simply move the image with the hand tool towards the top of the preview window. The filter stays in the same position in the preview window and doesn’t follow the image as it is panned. The graduated filter in the Exposure tab behaves as expected.

Bonne journée,
Wayne

1 Like

Salut Jacques, it seems to work fine now. Nice tool !

1 Like

@Wayne_Sutton
Thank you, I will have a look.

@paulmatth
Thank you :smile:

For Lab mode, which behaves differently from RGB mode. This may seem obvious, but here the gap is very significant.

I made 2 changes. The first one concerns the Lab mode itself. Its design for luminance is a gamma/slope curve with g=3 and slope 9.03.

I put a slider “Slope Lab factor (S)” which acts a bit like the TRC, but where I only modify the Slope of Lab part. This allows to modify the action of GHS in the shadows. By default it is at 9.03.

As with Lab we only act on the luminance, with GHS we easily end up with desaturated images. I added a slider "Chromaticy Lab factor (C) " which allows you to modify the chromaticity.

Executables
ghs

Jacques

I might have a go at implementing this in the future. One of my plans is improving the Tone Equalizer, which includes adding a graph. If you want to try, the parametric curve type is an example of a graph without any control points.

I’ve made a number of improvements to GHS.

Modes:

  • RGB Luminance and standard RGB modes now take stretch into account to adjust saturation.
  • Luminance & Chromaticity (Lab) mode takes chromaticity directly into account - which can be adjusted. This mode requires different settings for “D” , “b”, “SP”.

Settings SP, etc. :
It’s easier to set “SP” now that the histogram, when you click on the icon of the gamut button Gamut-hist.png, displays the data corresponding to those used in the algorithm: working profile and gamma=1

First image with “Histogram and Navigator panel” taking into account Output profile

Second image with “Histogram and Navigator panel” taking into account Working profile and gamma=1

GHS function representation

  • now when you click on “Linear” the system is reset
  • but it’s still not perfect. It’s not a curve, just a help

Executables
ghs

I think I’ve just made an important change in the use of GHS. The algorithm is complex, and the language used is unusual (stretch, symmetry point, etc.). What’s more, it’s very sensitive to certain settings (differences of eg 0.01 between sliders can result in very different images). I therefore initially thought of creating a representation of the transform when manipulating the 5 sliders that act on the GHS function - Stretch factor (D), Local intensity (b), Symmetry point (SP), Protect Shadows (LP), Protect Highlight (HP).
My first step was to use a diagonal curve with 20 reference points and a Beziers function. The disadvantage of using a curve is that I don’t know how to disable the mouse, nor how to make the menu simpler (and it is not a curve!).

So I fundamentally changed my approach and used the ‘Labgrid’ function which is present in RT in ‘Color Toning’, ‘Selective Editing Color & Light’, ‘Wavelet’, where you represent the Lab domain and 2 colors, or ‘Abstract profile’ or Selective Editing ‘Color appearance’ where you represent the CIExy diagram, primaries, white point, etc. I’ve modified it - making sure the other Labgrid functions work properly by using only 9 points, with no Beziers function. These points are spaced at 0.125 (0., 0.125, 0.250, 0.375, 0.5, 0.625, 0.75, 0.875, 1.). The background is a grey grid divided horizontally and vertically into 10 zones. Mouse off, resets off. This gives you a - not perfect - but sufficient representation of the transform (or its inverse). It’s not always a contrast curve, as this transform also acts on saturation or chroma, or hue when you make these choices.
image

Since my last comment, I’ve:

  • simplified the GUI in Basic mode, leaving only the ‘RGB luminance’ mode
  • made modifications to ‘local contrast’ and ‘saturation’ that take into account (at least in part) stretching and compression.

As I don’t have access to Rawpedia (I can’t make modifications on current systems), I’d like to offer some advice here

  • start in ‘neutral’ mode, leaving the necessary settings that won’t directly influence GHS (Highlight reconstruction, Capture Sharpening, Chromatic Aberrations, White balance, etc.).

  • set ‘Black point’ and ‘White point’ to enable GHS to work in the [0…1] space and not something else like [0.2…0.8] for example. It is advisable to observe the histogram in ‘Working profile’ mode (gamut button) , and values of clipped black and white point (change these value a little ‘to see’ , for example by lowering the black point - negatives values…).

  • Locate the luminance peak on the ‘Working profile’ histogram (if you’re working on it, of course) to set the ‘Symmetry point’.

  • then adjust the stretch (D) and intensity (b) values, followed by the HP and LP values.

  • then complete if necessary with other RT settings.

The ‘local contrast’ values I’ve chosen are low enough to reconstitute contrast, but often insufficient. The use of Selective Editing Wavelet - while waiting for its update in the ‘apseimprov’ branch (Pull Request 7111) - is a good solution for locally modifying contrast, clarity and other parameters.

Executables
ghs

Jacques

2 Likes

I just change (big coding job - not my strong point at all - to bring the ‘graph’ representing the simulation to 10 points), the number of points in “simulation” - now (0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0)
I also fix a bug (crash) in some cases when you adjust white point in “inverse GHS” (I hope).

Of course new Executables…
Jacques

I made various changes that do not modify the overall operation, but ensure a better synchronization of the various cursors linked to ‘Symmetric point (SP)’.

In addition I think I have reduced the risks of crash in “inverse GHS” mode

Executables
ghs

1 Like

I made a big mistake by merging the PR relating to GHS instead of those concerning Gamut compression.
I fixed (I hope) this mistake and everything should work correctly now. Whether it’s “dev”, the PR relating to GHS, or the one relating to Abstract profile (local contrast) and improvements to Selective editing (with Sigmoid, etc.).

Regarding GHS I have again made improvements to the graphical representation of the transform, which now follows the following points: 0., 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 1.
The essential adjustment of Black Point and White Point has also been refined, with display of actual values (Value Black point and White point).
image

Just a quick question Jacques.

I don’t see the use of Inverse GHS. I see that the curve turns the other way around, but the photo gets ugly with these inverted settings…?

@paulmatth
Paul
I am preparing documentation, but no Rawpedia accessible to modify it.

Inverse GHS, is mainly used to “undo” previous Stretche(s), a bit like “excluding spot”. For example, reduce or remove the effect on a sky.

In case of “Inverse GHS” it is necessary to modify the White Point and Black Point…(if they are different from 0 and 1).
if you change “Symmetry point (SP)” inverse GHS, behaves much like normal GHS (a little more limited).

This code is Siril’s and the comments are from the author of PixInsight : David Payne and Mike Cranfield…

Schematically according to the value of (b) Local Intensity, the system behaves as:

  • logarithm (based) transform
  • exponential (based) transform
  • hyperbolic (based) transform

When you change Protect shadows (LP) or Protect Highlight (HP) when (SP) values ​​allow, the above ‘curves’ are replaced by linear functions.

I would summarize by saying that once you understand the principles, the use is relatively simple. But these principles are different from what users are used to with Log Encoding, Sigmoid, TRC, etc.

2 Likes