Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Simulink to quickly build a hardware accelerated Simulation platform for Video processing

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to use Simulink to quickly build a hardware accelerated simulation platform for video processing. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

Text:

First of all, let's create a new Simulink model and configure it according to the settings mentioned in the previous lecture.

Then double-click in the space, enter and add the following modules:

Image From File

Frame To Pixels

Pixels to Frame

Video Reviewer

Embedded Subsystem

Put Video Reviewer into Enabled Subsystem, as shown in the following figure

Then connect all the modules as shown below. Here the input to each module contains two: pixel and ctrl. Pixel represents the corresponding pixel value, and the ctrl signal will indicate the start and end of the row, the start and end of the column, and the valid signal. Students who do not understand can refer to Mathwork's instructions on the video interface control bus https://www.mathworks.com/help/visionhdl/ug/pixelcontrol-bus.html.

Then we need to set up the Image From File module and double-click it. Set up File Name,Sample time in the following figure.

Next set Frame To Pixels and Pixels To Frame module, because we use the picture format is RGB240p, so we double-click on the module after the pop-up configuration window to select Video Format for 240pje RGB has 3 channels, so Number of components fill in 3. Pixels To Frame is the same. For those of you who don't know much about the video format, I suggest you read the Video format section of Matlab's Frame To Pixels document, with the following link

Https://www.mathworks.com/help/visionhdl/ref/frametopixels.html

Next, we set the simulation parameters, right-click in the blank, and select Model Properties.

Then we fill in the following code in InitFcn (initialization function) in Callbacks, so that we can automatically get parameters such as image length and width by changing the format of VideoFormat.

After completion, we set the simulation time to totalPixels in the configuration bar of Simulink Model (that is, the one configured in the previous step), and the simulation mode is selected as Accelerator mode.

At this point, we can test the simulation path and use ctrl+D to verify the integrity of the model after saving it. If there is no error, you can click the start button to start the simulation. If nothing happens, we will see the following picture

Now that the video channel has been successfully built, we can start to add our own RGBGREY module.

Students who are familiar with digital image processing must know that the formula for converting RGB images into grayscale images is as follows

GREY=0.299*R+0.587*G+0.114*B . So we build the conversion module as follows

The function of the Delay module is equivalent to the register module. The RGB signal is input through pixelIn, multiplied by the multiplier and the corresponding constant, and summed by the Sum of Element module. The following Data Type Conversion module intercepts the 8 digits before the decimal point, that is, it is converted to the type of uint8. Control Bus should also have a corresponding delay to ensure that the timing remains the same. (why two registers are used for delay and the replacement of multipliers will be mentioned later. We encapsulate this part of the module in a subsystem (select the module you want to encapsulate and right-click to select Create Subsystem from Selection). So far, the construction of our algorithm has been completed, as shown in the following figure. Since the grayscale image is single-channel, don't forget to change the number of channels in Pixel To Frame to 1.

At the beginning of the simulation, Video Reviewer will display the following image, indicating that our conversion algorithm has been verified successfully.

Description: 1. Careful students may find that when implementing the RGBGREY algorithm, when you double-click to add modules, all modules are from HDL Coder Toolbox. You can go to the official website to see more examples and be familiar with the support features. 2.MathWorks provides a set of hardware framework corresponding to the above model to enable users to quickly build algorithm verification test platform, mainly from Xilinx Zynq Support from Computer Vision Toolbox. The green and yellow parts shown in the previous figure model can not be integrated into hardware code, but should be adapted to the corresponding Zynq framework. As long as users develop algorithms according to the interface, that is, pixel and ctrl, they can easily use the hardware support package to deploy to FPGA.

On how to use Simulink to quickly build video processing hardware acceleration simulation platform to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report