An image filtering method, device, controller and readable storage medium

CN115619805BActive Publication Date: 2026-08-21BLACK SESAME TECH (CHENGDU) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211296796.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-21
Publication Date
2026-08-21
Estimated Expiration
2042-10-21

AI Technical Summary

Technical Problem

特别是对于一些较为低端的移动终端,其配置的CPU本身性能较弱,图像滤波过程又会占用大部分的硬件资源,导致CPU在处理其他任务时出现响应缓慢,处理效率低下,甚至死机等情况时有发生,不仅图像滤波处理的效率低下,而且还会严重影响用户的使用感受

Benefits of technology

[0037] Based on the above, the image filtering method provided in this application, after obtaining the image to be processed by the GPU based on a preset interpolation algorithm, divides the image to be processed into multiple sub-images according to the preset specifications of the filtering window, and divides all sub-images into multiple segmentation blocks according to preset segmentation rules. Then, the sampling pixel value and sampling weight value of each segmentation block are determined respectively. Finally, the filtering value of the image to be processed is determined based on the sampling pixel value and sampling weight value of each segmentation block.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115619805B_ABST
    Figure CN115619805B_ABST
Patent Text Reader

Abstract

The application provides an image filtering method and device, a controller and a readable storage medium, and applies to the technical field of image processing. After obtaining a to-be-processed image obtained by processing an original image based on a preset interpolation algorithm by a GPU, the to-be-processed image is divided into a plurality of subgraphs according to a preset specification of a filtering window, and all the subgraphs are divided into a plurality of segmentation blocks according to a preset division rule. Then, the sampling pixel value and the sampling weight value of each segmentation block are determined respectively. Finally, the filtering value of the to-be-processed image is determined based on the sampling pixel value and the sampling weight value of each segmentation block. At least one segmentation block in the plurality of segmentation blocks for calculating the filtering value of the to-be-processed image includes a plurality of subgraphs. By dividing the segmentation blocks, the number of times of collecting pixel values and the amount of calculation can be reduced. The to-be-processed image is obtained by processing the original image by the GPU using the preset interpolation algorithm. The interpolation characteristics of the GPU are used to improve the accuracy of pixel collection and improve the filtering processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, specifically to an image filtering method, apparatus, controller, and readable storage medium. Background Technology

[0002] In current applications, image filtering in mobile terminals and other electronic devices is mostly handled by the CPU. As image pixel counts increase, higher demands are placed on CPU performance. This is especially true for lower-end mobile terminals with relatively weak CPUs. The image filtering process consumes a significant portion of hardware resources, leading to slow CPU response, low processing efficiency, and even system crashes when handling other tasks. This not only results in inefficient image filtering but also severely impacts the user experience. Therefore, improving image filtering efficiency while reducing CPU resource consumption has become a pressing technical problem for those skilled in the art. Summary of the Invention

[0003] In view of this, this application aims to provide an image filtering method, apparatus, controller, and readable storage medium to improve image filtering processing efficiency, reduce CPU hardware resource consumption, and improve user experience.

[0004] In a first aspect, this application provides an image filtering method, comprising:

[0005] The image to be processed is obtained by the graphics processing unit (GPU) after processing the original image based on a preset interpolation algorithm.

[0006] The image to be processed is divided into multiple sub-images according to the preset specifications of the filtering window;

[0007] All the subgraphs are divided into multiple segments according to a preset partitioning rule, and at least one of the multiple segments includes multiple subgraphs.

[0008] The sampled pixel value and sampled weight value of each segmented block are determined respectively;

[0009] The filter value of the image to be processed is determined based on the sampled pixel value and sampled weight value of each segmented block.

[0010] In some optional implementations, determining the sampled pixel values ​​and sampled weight values ​​for each of the segmented blocks includes:

[0011] Determine the sampling points of the target segmentation block and the preset weights corresponding to each subgraph included in the target segmentation block;

[0012] Wherein, the target segmentation block is any one of the segmentation blocks;

[0013] The pixel value corresponding to the sampling point of the target segmentation block is determined to be the sampled pixel value of the target segmentation block.

[0014] In addition, the sum of the preset weights corresponding to each subgraph in the target segmentation block is determined as the sampling weight value of the target segmentation block.

[0015] In some optional implementations, determining the filter value of the image to be processed based on the sampled pixel values ​​and sampled weight values ​​of each of the segmented blocks includes:

[0016] The total filtered value is calculated based on the sampled pixel values ​​and sampled weight values ​​of each segmented block;

[0017] The total weight value is obtained by summing the sampling weight values ​​of each segmented block.

[0018] The quotient of the total filtered value and the total weight value is calculated to obtain the filtered value of the image to be processed.

