Curves Transforms in PixInsight

The CurvesTransform Process

Luminance Curves

Hue Curves

The CurvesTransform Process

CurvesTransform implements a set of transfer curves that can be applied to selected channels of images. A transfer curve in PixInsight is an interpolated function applied to each pixel of an image. You define input and output values for a set of arbitrary points. Then for each pixel, the current pixel value is used to interpolate a new value from the set of given points, and the interpolated value replaces the original. Do that for every pixel in an image and you are an instance of CurvesTransform.

The previous paragraph basically defines the parameters of CurvesTransform:

• A set of arbitrary interpolation points, which we call curve for short. Each curve point is given by two values: input and output. Both values are pixel values in the normalized real dynamic range, that is in the range [0,1] of real numbers, where zero corresponds to no signal (black) and one to full signal (white). In addition to the set of interpolation points, each curve can be interpolated as a smooth function generated by cubic splines, or as a stroked function by linear interpolation between adjacent points.
• A different curve can be defined, as stated above, for a number of channels: red, green, blue, combined RGB/gray, luminance in the CIE L*a*b* space, hue in the HSV space, and saturation in a special HSVL* space. Each curve is applied to the corresponding channel of the target image. For grayscale images, only the combined RGB/gray curve is applied.

Instances of CurvesTransform can be executed on image views and previews.

The R, G, and B curves are just applied to the corresponding channels of a color image; nothing original. The combined RGB/K curve is applied to each individual channel of a color image, or to the only channel of a grayscale image; again, no surprises. However, the other three curves, namely the luminance, hue and saturation curves, deserve somewhat detailed discussions.

Luminance Curves

The luminance curve of a CurvesTransform instance, when defined, is applied to the L* channel of the target image in the CIE L*a*b* color space. This works by transforming each pixel from the RGB space to the CIE L*a*b* space on the fly, applying interpolation to the L* value on the luminance curve, and performing the inverse transform back to the RGB space.

Color space transformations are calculated in the RGB working space (RGBWS) currently assigned to the image, which can be either a locally defined RGBWS or the global RGBWS.

 A B Uniformly illuminated areas with little hue variations can hide image detail. Luminance curves can be very helpful in these cases. Curve 'A' decreases luminance for a limited range of pixels between midtones and highlights. For the example yellow flower image (1), this curve reveals significant details. This correction cannot be accomplished with a single curve for the combined RGB channel without altering color balance. By modifying individual RGB curves, perhaps the same result might be obtained, but at the cost of a substantial amount of trial-error work. Luminance curves can also be very efficient when combined with saturation curves in PixInsight, as implemented in curves 'B'. Finally, luminance and saturation curves can be applied selectively through masks when particular image areas must be protected. 1. Original image. 2. Luminance curve A applied to the original. 3. Luminance/saturation curves B applied to original. 4. Mask generated from the original red channel. 5. Luminance curve A applied masked with (4). 1 2 3 4 5

Hue Curves

A hue curve can also be defined in CurvesTransfrom. In this case, each pixel is transformed to the HSV space, the new H value is interpolated, and the inverse HSV->RGB transform is performed. HSV is colorimetrically ignorant, so hue curves must be used with some care to avoid wild luminance/chrominance variations. However, judicious hue curves can be quite useful to adjust individual colors.

 A 1 A fancy hue curve. In the curve 'A' above, yellow and orange pixels are being transformed into red. Bluish green and cyan are being transformed into blue. 1. Original image. 2. Transformed image, after applying curve A. 2

Saturation Curves

The saturation curve, as defined by CurvesTransform, is quite unusual if we compare it to a "normal" color saturation transform. This is because a color saturation transform process (implemented as ColorSaturationTransform in PixInsight Standard) varies color saturation as a function of hue, that is, saturation is changed for some given colors. The saturation curve in CurvesTransform, on the other hand, varies saturation as a function of itself. This is equivalent to something like "increase saturation for unsaturated pixels, but don't touch already saturated ones", instead of "increase saturation for red pixels" in a "normal" saturation transform. The effect of a saturation curve is quite smooth, controllable, and is guaranteed to preserve color balance.

The last condition stated in the above paragraph is achieved because saturation transforms in PixInsight are performed in a special, colorimetrically rigorous HSVL* space. For each pixel, two color space transforms are carried out: to the HSV and to the CIE L*a*b* spaces. The S channel is interpolated, and the reverse transform HSV->RGB is performed. This gives us new pixel values with saturated (or unsaturated) chrominance... and a useless, plenty of noise, luminance. Therefore, the new RGB pixel is again transformed to the CIE L*a*b* space, the new luminance is discarded and replaced by the old one, and a final reverse CIE L*a*b* -> RGB transform is done. Of course, all that happens in the RGBWS assigned to the image, either local or global RGBWS.

 A B An example of saturation curves. Curve 'A' increases saturation, especially for lowly saturated pixels, as indicated by the strong slope at the beginning of the curve. Curve 'B' desaturates the image, especially for highly saturated pixels. 1. Original image. 2. Saturated image, after applying curve A. 3. Desaturated image, after applying curve B. 1 2 3