Bilateral filtering control method and chip
By searching and calculating the similarity of image information in the sliding window, avoiding repeated calculations, the problem of excessive calculations of image bilateral filtering processing in embedded devices is solved, and efficient image processing is achieved.
Patent Information
- Application Number
- CN202111167542.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-07
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2041-10-07
AI Technical Summary
The prior art is difficult to efficiently perform bilateral filtering of images in embedded devices, especially in terms of calculation times and cache space.
By searching for neighboring pixels in a sliding window and calculating image information similarity, we avoid repeated calculations, reduce the number of calculations, and accelerate the calculation using preset step size and preconfigured exponential functions.
It significantly reduces the number of calculations of bilateral image filtering processing, improves processing speed, and is suitable for mobile terminal chips with small cache space.
Smart Images

Figure CN113902701B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image filtering, and in particular to a bilateral filtering control method and chip. Background Art
[0002] Bilateral filtering is a widely used filtering method for images. It is widely used in the initial filtering of images because of its high retention of image edges and good filtering effect on non-edge areas of images. However, it requires a large number of operations, involving exponential operations, square operations, and division operations. In actual practice, it is difficult to use in embedded devices. Summary of the invention
[0003] In view of the above technical defects, the present invention discloses a bilateral filtering control method and chip, which can effectively reduce the number of calculations, so that the built-in chip of the mobile terminal can be used to perform real-time bilateral filtering on the image. The specific technical solution is as follows:
[0004] A bilateral filtering control method comprises: when a sliding window is configured to translate within an image to be processed, starting from the pixel point currently covered by the center position of the sliding window, searching for neighborhood pixel points within the image area currently framed by the sliding window, and calculating the image information similarity between the currently searched neighborhood pixel points and the center pixel point in a non-repetitive manner, wherein the pixel point covered by the center position of the sliding window is configured as the center pixel point; the neighborhood pixel point is a pixel point located within the neighborhood of the center pixel point; wherein the image information similarity includes the gray value similarity and spatial domain proximity required by the bilateral filtering algorithm.
[0005] Compared with the prior art, in the process of sliding the window in the image to be processed to perform bilateral filtering, this technical solution prevents the phenomenon of repeated calculation of image information similarity between the same pair of pixels, significantly reduces the number of calculations, and is suitable for performing bilateral filtering on images on chips with small cache space. Among them, this pair of pixels includes the currently traversed neighborhood pixel and the center pixel.
[0006] Furthermore, whenever the sliding window is translated by a preset step size within the image to be processed, starting from the pixel point currently covered by the center position of the sliding window, neighborhood pixel points are searched within the image area currently framed by the sliding window, and the image information similarity between the currently searched neighborhood pixel points and the center pixel point is calculated in a non-repetitive manner, then it is determined that the sliding window has performed a sliding operation within the image to be processed; wherein the preset step size is configured to allow the existence of a partially overlapping image area between the image area framed before the sliding window performs a sliding operation and the image area framed after performing the sliding operation.
[0007] This technical solution controls the non-repetitive calculation of image information similarity between a pair of pixel points that may be repeatedly traversed and need to participate in the image information similarity calculation when the sliding window is translated in the image to be processed according to a preset step size, thereby improving the speed of image filtering processing. Among them, the neighborhood pixel points and the central pixel point in this pair of pixel points can be exchanged or updated with each other.
[0008] Furthermore, the method for calculating the image information similarity between the currently searched neighborhood pixel point and the center pixel point in a non-repetitive manner includes: whenever a center pixel point previously covered by the center position of the sliding window is searched in the image area framed by the sliding window, the grayscale value similarity between the previously covered center pixel point and the pixel point currently covered by the center position of the sliding window is not calculated, but the corresponding grayscale value similarity obtained based on the previously covered center pixel point as the center pixel point is set as the grayscale value similarity between the previously covered center pixel point and the pixel point currently covered by the center position of the sliding window; wherein the translation direction of the sliding window within the same row of the image to be processed remains unchanged.
[0009] This technical solution targets a pair of pixel points that may be repeatedly traversed within a sliding window and need to participate in the grayscale value similarity calculation, controls this type of pixel point pair to only calculate the grayscale value similarity once, and can configure the image information similarity calculated when the pair of pixel points is first traversed as the grayscale value similarity required to be obtained when the pair of pixel points is repeatedly traversed subsequently. Compared with the repeated calculation phenomenon existing in the prior art, the number of calculations is reduced by half, thereby increasing the calculation speed of all pixel points of the image to be processed.
[0010] Further, if the pixel point covered by the center position of the sliding window in the current sliding operation is updated by a neighborhood pixel point searched in a previously executed sliding operation, the pixel point covered by the center position of the sliding window in the current sliding operation is set as the first reference center pixel point, and at the same time, it is determined that the pixel point covered by the center position of the sliding window in the previously executed sliding operation belongs to a neighborhood pixel point that can be searched in the image area currently framed by the sliding window, and the pixel point covered by the center position of the sliding window in the previously executed sliding operation is set as the second reference center pixel point; wherein, in the previously executed sliding operation, the grayscale value similarity between the first reference center pixel point and the second reference center pixel point has been calculated; then, if in the sliding window When a neighborhood pixel point searched in the previously framed image area is updated by the center pixel point covered by the center position of the sliding window in the previously performed sliding operation, the grayscale value similarity between the aforementioned first reference center pixel point and the second reference center pixel point is directly updated to the grayscale value similarity between a currently searched neighborhood pixel point and the pixel point covered by the center position of the sliding window in the current sliding operation, and it is determined: the corresponding grayscale value similarity obtained based on the previously covered center pixel point as the center pixel point is updated to the grayscale value similarity between the previously covered center pixel point and the pixel point currently covered by the center position of the sliding window; wherein the center pixel point covered by the center position of the sliding window in the previously performed sliding operation is the center pixel point previously covered by the center position of the sliding window.
[0011] In the technical solution, the sliding window is translated by a preset step size in the current sliding operation relative to the previous sliding operation. When the image area currently framed by the sliding window contains the pixel currently covered by the center position of the sliding window (the center pixel covered by the sliding window in the current sliding operation) and the pixel previously covered by the center position of the sliding window (the center pixel covered by the sliding window in the previous sliding operation), it is determined that there are two center pixels mutually contained in the convolution kernel (the sliding window with the center pixel covered in the corresponding sliding operation as the center position) in the image area currently framed by the sliding window, namely, the aforementioned first reference center pixel and the second reference center pixel. For the gray value similarity between the pair of repeatedly traversed reference center pixels, the gray value similarity calculated at the first traversal is selected as the latest result, so as to avoid repeated calculation of the gray value similarity between a neighborhood pixel and a corresponding center pixel, wherein the neighborhood pixel and the corresponding center pixel support interchangeability in the corresponding sliding operation;
[0012] Furthermore, the method for calculating the grayscale value similarity between a neighborhood pixel point and a corresponding center pixel point is as follows: calculate the square of the difference between the grayscale value of the neighborhood pixel point and the grayscale value of the corresponding center pixel point to obtain square data of the grayscale change value; wherein the neighborhood pixel point is located in the image area framed by a sliding window with the corresponding center pixel point as the center position; then the square data of the grayscale change value is processed by ratio with twice the square of the pixel domain parameter, and then the obtained ratio is used as a parameter and input into a preconfigured exponential function, and then the exponential function value calculated by the CPU is set as the grayscale value similarity between a neighborhood pixel point and a corresponding center pixel point; wherein the pixel domain parameter is a Gaussian distribution parameter, which is used to limit the range of change of the grayscale value similarity.
[0013] The technical solution uses the square of the difference between the grayscale value of a neighborhood pixel point and the grayscale value of a corresponding center pixel point in the image area framed by the sliding window to describe the grayscale value similarity between the neighborhood pixel point and the corresponding center pixel point, wherein the square of the difference between the grayscale value of the neighborhood pixel point and the grayscale value of the corresponding center pixel point is configured as the independent variable of a preconfigured exponential function.
[0014] Furthermore, the method for calculating the image information similarity between the currently searched neighborhood pixel point and the central pixel point in a non-repetitive manner includes: when the sliding window has not started to translate within the image to be processed, within the initial image area framed by the entire sliding window within the image to be processed, starting from the pixel point currently covered by the center position of the sliding window, searching for neighborhood pixel points within the initial image area, calculating the spatial proximity between the neighborhood pixel points searched in sequence and the same central pixel point, and storing the calculated spatial proximity between the neighborhood pixel points located at different pixel positions within the initial image area and the same central pixel point in a preset memory space, so that the sliding window can directly call the corresponding spatial proximity when performing a sliding operation within the image to be processed later; before the sliding window starts to translate within the image to be processed and in each sliding operation performed according to the preset step size, the spatial proximity between the neighborhood pixel points and the corresponding central pixel points having the same relative position relationship within the image area framed by the sliding window within the image to be processed is equal. So that when the sliding window is subsequently translated within the image to be processed, the spatial proximity calculated in advance on the corresponding position relationship is called for the relative position relationship between the neighborhood pixel points traversed in real time and the pixel points covered in real time by the center position of the sliding window, thereby avoiding repeated calculation of the spatial proximity.
[0015] Furthermore, the method for calculating the spatial proximity between a neighborhood pixel point and a corresponding center pixel point is as follows: calculating the square of the difference between the horizontal coordinate of the neighborhood pixel point and the horizontal coordinate of the corresponding center pixel point to obtain the square of the pixel horizontal axis distance; wherein the neighborhood pixel point is located in the image area framed by the sliding window centered on the corresponding center pixel point; calculating the square of the difference between the vertical coordinate of the neighborhood pixel point and the vertical coordinate of the corresponding center pixel point to obtain the square of the pixel vertical axis distance; then performing ratio processing on the sum of the square of the pixel horizontal axis distance and the square of the pixel vertical axis distance and twice the square of the spatial domain parameter, and then inputting the obtained ratio as a parameter into a preconfigured exponential function, and then setting the exponential function value calculated by the CPU as the spatial proximity between a neighborhood pixel point and a corresponding center pixel point; wherein the spatial domain parameter is a spatial domain parameter in the Euclidean distance formula, and is used to limit the range of variation of the spatial proximity.
[0016] The technical solution uses the square of the distance between a neighborhood pixel point and a corresponding center pixel point in an image area framed by a sliding window to describe the spatial proximity between the neighborhood pixel point and the corresponding center pixel point, wherein the square of the distance between the pixel position of the neighborhood pixel point and the pixel position of the corresponding center pixel point is configured as the independent variable of a preconfigured exponential function.
[0017] Furthermore, for a sliding operation performed by the sliding window, the bilateral filtering control method also includes: configuring the product of the grayscale similarity and spatial proximity between a currently searched neighborhood pixel point and its corresponding center pixel point as the weight of the grayscale value of the currently searched neighborhood pixel point at the pixel position; accumulating the products of the grayscale similarity and spatial proximity between each searched neighborhood pixel point and the pixel point currently covered by the center position of the sliding window in the image to be processed, and then configuring the accumulated result as the total weight; then accumulating the products of the grayscale value of each searched neighborhood pixel point at the pixel position and the configured weight, and then configuring the accumulated result as the weighted sum of the grayscale values of all the searched neighborhood pixel points; then, setting the ratio of the weighted sum of the grayscale values of all the searched neighborhood pixel points to the total weight as the result of a bilateral filtering; wherein, the currently searched neighborhood pixel point is located in the image area framed by the sliding window with the corresponding center pixel point as the center position.
[0018] This technical solution uses the product of gray value similarity and spatial proximity as the weight of the gray value at the corresponding pixel position of the image to be processed, and then uses the weight to perform weighted average processing on the gray value of the corresponding pixel point, so that the weighted average result is the result of a bilateral filtering of the image to be processed. It realizes the filtering and denoising of the image by combining the two factors of the geometric space distance and gray value difference between the pixel points, and makes the pixel value of the image filtering output depend on the weighted combination of the product of the gray value similarity and spatial proximity corresponding to the neighboring pixel points.
[0019] Furthermore, the sliding window is represented by a square window, and the side length of the square window is 2×W+1, where W is a positive integer. When the center position of the sliding window slides in the image to be processed, the pixel point covered becomes the central pixel point, and the sliding window can frame at most (4W) in one sliding operation (each translation of a preset step length). 2 +4W) neighborhood pixels.
[0020] Furthermore, the preconfigured exponential function is represented by a Taylor expansion composed of N approximation function expressions of different powers, so that the preconfigured exponential function is approximated by a polynomial function; wherein the Taylor expansion composed of N approximation function expressions of different powers belongs to a pre-solidified program segment, so that the aforementioned ratio is substituted into each approximation function expression through the entrance of the Taylor expansion; the power function carried by each approximation function expression is of different powers; wherein the CPU is configured to calculate the function values of N approximation function expressions of different powers in parallel, and then add the N function values calculated in parallel, and then use the sum obtained by the addition as the exponential function value calculated by the CPU for the preconfigured exponential function; wherein N is a positive integer greater than or equal to 2.
[0021] This technical solution uses N different approximation functions to add together to form an N-1 degree polynomial function for the exponential function required for bilateral filtering. The Taylor expansion approximates the pre-configured exponential function through addition, subtraction and multiplication of finite terms. On this basis, multiple CPU computing resources are called to perform parallel calculations on the Taylor expansion polynomial approximation function, so that elementary functions (each approximation function belongs to an elementary function) can be performed on multiple data at the same time, and then the corresponding number of exponential function values can be obtained at the same time. Compared with the existing technology, the operation speed of the exponential function is improved, the accuracy of the exponential function value is guaranteed, and the speed is increased.
[0022] Further, for the N corresponding neighboring pixels traversed in a sliding operation performed by the sliding window, the control CPU calls N calculation registers to parallelly calculate the image information similarity between the traversed N neighboring pixels and a central pixel in the sliding operation, or parallelly calculate the gray value similarity and the product of spatial proximity between the traversed N corresponding neighboring pixels and a central pixel in the sliding operation; wherein each calculation register is used to calculate the image information similarity between a neighboring pixel and a central pixel in a corresponding sliding operation, or calculate the gray value similarity and the product of spatial proximity between a neighboring pixel and a central pixel in a corresponding sliding operation; wherein N is a positive integer greater than or equal to 2. This technical solution uses parallel calculation to improve the calculation speed of the image information similarity corresponding to multiple neighboring pixels, and can also improve the calculation speed of the gray value similarity and the product of spatial proximity between multiple neighboring pixels and a corresponding central pixel, speed up the gray value weighted average processing speed of the neighboring pixels, and thus speed up the calculation speed of bilateral filtering.
[0023] A chip is used to store program codes corresponding to the bilateral filtering control method to reduce the number of calculations generated by executing the bilateral filtering algorithm, and also enables the chip to be configured as a chip dedicated to bilateral filtering. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 A flowchart of a bilateral filtering control method is disclosed as an embodiment of the present invention. DETAILED DESCRIPTION
[0025] The technical scheme in the embodiment of the present invention will be described in detail below in conjunction with the accompanying drawings in the embodiment of the present invention. It should be understood that the specific embodiments described below are only used to explain the present invention and are not used to limit the present invention. In the following description, specific details are given to provide a thorough understanding of the embodiments. However, it will be understood by those of ordinary skill in the art that the embodiments can be implemented without these specific details. For example, the circuit can be shown in a block diagram to avoid obscuring the embodiments in unnecessary details. In other cases, in order not to confuse the embodiments, known circuits, structures and techniques may not be shown in detail.
[0026] The terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0027] It should be noted that a computer function is a fixed program segment, or a subroutine, which can implement fixed calculation functions while also having an entry and an exit. The so-called entry refers to the various parameters of the function. The present invention can substitute the parameter values of the function into the subroutine through this entry for computer processing; the so-called exit refers to the function value of the function, which is brought back to the program that calls the function through this exit after being obtained by the computer.
[0028] In addition, the present invention can be customized according to the computing function of the computer function. As long as the computing function is fixed, we can define it as a function, so as to avoid the same program segment from appearing repeatedly in the program. When it is needed, only the corresponding function needs to be called. Among them, the computer function is a fixed function derived from mathematics, including but not limited to exponential operation, square operation and division operation.
[0029] As an example, Figure 1 As shown, a bilateral filtering control method is disclosed, and the bilateral filtering control method includes:
[0030] Step S101, when starting to perform bilateral filtering on the image to be processed, configure the sliding window to translate in the image to be processed, and traverse to the pixel points, and then enter step S102. The sliding window is a rectangular frame that supports sliding between rows and columns of the image when performing convolution operation on the image to be processed. Therefore, when starting to perform bilateral filtering, it is necessary to set a sliding window (equivalent to the function of the convolution kernel), and configure the sliding window to translate in the image to be processed to perform filtering operations on the traversed / searched pixel points. In this embodiment, the sliding window is specifically configured to translate in the image to be processed, and each translation step can determine to frame a specific image area, and then perform corresponding bilateral filtering operations on the specific image area.
[0031] Step S102, when the sliding window is translated in the image to be processed to perform bilateral filtering, starting from the pixel currently covered by the center position of the sliding window, the neighborhood pixel points are searched in the image area currently framed by the sliding window, and the image information similarity between the currently searched neighborhood pixel point and the center pixel point is calculated in a non-repetitive manner; the non-repetitive manner involved in this embodiment is the non-repetitive calculation of the positions of two pixel points, specifically, the non-repetitive calculation of the image information similarity between the two pixel points; in this embodiment, after the sliding window is translated once in the image to be processed, in the image area currently framed by the sliding window, starting from the pixel currently covered by the center position of the sliding window, the neighborhood pixel points are searched in sequence, and when no pair of pixel points (a neighborhood pixel point and its corresponding center pixel point) is performed Under the premise of repeated calculation, the image information similarity between the currently searched neighborhood pixel point and the center pixel point is calculated, and then the calculated image information similarity is stored, so that when a neighborhood pixel point searched is the original center pixel point (a pair of pixels at a specific relative position are repeatedly traversed), the corresponding image information similarity originally stored is directly called as the image information similarity between the currently searched neighborhood pixel point and the center pixel point; it is worth noting that the direction of translation of the sliding window remains unchanged before the line is wrapped; the search direction of searching for neighborhood pixels starting from the center position of the sliding window is not limited; and the number and position of the corresponding traversed pixels for each translation of the sliding window in the image to be processed are not limited, as long as a balance is achieved between the filtering effect and the amount of calculation of the image.
[0032] It should be noted that the pixel point covered by the center position of the sliding window is configured as the center pixel point; the neighborhood pixel point is the pixel point located in the neighborhood of the center pixel point, including but not limited to eight neighborhoods and 24 neighborhoods, which is specifically related to the size of the sliding window; wherein, the image information similarity includes the gray value similarity and spatial proximity required by the bilateral filtering algorithm, both of which are used as the weight domain required by the bilateral filtering algorithm; the gray value similarity corresponds to the intensity difference in the pixel domain required to execute the bilateral filtering algorithm, and the spatial proximity corresponds to the geometric difference in the spatial domain required to execute the bilateral filtering algorithm.
[0033] Compared with the prior art, in the process of sliding the window in the image to be processed to perform bilateral filtering, this embodiment controls the same pair of pixels not to repeatedly calculate the image information similarity, significantly reducing the number of calculations, and overall speeding up the calculation speed of the image information similarity, which is suitable for the chip built into the mobile terminal with a small cache space to perform bilateral filtering on the image. Among them, this pair of pixels includes the currently traversed neighborhood pixel and the center pixel.
[0034] As an embodiment, whenever the sliding window is translated by a preset step length in the image to be processed, starting from the pixel point currently covered by the center position of the sliding window, all neighboring pixel points are searched in the image area currently framed by the sliding window, and the image information similarity between each searched neighboring pixel point and the central pixel point is calculated in a non-repetitive manner, then it is determined that the sliding window performs a sliding operation in the image to be processed. Therefore, in this embodiment, after the sliding window is translated once according to a preset step length in the image to be processed, in the image area currently framed by the sliding window, starting from the pixel point currently covered by the center position of the sliding window, all neighboring pixel points are searched, and the image information similarity between each searched neighboring pixel point and the central pixel point is calculated in a non-repetitive manner. Starting from the pixel point covered, the neighborhood pixel points are searched in sequence according to the preset direction, and the image information similarity between the currently searched neighborhood pixel point and the center pixel point is kept non-repeatedly calculated. At this time, it is determined that a sliding operation has been performed, that is, within the image area currently framed by the sliding window, all the pixels in the neighborhood with the center position of the sliding window as the center pixel point are searched, recorded as neighborhood pixel points (at least 8) or all neighborhood pixel points, and the image information similarity between each neighborhood pixel point and the center pixel point is obtained. At this time, it is determined that the sliding window has performed a sliding operation; the non-repeated calculation method involved refers to the content of the aforementioned embodiment. In this embodiment, when the sliding window is translated in the image to be processed according to the preset step size, for a pair of pixel points that may be repeatedly traversed to participate in the image information similarity calculation, the image information similarity between this type of pixel pairs is controlled not to be repeatedly calculated, thereby improving the speed of image filtering processing. Among them, a pair of pixel points are neighborhood pixel points and their corresponding center pixel points. In this embodiment, starting from the pixel point currently covered by the center position of the sliding window (i.e., the center pixel point), the two neighboring pixel points searched in sequence are located at two adjacent pixel positions, including adjacent in the horizontal direction, adjacent in the vertical direction, and adjacent in the diagonal direction.
[0035] It should be supplemented that, when the sliding window has not started to translate within the image to be processed, that is, in the initial state where filtering has not started, starting from the pixel point currently covered by the center position of the sliding window, the neighborhood pixel points are searched within the image area currently framed by the sliding window, and the image information similarity between the currently searched neighborhood pixel points and the center pixel point is calculated. At this time, the calculated image information similarity between the currently searched neighborhood pixel points and the center pixel point is the image information similarity between the currently searched neighborhood pixel points and the center pixel point that was first covered, wherein the pixel point currently covered by the center position of the sliding window is the center pixel point that was first covered by the center position of the sliding window in the image to be processed.
[0036] Preferably, the preset step size is configured to allow a partially overlapping image area between an image area framed by the sliding window before performing a sliding operation and an image area framed by the sliding window after performing the sliding operation.
[0037] Preferably, the sliding window has a line break translation between executing the last sliding operation and executing the current sliding operation, so there is a partially overlapping image area or no overlapping image area between the image area framed by the sliding window when executing the last sliding operation and the image area framed by the sliding window when executing the current sliding operation.
[0038] Preferably, the sliding window continuously performs two adjacent sliding operations within the same row of the image to be processed, and there is a partially overlapping image area or no overlapping image area between the image area framed by the sliding window when performing the previous sliding operation and the image area framed by the sliding window when performing the current sliding operation.
[0039] As an embodiment, the method for calculating the image information similarity between the currently searched neighborhood pixel point and the center pixel point in a non-repetitive manner includes: whenever a center pixel point previously covered by the center position of the sliding window is searched in the image area framed by the sliding window, it is determined that the grayscale value similarity between the center pixel point previously covered by the center position of the sliding window and its corresponding neighborhood pixel point has been calculated once, and based on the unidirectional translation feature of the sliding window in the image to be processed, the grayscale value similarity between the center pixel point previously covered by the center position of the sliding window and its corresponding neighborhood pixel point is only calculated. Once, in the current sliding operation, it is selected not to calculate the gray value similarity between the previously covered central pixel and the pixel currently covered by the center position of the sliding window, but to update the corresponding gray value similarity obtained based on the previously covered central pixel as the central pixel to the gray value similarity between the previously covered central pixel and the pixel currently covered by the center position of the sliding window, so as to achieve non-repetitive calculation of the gray value similarity between the currently searched neighborhood pixel and the central pixel; wherein the translation direction of the sliding window in the same row of the image to be processed remains unchanged. This embodiment controls the gray value similarity between this type of pixel pair to be calculated only once for a pair of pixels that may be repeatedly traversed in the sliding window and need to participate in the gray value similarity calculation, and can configure the image information similarity calculated when the pair of pixels is first traversed as the gray value similarity required to be obtained when the pair of pixels is repeatedly traversed subsequently, thereby reducing the number of calculations by half compared with the repeated calculation phenomenon existing in the prior art, and achieving an increase in the calculation speed of all pixels of the image to be processed. Among them, a pair of pixels is a neighborhood pixel and its corresponding center pixel.
[0040] On the basis of the above embodiment, if the pixel point covered by the center position of the sliding window in the current sliding operation is updated by a neighborhood pixel point searched in a previously executed sliding operation, that is, when it is detected that the pixel point currently covered by the center position of the sliding window is a neighborhood pixel point searched in a previously executed sliding operation, the pixel point covered by the center position of the sliding window in the current sliding operation (the pixel point currently covered by the center position of the sliding window, that is, the most recently configured center pixel point) is set as the first reference center pixel point, and at the same time, it is determined that the pixel point covered by the center position of the sliding window in the previously executed sliding operation (the pixel point previously covered by the center position of the sliding window, that is, the configured center pixel point) belongs to a neighborhood pixel point that can be searched in the image area currently framed by the sliding window, and the pixel point covered by the center position of the sliding window in the previously executed sliding operation is set as the second reference center pixel point, forming a pair of pixel points that can be repeatedly traversed, that is, the first reference center pixel point and the second reference center pixel point determined in the current sliding operation. It is worth noting that, in the previously performed sliding operation, the gray value similarity between the first reference central pixel point and the second reference central pixel point has been calculated.
[0041] On the basis of the above embodiment, if a neighborhood pixel point searched in the image area currently framed by the sliding window is updated by the center pixel point covered by the center position of the sliding window in the previously executed sliding operation (the pixel point previously covered by the center position of the sliding window, that is, the configured center pixel point), it is determined that the neighborhood pixel point currently searched is the pixel point first covered by the center position of the sliding window in the previously executed sliding operation, that is, the second reference center pixel point, then the grayscale value similarity between the aforementioned first reference center pixel point and the second reference center pixel point is directly configured as the grayscale value similarity between the currently searched neighborhood pixel point (the aforementioned second reference center pixel point) and the pixel point covered by the center position of the sliding window in the current sliding operation (the aforementioned first reference center pixel point), without performing a grayscale value similarity calculation, thereby avoiding repeated calculation of the aforementioned first reference center pixel point. The grayscale value similarity between the reference center pixel point and the second reference center pixel point is determined; thereby determining: updating the corresponding grayscale value similarity obtained based on the previously covered center pixel point as the center pixel point to the grayscale value similarity between the previously covered center pixel point and the pixel point currently covered by the center position of the sliding window; wherein the grayscale value similarity between the aforementioned first reference center pixel point and the second reference center pixel point has been calculated in the previously executed sliding operation, and is the grayscale value similarity between the first corresponding pixel point pairs obtained; wherein the center pixel point covered by the center position of the sliding window in the previously executed sliding operation is the center pixel point previously covered by the center position of the sliding window; wherein, during the translation process of the sliding window in the image to be processed, it is configured not to allow repeated framing of the same specific image area, and the size of the specific image area is equal to the size of the sliding window.
[0042] In this embodiment, the sliding window is translated by a preset step size in the current sliding operation relative to the previous sliding operation. When the image area currently framed by the sliding window contains the pixel currently covered by the center position of the sliding window (the center pixel covered by the sliding window in the current sliding operation) and the pixel previously covered by the center position of the sliding window (the center pixel covered by the sliding window in the previous sliding operation), it is determined that there are two center pixels mutually contained in the convolution kernel (the sliding window with the center pixel covered in the corresponding sliding operation as the center position) in the image area currently framed by the sliding window, namely, the first reference center pixel and the second reference center pixel. For the gray value similarity between the pair of repeatedly traversed reference center pixels, the gray value similarity calculated at the first traversal is selected as the latest result, so as to avoid repeated calculation of the gray value similarity between a neighborhood pixel and a corresponding center pixel, wherein the neighborhood pixel and the corresponding center pixel support mutual updating to exchange the function positioning of the pixel position in different sliding operations of the sliding window.
[0043] In some embodiments, a 3x3 sliding window (a window whose side length is 3 pixels) is used to perform a sliding operation on the image to be processed. Initially, pixel A and pixel B are separated into two adjacent columns in the sliding window. If pixel A is located in the second column of the image to be processed and pixel B is located in the third column of the image to be processed, and pixel A is located at the center of the pixel, and pixel A and pixel B are located in the same row, then after traversing the neighboring pixels from the first column to the third column in the sliding window and obtaining the corresponding image information similarity, the 3x3 sliding window is controlled to translate once according to a preset step size; then when the 3x3 sliding window is framed from the second column of the image to be processed to the fourth column of the image to be processed, and when the 3x3 sliding window is framed from the second row of the image to be processed to the fourth row of the image to be processed, and when the 3x3 sliding window is framed from the first row of the image to be processed to the third row of the image to be processed, execution is started. A new sliding operation is performed. At this time, the image area currently framed by the 3x3 sliding window and the image area framed by the previous sliding operation have partially overlapping image areas, wherein the partially overlapping image areas include pixel points A and pixel points B, which are respectively located in the first column and the second column of the 3x3 sliding window. The image information similarity between pixel points A and pixel points B has been calculated in the previous sliding operation, and there is no need to repeat the calculation in the current sliding operation. Instead, the previous calculation result is directly used, especially the gray value similarity between pixel points A and pixel points B; and the spatial proximity between pixel points A and pixel points B is calculated and determined by all relative position relationships between the center position and the adjacent pixel position in the 3x3 sliding window before the sliding operation is started (understood as before the bilateral filtering operation is started), and will not change as the 3x3 sliding window is translated in the image to be processed. Among them, pixel point A can be recorded as the aforementioned first reference center pixel point, and pixel point B can be recorded as the aforementioned second reference center pixel point. Therefore, in some embodiments, within an image region defined by a 3x3 sliding window (3x3 bilateral filter kernel), only four grayscale value similarities need to be calculated for eight pixel pairs, but the grayscale value similarities calculated four times are not necessarily the same, and the other four grayscale value similarities are calculated in advance. The aforementioned 3x3 is 3 times 3, and the 3x3 sliding window represents a sliding window of 3 rows and 3 columns.
[0044] On the basis of any of the foregoing embodiments, a method for calculating the grayscale value similarity between a neighborhood pixel point and a corresponding center pixel point is as follows: calculating the square of the difference between the grayscale value of the neighborhood pixel point and the grayscale value of the corresponding center pixel point to obtain square data of the grayscale change value; wherein the neighborhood pixel point is located in an image area framed by a sliding window with the corresponding center pixel point as the center position, and the neighborhood pixel points participating in the grayscale value similarity calculation are arranged symmetrically left and right and up and down in the image to be processed relative to the center pixel point; then the square data of the grayscale change value and the square of the pixel domain parameter are added together. The ratio is processed by multiples, and the obtained ratio is used as a parameter and input into a pre-configured exponential function, and then the exponential function value calculated by the CPU is updated to the gray value similarity between a neighborhood pixel point and a corresponding center pixel point; wherein the pixel domain parameter is a Gaussian distribution parameter, which is used to limit the variation range of the gray value similarity and determine the difference between pixel values; the coefficient of the exponential part of the pre-configured exponential function is a negative sign to form a subtraction function of the exponential part, and the exponential part is used to accept an independent variable, and the independent variable is the ratio of the square data of the gray value variation value to twice the square of the pixel domain parameter. Therefore, this embodiment uses the square of the difference between the gray value of a neighborhood pixel point and the gray value of a corresponding center pixel point in the image area framed by the sliding window to describe the gray value similarity between the neighborhood pixel point and the corresponding center pixel point.
[0045] As an embodiment, the method for calculating the image information similarity between the currently searched neighborhood pixel points and the central pixel point in a non-repetitive manner also includes: when the sliding window has not started to translate within the image to be processed, that is, when the sliding window has not started to be used to perform bilateral filtering on the image to be processed, the entire sliding window is within the initial image area framed within the image to be processed, starting from the pixel point currently covered by the center position of the sliding window, searching for neighborhood pixel points within the initial image area, calculating the spatial proximity between the neighborhood pixel points searched in sequence and the same central pixel point, and storing the calculated spatial proximity between the neighborhood pixel points at different pixel positions within the initial image area and the same central pixel point in a preset memory space, so that the corresponding spatial proximity can be directly called when the sliding window performs a sliding operation in the image to be processed later. At this time, all the neighborhood pixel points within the initial image area framed by the sliding window within the image to be processed can be determined by searching and calculating. The spatial proximity between the neighboring pixels and the central pixel point is equal and has a fixed value in the image area framed in real time by the sliding window in the image to be processed before the sliding window starts to translate in the image to be processed (which may be before the first sliding operation is performed) and in each sliding operation performed according to the preset step size. Therefore, the spatial proximity between the neighboring pixels and the central pixel point only needs to calculate and save the spatial proximity between all the searched neighboring pixels and the corresponding central pixel point in the initial image area framed by the sliding window in the image to be processed before the sliding window starts to translate, so that when the sliding window is subsequently translated in the image to be processed, the spatial proximity on the corresponding position relationship calculated in advance is called for the relative position relationship between the neighboring pixels traversed in real time and the pixels covered in real time by the center position of the sliding window, so as to avoid repeated calculation of the spatial proximity. Preferably, the shape of the sliding window is the same as the shape of the initial image area, and the area of the sliding window is equal to the area of the initial image area, so as to obtain a more complete spatial proximity between the pixel position and the corresponding central pixel point. The obtained spatial proximity is more representative in the image to be processed and fully describes the positional relationship between each neighborhood pixel point in various neighborhoods relative to a central pixel point.
[0046] It should be noted that, in the image to be processed, the characteristics of a pair of pixel points with the same relative position relationship are as follows: starting from the pixel position where one pixel point is located, a first fixed number of pixel points are offset along the same horizontal direction, and a second fixed number of pixel points are offset along the same vertical direction to reach the pixel position where another pixel point is located, wherein the first fixed number and the second fixed number do not change with the translation of the sliding window, that is, they do not change with the number of sliding operations performed. In a pair of pixel points with the same relative position relationship, one pixel point is fixedly set in a fixed traversal direction of the other pixel point, and a fixed straight-line distance is maintained between one pixel point and the other pixel point.
[0047] In the above embodiment, the method for calculating the spatial proximity between a neighborhood pixel point and a corresponding center pixel point is as follows: calculating the square of the difference between the horizontal coordinate of the neighborhood pixel point and the horizontal coordinate of the corresponding center pixel point to obtain the square of the horizontal axis distance of the pixel; wherein the neighborhood pixel point is located in the image area framed by the sliding window with the corresponding center pixel point as the center position, and the neighborhood pixel points participating in the spatial proximity calculation are arranged symmetrically in the aforementioned initial image area with respect to the center pixel point in the left and right directions and in the top and bottom directions; calculating the square of the difference between the vertical coordinate of the neighborhood pixel point and the vertical coordinate of the corresponding center pixel point to obtain the square of the vertical axis distance of the pixel; then performing ratio processing on the sum of the square of the horizontal axis distance of the pixel and the square of the vertical axis distance of the pixel and twice the square of the spatial domain parameter, and then inputting the obtained ratio as a parameter into a preconfigured exponential function, and then setting the exponential function value calculated by the CPU as the spatial proximity between a neighborhood pixel point and a corresponding center pixel point; wherein the spatial domain parameter is a spatial domain parameter in the Euclidean distance formula, which is used to limit the range of change of the spatial proximity and determines the change of the spatial distance. The coefficient of the exponential part of the preconfigured exponential function is a negative sign to make the exponential part a decreasing function, and the exponential part is used to accept an independent variable, and the independent variable is a ratio of the sum of the square of the horizontal axis distance of the pixel and the square of the vertical axis distance of the pixel to twice the square of the spatial domain parameter. Therefore, this embodiment uses the square of the distance between a neighborhood pixel point and a corresponding central pixel point in the image area framed by the sliding window to describe the spatial proximity between the neighborhood pixel point and the corresponding central pixel point.
[0048] As an embodiment, for a sliding operation performed by the sliding window, the bilateral filtering control method further includes: configuring the product of the grayscale similarity and spatial proximity between a currently searched neighborhood pixel point and its corresponding center pixel point as the weight of the grayscale value of the currently searched neighborhood pixel point at the pixel position; accumulating the products of the grayscale similarity and spatial proximity between each searched neighborhood pixel point and the pixel point currently covered by the center position of the sliding window in the image to be processed, and then configuring the accumulated result as the total weight; and then accumulating the products of the grayscale similarity and spatial proximity between the searched neighborhood pixel point and the center position of the sliding window in the image to be processed. The product of the grayscale value and the weight of each neighboring pixel point at the pixel position is accumulated, that is, the product of the grayscale similarity between each neighboring pixel point and its corresponding central pixel point and its spatial proximity is multiplied by the grayscale value of the corresponding neighboring pixel point at the pixel position, and then the product of the grayscale values at these pixel positions and the weight is added up as the result of the accumulation, and then the result of the accumulation is configured as the weighted sum of the grayscale values of all the searched neighboring pixel points; then, the ratio of the weighted sum of the grayscale values of all the searched neighboring pixel points to the total weight is set as the result of a bilateral filtering. It should be noted that a neighborhood pixel point currently searched is located in the image area framed by a sliding window with a corresponding central pixel point as the center position; the sliding window is represented by a square window, and the side length of the square window is 2×W+1, where W is a positive integer. The pixel point covered by the center position of the sliding window when sliding in the image to be processed becomes the central pixel point, and the sliding window is framed (4W) in one sliding operation (each translation of a preset step length) 2 +4W) neighborhood pixels.
[0049] Therefore, this embodiment uses the product of gray value similarity and spatial proximity as the weight of the gray value at the corresponding pixel position of the image to be processed, and then uses the weight to perform weighted averaging on the gray value of the corresponding pixel point, so that the weighted average result is the result of a bilateral filtering of the image to be processed. The two factors of geometric space distance and gray value difference between pixel points are combined to filter and denoise the image, and the pixel value of the image filtering output depends on the weighted combination of the product of gray value similarity and spatial proximity corresponding to the neighboring pixel points. In this embodiment, the weighted average of the pixels adjacent to each other in space and the pixels with similar pixel values are integrated, and the original value of the center point can be replaced by the average value of the pixels in the bright area around the center point, while the pixels in the dark area adjacent to it are ignored; among them, the concepts of two weight domains in bilateral filtering: spatial domain (spatial domain S) and pixel domain (range domain R).
[0050] As an embodiment, the preconfigured exponential function is represented by a Taylor expansion composed of N approximation functional expressions of different powers, so that the preconfigured exponential function is approximated by a polynomial function; wherein the Taylor expansion composed of N approximation functional expressions of different powers belongs to a pre-set program segment, so that the aforementioned ratio is input into each approximation functional expression through the entrance of the Taylor expansion. It can be understood that each approximation functional expression belongs to a pre-set program segment and supports independent execution; the power function carried by each approximation functional expression is of different degrees, and the approximation functional expression with a higher degree is closer to the preconfigured exponential function (as a given function), making its approximation degree better and better. In this embodiment, the CPU is configured to calculate the function values of N different approximation functions in parallel, wherein the CPU uses a parallel computing instruction set to configure N computing units to perform N different approximation functions in parallel, each computing unit performs an approximation function, and all computing units synchronously perform approximation function operations under corresponding program segments to obtain function values at the same time; then the N function values calculated in parallel are added, and the sum obtained by the addition is used as the exponential function value calculated by the CPU for the preconfigured exponential function; wherein N is a positive integer greater than or equal to 2, and supports adaptive configuration. Preferably, the CPU uses the arm architecture, and the parallel computing instruction set is the Neon instruction set.
[0051] This embodiment uses N different approximation function formulas to add together to form an N-1 order polynomial function, which is also an N-1 order Taylor expansion, and approximates the preconfigured exponential function (exp function) by approximating the expression through a finite number of elementary functions; on this basis, multiple computing resources of the CPU or the multi-core structure of the processor are called to perform parallel calculations on each approximation function formula of the Taylor expansion, so that elementary functions (each approximation function formula belongs to an elementary function) can be performed on multiple data at the same time, and then the corresponding number of exponential function values can be obtained at the same time. Therefore, by using the exponential function approximation algorithm of Taylor expansion in conjunction with the parallel processing of the CPU, when calculating the exponential function of the gap between two pixel points (grayscale value gap and spatial gap), both speed and accuracy are taken into account. Compared with the prior art, the operation speed of the exponential function is improved, and the accuracy of the exponential function value is guaranteed while increasing the speed.
[0052] On the basis of the above-mentioned embodiment, for the N corresponding neighborhood pixels searched in a sliding operation performed by the sliding window, the control CPU calls N calculation registers to parallelly calculate the image information similarity between the N searched neighborhood pixels and a central pixel in the sliding operation, or parallelly calculate the product of the gray value similarity and spatial proximity between the N searched corresponding neighborhood pixels and a central pixel in the sliding operation; preferably, the processor used in this embodiment is a multi-core (for example, 8 cores or 16 cores) structure. Each core is a complete calculation register, and multiple calculation units perform data calculation in parallel under the control of the Neon instruction set. Each calculation register is used to calculate the image information similarity between a neighborhood pixel point and a central pixel point in a corresponding sliding operation, or to calculate the gray value similarity between a neighborhood pixel point and a central pixel point in a corresponding sliding operation and the product of its spatial proximity; different calculation registers support independent calculation operations of image information similarity or its corresponding product; wherein N is a positive integer greater than or equal to 2, which is determined by a predefined search quantity and is associated with the number of pixel points required by the convolution filter. This embodiment uses parallel calculation to improve the calculation speed of the image information similarity corresponding to multiple neighborhood pixel points, and can also improve the calculation speed of the gray value similarity between multiple neighborhood pixel points and a corresponding central pixel point and the product of their spatial proximity, speed up the gray value weighted average processing speed of the neighborhood pixel points, and thus speed up the calculation speed of the bilateral filter.
[0053] Based on the above embodiment, a chip is also disclosed, which is used to store the program code corresponding to the bilateral filtering control method to reduce the number of calculations generated by executing the bilateral filtering algorithm. The chip is also installed in the bilateral filter. It should be noted that the bilateral filter is a filter that can denoise while preserving edges. The reason why this denoising effect can be achieved is that the filter is composed of two functions. One function determines the filter coefficient by the geometric space distance. The other function determines the filter coefficient by the pixel difference.
[0054] Direction words such as "up (front)", "down (back)", "left" and "right" mentioned in the above embodiments, unless otherwise specified, refer to the up, down, left and right directions of the drawings, and vertical and horizontal refer to the vertical and horizontal directions of the drawings.
[0055] Those of ordinary skill in the art will understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. These programs can be stored in computer-readable storage media (such as ROM, RAM, magnetic disks or optical disks, etc., which can store program codes). When the program is executed, it executes the steps of the above-mentioned method embodiments. Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention is described in detail with reference to the above-mentioned embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the above-mentioned embodiments, or replace some or all of the technical features therein by equivalent; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A bilateral filtering control method, characterized in that: The bilateral filtering control method comprises: When the sliding window is configured to translate within the image to be processed, starting from the pixel currently covered by the center position of the sliding window, the neighborhood pixel points are searched within the image area currently framed by the sliding window, and the image information similarity between the currently searched neighborhood pixel points and the center pixel point is calculated in a non-repetitive manner, wherein the pixel point covered by the center position of the sliding window is configured as the center pixel point; the neighborhood pixel point is a pixel point located in the neighborhood of the center pixel point; Among them, the image information similarity includes the gray value similarity and spatial proximity required by the bilateral filtering algorithm; The method for calculating the image information similarity between the currently searched neighborhood pixel point and the central pixel point in a non-repetitive manner includes: Whenever a central pixel previously covered by the center position of the sliding window is searched in the image area framed by the sliding window, the gray value similarity between the previously covered central pixel and the pixel currently covered by the center position of the sliding window is not calculated, but the corresponding gray value similarity obtained based on the previously covered central pixel as the central pixel is updated to the gray value similarity between the previously covered central pixel and the pixel currently covered by the center position of the sliding window; The translation direction of the sliding window in the same row of the image to be processed remains unchanged.
2. The bilateral filtering control method according to claim 1, characterized in that: Whenever the sliding window is translated by a preset step length within the image to be processed, starting from the pixel point currently covered by the center position of the sliding window, all neighboring pixel points are searched within the image area currently framed by the sliding window, and the image information similarity between each searched neighboring pixel point and the center pixel point is calculated in a non-repetitive manner, then it is determined that the sliding window performs a sliding operation within the image to be processed.
3. The bilateral filtering control method according to claim 2, characterized in that: If the pixel point covered by the center position of the sliding window in the current sliding operation is updated by a neighborhood pixel point searched in a previous sliding operation, the pixel point covered by the center position of the sliding window in the current sliding operation is set as the first reference center pixel point, and at the same time, it is determined that the pixel point covered by the center position of the sliding window in the previous sliding operation belongs to a neighborhood pixel point that can be searched in the image area currently framed by the sliding window, and the pixel point covered by the center position of the sliding window in the previous sliding operation is set as the second reference center pixel point; wherein, in the previous sliding operation, the gray value similarity between the first reference center pixel point and the second reference center pixel point has been calculated; Then, if a neighborhood pixel point searched in the image area currently framed by the sliding window is updated by the center pixel point covered by the center position of the sliding window in the previous sliding operation, the grayscale value similarity between the first reference center pixel point and the second reference center pixel point is directly updated to the grayscale value similarity between the currently searched neighborhood pixel point and the pixel point covered by the center position of the sliding window in the current sliding operation, and it is determined that: the corresponding grayscale value similarity obtained on the basis of the previously covered center pixel point as the center pixel point is updated to the grayscale value similarity between the previously covered center pixel point and the pixel point currently covered by the center position of the sliding window; The central pixel point covered by the center position of the sliding window in the previously performed sliding operation is the central pixel point previously covered by the center position of the sliding window.
4. The bilateral filtering control method according to claim 2, characterized in that: The method for calculating the gray value similarity between a neighborhood pixel and a corresponding central pixel is: Calculate the square of the difference between the grayscale value of the neighborhood pixel and the grayscale value of a corresponding central pixel to obtain square data of the grayscale change value; wherein the neighborhood pixel is located in the image area framed by a sliding window with the corresponding central pixel as the center position; Then the square data of the grayscale change value is processed by ratio with twice the square of the pixel domain parameter, and the obtained ratio is used as a parameter to input into the pre-configured exponential function, and then the exponential function value calculated by the CPU is set as the grayscale value similarity between a neighborhood pixel point and a corresponding center pixel point; The pixel domain parameters are Gaussian distribution parameters, which are used to limit the variation range of gray value similarity.
5. The bilateral filtering control method according to claim 2, characterized in that: The method for calculating the image information similarity between the currently searched neighborhood pixel point and the central pixel point in a non-repetitive manner includes: When the sliding window does not start to translate in the image to be processed, within the initial image area framed by the entire sliding window in the image to be processed, starting from the pixel point currently covered by the center position of the sliding window, search for neighboring pixel points in the initial image area, calculate the spatial proximity between the searched neighboring pixel points and the same central pixel point, and store the calculated spatial proximity between the neighboring pixel points at different pixel positions in the initial image area and the same central pixel point in a preset memory space, so that the sliding window can directly call the corresponding spatial proximity when performing a sliding operation in the image to be processed later; Before the sliding window starts to translate in the image to be processed and in each sliding operation performed according to the preset step size, the spatial proximity between neighboring pixel points and the corresponding central pixel point with the same relative position relationship in the image area framed by the sliding window in the image to be processed is equal.
6. The bilateral filtering control method according to claim 5, characterized in that: The method for calculating the spatial proximity between a neighborhood pixel and a corresponding center pixel is: Calculate the square of the difference between the horizontal coordinate of the neighborhood pixel point and the horizontal coordinate of a corresponding center pixel point to obtain the square of the pixel horizontal axis distance; wherein the neighborhood pixel point is located in the image area framed by the sliding window with the corresponding center pixel point as the center position; Calculate the square of the difference between the ordinate of the neighborhood pixel point and the ordinate of a corresponding central pixel point to obtain the square of the pixel ordinate distance; Then the sum of the square of the pixel horizontal axis distance and the square of the pixel vertical axis distance is ratioed to twice the square of the spatial domain parameter, and the obtained ratio is used as a parameter to input into a pre-configured exponential function, and then the exponential function value calculated by the CPU is set as the spatial domain proximity between a neighborhood pixel point and a corresponding center pixel point; The spatial domain parameter is a spatial domain parameter in the Euclidean distance formula, and is used to limit the range of variation of the spatial domain proximity.
7. The bilateral filtering control method according to claim 2, characterized in that: For a sliding operation performed by the sliding window, the bilateral filtering control method further includes: The product of the grayscale similarity and spatial proximity between a currently searched neighborhood pixel point and its corresponding central pixel point is configured as the weight of the grayscale value of the currently searched neighborhood pixel point at the pixel position; Accumulate the product of the grayscale similarity and the spatial proximity between each searched neighborhood pixel point and the pixel point currently covered by the center position of the sliding window in the image to be processed, and then configure the accumulated result as the total weight; Then, the grayscale value of each searched neighboring pixel at the pixel position and its configured weight are multiplied and accumulated, and the accumulated result is configured as the weighted sum of the grayscale values of all the searched neighboring pixels; Then, the ratio of the weighted sum of the grayscale values of all the searched neighboring pixels to the total weight is set as the result of a bilateral filtering; Among them, a neighborhood pixel point currently searched is located in the image area framed by a sliding window with a corresponding central pixel point as the center position.
8. The bilateral filtering control method according to claim 7, characterized in that: The sliding window is represented by a square window, and the side length of the square window is 2×W+1, where W is a positive integer.
9. The bilateral filtering control method according to claim 4, characterized in that: The preconfigured exponential function is represented by a Taylor expansion consisting of N approximation functional expressions of different orders, so that the preconfigured exponential function is approximately expressed by a polynomial function; The Taylor expansion composed of N approximation function expressions of different powers belongs to a preset program segment, so that the aforementioned ratio is input into each approximation function expression through the entrance of the Taylor expansion expression; the power function carried by each approximation function expression has a different power; The CPU is configured to calculate in parallel the function values of N different approximation function expressions, then add the N function values calculated in parallel, and then use the sum value obtained by the addition as the exponential function value calculated by the CPU for the preconfigured exponential function; Wherein, N is a positive integer greater than or equal to 2.
10. The bilateral filtering control method according to claim 7, characterized in that: For the N corresponding neighborhood pixel points searched in a sliding operation performed by the sliding window, the CPU is controlled to call N calculation registers to parallelly calculate the image information similarity between the N searched neighborhood pixel points and a central pixel point in the sliding operation, or to parallelly calculate the product of the gray value similarity between the N searched corresponding neighborhood pixel points and a central pixel point in the sliding operation and their spatial proximity; Each calculation register is used to calculate the image information similarity between a neighborhood pixel point and a central pixel point in a corresponding sliding operation, or to calculate the product of the gray value similarity between a neighborhood pixel point and the central pixel point in a corresponding sliding operation and its spatial proximity; Wherein, N is a positive integer greater than or equal to 2.
11. A chip, characterized in that: The chip is used to store the program code corresponding to the bilateral filtering control method described in any one of claims 1 to 10.
Citation Information
Patent Citations
An improved bilateral filtering method based on a Poisson kernel
CN109903254A
Self-adaptive threshold segmentation method for grayscale image
CN113129326A