[0019] In some optional implementations, calculating the total filtered value based on the sampled pixel values ​​and sampled weight values ​​of each of the segmented blocks includes:

[0020] For each segmentation block, the product of the sampled pixel value and the sampled weight value of the segmentation block is calculated to obtain the filter value of each segmentation block;

[0021] The total filtered value is obtained by summing the filtered values ​​of each segmented block.

[0022] In some optional implementations, dividing the image to be processed into multiple sub-images according to a preset specification of the filtering window includes:

[0023] The image to be processed is divided into (2N+1) segments according to the preset specifications of the filtering window. 2 There are 1 subgraph, where N is an integer greater than or equal to 1.

[0024] In some optional implementations, dividing all the subgraphs into multiple segments according to a preset partitioning rule includes:

[0025] The entire subgraph is divided into a first-type segmentation block and multiple second-type segments;

[0026] The first type of segmentation block includes one subgraph, while the second type of segmentation block includes two or four subgraphs.

[0027] In some alternative implementations, the subgraphs in a segmentation block comprising two subgraphs are arranged in two rows and one column or one row and two columns.

[0028] The subgraphs in the segmentation block, which includes four subgraphs, are arranged in two rows and two columns.

[0029] Secondly, this application provides an image filtering device, comprising:

[0030] An acquisition unit is used to acquire an image to be processed, which is obtained by a graphics processing unit (GPU) processing an original image based on a preset interpolation algorithm.

[0031] The first partitioning unit is used to divide the image to be processed into multiple sub-images according to the preset specifications of the filtering window;

[0032] The second partitioning unit is used to divide all the subgraphs into multiple partition blocks according to a preset partitioning rule, wherein at least one of the multiple partition blocks includes multiple subgraphs.

[0033] The first determining unit is used to determine the sampled pixel value and sampled weight value of each segmented block respectively;

[0034] The second determining unit is used to determine the filter value of the image to be processed based on the sampled pixel value and sampled weight value of each segmented block.

[0035] Thirdly, this application provides a controller, including: a memory and a processor; the memory stores a program suitable for execution by the processor to implement the image filtering method according to any one of the first aspects of the present invention.

[0036] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the image filtering method as described in any of the first aspects of the present invention.

[0037] Based on the above, the image filtering method provided in this application, after obtaining the image to be processed by the GPU based on a preset interpolation algorithm, divides the image to be processed into multiple sub-images according to the preset specifications of the filtering window, and divides all sub-images into multiple segmentation blocks according to preset segmentation rules. Then, the sampling pixel value and sampling weight value of each segmentation block are determined respectively. Finally, the filtering value of the image to be processed is determined based on the sampling pixel value and sampling weight value of each segmentation block.

[0038] In the image filtering method provided by this invention, at least one of the multiple segmentation blocks used to calculate the filtered value of the image to be processed includes multiple sub-images. By dividing the image into segmentation blocks, the number of times pixel values ​​are collected and the amount of calculation can be effectively reduced. Furthermore, the image to be processed is obtained by the GPU using a preset interpolation algorithm, which can utilize the interpolation characteristics of the GPU to improve the accuracy of pixel collection. This improves the efficiency of filtering while ensuring the accuracy of image filtering. In addition, this method can be applied to a controller independent of the CPU, which can effectively reduce the CPU hardware resource occupation during the entire image processing process, help improve the CPU's response speed to other tasks, and improve the user experience. Attached Figure Description

[0039] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0040] Figure 1 This is a flowchart of an image filtering method provided in an embodiment of the present invention;

[0041] Figure 2 This is a schematic diagram of a subgraph partitioning method provided in an embodiment of the present invention;

[0042] Figures 3a-3c These are schematic diagrams illustrating different types of segmented blocks provided in embodiments of the present invention;

[0043] Figure 4 This is a schematic diagram of the segmentation result of an image to be processed provided by an embodiment of the present invention;

[0044] Figure 5 This is a schematic diagram of the sampling points of each segmented block in the image to be processed provided in the embodiments of the present invention;

[0045] Figure 6 This is a structural block diagram of an image filtering device provided in an embodiment of the present invention.

[0046] Figure 7 This is a schematic diagram of the structure of a controller provided in an embodiment of the present invention. Detailed Implementation

[0047] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0048] In current applications, image filtering in mobile devices (such as smartphones and tablets) is mostly handled by the CPU. As image pixel counts increase, higher demands are placed on CPU performance. This is especially true for lower-end mobile devices with weaker CPUs. The image filtering process consumes a significant portion of hardware resources, leading to slow CPU response, low processing efficiency, and even system crashes when handling other tasks. This not only results in inefficient image filtering but also severely impacts the user experience.

