FromOpenCV
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
Port_1 — First input signal
scalar | vector | matrix | simulink bus | simulink image
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
Port_1 — Output signal
scalar | vector | matrix | simulink bus | simulink image
Output signal from the FromOpenCV block.
Data Types: Converted Simulink types
Parameters
DataType — Data type of the Input signal of FromOpenCV block
input data type
(default)
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
Mapping of Input and Output Data Types
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
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
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.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- 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)