13.07.2015 Views

XAPP1167

XAPP1167

XAPP1167

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Steps to Accelerate an OpenCV ApplicationStep 1. Create new designThe ‘demo’ design includes the basic structure for combinations of image processing functions.To create the new erode design, copy the demo design directory in sw directory:$ cd ${VIDEO_HOME}/sw$ cp –r demo erode$ cd erodeEdit the source file opencv_top.cpp, modify the 5 pipeline functions to just single erodefunction:void opencv_image_filter(IplImage* src, IplImage* dst) {cvErode(src, dst);}Edit the source file top.cpp in the same way:void image_filter(AXI_STREAM& input,AXI_STREAM& output,int rows,int cols) {//Create AXI streaming interfaces for the core#pragma HLS RESOURCE variable=input core=AXISmetadata="-bus_bundle INPUT_STREAM"#pragma HLS RESOURCE variable=output core=AXISmetadata="-bus_bundle OUTPUT_STREAM"#pragma HLS RESOURCE core=AXI_SLAVE variable=rowsmetadata="-bus_bundle CONTROL_BUS"#pragma HLS RESOURCE core=AXI_SLAVE variable=colsmetadata="-bus_bundle CONTROL_BUS"#pragma HLS RESOURCE core=AXI_SLAVE variable=returnmetadata="-bus_bundle CONTROL_BUS"#pragma HLS INTERFACE ap_stable port=rows#pragma HLS INTERFACE ap_stable port=colsRGB_IMAGE img_0(rows, cols);RGB_IMAGE img_1(rows, cols);hls::AXIvideo2Mat(input, img_0);hls::Erode(img_0, img_1);hls::Mat2AXIvideo(img_1, output);}Note: In the new top.cpp, we use the corresponding function in hls namespace to erode an image.Run C simulation to verify the algorithm:$ make simIt will build a test to run hls::Erode to generate an output image to compare with the goldenimage generated by OpenCV function cvErode. See “Test passed!” to verify the two imagesare exactly the same. It is also recommended to view the output images to verify the result oferode.Step 2. Build OpenCV application for ARMTo cross-build ARM applications on host, the ARM GNU tools must be installed. The ARM GNUtools are included with the Xilinx Software Development Kit (SDK). The opencv_install directoryalso includes the precompiled version of OpenCV library for ARM at${VIDEO_HOME}/opencv_install/arm. For more information on using ARM GNU tools orbuilding OpenCV library, please refer to http://opencv.org/.For this design, run the following make rule to build the ARM application:$ make elf<strong>XAPP1167</strong> (v2.0) August 27, 2013 www.xilinx.com 12

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!