[0049] Existing technologies have also taken certain improvement measures to solve this problem. For example, NEON technology is used to optimize the box filter algorithm commonly used in image filtering. Although these methods can improve the efficiency of image filtering to a certain extent, they are still implemented by the CPU and cannot effectively reduce the CPU load, making it difficult to effectively solve the above problems.

[0050] Based on the above, this invention provides a graphics filtering method. This method is applied to controllers independent of the CPU, such as a graphics processing unit (GPU), and is no longer dependent on the CPU for implementation. Therefore, it can effectively reduce the CPU load. Furthermore, in this method, at least one segmentation block in the multiple segmentation blocks used to calculate the filtered values ​​of the image to be processed includes multiple sub-images. By dividing the image into segmentation blocks, the number of times pixel values ​​are collected and the amount of calculation can be effectively reduced. Moreover, the image to be processed is obtained by the GPU using a preset interpolation algorithm. The interpolation characteristics of the GPU can be used to improve the accuracy of pixel collection, thereby improving the filtering efficiency while ensuring the accuracy of image filtering processing. This helps to improve the CPU's response speed to other tasks and improve the user experience.

[0051] See Figure 1 , Figure 1 This is a flowchart of an image filtering method provided in an embodiment of the present invention. The flowchart of the image filtering method provided in this embodiment may include:

[0052] S100, Obtain the image to be processed.

[0053] As is known from the principles of GPU image processing, when a GPU acquires an image, it needs to interpolate the original image based on a preset interpolation algorithm and convert it into a texture format supported by the GPU. Therefore, the images to be processed mentioned in this embodiment and subsequent embodiments are all obtained by the GPU processing the original image based on the preset interpolation algorithm. The specific implementation process of the preset interpolation algorithm applied to the GPU can be referred to relevant technologies, and this invention does not limit it in this regard.

[0054] S110. Divide the image to be processed into multiple sub-images according to the preset specifications of the filtering window.

[0055] It's understandable that the filtering window is a sliding window that iterates through all pixels of the image to be processed, sliding across the entire image during the filtering process. As for the preset specifications of the filtering window—that is, the number of pixels it can encompass at a time—in practical applications, it needs to be determined based on the size of the image to be processed, the GPU's hardware performance, and the specific filtering requirements.

[0056] Furthermore, based on the preset specifications of the filtering window, the image to be processed can be divided into multiple sub-images. As a preferred implementation, the image to be processed can be divided into (2N+1) sub-images. 2 The image to be processed is divided into several sub-images, where N is an integer greater than or equal to 1. Based on this constraint, the minimum number of sub-images is 9, and it must be an odd number. Dividing the image into an odd number of sub-images ensures symmetry at the edges and corners of the image and also facilitates the segmentation of blocks in subsequent steps. The specific implementation of dividing the sub-image into different segments will be discussed later and will not be detailed here.

[0057] Optional, see Figure 2 , Figure 2 This is a schematic diagram of subgraph partitioning provided in an embodiment of the present invention. Figure 2 In the illustrated embodiment, taking N=1 as an example, the specific implementation of dividing the image to be processed into 9 sub-images is explained. Here, (i, j) represents the coordinate position of any sub-image in the image to be processed, i∈[0,2], j∈[0,2], and X(i, j) represents the sampled pixel value of the sub-image corresponding to coordinate (i, j). When N takes other integers greater than 1, the sub-image division method can be referred to the same way. Figure 2 The implementation is shown below; examples will not be provided here.

[0058] The specific process for determining the coordinates of any sub-image and the sampled pixel values ​​will be discussed in later sections and will not be detailed here.

[0059] S120. Divide all subgraphs into multiple segments according to the preset partitioning rules.

[0060] As mentioned earlier, the image filtering process requires covering all pixels in the image to be processed. Therefore, in the process of dividing the image into segments, no sub-image can be omitted. Furthermore, in order to effectively improve the efficiency of image filtering, at least one of the segments obtained after this step includes multiple sub-images.

[0061] Optionally, in the specific implementation, all sub-images are divided into one first-type segmentation block and multiple second-type segmentation blocks. Each first-type segmentation block includes one sub-image, and this first-type segmentation block should be selected from the sub-image located at the center of the image to be processed. Figure 2 For example, the subgraph with coordinates (1, 1) should be selected.

[0062] Furthermore, for the second type of segmentation block, the segmentation block includes two or four subgraphs. Specifically, for a segmentation block including two subgraphs, its optional configuration includes... Figure 3a and Figure 3b Two types. Among them, such as Figure 3a As shown, the two subgraphs in the partition block are arranged in two rows and one column. In addition, the two subgraphs in the partition block can also be arranged as follows: Figure 3b As shown, they are arranged in two categories in one row. For a segmentation block containing four subgraphs, the four subgraphs can be arranged as follows: Figure 3c As shown, it is arranged in two rows and two columns. For Figures 3a to 3c The subgraphs shown are distributed in a manner that is either vertically symmetrical, horizontally symmetrical, or diagonally symmetrical.

