An image bilateral filtering method implemented using FPGA
By using a filter template composed of a small amount of weight coefficients on the FPGA and using the threshold judgment mechanism, the problem of large resource consumption and insufficient real-time performance of the bilateral filtering method is solved, and efficient image bilateral filtering processing is achieved.
Patent Information
- Application Number
- CN202111618470.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-28
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2041-12-28
AI Technical Summary
In the prior art, the formula of the bilateral filtering method implemented by FPGA is too complex, the hardware resource consumption is large, and the real-time performance is insufficient.
A small amount of weight coefficients is used to form a filter template, which is directly solidified in the FPGA program, and the template is selected through the threshold judgment mechanism to achieve low resource consumption, small calculation amount and high real-time performance.
It realizes efficient bilateral image filtering on FPGA, reducing the storage requirements of weight coefficients and computing resource consumption, and improving real-time performance.
Smart Images

Figure CN114359117B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to an image bilateral filtering method implemented using an FPGA. Background Art
[0002] Image filtering processing is to filter the video images obtained by an imaging device, such as removing the values of unwanted pixels in the image (such as denoising), or enhancing the values of pixels in a certain area of the image (such as edge extraction). Image filtering processing methods mainly include: mean filtering, median filtering, maximum and minimum filtering, bilateral filtering, guided filtering, etc. Among them, bilateral filtering is a non-linear filter, which can achieve the effects of preserving edges and denoising and smoothing. Like other filtering principles, bilateral filtering also uses the method of weighted average, and uses the weighted average of the brightness values of surrounding pixels to represent the intensity of a certain pixel. The weighted average used is based on the Gaussian distribution. Most importantly, the weights of bilateral filtering not only consider the Euclidean distance of pixels (such as ordinary Gaussian low-pass filtering, which only considers the influence of position on the central pixel), but also consider the radiation difference in the pixel range domain (such as the similarity degree, color intensity, depth distance, etc. between the pixels in the convolution kernel and the central pixel), and these two weights are considered simultaneously when calculating the central pixel. Therefore, the bilateral filter can well preserve the pixel values near the edge while denoising.
[0003] However, the expression of the bilateral filter is too complex, and the weight values at each position of the image need to perform multiple exponential and division operations. Implementing a real-time filtering algorithm on a serial-structured processor such as an ARM or a DSP is very time-consuming. For a system with high real-time requirements, it is easier to meet the requirements by implementing it in hardware. Due to its powerful data parallel processing ability and the structural characteristics of the pipeline, FGPA can effectively improve the running speed of the algorithm, thereby improving the real-time performance of image processing. Summary of the Invention
[0004] In view of the above-mentioned defects of the prior art, the technical problems to be solved by the present invention are that the formula for realizing the bilateral filtering effect is too complex, the hardware implementation consumes a large amount of resources, and the real-time performance is insufficient.
[0005] To solve the above problems, the present invention provides the following technical solutions:
[0006] An image bilateral filtering method implemented using an FPGA, including the steps of:
[0007] S1. Generate a filtering template through the following calculations and store it inside the FPGA;
[0008]
[0009] Among them, ω(i,j,k,l) represents the weighting coefficient of the filtering template, (k,l) represents the center coordinates of the template window, (i,j) represents the other coordinates of the template window, f(i,j) and f(k,l) represent the corresponding gray values at this point, and σ d is the distance standard deviation, and σ r is the gray standard deviation.
[0010] S2. Generate a data window with the same size as the filtering template, and determine the pixel at the center point of the window;
[0011] S3. Calculate the mean difference between the gray value of the pixel at the center point of the data window and the gray values of its neighboring pixels;
[0012] S4. Compare the mean gray difference with a predefined threshold to select a filtering template;
[0013] S5. Convolve the selected filtering template with the window data to complete bilateral filtering.
[0014] Furthermore, the selection of the threshold in step S4 adopts any one of the bimodal method, P-parameter method, maximum inter-class variance method, maximum entropy threshold method, and iterative method.
[0015] Furthermore, the number of filtering templates in step S1 is 2 to 3.
[0016] Furthermore, the size of the filtering template in step S1 is 3×3 or 5×5 or 7×7.
[0017] Furthermore, the gray standard deviation and the distance standard deviation are set to fixed values.
[0018] Furthermore, the gray standard deviation σ r is 5 to 30.
[0019] Furthermore, the distance standard deviation σ d is 1 to 3.
[0020] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0021] The method provided by the present invention uses a small number of weighting coefficients to form a filtering template, which is directly solidified in the FGPA program, and then a template is selected through a threshold judgment mechanism, which can achieve low resource consumption, small calculation amount, and high real-time performance, and solves the problem that the bilateral filtering method implemented by FPGA in the prior art needs to store a large number of weighting coefficients and query parameters through a lookup table during operation, consuming a large amount of resources. Description of the Drawings
[0022] Figure 1 is a flowchart of image data calculation and processing according to a preferred embodiment of the present invention;
[0023] Figure 2 It is a schematic diagram of the selected window in another preferred embodiment of the present invention.
[0024] Figure 3 It is the image filtering result in another preferred embodiment of the present invention. Specific Embodiments
[0025] The following introduces multiple preferred embodiments of the present invention with reference to the accompanying drawings of the specification to make its technical content clearer and easier to understand. The present invention can be embodied in many different forms of embodiments, and the protection scope of the present invention is not limited to the embodiments mentioned in the text.
[0026] The present invention provides an image bilateral filtering method implemented using an FPGA, including the following steps:
[0027] S1. Generate a filtering template through formula calculation and store it inside the FPGA; the calculation formula of the filtering template is:
[0028]
[0029] Among them, ω(i,j,k,l) represents the weighting coefficient of the filtering template, (k,l) represents the center coordinates of the template window, (i,j) represents the other coordinates of the template window, f(i,j) and f(k,l) represent the corresponding gray values of this point, and σ d is the distance standard deviation, and σ r is the gray standard deviation; preferably, the distance standard deviation and the gray standard deviation adopt fixed values, and more preferably, the distance standard deviation σ d is selected to be between 1 and 3, and the gray standard deviation σ r is selected to be between 5 and 30 to ensure that the distance between the neighboring pixel points and the center point is within [-3σ d , 3σ d , and the gray difference is within [-3σ r , 3σ r .
[0030] Preferably, the number of generated filtering templates is 2 to 3, specifically 2 or 3; more specifically, the size of the filtering template is 3×3 or 5×5 or 7×7.
[0031] S2. Generate a data window with the same size as the filtering template; specifically, select the FIFO method or the IP core of the shift register to generate the window. Figure 2 The shown is a schematic diagram of a 5×5 data window.
[0032] S3. Calculate the average value of the gray difference between the pixel gray value at the center point of the data window and the gray values of its neighboring pixels.
[0033] S4. Select a filtering template according to the comparison between the mean gray difference and the predefined threshold. Preferably, the threshold can be determined by any one of the following methods: bimodal method, P-parameter method, maximum between-class variance method, maximum entropy threshold method, and iterative method. Specifically, if the mean gray difference is greater than or equal to the threshold, select the filtering template with the larger value of σ; if the mean gray difference is less than the threshold, select the filtering template calculated with the smaller value of σ. r The filtering template with the larger value of σ; if the mean gray difference is less than the threshold, select the filtering template calculated with the smaller value of σ. r The filtering template calculated with the smaller value.
[0034] S5. Complete bilateral filtering by convolving the selected filtering template with the window data. Specifically, the calculation formula for bilateral filtering g(i, j) is:
[0035]
[0036] where (i, j) represents the coordinates of the center point of the window, (k, l) represents the coordinates of a certain point in the sliding window, f(i, j) represents the gray value corresponding to this point, and ω(i, j, k, l) represents the weighting coefficient of the filtering template.
[0037] Figure 1 The figure shows the calculation flow chart of the bilateral filtering method provided by the present invention. Figure 3 The figure shows the filtering results of the original image using different filtering templates. Two 5×5 filtering templates are used. Among them, the distance standard deviation σ d is 2, and the gray standard deviation σ r is 5 and 20. When performing convolution calculation, the insufficient edges of the original image are filled with 0 pixels.
[0038] The above has described in detail the preferred specific embodiments of the present invention. It should be understood that those of ordinary skill in the art can make many modifications and variations according to the concept of the present invention without creative labor. Therefore, all technical solutions that can be obtained by those skilled in the art in the technical field of the present invention based on the concept of the present invention through logical analysis, reasoning, or limited experiments on the basis of the prior art should be within the protection scope determined by the claims.
Claims
1. An image bilateral filtering method implemented using an FPGA, characterized in that, Including the steps: S1. Generate a filtering template through the following calculations and store it inside the FPGA; Among them, ω(i, j, k, l) represents the weighting coefficient of the filtering template, (k, l) represents the center coordinates of the template window, (i, j) represents the other coordinates of the template window, f(i, j) and f(k, l) represent the corresponding gray values at this point, and σ d is the standard deviation of the distance, and σ r is the standard deviation of the gray value; the number of the filtering templates is 2 to 3; S2. Generate a data window with the same size as the filtering template and determine the central pixel of the window; S3. Calculate the mean difference between the gray value of the central pixel of the data window and the gray values of its neighboring pixels; S4. Select a filtering template according to the comparison between the mean gray difference and a predefined threshold; S5. Complete bilateral filtering by convolving the selected filtering template with the window data.
2. The image bilateral filtering method according to claim 1, characterized in that, The threshold in step S4 is selected by any one of the following methods: the bimodal method, the P-parameter method, the maximum inter-class variance method, the maximum entropy threshold method, and the iterative method.
3. The image bilateral filtering method according to claim 1, characterized in that, The size of the filtering template in step S1 is 3×3 or 5×5 or 7×7.
4. The image bilateral filtering method according to claim 1, wherein The gray standard deviation and the distance standard deviation are set to fixed values.
5. The image bilateral filtering method according to claim 4, wherein The standard deviation of gray scale σ r is 5 to 30.
6. The image bilateral filtering method according to claim 5, characterized in that The distance standard deviation σ d is from 1 to 3.
Citation Information
Patent Citations
Dense matching method using confidence weight-based bilateral filtering
CN107506782A
Method and apparatus for implementing bilateral image filtering in FPGA, and FPGA
WO2020057062A1