TD_MATRIX2IMAGE Examples - Teradata Vantage

Database Unbounded Array Framework Time Series Functions

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-10-04
dita:mapPath
ncd1634149624743.ditamap
dita:ditavalPath
ruu1634160136230.ditaval
dita:id
ncd1634149624743

Example: Convert Matrix to Gray Scale Image with Fixed Range

EXECUTE FUNCTION
TD_MATRIX2IMAGE
(
  MATRIX_SPEC (
    TABLE_NAME( matrixTable ),
    MATRIX_ID( id ),
    ROW_AXIS (SEQUENCE( y )),
    COLUMN_AXIS (SEQUENCE (x)),
    PAYLOAD (
      FIELDS (GRAY),
      CONTENT (REAL)
    )
  ),
  FUNC_PARAMS (
    RANGE (0, 255)
  )
);
It was not necessary to specify TYPE because a single payload was used in the command.

Example: Convert Matrix to Gray Scale Image with Automatic Range

EXECUTE FUNCTION
TD_MATRIX2IMAGE
(
  MATRIX_SPEC (
    TABLE_NAME( matrixTable ),
    MATRIX_ID( id ),
    ROW_AXIS (SEQUENCE( y )),
    COLUMN_AXIS (SEQUENCE (x)),
    PAYLOAD (
      FIELDS (GRAY),
      CONTENT (REAL)
    )
  )
);
This TD_MATRIX2IMAGE command had the function determine the range, so it was not necessary to specify FUNC_PARAMS.

Example: Convert Matrix to Colormap Image

EXECUTE FUNCTION
TD_MATRIX2IMAGE
(
  MATRIX_SPEC (
    TABLE_NAME( matrixTable ),
    MATRIX_ID( id ),
    ROW_AXIS (SEQUENCE( y )),
    COLUMN_AXIS (SEQUENCE (x)),
    PAYLOAD (
      FIELDS (GRAY),
      CONTENT (REAL)
    )
  ),
  FUNC_PARAMS (
    TYPE ('colormap'),
    COLORMAP ('viridis'),
    RANGE (0, 255)
  )
);

Example: Convert Matrix to RGB Image with All Channels Range Fixed

TD_MATRIX2IMAGE
(
  MATRIX_SPEC (
    TABLE_NAME( matrixTable ),
    MATRIX_ID( id ),
    ROW_AXIS (SEQUENCE( y )),
    COLUMN_AXIS (SEQUENCE (x)),
    PAYLOAD (
      FIELDS (RED, GREEN, BLUE),
      CONTENT (MULTIVAR_REAL)
    )
  ),
  FUNC_PARAMS (
    RED (0, 255),
    GREEN (0, 255),
    BLUE (0, 255)
  )
);
It was not necessary to specify TYPE (RGB) because there are three payloads.

Example: Convert Matrix to RGB Image with Automatic Range for All Channels

EXECUTE FUNCTION
TD_MATRIX2IMAGE
(
  MATRIX_SPEC (
    TABLE_NAME( matrixTable ),
    MATRIX_ID( id ),
    ROW_AXIS (SEQUENCE( y )),
    COLUMN_AXIS (SEQUENCE (x)),
    PAYLOAD (
      FIELDS (RED, GREEN, BLUE),
      CONTENT (MULTIVAR_REAL)
    )
  )
);