Hyperbolic Stretch is the generalized hyperbolic stretch (GHS): a family of curves that add the most contrast at a symmetry point we choose, as strongly and as locally as we ask, with the shadows and the highlights protected. Placed at the background's level, it brings out faint nebulosity without bloating the stars; placed higher, it adds contrast to the bright parts of an image already stretched. Its inverse undoes it.

Categories
  • Intensity
Keywords
  • hyperbolic stretch
  • generalized hyperbolic stretch
  • GHS
  • stretch
  • nonlinear stretch
  • linear data
  • symmetry point
  • local intensity
  • stretch factor
  • highlight protection
  • shadow protection
  • inverse stretch
  • PixInsight GeneralizedHyperbolicStretch

1Introduction

Most stretches add contrast where they are steepest, and we have little say on where that is. The generalized hyperbolic stretch, published by Mike Cranfield and Dave Payne, lets us put it there: at the symmetry point the curve is steepest, and the further from it, the flatter. The stretch factor says how much contrast is added there, and the local intensity how narrowly it is concentrated around the point. Below a shadow protection level and above a highlight protection level the curve becomes a straight line, so those ranges keep their contrast.

Several kinds of curve belong to the family, chosen by the local intensity: logarithmic at −1, exponential at 0, hyperbolic above, and more local the higher it goes. One process can thus do a gentle initial stretch, a strong one that spares the stars, or a final touch of contrast in the midtones.

Hyperbolic Stretch is our own engine, written from the authors' published equations, with the parameters of PixInsight's GeneralizedHyperbolicStretch: a PixInsight icon of it opens here, and the panel saves one that PixInsight opens. DSPX does the stretch of the red, green and blue channels, each by the same curve, and its inverse; the other stretches and channel choices of the PixInsight process are not offered yet.

The Veil Nebula before and after Hyperbolic Stretch
From linear to visible in one step. Left, part of a Veil, its background neutralized, shown without a screen stretch; right, after Hyperbolic Stretch with a stretch factor of 5, a local intensity of 8 and the symmetry point at the background's level.

2Quick Start

  1. Open the linear image, its gradients removed and its background neutral.
  2. Choose Process > Intensity > Hyperbolic Stretch. With the live preview (the eye) on, the image shows the stretch, without its screen stretch.
  3. Set Symmetry point (SP) to the background's level: the Log of Background Neutralization or the screen stretch's shadows point tells where it is.
  4. Raise Stretch factor ln(D+1) until the faint parts show, and Local intensity (b) until the stars are as small as we want.
  5. Click Apply. The screen stretch is turned off, and the image is shown as it now is. For more, apply again with new settings: GHS is meant to be used in several small steps.

3Interface & Parameters

The panel has two sections, Stretch and Protection, each of which folds away with the arrow beside its title. Under them are the image the process applies to with the live preview's eye, the buttons and the system bar along the bottom.

The Hyperbolic Stretch panel
The Hyperbolic Stretch panel with the settings of the picture above.

3.1Stretch

Stretch: The kind of stretch. DSPX has the generalized hyperbolic stretch, written into every icon so that PixInsight reads the same.

Channels: What is stretched: the red, green and blue channels, each by the same curve; a gray image by its one channel.

Inverse: Applies the inverse of the stretch, the curve that undoes it. With the same settings, a stretch and its inverse give the image back.

Stretch factor ln(D+1): How strong the stretch is, from 0 to 10: the natural logarithm of D + 1, D being the curve's slope parameter. 0, the default, changes nothing. Each unit is a big step: 1 or 2 for a touch of contrast, 4 to 6 to bring linear data up.

Local intensity (b): How concentrated the stretch is around the symmetry point, from −5 to 15; 0 by default. Higher values add the contrast in a narrower band of brightness and leave the rest flatter, which keeps stars small; −1 is a logarithmic curve, 0 an exponential one.

Symmetry point (SP): Where the stretch adds the most contrast, from 0 to 1; 0 by default. For the first stretch of linear data, the background's level; later, the brightness of what should gain contrast.

3.2Protection

Highlight protection (HP): Above this level the curve is a straight line, with the slope it has there, so the highlights keep their contrast and the stars do not swell. 1 by default, no protection. It is at least the symmetry point.

