This time, we will combine Build and Install OpenCV in Vitis HLS 2022.2 and PYNQ-Z2 HDMI Usage - 2: HDMI Passthrough to perform real-time Sobel filter image processing.
Vitis HLSBased on Build and Install OpenCV in Vitis HLS 2022.2, we can directly execute Run Implementation.
Then, the IP generated through Vitis HLS will be located in the solution1/impl/ip folder.
Vivado Block DesignWe can first import the HLS IP generated earlier into Vivado.
Then, following the Block Design outlined in PYNQ-Z2 HDMI Usage - 2: HDMI Passthrough, add the imported IP as an extra component.
Finally, run Connection Automation to automatically connect the blocks.
Next, follow the standard Vivado design process: Synthesis ---> Implementation ---> Generate Bitstream, then export the XSA to Vitis.
VitisBased on PYNQ-Z2 HDMI Usage - 1: TPG Output and PYNQ-Z2 HDMI Usage - 2: HDMI Passthrough, build the Platform and Application in Vitis.
Since we're using the HLS IP, after building the Platform you'll find the file xhls_sobel_axi_stream_top.h in the directory
[Platform]\export[Platform]\sw[Platform]\standalone_domain\bspinclude\include
This file details how the HLS IP is initialized and describes its functions.
Consequently, in the Application, we need to import xhls_sobel_axi_stream_top.h and declare the XHls_sobel_axi_stream_top structure.
#include "xhls_sobel_axi_stream_top.h"
XHls_sobel_axi_stream_top example_ptr;
In the main function, initialize the Sobel filter and configure the resolution.
// Initialize module
Status = XHls_sobel_axi_stream_top_Initialize(&example_ptr, XPAR_HLS_SOBEL_AXI_STREAM_0_DEVICE_ID);
if (Status != XST_SUCCESS) {
xil_printf("Example Initialization Failed\r\n");
return XST_FAILURE;
}
// Set Resolution
XHls_sobel_axi_stream_top_Set_rows(&example_ptr, 1080);
XHls_sobel_axi_stream_top_Set_cols(&example_ptr, 1920);
Run Sobel filter IP.
XHls_sobel_axi_stream_top_Start(&example_ptr);
XHls_sobel_axi_stream_top_EnableAutoRestart(&example_ptr);
Next, after building the complete program, flash it onto the PYNQ-Z2 board.
Reference
Comments
Please log in or sign up to comment.