FromOpenCV
Converts OpenCV data types to Simulink data types
Libraries:
Computer Vision Toolbox Interface for OpenCV in Simulink
Description
The FromOpenCV block converts the Simulink® OpenCV data types to Simulink 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 FromOpenCV block. The input can be of different data types. Each of the input data types determines the output data type of the block. For more information, see Mapping Input and Output Data Types.
Data Types: OpenCV types
Output
Output signal from the FromOpenCV block.
Data Types: Converted Simulink types
Parameters
Specifies the input data type of the FromOpenCV block. The table lists the one-to-one mapping of the input versus output data types of the FromOpenCV 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 FromOpenCV block.
DataType Parameter | FromOpenCV Block Input Signal Data Type | FromOpenCV Block Output 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.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)