Shadow protection (LP): Below this level the curve is a straight line, so the shadows are not crushed. 0 by default, no protection. It is at most the symmetry point.

3.3Apply, Preview and Instance

Live preview (the eye): At the end of the Applies to row; Preview in the system bar is the same switch. On by default. The image shows Hyperbolic Stretch applied to the part in view, as the settings change, with the banner "PREVIEW only, nothing applied"; the image itself does not change until Apply. An image shown through a screen stretch is previewed without it, since the stretch is what we are previewing. Before, in the banner, or the backslash key held, shows the image as it is. At 1:1 the preview is exactly what Apply gives there; at a reduced zoom it is computed on the reduced view and is very close.

Applies to: The image Hyperbolic Stretch works on, chosen in a list of the open images. It shows the image in front, and follows it as we bring other images to the front. Picking another image in the list makes the panel work on that one, its live preview included, without bringing it to the front; the pick stays while we work on other images, and Follow Active, the small button that appears beside the list, makes the panel follow the image in front again. An image that a tool or a run is working on is listed, but cannot be picked.

Apply: Stretches the image named in Applies to, in one history step that Undo takes back, through the image's mask if it has one. When the live preview showed the image without its screen stretch, Apply turns that stretch off. The size, the sample format and the metadata stay as they are.

Instance: Shows the process as the panel has it now, as text: the settings as a DSPX process (.dsproc) or as a PixInsight process icon (.xpsm) of GeneralizedHyperbolicStretch, chosen under Format. Copy puts the text on the clipboard; Save... saves it as a file and puts it on the Process Shelf.

Reset: Puts every setting back to its default.

The system bar along the bottom of the panel has the same commands as small icons: at the left, drag to apply and Apply; at the right, Instance, Help (this page) and Reset. Drag to apply, the first icon, carries the process with its settings: dropped on an image's window, it applies them to that image, whatever image the panel works on; dropped on the Process Shelf, it is kept there as a row of its own. With Edit > Preferences > Layout > Hide classic buttons, the bar alone has them.

4Shaping the Curve

The stretch factor and the local intensity work together. With a low local intensity, the contrast spreads over a wide band of brightness: everything brightens, the stars with the nebula. With a high one, it is concentrated just above the symmetry point: the faint signal rises, and what is already bright, the stars, rises much less. A higher local intensity usually needs a lower stretch factor for the same background.

Two hyperbolic stretches with different local intensities
Two local intensities. Left, a stretch factor of 5 and a local intensity of 8; right, 4 and 12. The second keeps the stars smaller and the sky darker, and asks for a second, gentler step to bring the nebula up.

The curve is computed for every sample, not taken from a table, and it is monotonic and smooth through the protection levels, where its slope is kept. Its inverse is computed in closed form, so Inverse gives the image back to the precision of its samples.

5Usage Tips and Tricks

Several small steps. GHS is at its best as a sequence: a first stretch at the background's level, then a few more, each with the symmetry point moved to where the next contrast is wanted.

Protect the stars with HP. Lowering Highlight protection toward the stars' level keeps their cores from growing, at the price of less contrast in the brightest parts of the nebula.

Contrast after a stretch. On a stretched image, a small stretch factor with the symmetry point in the midtones works as a contrast curve centered where we want it.

Find the background's level. The Log of Background Neutralization gives the mean background; Masked Stretch's gives its median. Either is a good first symmetry point.

GPU. In DSPX mode a large image is processed on the graphics card, 2 to 3 times faster than on the processor, and the live preview updates faster too. A small image stays on the processor, where it is quicker. Choose CPU only in Edit > Preferences > Performance / AI to keep it on the processor, and see GPU Acceleration for what else runs on the card.

Arcsinh Stretch: a stretch that keeps the color of every pixel.

Masked Stretch: a stretch that keeps the stars small, to a background level we choose.

Histogram: the classic stretch, and the way to put a screen stretch into the pixels.

Curves: any curve, drawn by hand, per channel or component.

Star Stretch: a script that takes the stars out, stretches them on their own with this process or Arcsinh Stretch, and puts them back on a starless image.