Kautilya V, MathWorks
The Computer Vision Toolbox™ OpenCV Interface for Simulink® simplifies converting programs created with OpenCV, an open source computer vision library, into Simulink blocks that can be used to integrate computer vision capabilities into a control system. The interface needs Computer Vision Toolbox and can be installed as an add-on.
The interface has options to name the blocks being created, select various functions, specify whether the arguments are inputs or outputs, and set the default parameters. From this information, the interface automatically creates Simulink blocks that can be integrated into any Simulink model.
An example is shown using smile detection OpenCV code to analyze The Mona Lisa’s smile. For more information, various discovery pages and documentation pages are available.
Welcome to a video on the OpenCV Interface in Simulink.
OpenCV is an open source computer vision library. This video shows you the ease of converting programs created with OpenCV into Simulink blocks that you can use to integrate computer vision capabilities into your control system.
To use the OpenCV interface in Simulink Add-On, you will need the Computer Vision Toolbox. To install this Add-On, open the “Add-On Explorer” by clicking on “Add-Ons” in “Home”. Search for “OpenCV in Simulink” and click on the “Computer Vision Toolbox Interface for OpenCV in Simulink” to open it. Install it.
To show you how to use the interface, “let’s use an example to detect if someone is smiling in an image. To run the interface, you can open it from the “APPS” tab or run it from the command window by entering the command to open the app. Enter a project name such as “SmileDetectionDemo”, select “Start a new import”, and click the “next” button. Specify the information on where the files are located and click “next” twice to start the parsing. Parsing analyzes the files to find functions and types that may be imported. Once the parsing is complete, open the next page and select the functions you want to import and click “next”.
Specify whether an argument is an input, output or both. This is done to define the inputs and outputs for the Simulink block being created.For this example, we change the “img” argument to an “Input” and click next.
Finally, we change the default parameters as needed and click next. A new window with newly created blocks should appear. These are Simulink blocks of the OpenCV SmileDetection code. Close the interface window. To test the newly created block, open “smileDetect.slx”. This is a model that uses the newly created block to identify whether a person in an image is smiling. We will use this model to identify whether the Mona Lisa is really smiling. Integrate the subsystem block into it and change the image parameters and click run. A window pops up with Looks like she isn’t smiling.
For more information on the Add-on tool and to see various examples, please refer to the documentation page: “OpenCV Interface Support for Simulink”.
Thank you for watching.
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: .Select web site
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.