Main Content

Matrix To Image

Converts matrix data to Simulink image data

Since R2021b

Libraries:
Computer Vision Toolbox OpenCV Interface for Simulink

Description

The Matrix To Image block converts matrix data to Simulink® image data.

Ports

Input

expand all

Input signal to the Matrix To Image block. The input is a numerical matrix.

Data Types: uint8 | uint16 | int8 | int16 | single | double

Output

expand all

Output signal from the Matrix To Image block. The output is an image in Simulink.ImageType data type.

Data Types: Simulink.ImageType

Parameters

expand all

Specify the number of rows in the image data as a positive integer.

Programmatic Use

Block Parameter: Rows
Type: double
Value: positive integer
Default: '480'

Specify the number of columns in the image data as a positive integer.

Programmatic Use

Block Parameter: Columns
Type: double
Value: positive integer
Default: '640'

Specify the number of color channels or samples for each pixel in the array as 1 or 3. The number of channels must correspond to the number of color channels in the color format of the image data. These are the values of Channels for the supported color formats:

ChannelsColor Format
1Grayscale
3RGB
3BGR

Programmatic Use

Block Parameter: Columns
Type: character vector
Value: positive integer
Default: '3'

Specify the data type of the underlying image data as one of these options:

  • 'uint8'

  • 'int8'

  • 'uint16'

  • 'int16'

  • 'uint32'

  • 'int32'

  • 'single'

  • 'double'

  • 'logical'

Programmatic Use

Block Parameter: ClassUnderlying
Type: character vector
Value: 'uint8' | 'int8' | 'uint16' | 'int16' | 'uint32' | 'int32' | 'single' | 'double' | 'logical'
Default: 'uint8'

Specify the memory arrangement of the matrix data in the image as Column-major or Row-major.

Programmatic Use

Block Parameter: Layout
Type: character vector
Value: 'Column-major' | 'Row-major'
Default: 'Column-major'

Specify what each color channel of a pixel represents in the underlying image data as Grayscale, RGB, or BGR.

Programmatic Use

Block Parameter: ColorFormat
Type: character vector
Value: 'Grayscale' | 'RGB' | 'BGR'
Default: 'RGB'

Block Characteristics

Data Types

double | single | uint8 | uint16 | int8 | int16 | int32 | image

Direct Feedthrough

Yes

Multidimensional Signals

Yes

Variable-Size Signals

No

Extended Capabilities

Version History

Introduced in R2021b