Digital image improved bilateral filtering method based on FPGA
By grouping on FPGAs and simplifying the filter coefficients of the bilateral filtering algorithm, and using Gaussian filters to reduce noise interference, the calculation complexity and resource occupation problems of the bilateral filtering algorithm on FPGAs are solved, and efficient image noise suppression and edge retention are achieved. .
Patent Information
- Application Number
- CN202411369707.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2025-01-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing bilateral filtering algorithm has high computational complexity on FPGAs and occupies a lot of logical resources, resulting in insufficient ability to process image noise signals in real time.
By setting up pixel data windows, grouping pixel points, simplifying the filter coefficients using segmentation functions and fixed-pointing methods, storing them in the lookup table, and using Gaussian filters to generate low-pass boot images to reduce noise interference and calculate improved filter coefficients.
It significantly reduces the FPGA logic resource occupancy, improves the real-time and processing efficiency of the algorithm, and can run in real time on low-cost FPGAs, suppresses noise and preserves image edge details.
Smart Images

Figure CN119313568A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of digital image processing, and in particular to an improved bilateral filtering method for digital images based on FPGA. Background Art
[0002] Digital images will be disturbed by noise signals during the process of acquisition, transmission and reception, and noise will affect the processing effects of other algorithms in the system. Therefore, image filtering and noise reduction is an indispensable and important part of the digital image processing system. The problems existing in the current image filtering algorithms include the processing of image detail information, computational complexity, preservation of edges in the image, blurring effects, etc. Common image filtering algorithms mainly include mean filtering, guided filtering, bilateral filtering, Gaussian filtering, median filtering, etc. Among them, compared with other filtering methods, bilateral filtering is a filtering method that simultaneously considers the geometric distance between pixels and the difference in pixel values, and can well retain the edge information in the image while suppressing image noise.
[0003] However, the calculation expression of the bilateral filter is relatively complex. The filter weight coefficient corresponding to each pixel point needs to undergo multiple multiplication, division and exponential operations, and the calculation complexity is relatively high.
[0004] For bilateral filtering implemented on FPGA, the calculation of the filter coefficient for each pixel is a bottleneck problem in the implementation process, which will occupy a large amount of FPGA on-chip logic resources and produce a long delay time, which is not conducive to real-time processing of noise signals in the image. Therefore, an improved bilateral filtering algorithm that can be implemented on FPGA has good research significance and practical value. Summary of the invention
[0005] In order to solve the above problems existing in this field, the present invention proposes a digital image improved bilateral filtering method based on FPGA.
[0006] The technical solution of the present invention is as follows: A digital image improved bilateral filtering method based on FPGA, comprising the following steps:
[0007] Set the size of the bilateral filter convolution template and pixel data window;
[0008] Generate a pixel data window corresponding to the size and determine the position of the central pixel point;
[0009] The input image pixels in the pixel data window are grouped according to the geometric distance of each pixel to the central pixel;
[0010] Simplify the value domain filter coefficients and spatial domain filter coefficients of pixel points by piecewise function and low bit width fixed point method, and store them in the lookup table;
[0011] The grouped images are filtered using a Gaussian filter to generate a low-pass guided image;
[0012] The low-pass guide image and the original grouped image are input into the bilateral filter together to obtain the filter coefficient of the improved bilateral filter; the improved range filter coefficient is calculated according to the difference between the gray values of the two; each group of pixel points in the pixel data window is combined with the corresponding spatial domain filter coefficient and the improved range filter coefficient, and weighted average is performed to finally obtain the bilateral filtering result of the pixel data window.
[0013] The filter coefficients of the improved bilateral filter are calculated as follows:
[0014]
[0015] Where W(i,j) represents the filter coefficient of the improved bilateral filter, (m,n) represents the coordinates of the central pixel point of the pixel data window, (i,j) represents the coordinates of the remaining pixels in the pixel data window, SD(m,n,i,j) represents the geometric distance between two pixels, f(m,n) represents the grayscale value corresponding to the pixel point in the original image, and f g (i, j) represents the gray value corresponding to the pixel in the low-pass guidance image, s d is the spatial standard deviation, s r is the standard deviation of the range.
[0016] The simplified range filter coefficients are stored in a lookup table; the difference in the grayscale values of the pixel points is used as the input of the lookup table, and the corresponding range filter coefficients are used as the output.
[0017] The spatial domain standard deviation is set to 1.0; the value range standard deviation is set to 15-90.
[0018] The grouping is to group pixels in the pixel data window having the same geometric distance from the central pixel into one group.
[0019] The size of the pixel data window is 5×5; the pixels in the 5×5 pixel data window are divided into 7 groups, among which the central pixels are listed as a group; all the pixels in the pixel data window are taken out within one system clock cycle; the output of each group of pixels is controlled by a multiplexer, and one pixel is taken out in each quadruple frequency clock cycle; the bit selection signal of the multiplexer is given by a counter driven by a quadruple frequency clock signal.
[0020] The simplified calculation of the range filter coefficient is specifically as follows: firstly, the maximum bit width of the range filter coefficient is set to 6 bits and the maximum value is 63 by using the fixed-point method; and the range filter coefficient is estimated by using a piecewise function.
[0021] The piecewise function is as follows, where G r (i, j) represents the range filter coefficients that have not been simplified by the piecewise function, AG r (i, j) represents the simplified range filter coefficient;
[0022]
[0023] The spatial domain filter coefficient is proportional to the geometric distance from each pixel point in the pixel data window to the central pixel point.
[0024] The range filter coefficient is inversely proportional to the grayscale value difference between each pixel point and the central pixel point in the pixel data window.
[0025] Compared with the prior art, the present invention has the following beneficial effects:
[0026] 1. The present invention improves bilateral filtering to solve the problem that the on-chip logic resources of FPGA are limited and unsuitable for completing nonlinear floating-point operations. First, the input data is grouped and the system is changed to parallel synchronous processing of multiple groups of data channels, which improves the data throughput and the real-time performance of filtering;
[0027] 2. The filter coefficients are simplified by means of piecewise functions and fixed-point conversion, which reduces the number of filter coefficients required and reduces the occupancy rate of FPGA logic resources;
[0028] 3. Pre-calculate the spatial domain filter coefficients and value range filter coefficients of bilateral filtering and store them in the lookup table, which significantly reduces the computational complexity of the algorithm, effectively alleviates the real-time computing pressure of the system, and improves the real-time performance of the algorithm processing;
[0029] 4. Use the Gaussian filter to process the original input image and generate the corresponding low-pass guided image as the input of the bilateral filter. The difference in grayscale between the two is used to further reduce the interference of the noise signal on the value range filtering of the bilateral filter, thereby improving the filtering effect of the filter.
[0030] The present invention can run the improved bilateral filtering algorithm in real time on a low-cost FPGA with less logic resources, and can suppress image noise while retaining edge details in the image as much as possible. The present invention has good application value for industrial field real-time detection scenarios with high real-time performance, low cost, low power consumption and other requirements. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 It is the overall flow chart of the method of the present invention;
[0032] Figure 2 It is a structural framework diagram of the method of the present invention;
[0033] Figure 3 This is a simplified diagram of a piecewise function. DETAILED DESCRIPTION
[0034] Referring to the following specific embodiments, the main calculation formula of the bilateral filter convolution template of the digital image improved bilateral filtering method based on FPGA is as follows:
[0035]
[0036] Among them, W(i,j) represents the filter coefficient of the convolution template, (m,n) represents the coordinates of the central pixel point of the pixel data window, (i,j) represents the coordinates of the remaining pixels in the window, SD(m,n,i,j) represents the geometric distance between two pixels, f(m,n) and f g (i, j) represent the grayscale values corresponding to the pixels in the original image and the low-pass guided image, respectively. d is the spatial standard deviation, s r is the standard deviation of the range.
[0037] The specific implementation mode of the present invention is as follows Figure 1 and Figure 2 As shown, the following steps are included:
[0038] S1. Generate a pixel data window of size 5×5 through modules such as FIFO IP core, and locate the central pixel point of the window;
[0039] S2, grouping pixels according to the geometric distance from each pixel to the central pixel;
[0040] S3, simplifying the value domain filter coefficient of the pixel point by a piecewise function, simplifying the spatial domain filter coefficient of the pixel point by a low-bit width fixed-point method, and storing the simplified filter coefficient in a lookup table; the simplified piecewise function is as follows Figure 3 As shown; G r (i, j) represents the range filter coefficients that have not been simplified by the piecewise function, AG r (i, j) represents the simplified range filter coefficient;
[0041]
[0042] S4, performing Gaussian filtering on the input image to generate a low-pass guided image, which is used as the input of the bilateral filter;
[0043] S5, the low-pass guide image and the original input image are input into a bilateral filter, and the filter weight value of each pixel is determined according to the filter coefficient pre-stored in the lookup table;
[0044] S6. Perform weighted averaging on the pixel points in the pixel data window to obtain the final bilateral filtering result. Specifically, the calculation formula of the output result is:
[0045]
[0046] Among them, O(m,n) represents the grayscale value corresponding to the output pixel, and W(i,j) represents the filter weight coefficient.
Claims
1. An improved bilateral filtering method for digital images based on FPGA, characterized in that: The following steps are involved: Set the size of the bilateral filter convolution template and pixel data window; Generate a pixel data window corresponding to the size and determine the position of the central pixel point; The input image pixels in the pixel data window are grouped according to the geometric distance of each pixel to the central pixel; Simplify the value domain filter coefficients and spatial domain filter coefficients of pixel points by piecewise function and low bit width fixed point method, and store them in the lookup table; The grouped images are filtered using a Gaussian filter to generate a low-pass guided image; The low-pass guide image and the original grouped image are input into the bilateral filter together to obtain the filter coefficient of the improved bilateral filter; the improved range filter coefficient is calculated according to the difference between the gray values of the two; each group of pixel points in the pixel data window is combined with the corresponding spatial domain filter coefficient and the improved range filter coefficient, and weighted average is performed to finally obtain the bilateral filtering result of the pixel data window.
2. The improved bilateral filtering method for digital images based on FPGA according to claim 1, characterized in that: The filter coefficients of the improved bilateral filter are calculated as follows: Where W(i,j) represents the filter coefficient of the improved bilateral filter, (m,n) represents the coordinates of the central pixel point of the pixel data window, (i,j) represents the coordinates of the remaining pixels in the pixel data window, SD(m,n,i,j) represents the geometric distance between two pixels, f(m,n) represents the grayscale value corresponding to the pixel point in the original image, and f g (i, j) represents the gray value corresponding to the pixel in the low-pass guidance image, s d is the spatial standard deviation, s r is the standard deviation of the range.
3. The improved bilateral filtering method for digital images based on FPGA according to claim 2, characterized in that: The simplified range filter coefficients are stored in a lookup table; the difference in the grayscale values of the pixel points is used as the input of the lookup table, and the corresponding range filter coefficients are used as the output.
4. The FPGA-based digital image improved bilateral filtering method according to claim 2 or 3, characterized in that: The spatial domain standard deviation is set to 1.0; the value range standard deviation is set to 15-90.
5. The improved bilateral filtering method for digital images based on FPGA according to claim 1, characterized in that: The grouping is to group pixels in the pixel data window having the same geometric distance from the central pixel into one group.
6. The improved bilateral filtering method for digital images based on FPGA according to claim 5, characterized in that: The size of the pixel data window is 5×5; the pixels in the 5×5 pixel data window are divided into 7 groups, among which the central pixels are listed as a group; all the pixels in the pixel data window are taken out within one system clock cycle; the output of each group of pixels is controlled by a multiplexer, and one pixel is taken out in each quadruple frequency clock cycle; the bit selection signal of the multiplexer is given by a counter driven by a quadruple frequency clock signal.
7. The improved bilateral filtering method for digital images based on FPGA according to claim 3, characterized in that: The simplified range filter coefficient is calculated as follows: Firstly, the maximum bit width of the range filter coefficient is set to 6 bits and the maximum value is 63 by using the fixed-point method; the range filter coefficient is estimated by using the piecewise function.
8. The improved bilateral filtering method for digital images based on FPGA according to claim 7, characterized in that: The piecewise function is as follows, where G r (i, j) represents the range filter coefficients that have not been simplified by the piecewise function, AG r (i, j) represents the simplified range filter coefficient; 9. The improved bilateral filtering method for digital images based on FPGA according to claim 2, characterized in that: The spatial domain filter coefficient is proportional to the geometric distance from each pixel point in the pixel data window to the central pixel point.
10. The improved bilateral filtering method for digital images based on FPGA according to claim 2, characterized in that: The range filter coefficient is inversely proportional to the grayscale value difference between each pixel point and the central pixel point in the pixel data window.