Matrix To Image
Libraries:
Computer Vision Toolbox OpenCV Interface for Simulink
Description
The Matrix To Image block converts matrix data to Simulink® image data.
Examples
Smile Detection by Using OpenCV Code in Simulink
Build a smile detector by using the OpenCV Importer app. The detector estimates the intensity of the smile on a face image or a video. Based on the estimated intensity, the detector identifies an appropriate emoji from its database, and then places the emoji on the smiling face.
Convert RGB Image to Grayscale Image by Using OpenCV Importer
Convert an RGB image to a grayscale image by using the OpenCV Importer app. The converter converts an RGB image to a grayscale image by eliminating the hue and saturation information while retaining the luminance.
Shadow Detection by Using OpenCV Code in Simulink
Detect shadows in a recorded video by using the OpenCV Importer app.
Ports
Input
Input signal to the Matrix To Image block. The input is a numerical matrix.
Data Types: uint8
| uint16
| int8
| int16
| single
| double
Output
Output signal from the Matrix To Image block. The output is an
image in Simulink.ImageType
data type.
Data Types: Simulink.ImageType
Parameters
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:
Channels | Color Format |
---|---|
1 | Grayscale |
3 | RGB |
3 | BGR |
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 |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Extended Capabilities
Supports C++ code generation.
Version History
Introduced in R2021b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)