ToOpenCV
Converts Simulink data types to OpenCV data types
Libraries:
Computer Vision Toolbox Interface for OpenCV in Simulink
Description
The ToOpenCV block converts the Simulink® data types to Simulink OpenCV data types.
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.
Draw Different Shapes by Using OpenCV Code in Simulink
Draw different shapes on images by using OpenCV Importer.
Ports
Inputs
Input signal to the ToOpenCV block. The input can be of different data types. Each of the input data types determines the output data type of the block.
Data Types: uint8
| uint16
| int8
| int16
| int32
| single
| double
| Simulink.ImageType
| CV_DMATCH_BUS
| CV_RECT_BUS
| CV_ROTATEDRECT_BUS
| CV_TERMCRITERIA_BUS
| CV_SIZE_BUS
| CV_RANGE_BUS
| CV_POINT2I_BUS
| CV_POINT2F_BUS
| CV_POINT2D_BUS
| CV_POINT3I_BUS
| CV_POINT3F_BUS
| CV_POINT3D_BUS
Output
Output signal from the ToOpenCV block. The output signal supports OpenCV types. For more information, see Mapping Input and Output Data Types.
Data Types: OpenCV types
Parameters
Specifies the input data type of the ToOpenCV block. The table lists the one-to-one mapping of the input versus output data types of the ToOpenCV block.
Programmatic Use
Block Parameter:
DataType |
Type: character vector |
Value: input data type |
Default:
'Point2i'
|
Block Characteristics
Data Types | |
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
More About
The table lists the one-to-one mapping of the input versus output data types of the ToOpenCV block.
DataType Parameter | ToOpenCV Block Output Signal Data Type | ToOpenCV Block Input Signal Data Type |
---|---|---|
Mat or Mat-Image | cv_Mat | uint8 array |
uint16 array | ||
int8 array | ||
int16 array | ||
int32 array | ||
single array | ||
double array | ||
Simulink.ImageType | ||
Simulink.ImageType | cv_Mat | Simulink.ImageType |
DMatch | cv_DMatch | CV_DMATCH_BUS |
vector<DMatch> | vector_cv_DMatch | CV_DMATCH_BUS (1d array) |
vector<vector<DMatch>> | vector_vector_cv_DMatch | CV_DMATCH_BUS (2d array) |
Rect | cv_Rect | CV_RECT_BUS |
vector<Rect> | vector_cv_Rect | CV_RECT_BUS (1d array) |
RotatedRect | cv_RotatedRect | CV_ROTATEDRECT_BUS |
vector<RotatedRect> | vector_cv_RotatedRect | CV_ROTATEDRECT_BUS (1d array) |
TermCriteria | cv_TermCriteria | CV_TERMCRITERIA_BUS |
Scalar | cv_Scalar | double array |
Size | cv_Size | CV_SIZE_BUS |
Range | cv_Range | CV_RANGE_BUS |
Point | cv_Point | CV_POINT2I_BUS |
Point2f | cv_Point2f | CV_POINT2F_BUS |
Point2d | cv_Point2d | CV_POINT2D_BUS |
Point3i | cv_Point3i | CV_POINT3I_BUS |
Point3f | cv_Point3f | CV_POINT3F_BUS |
Point3d | cv_Point3d | CV_POINT3D_BUS |
vector<Point> | vector_cv_Point | CV_POINT2I_BUS (1d array) |
vector<Point2f> | vector_cv_Point2f | CV_POINT2F_BUS (1d array) |
vector<Point2d> | vector_cv_Point2d | CV_POINT2D_BUS (1d array) |
vector<Point3i> | vector_cv_Point3i | CV_POINT3I_BUS (1d array) |
vector<Point3f> | vector_cv_Point3f | CV_POINT3F_BUS (1d array) |
vector<Point3d> | vector_cv_Point3d | CV_POINT3D_BUS (1d array) |
vector<vector<Point>> | vector_vector_cv_Point | CV_POINT2I_BUS (2d array) |
vector<vector<Point2f>> | vector_vector_cv_Point2f | CV_POINT2F_BUS (2d array) |
vector<vector<Point2d>> | vector_vector_cv_Point2d | CV_POINT2D_BUS (2d array) |
vector<vector<Point3i>> | vector_vector_cv_Point3i | CV_POINT3I_BUS (2d array) |
vector<vector<Point3f>> | vector_vector_cv_Point3f | CV_POINT3F_BUS (2d array) |
vector<vector<Point3d>> | vector_vector_cv_Point3d | CV_POINT3D_BUS (2d array) |
Extended Capabilities
Supports C++ code generation.
Version History
Introduced in R2020a
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)