[0063] Based on the basic preset partitioning rules of the above-mentioned segmentation blocks, by combining different numbers and types of segmentation blocks, (2N+1) segments in the image to be processed can be obtained. 2 Each sub-image is fully covered, thus achieving full coverage of all pixels. Taking an image to be processed divided into 25 sub-images as an example, the resulting segmented blocks can be as follows: Figure 4 As shown, it includes a first-type segmentation block, comprising four... Figure 3c The shown segment has two parts. Figure 3a The shown segment and two Figure 3b The segmentation blocks shown.

[0064] S130. Determine the sampled pixel value and sampled weight value for each segmented block.

[0065] In practical applications, when acquiring an image to be processed, the GPU needs to convert the image into a texture format it supports and perform normalization on the original image. Therefore, regardless of the specific size of the original image, the horizontal and vertical value ranges of the image to be processed after GPU interpolation sampling are the same, i.e., [0,1]. Thus, for an original image with dimensions row × col, the horizontal step size between adjacent pixels in the corresponding image to be processed is 1 / col, and the vertical step size is 1 / row, where col is the width of the original image and row is the height of the original image.

[0066] Based on the above, taking the coordinate position of any sub-image in the image to be processed as the reference, and of course, as a preferred implementation, the image to be processed is divided into (2N+1) sub-images. 2 In the case of multiple subimages, the coordinates of the subimage located at the center of the image to be processed (i.e., the subimage with coordinates (N, N)) are selected as the reference. It can be understood that in practical applications, for any subimage, the coordinates of the pixel located at the center of the subimage can be used as the subimage's position coordinates to facilitate subsequent related calculations and processing.

[0067] Furthermore, based on the position coordinates of the reference subgraph, and according to the aforementioned step size and the relative positions of the subgraphs, the position coordinates of each subgraph can be determined. Assuming the position coordinates of the reference subgraph are (dx, dy), the positions of other sampling points are determined by moving the subgraph horizontally and vertically by step size. Horizontally, the position after moving one step to the right is dx+1 / col, and the position after moving one step to the left is dx-1 / col. Vertically, the position after moving one step downwards is dy+1 / row, and the position after moving one step upwards is dy-1 / row.

[0068] Based on the above, each segmented block is taken as the target segmented block. First, the sampling points of the target segmented block are determined according to the method described above, and the pixel values ​​corresponding to the sampling points of the target segmented block are taken as the sampled pixel values ​​of the target segmented block, thus obtaining the sampled pixel values ​​corresponding to each segmented block. Optionally, see [link to relevant documentation]. Figure 5 As shown by the black dots, when the image to be processed is divided into 9 sub-images, the sampling point of the segment located at the center of the image to be processed is also the center of the image to be processed. This can be determined using the sampling point determination method described above. Figure 3a The segmentation block shown is sampled for two adjacent subgraphs in the vertical direction, and the sampling point corresponds to the center position of the two adjacent subgraphs. Figure 3b The segmentation blocks shown primarily sample two adjacent subgraphs in the horizontal direction, with the sampling points corresponding to the center positions of the adjacent subgraphs. Furthermore, for... Figure 3c The sampling points for the segmented blocks shown should correspond to the midpoints where the four subgraphs intersect. Figure 5 (not shown in the image).

[0069] Simultaneously, it is necessary to determine the preset weight values ​​for each subgraph included in the target segmentation block. In practical applications, the preset weight values ​​for each subgraph are directly related to the actual filter used. For example, when using a box filter, the preset weight value for each subgraph is 1; when using a Gaussian filter or other filters, the preset weight values ​​for each subgraph need to be adjusted accordingly.

[0070] Furthermore, by calculating the sum of the preset weight values ​​corresponding to each subgraph in the target segmentation block, the sampling weight value of the target segmentation block can be obtained.

[0071] by Figure 3a or Figure 3b Taking the segmentation block shown as an example, when using a box filter, the preset weight value of each sub-image is 1, so the sampling weight value of the segmentation block is 2. Correspondingly, Figure 3c The segmentation block shown comprises four sub-images, each with a corresponding sampling weight value of 4. It is understandable that for segmentation blocks with the same structure in the image to be processed, their respective sampling weight values ​​are the same.

[0072] S140. Based on the sampled pixel values ​​and sampled weight values ​​of each segmented block, determine the filter value of the image to be processed.

