Function

Description

Name

class Tinman.Image.Function

Derived from

Image

Transform linear pixel values using a custom function.

The given function is evaluated on linear pixel values, that is after raw pixels have been translated to normalized pixel values (see Image.Range) and after gamma correction has been applied (see Gamma). The expression may use all members of the default Tinman script. The following arguments are available to the function expression:

  • raw
    The input pixel value (raw).

  • lin
    The input pixel value (linear) in the range [0..1].

  • A, B, C, D, E, F
    Coefficients that can be used to transform between raw and linear pixel values:

    lin = pow(raw * A + B, C)
    raw = pow(lin, D) * E + F
    D   = 1 / C
    E   = 1 / A
    F   = -B / A

    where raw is the raw pixel value that is actually stored in the source image (e.g. [0..255] for 8-bit images) and lin is the linear pixel value that is stored in the image scanline buffer. A and B represent the transformation from raw pixel values to normalized pixel values (see Image.Range); C is the exponent that best approximates the performed gamma correction (see Gamma).

Fields / Required

image

Type

Image

Constraint

# != null

The source image.


function

Type

string

Constraint

# != null

A function expression (see ConfigScript expr rule) that consumes input linear pixel values in the range [0..1] and returns output linear pixel value in the range [0..1]. Output values are clamped (including infinities), not-a-number output values produce void pixels.

Fields / Optional

channel

Type

Channel

Default

Channel.Intensity

The pixel channel the function shall be applied to. If Channel.Void, no transformation will be performed.

Fields / External

info

Type

Image.Info

Contains information about the image data source, including image format and embedded georeferencing information.