Implementation of Sobel filtering algorithm based on Vivado HLS in Zedboard
Platform: Zedboard + Webcam
Tools: g++4.6 + VIVADO HLS + Xilinx EDK + Xilinx SDK
System: ubuntu12.04
Overall design ideas
Theoretical basis of Sobel algorithm
Cable Bell operator ( Sobel operator ) is primarily used for edge detection, Technically, it is a discrete difference operator that is used to calculate the approximate value of the grayscale of the image luminance function. Using this operator at any point in the image will result in a corresponding grayscale vector or its normal vector.
This operator contains two sets of Span style= "color:black; letter-spacing:0.4pt; font-family: ' Arial ', ' Sans-serif ' ">3x3 The matrix, which is transverse and longitudinal, is a plane convolution with the image, and the luminance difference approximation of transverse and longitudinal can be obtained respectively. If a represents the original image, GX gy
Gx = ( -1) *f (x-1, y-1) + 0*f (x,y-1) + 1*f (x+1,y-1)
+ ( -2) *f (x-1,y) + 0*f (x, y) +2*f (x+1,y)
+ ( -1) *f (x-1,y+1) + 0*f (x,y+1) + 1*f (x+1,y+1)
= [F (x+1,y-1) +2*f (x+1,y) +f (x+1,y+1)]-[f (x-1,y-1) +2*f (x-1,y) +f (x-1,y+1)]
Gy =1* F (x-1, y-1) + 2*f (x,y-1) + 1*f (x+1,y-1)
+0*f (x-1,y) 0*f (x, y) + 0*f (x+1,y)
+ ( -1) *f (x-1,y+1) + ( -2) *f (x,y+1) + ( -1) *f (x+1, y+1)
= [F (x-1,y-1) + 2f (x,y-1) + f (x+1,y-1)]-[f (x-1, y+1) + 2*f (x,y+1) +f (x+1,y+1)]
which F (A, b), represents an image (A, b) the gray value of the point;
The horizontal and vertical gray values of each pixel of the image are combined with the following formula to calculate the gray size of the point:
in general, in order to improve efficiency use an approximate value that does not open the square:
if the gradient G greater than a certain threshold It is considered that the point (x, y) is an edge point.
The gradient direction can then be calculated using the following formula:
Sobel The operator detects the edge by reaching the extremum at the edge, according to the Gray weighted difference between the top, the left and right points of the pixel. It has smooth effect on noise, provides accurate edge orientation information and low edge positioning accuracy. When the accuracy requirement is not very high, it is a more common method of edge detection.
validation and implementation of process HLS algorithm
The algorithm verification includes the algorithm C + + implementation, the synthesis compiles the simulation, realizes the export pcore for------->xlinx EDK
EDK Hardware Engineering Building
EDK in the main building Zedboard hardware platform, the implementation of VDMA (with Axi-stream), hdmi,ddr and so on, to generate System.bit, with Uboot, FSBL generation Zedboard bootload (BOOT. BIN).
Reference:
Zedboard Start-up process analysis: http://blog.csdn.net/xiabodan/article/details/23093111
Zedboard Building Embedded linux:http://blog.csdn.net/xiabodan/article/details/23379645
LINUX System porting
Prepare a >8g SD card with partition FAT32+EXT4 (where EXT4 is the file system >4gb,fat partition as the kernel device tree bootloader) can be done with the GParted partition tool Apt-get install GParted
System porting includes kernel image compiling, bootloader porting, device tree compiling, file system porting
Specific porting steps See: http://blog.csdn.net/xiabodan/article/details/23379645
Kernel image address: git clone http://github.com/Digilent/linux-3.3.digilent.git
Uboot Source: Git clone git://git.xiinx.com/u-boot-xarm.git click Open Link click Open Link click Open link
The device tree can be found in the kernel, the device tree, the kernel image, BOOT. Bin is copied to the FAT partition in the SD card
File system: http://releases.linaro.org/images/12.04 copied directly to SD card in EXT4 partition
LINUX VDMA Driver Application Authoring and implementation
The driver is written so that we can manage and control the VDMA in PS. The premise is that we have done all the relevant hardware design and so on at the bottom.
Porting OpenCV Library: For comparing the processing speed comparison of FPGA algorithm, there are two methods to transplant OpenCV Library,
1:apt-get Install Libopencv-dev PYTHON-OPENCV (for Python)
2: Download source code compilation
Source Address: http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/
Compile step Reference: based on OpenCV webcam in ubuntu video get http://blog.csdn.net/xiabodan/article/details/38875875
Reference
Using HLS various questions: http://blog.csdn.net/xiabodan/article/details/38448589
Sobel Filter application on the Xilinx Zynq zedboard:http://shakithweblog.blogspot.com/2012/12/ Getting-sobel-filter-application.html
Sobel Edge detection algorithm: http://www.cnblogs.com/lancidie/archive/2011/07/17/2108885.html
Implementation of Sobel filtering algorithm based on Vivado HLS in Zedboard