[0073] For each segment, the product of the sampled pixel value and the sampled weight value of that segment is calculated to obtain the filtered value of each segment. Furthermore, the sum of the filtered values ​​of all segment segments is calculated to obtain the total filtered value; that is, the total filtered value is calculated based on the sampled pixel value and sampled weight value of each segment. Simultaneously, the sum of the sampled weight values ​​of each segment segment is calculated to obtain the total weight value.

[0074] Based on the above calculation results, the quotient of the total filtered value and the total weight value can be used to obtain the filtered value of the image to be processed.

[0075] Still with Figure 5Taking the segmentation results of the image to be processed as an example, the sampled pixel value of segmentation block A is X1, and the sampling weight value is 1, so the filtering value of segmentation block A is X1×1; similarly, the sampled pixel value of segmentation block B is X2, and the sampling weight value is 2, so the filtering value of segmentation block B is X2×2 (i.e., including two segmentation blocks B); the sampled pixel value of segmentation block C is X3, and the sampling weight value is 2, so the filtering value of segmentation block C is X3×2 (i.e., including two segmentation blocks C). Furthermore, the total filtering value SUM for the image to be processed is SUM = X1×1 + 2×X2×2 + 2×X3×2, and the total weight value is 1 + 2×2 + 2×2 = 5. The filtering value of the image to be processed is SUM / 5.

[0076] In summary, the image filtering method provided by this invention includes at least one segmentation block comprising multiple sub-images among multiple segmentation blocks used to calculate the filtered values ​​of the image to be processed. By dividing the image into segmentation blocks, the number of times pixel values ​​are collected and the amount of computation can be effectively reduced. Furthermore, since the image to be processed is obtained by the GPU using a preset interpolation algorithm, the interpolation characteristics of the GPU can be utilized to improve the accuracy of pixel collection, thereby improving the efficiency of filtering while ensuring the accuracy of image filtering. Moreover, when applied to the GPU, this method can effectively reduce the CPU hardware resource consumption during the entire image processing process, helping to improve the CPU's response speed to other tasks and enhancing the user experience.

[0077] To explain in more detail the principle behind this method's improvement in image filtering efficiency, the following section will use... Figure 5 Taking the application scenario shown as an example, this paper discusses the existing technologies for... Figure 5 The process of filtering the image to be processed is described below:

[0078] The image to be processed is divided into 9 sub-images, combined with... Figure 2 As shown, the sampled pixel values ​​of each sub-image are represented as X(0,0), X(0,1), X(0,2), X(1,0), X(1,1), X(1,2), X(2,0), X(2,1), X(2,2). Meanwhile, the preset weight values ​​of each sub-image are denoted as w(0,0), w(0,1), w(0,2), w(1,0), w(1,1), w(1,2), w(2,0), w(2,1), w(2,2).

[0079] Based on the above premise, existing technologies require calculating the filter value X(i,j)×w(i,j) corresponding to each subgraph, denoted as sub_sum(i,j), then we have

[0080] sub_sum(0,0)=X(0,0)×w(0,0);

[0081] sub_sum(0,1)=X(0,1)×w(0,1);

[0082] sub_sum(0,2)=X(0,2)×w(0,2);

[0083] sub_sum(1,0)=X(1,0)×w(1,0);

[0084] sub_sum(1,1)=X(1,1)×w(1,1);

[0085] sub_sum(1,2)=X(1,2)×w(1,2);

[0086] sub_sum(2,0)=X(2,0)×w(2,0);

[0087] sub_sum(2,1)=X(2,1)×w(2,1);

[0088] sub_sum(2,2)=X(2,2)×w(2,2).

[0089] Therefore, it can be seen that the existing technology requires a total of 9 multiplication operations to calculate the filter value of each subgraph.

[0090] Furthermore, calculating the total filtered value, denoted as SUM, yields:

[0091] SUM=sub_sum(0,0)+sub_sum(0,1)+sub_sum(0,2)+sub_sum(1,0)+sub_sum(1,1)+sub_sum(1,2)+sub_sum(2,0)+sub_sum(2,1)+sub_sum(2,2)

[0092] Calculating the total filtered value requires a total of 8 addition operations.

[0093] To find the filtered value of the image to be processed, RESULT = SUM / 9, meaning that a total of 1 division operation is performed.

[0094] In summary, for a 3×3 boxfilter, the total computational cost of existing technologies is: 9 multiplication operations + 8 addition operations + 1 division operation.

[0095] When using the image filtering method provided by this invention, Figure 5 The filtering process for the image to be processed is as follows:

