Class Interpretation

Describes how an image pixel should be interpreted. Any interpretation other than Raw will apply a specific processing to every pixel of an image.

Note: this is unrelated to the file format / encoding (like JPG and PNG). This interpretation occurs after the image was decoded into a pixel buffer.

// Use the Mapbox Terrain RGB interpretation
const interp = Interpretation.MapboxTerrainRGB;

// Use the raw interpretation
const raw = Interpretation.Raw;

// Use the min/max scaling interpretation
const min = 234.22;
const max = 994.1;
const minmax = Interpretation.ScaleToMinMax(min, max);

// Negates the sign of all pixel values, without any interpretation.
// This is useful if your dataset expressed depths (positive values going down) rather than
// heights (positive values going up).
const custom = new Interpretation(Mode.Raw, {
negateValues: true,
})

Hierarchy

  • Interpretation

Constructors

Properties

Accessors

  • get colorSpace(): ColorSpace
  • Gets the color space required for a correct decoding of textures in this interpretation. If color space cannot be determined, returns undefined.

    Returns ColorSpace

  • get max(): number
  • The max value (only for MinMax mode).

    Returns number

  • get min(): number
  • The min value (only for MinMax mode).

    Returns number

  • get negateValues(): boolean
  • Gets or set the sign negation of elevation values. If true, reverses the sign of elevation values, such that positive values are going downward, rather than updwards. In other words, interpret values as depths rather than heights.

    Returns boolean

  • set negateValues(v): void
  • Parameters

    • v: boolean

    Returns void

  • get MapboxTerrainRGB(): Interpretation
  • Preset for Mapbox Terrain RGB. The image represent an elevation encoded with the Mapbox Terrain RGB scheme. The input is an sRGB image, and the output will be a grayscale image.

    Returns Interpretation

  • get Raw(): Interpretation
  • Preset for raw. The pixel is used as is, without transformation. Compatible with both grayscale and color images. This is the default.

    Returns Interpretation

Methods

  • Returns true if this interpretation does not perform any transformation to source pixels.

    Returns boolean

  • Returns a user-friendly string representation of this interpretation.

    Returns string

  • Reverses the sign of elevation values, such that positive values are going downward, rather than updwards. In other words, interpret values as depths rather than heights.

    Returns Interpretation

  • Preset for compression.

    Compresses the input range into the 8-bit range. This is the inverse of ScaleToMinMax.

    Note: this is typically used to visualize high dynamic range images, such as 32-bit data, into the 8-bit range suitable for display.

    Parameters

    • min: number

      The minimum value of the dataset.

    • max: number

      The maximum value of the dataset.

    Returns Interpretation

    The interpretation.

    Example

    // We have a 16-bit satellite image with min = 200, and max = 4000. We wish to visualize it
    // without saturation.
    const interp = Interpretation.CompressTo8Bit(200, 4000);
  • Preset for scaling interpretation.

    Applies a scaling processing to pixels with the provided min/max values with the following formula : output = min + input * (max - min).

    Input can be either color or grayscale, and output will be either color or grayscale, depending on input.

    Note: this is typically used to encode elevation data into a 8-bit grayscale image.

    Parameters

    • min: number

      The minimum value of the dataset, that maps to 0.

    • max: number

      The maximum value of the dataset, that maps to 255.

    Returns Interpretation

    The scaling values.

    Example

    // We have a grayscale image that represents elevation data ranging from 130 to 1500 meters.
    // Pixels with color 0 will map to 130 meters, and the pixels with color
    // 255 will map to 1500 meters, and so on.
    const interp = Interpretation.ScaleToMinMax(130, 1500);

Generated using TypeDoc