Main Content

Image To Matrix

Converts Simulink image data to matrix data

Since R2021b

Libraries:
Computer Vision Toolbox OpenCV Interface for Simulink

Description

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

Examples

Ports

Input

expand all

Input signal to the Image To Matrix block. The input is a Simulink image data type.

Data Types: Simulink.ImageType

Output

expand all

Output signal from the Image To Matrix block. The output is a matrix or an array, depending on the format of the input.

  • M-by-N matrix — The input is a Grayscale image. M and N are the height and width of the image, in pixels.

  • M-by-N-by-C matrix — The input is an RGB or BGR image. M and N are the height and width of the image, in pixels. C is the number of color channels.

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

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:

Color FormatChannels
Grayscale1
RGB3
BGR3

Programmatic Use

Block Parameter: Channels
Type: double
Value: positive integer
Default: '3'

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