[0096] Using the position coordinates (1,1) of segment A as a reference, determine the position coordinates of segment blocks B and C. Specifically, segment block B corresponds to two sampling points: X(0,0.5) located between X(0,0) and X(0,1), and X(2,1.5) located between X(2,1) and X(2,2). Segment block C also corresponds to two sampling points: X(1.5,0) located between X(1,0) and X(2,0), and X(0.5,2) located between X(0,2) and X(1,2).

[0097] Based on the above, the following calculations are performed:

[0098] (1) Calculate the filtered values ​​of each sampling point corresponding to segmentation block A, segmentation block B, and segmentation block C, where,

[0099] The filter value for segment A is: X(1,1)×w(1,1);

[0100] The filtered values ​​for segment B are as follows:

[0101] X(0,0.5)×(w(1,0)+w(2,0));

[0102] X(2,1.5)×(w(0,2)+w(1,2));

[0103] Among them, w(1,0)+w(2,0) and w(0,2)+w(1,2) can be calculated in advance and are not included in the addition calculation.

[0104] The filtered values ​​for segmented block C are as follows:

[0105] X(1.5,0)×(w(0,0)+w(0,1));

[0106] X(0.5,2)×(w(2,1)+w(2,2));

[0107] Among them, w(0,0)+w(0,1) and w(2,1)+w(2,2) can be calculated in advance and are not included in the addition calculation.

[0108] In other words, this scheme involves a total of 5 multiplication operations.

[0109] (2) Calculate the total filter value SUM and the total weight value.

[0110] The total filtered value SUM = X(1,1)×w(1,1)+X(1.5,0)×(w(1,0)+w(2,0))+X(0.5,2)×(w(0,2)+w(1,2))+X(0,0.5)×(w(0,0)+w(0,1))+X(2,1.5)×(w(2,1)+w(2,2)). A total of 4 addition operations were performed.

[0111] The total weight is: 2×(w(1,0)+w(2,0))+2×w(0,0)+w(0,1)+1×w(1,1)

[0112] The total weight value can be calculated in advance and is not included in the addition calculation.

[0113] (3) Calculate the filter value of the image to be processed, denoted as RESULT.

[0114] RESULT=SUM / (2×(w(1,0)+w(2,0))+2×w(0,0)+w(0,1)+1×w(1,1))

[0115] One division calculation in total

[0116] For this scheme, the total computational workload is:

[0117] 5 multiplication operations + 4 addition operations + 1 division operation

[0118] In summary, in actual calculations, addition has a relatively small impact on performance; multiplication and division are the main factors. Therefore, the main difference lies in the fact that this solution can save four multiplication operations compared to existing solutions, theoretically improving performance by 80%. This is mainly due to the reduction in sampling points; existing technologies calculate nine points, while this solution calculates five.

[0119] Correspondingly, for an image to be processed divided into 25 sub-images, the method provided in this application only requires sampling 9 points, which can theoretically improve performance by 177%. For an image to be processed divided into 49 sub-images, normally 49 points need to be sampled for calculation, but the image processing method provided in this application only requires sampling 17 points, which can theoretically improve performance by 188%.

[0120] The image filtering device provided by this invention is described below. This image filtering device belongs to the same concept as the image filtering method provided in the embodiments of this application, and can execute the image filtering method provided in any embodiment of this application, possessing the corresponding functional modules and beneficial effects for executing the image filtering method. Technical details not described in detail in this embodiment can be found in the image filtering method provided in the embodiments of this application, and will not be repeated here.

[0121] See Figure 6 , Figure 6 This is a structural block diagram of an image filtering device provided by the present invention. The image filtering device provided in this embodiment includes:

[0122] The acquisition unit 10 is used to acquire the image to be processed, which is obtained by the GPU after processing the original image based on a preset interpolation algorithm.

[0123] The first division unit 20 is used to divide the image to be processed into multiple sub-images according to the preset specifications of the filtering window;

[0124] The second partitioning unit 30 is used to divide all subgraphs into multiple partition blocks according to a preset partitioning rule, wherein at least one partition block includes multiple subgraphs.

[0125] The first determining unit 40 is used to determine the sampled pixel value and sampled weight value of each segmentation block respectively;

[0126] The second determining unit 50 is used to determine the filter value of the image to be processed based on the sampled pixel value and sampled weight value of each segmented block.

[0127] Optionally, the first determining unit 40 is used to determine the sampled pixel values ​​and sampled weight values ​​of each segmented block, including:

[0128] Determine the sampling points of the target segmentation block and the preset weights corresponding to each subgraph included in the target segmentation block;

[0129] The target segment can be any one of the segments.

[0130] The pixel value corresponding to the sampling point of the target segmentation block is determined to be the sampled pixel value of the target segmentation block.

