- In the MATLAB Current Folder, navigate to \HLS_Library\Lab1\Section1.
- Double-click the Sobel_Edge_Detection_start.slx model.
This model already contains source and sink blocks to stream video files as input directly into your algorithm and view the results. The model also contains some of the needed HLS blocks required for this section. Note the difference in appearance for the HLS blocks in the design versus the Simulink blocks.
- Double-click Sobeledge_lib.slx library model and drag the SobelFilter_XMC block into the area labeled Convolve Image Frame with Sobel Kernel and Compute Gradient as shown in the following figure and connect the input of this block to the output of the From Multimedia File block.
- Select the GradientMag_XMC block from the Sobeledge_lib.slx file and drag it into the model, and connect the X and Y outputs of the Sobel Filter block to the input of this block.
- Connect the rest of the blocks to complete the algorithm as shown in the
following figure.Note: The blocks SobelFilter_XMC and GradientMag_XMC have been generated using the
the Note: The Model Composer blocks can operate on matrices (image frames in the following figure).
One way to assess the simulation performance of the algorithm is to check the video frame rate of the simulation. To do this:
command or click the button to simulate the model and
view the results of the Sobel Edge Detection algorithm.
- Add the Frame Rate Display block from the Simulink Computer Vision System Toolbox (under the Sinks category) and connect it to the output of the algorithm as shown in the following figure.
- Simulate the model again to see the number of video frames processed per
- Try changing the input video through the From Multimedia File block by
double-clicking the block and changing the File Name field to select a different
video. Notice that changing the video resolution in the Source block does not
require any structural modifications to the algorithm itself.Note: You must stop simulation before you can change the input file. Also, the .mp4 files in the MATLAB vision data tool box directory are not supported.