[0131] In addition, the sum of the preset weights corresponding to each subgraph in the target segmentation block is determined as the sampling weight value of the target segmentation block.

[0132] Optionally, the second determining unit 50 is used to determine the filter value of the image to be processed based on the sampled pixel values ​​and sampled weight values ​​of each segmented block, including:

[0133] The total filtered value is calculated based on the sampled pixel values ​​and sampled weight values ​​of each segmented block;

[0134] Calculate the sum of the sampling weight values ​​of each segment to obtain the total weight value;

[0135] The filter value of the image to be processed is obtained by calculating the quotient of the total filter value and the total weight value.

[0136] Optionally, the second determining unit 50 is used to calculate the total filtered value based on the sampled pixel values ​​and sampled weight values ​​of each segmented block, including:

[0137] For each segmentation block, the product of the sampled pixel value and the sampled weight value of the segmentation block is calculated to obtain the filter value of each segmentation block;

[0138] Calculate the sum of the filtered values ​​of each segment to obtain the total filtered value.

[0139] Optionally, the first partitioning unit 20 is used to divide the image to be processed into multiple sub-images according to the preset specifications of the filtering window, including:

[0140] The image to be processed is divided into (2N+1) segments according to the preset size of the filtering window. 2 There are 1 subgraph, where N is an integer greater than or equal to 1.

[0141] Optionally, the second partitioning unit 60 is used to divide the entire subgraph into multiple partitioning blocks according to a preset partitioning rule, including:

[0142] Divide all subgraphs into one first-type partition and multiple second-type partitions;

[0143] The first type of segmentation block includes one subgraph, while the second type of segmentation block includes two or four subgraphs.

[0144] Optionally, the subgraphs in a segmentation block comprising two subgraphs may be arranged in two rows and one column or one row and two columns.

[0145] The subgraphs in the segmentation block, which includes four subgraphs, are arranged in two rows and two columns.

[0146] Optional, see Figure 7 , Figure 7 See the structural block diagram of the controller provided in the embodiment of the present invention. Figure 7 As shown, it may include: at least one processor 100, at least one communication interface 200, at least one memory 300 and at least one communication bus 400.

[0147] In this embodiment of the invention, the number of processor 100, communication interface 200, memory 300, and communication bus 400 is at least one, and the processor 100, communication interface 200, and memory 300 communicate with each other through communication bus 400; obviously, Figure 7 The communication connections shown for the processor 100, communication interface 200, memory 300, and communication bus 400 are optional.

[0148] Optionally, the communication interface 200 can be an interface of a communication module, such as the interface of a GSM module.

[0149] Processor 100 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention.

[0150] The memory 300 stores the application program and may include high-speed RAM memory as well as non-volatile memory, such as at least one disk storage device.

[0151] Specifically, the processor 100 is used to execute an application program in the memory to implement any embodiment of the image filtering method described above.

[0152] In some embodiments, this embodiment also provides a computer-readable storage medium, such as a floppy disk, optical disk, hard disk, flash memory, USB flash drive, SD (Secure Digital Memory Card), MMC (Multimedia Card), etc., in which one or more instructions for implementing the above steps are stored. When these one or more instructions are executed by one or more processors, the processors perform the image filtering method described above. For specific implementation details, please refer to the foregoing description; further elaboration is not provided here.

[0153] In addition to the methods and apparatus described above, embodiments of this application may also be computer program products, which include computer program instructions that, when executed by a processor, cause the processor to perform the steps in the image filtering methods according to various embodiments of this application as described above.

[0154] Computer program products can be written in any combination of one or more programming languages ​​to perform the operations of the embodiments of this application. The programming languages ​​include object-oriented programming languages ​​such as Java and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0155] Those skilled in the art will understand that the contents disclosed herein can be varied and modified in many ways. For example, the various devices or components described above can be implemented in hardware, or in software, firmware, or a combination of some or all of the three.

[0156] Furthermore, while this disclosure makes various references to certain elements of the methods according to embodiments of this disclosure, any number of different elements may be used and operated on a client and / or server. Elements are merely illustrative, and different elements may be used in methods and different aspects of methods.

[0157] This disclosure uses flowcharts to illustrate the steps of a method according to embodiments of this disclosure. It should be understood that the preceding or following steps are not necessarily performed in exact order. Instead, the steps can be processed in reverse order or simultaneously. Furthermore, other operations can be added to these processes.

[0158] Those skilled in the art will understand that all or part of the steps in the above methods can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium, such as a read-only memory. Optionally, all or part of the steps in the above embodiments can also be implemented using one or more integrated circuits. Accordingly, each module / unit in the above embodiments can be implemented in hardware or as a software functional module. This disclosure is not limited to any particular combination of hardware and software.

[0159] Unless otherwise defined, all terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure pertains. It should also be understood that terms such as those defined in a common dictionary should be interpreted as having a meaning consistent with their meaning in the context of the relevant art, and not as having an idealized or highly formalized meaning, unless expressly defined herein.

[0160] The foregoing description is intended to illustrate the present disclosure and should not be construed as limiting it. While several exemplary embodiments of the present disclosure have been described, those skilled in the art will readily understand that many modifications may be made to the exemplary embodiments without departing from the novel teachings and advantages of the present disclosure. Therefore, all such modifications are intended to be included within the scope of the present disclosure as defined by the claims. It should be understood that the foregoing description is intended to illustrate the present disclosure and should not be construed as limiting it to the specific embodiments disclosed, and modifications to the disclosed embodiments and other embodiments are intended to be included within the scope of the appended claims. The present disclosure is defined by the claims and their equivalents.

Claims

1. An image filtering method, characterized in that, include: The image to be processed is obtained by the graphics processing unit (GPU) after processing the original image based on a preset interpolation algorithm. The image to be processed is divided into multiple sub-images according to the preset specifications of the filtering window; All the subgraphs are divided into multiple segments according to a preset partitioning rule, and at least one of the multiple segments includes multiple subgraphs. The sampling points of the target segmentation block and the preset weights corresponding to each subgraph included in the target segmentation block are determined, wherein the target segmentation block is any one of the segmentation blocks; The pixel value corresponding to the sampling point of the target segmentation block is determined to be the sampled pixel value of the target segmentation block. In addition, the sum of the preset weights corresponding to each subgraph in the target segmentation block is determined as the sampling weight value of the target segmentation block; The filter value of the image to be processed is determined based on the sampled pixel value and sampled weight value of each segmented block.

2. The method according to claim 1, characterized in that, Determining the filter value of the image to be processed based on the sampled pixel values ​​and sampled weight values ​​of each segmented block includes: The total filtered value is calculated based on the sampled pixel values ​​and sampled weight values ​​of each segmented block; The total weight value is obtained by summing the sampling weight values ​​of each segmented block. The quotient of the total filtered value and the total weight value is calculated to obtain the filtered value of the image to be processed.

3. The method according to claim 2, characterized in that, The calculation of the total filtered value based on the sampled pixel values ​​and sampled weight values ​​of each segmented block includes: For each segmentation block, the product of the sampled pixel value and the sampled weight value of the segmentation block is calculated to obtain the filter value of each segmentation block; The total filtered value is obtained by summing the filtered values ​​of each segmented block.

4. The method according to claim 1, characterized in that, The process of dividing the image to be processed into multiple sub-images according to the preset specifications of the filtering window includes: The image to be processed is divided into (2N+1) according to the preset specifications of the filtering window. 2 There are 1 subgraph, where N is an integer greater than or equal to 1.

5. The method according to claim 1, characterized in that, The step of dividing all the subgraphs into multiple segments according to a preset partitioning rule includes: The entire subgraph is divided into a first-type segmentation block and multiple second-type segments; The first type of segmentation block includes one subgraph, while the second type of segmentation block includes two or four subgraphs.

6. The method according to claim 5, characterized in that, The subgraphs in a segmentation block containing two subgraphs are arranged in two rows and one column or one row and two columns. The subgraphs in the segmentation block, which includes four subgraphs, are arranged in two rows and two columns.

7. An image filtering device, characterized in that, include: An acquisition unit is used to acquire an image to be processed, which is obtained by a graphics processing unit (GPU) processing an original image based on a preset interpolation algorithm. The first partitioning unit is used to divide the image to be processed into multiple sub-images according to the preset specifications of the filtering window; The second partitioning unit is used to divide all the subgraphs into multiple partition blocks according to a preset partitioning rule, wherein at least one of the multiple partition blocks includes multiple subgraphs. The first determining unit is configured to determine the sampling points of the target segmentation block and the preset weights corresponding to each sub-image included in the target segmentation block, determine the pixel value corresponding to the sampling points of the target segmentation block as the sampling pixel value of the target segmentation block, and determine the sum of the preset weights corresponding to each sub-image in the target segmentation block as the sampling weight value of the target segmentation block, wherein the target segmentation block is any one of the segmentation blocks; The second determining unit is used to determine the filter value of the image to be processed based on the sampled pixel value and sampled weight value of each segmented block.

8. A controller, characterized in that, include: Memory and processor; The memory stores a program suitable for execution by the processor to implement the image filtering method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the image filtering method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Fast video image bilateral filtering method

    CN101488219A

  • Image processing method and device, electronic equipment and storage medium

    CN113643198A