Image processing method, electronic device, and related apparatus
Patent Information
- Application Number
- CN202510440588.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-09
- Publication Date
- 2026-10-16
AI Technical Summary
[0005]本申请实施例提供一种图像处理方法、电子设备以及相关装置,以改善动态模糊后的图像产生残影的问题出现
[0064] In one possible implementation, the chip or chip system described above in this application further includes at least one memory storing instructions. The memory can be an internal storage unit of the chip, such as a register or cache, or it can be a storage unit of the chip itself (e.g., read-only memory, random access memory, etc.).
Smart Images

Figure CN122928612A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of terminal technology, and in particular to an image processing method, electronic device, and related apparatus. Background Technology
[0002] After applying motion blur to an image, it can produce a motion blur effect, which is a visual blur effect that simulates the movement of an object.
[0003] Currently, in the process of dynamic blurring, the blur radius and blur angle are usually determined first, and then each pixel in the image is processed individually. For example, multiple pixels within the blur radius that lie on a straight line at the blur angle can be selected for weighted processing to achieve the dynamic blurring effect.
[0004] However, this method of directly selecting multiple pixels adjacent to a pixel and weighting their pixel values may result in ghosting in the image after dynamic blurring. Summary of the Invention
[0005] This application provides an image processing method, electronic device, and related apparatus to improve the problem of image ghosting after dynamic blurring.
[0006] In a first aspect, embodiments of this application provide an image processing method, including:
[0007] Based on the fuzzy radius, determine the number of times N to be executed in the fuzzy processing. The fuzzy radius is positively correlated with the number of times N to be executed, and the number of times N to be executed is less than or equal to the fuzzy radius. N is an integer greater than or equal to 1.
[0008] In the i-th blurring process, for any first pixel in the first image, a weighted processing is performed based on the pixel value of the first pixel and the pixel value of at least one reference pixel in the first image to obtain the adjusted pixel value of the first pixel. The first image is the image obtained after the (i-1)-th blurring process, and the value of i ranges from 1 to N.
[0009] Here, it can be understood that when i is 1, it represents the first blurring operation. Therefore, according to the above understanding, the first image is the image obtained after the 0th blurring operation. In this implementation, the 0th image is not actually blurred; essentially, the first image corresponding to i being 1 is the original image to be blurred. When i is greater than 1, the image output from the previous blurring operation can be used as the input image for the current blurring operation in subsequent processing.
[0010] In this process, the adjusted pixel values of multiple pixels in the first image constitute the second image, and the second image obtained after performing the Nth blurring process is the target image.
[0011] In this implementation, the first blurring process targets the original image to be blurred, and each subsequent blurring process targets the image output by the previous blurring process. This step-by-step blurring method can achieve a certain smoothing effect, with each blurring process transitioning gradually to improve the problems of ghosting and content loss caused by the one-time weighted processing of multiple pixels within the blur radius.
[0012] In one possible implementation, when the fuzzy radius belongs to the first preset interval among multiple preset intervals, N is equal to the number of executions to be performed corresponding to the first preset interval in the first mapping relationship. The first mapping relationship is used to indicate the correspondence between the preset interval and the number of executions to be performed.
[0013] Among them, the starting and ending values of multiple preset intervals are, for example, equal to the nth power of the first value, and the difference between n corresponding to the starting value and n corresponding to the ending value is, for example, equal to 1. In this way, the fuzzy radius R and the number of executions N can approximately satisfy the logarithmic relationship, thereby improving the rationality of the number of executions N determined based on the fuzzy radius R under the premise that the fuzzy radius R and the number of executions N are positively correlated.
[0014] More specifically, the number of times fuzzing needs to be executed can be calculated in the following way:
[0015] Determine the logarithmic result with a base of a first value corresponding to the fuzzy radius. For example, the first value is equal to 2, or it can also be equal to any integer set according to actual needs.
[0016] Next, the logarithmic result is rounded down to obtain the floor value. Then, the floor value is incremented by one to obtain the number of executions, N. Increasing the floor value by one can also be understood as rounding up.
[0017] By rounding down, the final number of executions N is always an integer, regardless of the value of the blur radius R, ensuring the feasibility of performing N subsequent blurring operations. Furthermore, this can be understood as... (The sentence is incomplete and requires more context to translate accurately.) This can lead to multiple blur radii within the same preset interval corresponding to the same number of blur iterations, resulting in identical blurring effects obtained from different blur radii. To address this issue, the method provided in this application... Add 1 to the previous one to differentiate between different blur radii in the final blurring process, thus achieving different blurring effects for different blur radii.
[0018] In one possible implementation, the method also includes:
[0019] The first direction is determined based on the blur angle, wherein the angle between the first direction and the preset direction corresponding to the first pixel is equal to the blur angle.
[0020] In the first image, with the first pixel as the origin, K pixels are selected along the first direction, and K pixels are selected in the opposite direction of the first direction to obtain at least one reference pixel, where K is an integer greater than or equal to 1.
[0021] In this implementation, multiple symmetrical pixels along the first direction and the opposite direction are selected as reference pixels to avoid content offset issues in the blurring process.
[0022] In one possible implementation, the total number of reference pixels selected during N blurring processes is less than twice the blur radius.
[0023] In this implementation, by limiting the total number of reference pixels selected in the N blurring processes to less than 2R, the computational load and time consumption of the blurring process are reduced.
[0024] In one possible implementation, K pixels are selected in the first image along a first direction, with the first pixel as the origin, and K pixels are selected in the opposite direction of the first direction to obtain at least one reference pixel, including:
[0025] Taking the first pixel as the origin, a second pixel and a third pixel are selected in the first image along a first direction, wherein the distance between the second pixel and the first pixel is a first distance, and the distance between the third pixel and the first pixel is a second distance; and,
[0026] Taking the first pixel as the origin, select the fourth pixel and the fifth pixel in the first image in the opposite direction of the first direction. The distance between the fourth pixel and the first pixel is the first distance, and the distance between the fifth pixel and the first pixel is the second distance.
[0027] Where the first distance is a i The second distance is a i+1 , where a is an integer greater than 1; at least one reference pixel includes the second pixel, the third pixel, the fourth pixel, and the fifth pixel.
[0028] In this implementation, for example, the second and fourth pixels can be set to be two pixels symmetrical to the first pixel, meaning the distance between the second and first pixels is the same as the distance between the fourth and first pixels (this can be represented as the first distance). Similarly, the third and fifth pixels can be set to be two pixels symmetrical to the first pixel, meaning the distance between the third and first pixels is the same as the distance between the fifth and first pixels (this can be represented as the second distance). This allows for the selection of multiple symmetrical pixels along the first direction and its opposite as reference pixels, avoiding content offset issues in the blurring process.
[0029] In one possible implementation, the weight corresponding to the first pixel is the first weight, the weights corresponding to the second and fourth pixels are the second weights, and the weights corresponding to the third and fifth pixels are the third weights; for example, the second weight can be equal to the square of the third weight.
[0030] Among them, the first weight, the second weight, and the third weight are all numbers greater than 0 and less than 1, and the second weight is greater than the third weight.
[0031] Furthermore, when the value of i is between 1 and N-1, the value of the first weight is L, the value of the second weight is M, and the sum of the first weight, twice the second weight, and twice the third weight is equal to 1. Both L and M are numbers greater than 0 and less than 1.
[0032] Thus, the first weight is set to L, and the second weight is set to M. This means that in each subsequent fuzzing iteration before the final iteration, the data is weighted according to fixed weights to perform the complete fuzzing process.
[0033] In one possible implementation, when the value of i is equal to N, the value of the second weight is positively correlated with the first parameter, the value of the first weight is negatively correlated with the first parameter, and the value range of the second weight is 0 to M, while the value range of the first weight is L to 1.
[0034] Wherein, the first parameter is the ratio of the second value to the third value, the second value is the difference between the fuzzy radius and the starting value of the first preset interval, and the third value is the difference between the starting value and the ending value of the first preset interval.
[0035] This ensures that the closer the blur radius is to the start of the first preset interval, the greater the weight of the pixel value of the first pixel in the final blurring process. Similarly, the closer the blur radius is to the end of the first preset interval, the greater the weight of the pixel value of the selected reference pixel in the final blurring process. This guarantees the reasonableness of the blurring effect as the blur radius increases.
[0036] For example, when the first parameter is 0, the second weight is 0, and the first weight is 1. This ensures that in the implementation of the fuzzy radius corresponding to the starting value of the first preset interval, the final fuzzing process is actually ineffective.
[0037] Secondly, embodiments of this application provide an image processing method, including:
[0038] Based on the blur radius, it is determined that the original image will undergo two blurring processes. The original image is the image that needs to be blurred.
[0039] Next, for any pixel in the original image, a weighted average is performed based on the pixel value and the pixel values of multiple reference pixels symmetrical to the pixel, resulting in a first blurred image. In this application, as long as the selected multiple reference pixels are symmetrical to the pixel being processed, the selection method of the reference pixels can be arbitrarily set according to actual needs.
[0040] Next, for any pixel in the first blurred image, a weighted average is performed based on the pixel value and the pixel values of multiple reference pixels symmetrical to that pixel to obtain the target image. The method for selecting the reference pixels described here is similar.
[0041] Based on this processing method, the original image can be blurred in stages. The staged blurring is achieved by obtaining the first blurred image after the first blurring process is completed, and then performing the second blurring process on the first image. This can achieve a transition effect in the blurring process, thereby improving the problems of ghosting and content loss caused by the one-time weighted processing of multiple pixels within the blur radius.
[0042] In one possible implementation, the method further includes:
[0043] The first direction is determined based on the blur angle, and the angle between the first direction and the preset direction corresponding to the pixel is equal to the blur angle; where,
[0044] For any pixel in the original image, the multiple reference pixels include K pixels selected along the first direction with the pixel as the origin in the original image, and K pixels selected in the opposite direction of the first direction, where K is an integer greater than or equal to 1.
[0045] For any pixel in the first blurred image, the plurality of reference pixels include K pixels selected along the first direction with the pixel as the origin, and K pixels selected in the opposite direction of the first direction, where K is an integer greater than or equal to 1.
[0046] In one possible implementation, the total number of reference pixels selected during the two blurring processes is less than twice the blur radius.
[0047] In one possible implementation, for any pixel in the original image, K pixels selected along a first direction include a second pixel and a third pixel, wherein the distance between the second pixel and other pixels is a first distance, and the distance between the third pixel and other pixels is a second distance; and...
[0048] The K pixels selected in the opposite direction of the first direction include the fourth pixel and the fifth pixel, wherein the distance between the fourth pixel and the pixel is the first distance, and the distance between the fifth pixel and the pixel is the second distance;
[0049] Where the first distance is a j The second distance is a j+1 Both a and j are integers greater than 1. For example, j can be 1, or it can be set according to actual needs.
[0050] In one possible implementation, the weight corresponding to a pixel is the first weight, the weights corresponding to the second and fourth pixels are the second weights, and the weights corresponding to the third and fifth pixels are the third weights.
[0051] Among them, the first weight, the second weight, and the third weight are all numbers greater than 0 and less than 1, and the second weight is greater than the third weight.
[0052] In one possible implementation, the first weight is L, the second weight is M, and the sum of the first weight, twice the second weight, and twice the third weight equals 1, where L and M are both numbers greater than 0 and less than 1.
[0053] In one possible implementation, for any pixel in the first blurred image, K pixels selected along a first direction include a sixth pixel and a seventh pixel, wherein the distance between the sixth pixel and other pixels is a third distance, and the distance between the seventh pixel and the first pixel is a fourth distance; and...
[0054] The K pixels selected in the opposite direction of the first direction include the eighth pixel and the ninth pixel, wherein the distance between the eighth pixel and the pixel is the third distance, and the distance between the ninth pixel and the pixel is the fourth distance.
[0055] Where the third distance is a j+1 The fourth distance is a j+2 , where a and j are both integers greater than 1.
[0056] In one possible implementation, the weight corresponding to a pixel is the fourth weight, the weights corresponding to the sixth and eighth pixels are the fifth weights, and the weights corresponding to the seventh and ninth pixels are the sixth weights.
[0057] Among them, the fourth, fifth, and sixth weights are all numbers greater than 0 and less than 1, and the fifth weight is greater than the sixth weight.
[0058] In one possible implementation, the value of the fifth weight is positively correlated with the first parameter, the value of the fourth weight is negatively correlated with the first parameter, and the value range of the fifth weight is 0 to M, while the value range of the fourth weight is L to 1.
[0059] Wherein, the first parameter is the ratio of the second value to the third value, the second value is the difference between the fuzzy radius and the starting value of the first preset interval to which it belongs, and the third value is the difference between the starting value and the ending value of the first preset interval; the first preset interval is one of multiple intervals pre-divided for the fuzzy radius.
[0060] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, the memory for storing code instructions, and the processor for running the code instructions to perform the methods described in the first aspect or any possible implementation of the first aspect.
[0061] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program or instructions that, when executed on a computer, cause the computer to perform the methods described in the first aspect or any possible implementation thereof.
[0062] Fifthly, embodiments of this application provide a computer program product including a computer program, which, when run on a computer, causes the computer to perform the methods described in the first aspect or any possible implementation thereof.
[0063] Sixthly, this application provides a chip or chip system including at least one processor and a communication interface. The communication interface and the at least one processor are interconnected via a circuit. The at least one processor is used to run computer programs or instructions to perform the methods described in the first aspect or any possible implementation of the first aspect. The communication interface in the chip can be an input / output interface, pins, or circuits, etc.
[0064] In one possible implementation, the chip or chip system described above in this application further includes at least one memory storing instructions. The memory can be an internal storage unit of the chip, such as a register or cache, or it can be a storage unit of the chip itself (e.g., read-only memory, random access memory, etc.).
[0065] It should be understood that the second to sixth aspects of this application correspond to the technical solutions of the first aspect of this application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation are similar, and will not be repeated here. Attached Figure Description
[0066] Figure 1 A schematic diagram of a dynamically blurred scene provided for an embodiment of this application;
[0067] Figure 2 This application provides a schematic diagram of motion blur processing in its embodiments. Figure 1 ;
[0068] Figure 3 This application provides a schematic diagram of motion blur processing in its embodiments. Figure 2 ;
[0069] Figure 4 The illustration of the dynamic blur effect provided in the embodiments of this application Figure 1 ;
[0070] Figure 5 A schematic flowchart of the image processing method provided in the embodiments of this application;
[0071] Figure 6 This is a schematic diagram illustrating the relationship between the fuzzy radius and the fuzzy order in an embodiment of this application.
[0072] Figure 7 A schematic diagram illustrating the implementation of the first direction provided in an embodiment of this application;
[0073] Figure 8This application provides a schematic diagram of the implementation of phased execution of dynamic fuzzing in its embodiments. Figure 1 ;
[0074] Figure 9 A schematic diagram of the first parameter provided for the embodiments of this application. Figure 1 ;
[0075] Figure 10 A schematic diagram of the first parameter provided for the embodiments of this application. Figure 2 ;
[0076] Figure 11 This application provides a schematic diagram of the implementation of phased execution of dynamic fuzzing in its embodiments. Figure 2 ;
[0077] Figure 12 This is a schematic diagram of image augmentation provided for an embodiment of this application;
[0078] Figure 13 The illustration of the dynamic blur effect provided in the embodiments of this application Figure 2 ;
[0079] Figure 14 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0080] To facilitate understanding, the relevant terms and concepts involved in the embodiments of this application will be introduced below:
[0081] 1. Dynamic blur
[0082] Motion blur refers to the blurring effect that occurs when moving objects or a camera are moving rapidly, due to the slow shutter speed of the camera or the rapid movement of the object. It is often used to simulate visual perception in the real world, increasing the sense of dynamism and speed in an image.
[0083] Applying motion blur to an image creates a blurred effect, which simulates the visual blurring of an object in rapid motion. This effect is commonly used in photography, film, games, and image processing to enhance the sense of motion, speed, or realism.
[0084] In image processing, for example, adding motion blur to animations can make the image look more natural, preventing it from appearing unrealistic due to fast-paced movements. Similarly, adding motion blur to static images can increase their visual impact and enhance immersion.
[0085] 2. Animation effects
[0086] Motion effects generally refer to the effects of enhancing visual presentation through animation and dynamic elements, and are widely used in video, film, advertising, UI design, web design, and other fields. Simply put, motion effects are the process of making static elements visually change through movement, transformation, or other dynamic effects to attract attention, convey information, or enhance emotional expression.
[0087] Animation effects are not just about the movement of objects; they can also include many other forms of dynamic changes, such as transparency, scaling, rotation, and color changes. Animation effects can effectively enhance the user's visual experience and interactive feel.
[0088] 3. Electronic equipment
[0089] The electronic devices in this application embodiment can be referred to as user equipment (UE), terminal, etc. For example, electronic devices can be mobile phones, tablets, personal digital assistants (PDAs), handheld devices with wireless communication capabilities, computing devices, in-vehicle devices or wearable devices, virtual reality (VR) terminal devices, augmented reality (AR) terminal devices, wireless terminals in industrial control, wireless terminals in smart homes, etc. The form of the electronic devices is not specifically limited in this application embodiment.
[0090] In current electronic devices, there are some scenarios where dynamic blurring of images is necessary. The following section will discuss these scenarios in conjunction with... Figure 1 To illustrate one possible scenario. Figure 1 This is a schematic diagram of a dynamically blurred scene provided in an embodiment of this application.
[0091] Figure 1 The image displayed is the image editing interface in the photo album, such as... Figure 1 As shown, for example, a motion blur filter 102 can be added under the image editing function in the photo album. For instance, a user can click the filter trigger control 101 to display multiple filter selection controls as shown in the figure, such as Original, Classic, Grayscale, Natural, and Motion Blur filter selection controls. When the user selects the motion blur filter selection control 102, the electronic device can apply a motion blur effect to the image, thereby generating an image with the motion blur effect added.
[0092] In another scenario, motion blur effects can be added to the animations of electronic devices to enhance the naturalness of the animation playback. Animations described here could include, for example, the opening and closing of folders on the desktop, or the opening of an application from the desktop and the exit from an application to the desktop. This application does not limit the specific animation effects; any animation that needs to be played on an electronic device can have the motion blur effects described in this application added.
[0093] In response to the scenarios described above, the following will be combined with... Figure 2 and Figure 3 This paper explains a method for handling dynamic blur. Figure 2 This application provides a schematic diagram of motion blur processing in its embodiments. Figure 1 , Figure 3 This application provides a schematic diagram of motion blur processing in its embodiments. Figure 2 .
[0094] It is important to understand that during the processing of motion blur, for example, the blur radius and blur angle can be predetermined. For instance, in the motion blur scenario of image editing described above, the user can manually input the blur radius and blur angle to achieve the desired motion blur effect, or a fixed blur radius and blur angle can be preset to achieve a specific motion blur effect. As another example, in the motion blur scenario of animation playback described above, a fixed blur radius and blur angle can be preset to achieve a predetermined motion blur effect during animation playback.
[0095] After determining the blur radius and blur angle, multiple pixels within the blur radius that lie on the line of the blur angle can be selected for weighted processing to achieve a dynamic blur effect. Since images typically contain multiple pixels, similar processing is applied to each pixel in the image during dynamic blurring. Therefore, the following explanation uses an arbitrary pixel in the image as an example.
[0096] Reference Figure 2 Suppose that there is a pixel 0 in image 1, as shown in the figure, and assume that the blur radius is 3 and the blur angle is 0 (degrees). Then, for example, we can choose 3 pixels to the left of pixel 0 (pixels 2, 4, and 6) and 3 pixels to the right of pixel 0 (pixels 1, 3, and 5) as pixels to participate in the blur processing.
[0097] It should be understood that the method selects 3 pixels on the left and 3 pixels on the right for two reasons. One reason is that the blur radius is 3. Another reason is that the direction to the right of a pixel is usually taken as the direction corresponding to an angle of 0. Therefore, the right side corresponds to the positive direction of the blur angle of 0, and the left side corresponds to the negative direction of the blur angle of 0. By selecting 3 pixels along the positive and negative directions of the blur angle of 0, it is possible to select multiple pixels with a blur radius of 3 and a blur angle of 0.
[0098] For example, dynamic blurring of pixel 0 can be performed based on pixels 0, 1, 2, 3, 4, 5, and 6. In one implementation, such as... Figure 2 As shown, for example, a weight can be set for pixel 0 as a, and a weight can be set for pixels 1 and 2 (the distance between these two pixels and pixel 0 is defined as 1) as b, and a weight can be set for pixels 3 and 4 (the distance between these two pixels and pixel 0 is 2) as c, and a weight can be set for pixels 5 and 6 (the distance between these two pixels and pixel 0 is 3) as d.
[0099] Based on this, for example, it can be processed according to the following formula:
[0100] a×X0+b×(X1+X2)+c×(X3+X4)+d×(X5+X6)=X0 ` Formula 1
[0101] In the above formula, X0 is the pixel value of pixel 0, X1 is the pixel value of pixel 1, X2 is the pixel value of pixel 2, X3 is the pixel value of pixel 3, X4 is the pixel value of pixel 4, X5 is the pixel value of pixel 5, and X6 is the pixel value of pixel 6. After processing according to the formula described above, the blurred pixel value X0 of pixel 0 can be obtained. ` .
[0102] By performing the aforementioned processing on each pixel in Image 1, we can obtain the blurred pixel value corresponding to each pixel in Image 1. For example, in... Figure 2 In the example, for pixel 0, the blurred pixel value can be obtained as X0. ` And for pixel 1, the blurred pixel value can be obtained as X1. ` And for pixel 2, the blurred pixel value X2 can be obtained. ` The understanding of pixels 3, 4, 5 and 6 is similar, and will not be repeated here.
[0103] Furthermore, the pixel values after blurring each pixel can form image 2. In other words, after blurring image 1, image 2 can be obtained, and image 2 will present the effect of dynamic blurring of image 1.
[0104] In one implementation, the weights described above can satisfy the following requirement: a + 2b + 2c + 2d = 1. Based on this, the specific settings of the weights can be arbitrarily set according to actual needs. For example, a ≥ b ≥ c ≥ d can also be set, but this application does not limit the specific size of the weights; they can be set according to actual needs.
[0105] This combination Figure 2 This section describes the implementation of a blur radius of 3 and a blur angle of 0. To further understand blur radius and blur angle, we will now combine... Figure 3 Another approach to handling fuzzy radius and fuzzy angle is introduced.
[0106] Reference Figure 3 Suppose that there is a pixel 0 in image 1, as shown in the figure, and assume that the blur radius is 3 and the blur angle is 90 degrees. Then, for example, we can select 3 pixels above pixel 0 (pixels 2, 4, and 6) and 3 pixels below pixel 0 (pixels 1, 3, and 5) as pixels to participate in the blur processing.
[0107] The reason for selecting three pixels at the top and bottom is twofold: firstly, the blur radius is 3; secondly, the direction to the right of a pixel is usually considered the direction corresponding to an angle of 0. Therefore, the top corresponds to the positive direction of a blur angle of 90 degrees, and the bottom corresponds to the opposite direction of a blur angle of 90 degrees. By selecting three pixels along the positive and opposite directions of a blur angle of 90 degrees, it is possible to select multiple pixels corresponding to a blur radius of 3 and a blur angle of 0 degrees.
[0108] Then, motion blur processing can be performed on pixel 0 based on pixels 0, 1, 2, 3, 4, 5, and 6. The implementation method of motion blur processing is the same as described above. Figure 2 The descriptions are similar, so I won't repeat them here.
[0109] Furthermore, if the pixel values after blurring are determined for each pixel in image 1, the pixel values after blurring can constitute image 2. In other words, after blurring image 1, image 2 can be obtained, and image 2 will present the effect of dynamic blurring of image 1.
[0110] However, the blurring method described above directly selects multiple pixels adjacent to a given pixel and performs weighted pixel value processing to obtain the blurred pixel value. This can lead to issues such as loss of image detail and ghosting in the resulting dynamically blurred image. These problems become more pronounced, especially when the blur radius is large.
[0111] For example, you can refer to Figure 4 To understand, Figure 4 The illustration of the dynamic blur effect provided in the embodiments of this application Figure 1 .
[0112] like Figure 4 As shown, for example, for Figure 4 The image shown in (a) is subjected to motion blur processing to obtain... Figure 4 The image shown in (b) is the dynamically blurred image. (Refer to...) Figure 4 As shown in (b), it can be determined that in the motion-blurred image, the areas indicated by boxes 401, 402, and 403 exhibit obvious ghosting issues. Ghosting also exists in other parts of the image, but will not be listed here.
[0113] Besides the issues of detail loss and ghosting, it's understandable that a larger blur radius means more surrounding pixels need to be considered in the weighted calculation for each individual pixel. This leads to a linear increase in the number of operations during dynamic blur processing as the blur radius increases. In other words, a large blur radius results in more operations and consequently, slower processing speed.
[0114] To address the aforementioned technical problems, this application proposes an image processing method. This method determines the number of blurring operations N based on the blur radius, and then performs N blurring operations sequentially. The input for each blurring operation is the output of the previous blurring operation, thus achieving an effective transition of the blurring effect and avoiding the loss of image details and ghosting. In each blurring operation, not all pixels within the blur radius are selected for calculation; instead, a specific number of pixels are chosen for individual pixel blurring calculations. This effectively reduces the computational load of blurring operations, thereby improving processing speed.
[0115] Based on the above description, the image processing method provided in this application will be described in detail below with reference to specific embodiments. These embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0116] Figure 5 This is a schematic flowchart illustrating the image processing method provided in an embodiment of this application. Figure 5 As shown, the image processing method provided in this application includes:
[0117] 1. Determine the number of fuzzy iterations N based on the fuzzy radius.
[0118] 2. Perform blurring processing on the original image N times in sequence to obtain the target image.
[0119] The following sections will introduce these two parts separately, starting with... Figure 6 This paper introduces the implementation method of determining the fuzzy number N based on the fuzzy radius. Figure 6 This is a schematic diagram illustrating the relationship between the fuzzy radius and the number of fuzzy iterations provided in an embodiment of this application.
[0120] In one implementation, the blur radius and the blur number N in this application are generally directly proportional; that is, the larger the blur radius is set, the larger the blur number N will be. The blur number can also be described as the number of times the blur processing needs to be executed.
[0121] For example, the fuzzy radius R and the fuzzy number N can satisfy the following formula:
[0122]
[0123] Assuming that the formula in formula two Equivalent to W, then based on the above formula 2, we can determine that N and R actually satisfy the following: Figure 6 The situation shown:
[0124] When the fuzzy radius R is within the range of (0,2), referring to the above formula, we can determine that W equals 0, then the number of fuzzing N = W + 1 = 1;
[0125] When the fuzzy radius R is within the range of [2,4), W can be determined to be equal to 1 by referring to the above formula, then the number of fuzzy operations N = W + 1 = 2;
[0126] When the fuzzy radius R is within the range of [4,8), W can be determined to be equal to 2 by referring to the above formula, then the number of fuzzy operations N = W + 1 = 3;
[0127] When the fuzzy radius R is within the range of [8, 16), W can be determined to be equal to 3 by referring to the above formula, and then the number of fuzzy operations N = W + 1 = 4.
[0128] The implementation of the fuzzy radius R in other ranges can be understood by referring to Formula 2 above, and will not be elaborated here.
[0129] Based on this, it can be understood that multiple preset intervals can be pre-defined in this application. For example, (0,2), [2,4), [4,8), and [8,16) described above can be understood as multiple preset intervals. Furthermore, a first mapping relationship can be pre-established, where the first mapping relationship indicates the correspondence between the preset intervals and the number of executions to be performed. For example, in the implementation described above, the number of executions to be performed corresponding to the preset interval (0,2) is 1, the number of executions to be performed corresponding to the preset interval [2,4) is 2, the number of executions to be performed corresponding to the preset interval [4,8) is 3, the number of executions to be performed corresponding to the preset interval [8,16) is 4, and so on.
[0130] Based on this, it can be determined which of the multiple preset intervals the currently set fuzzy radius belongs to (here referred to as the first preset interval). Then, the number of executions corresponding to the first preset interval can be determined in the first mapping relationship, thereby obtaining the number of executions N corresponding to the current fuzzy radius.
[0131] In this implementation, by setting the fuzzy radius R and the number of executions N to approximately satisfy a logarithmic relationship, the rationality of the number of executions N determined based on the fuzzy radius R can be improved, provided that the fuzzy radius R and the number of executions N are positively correlated. Furthermore, by rounding down, the final number of executions N can be ensured to be an integer regardless of the value of the fuzzy radius R, guaranteeing the feasibility of performing N fuzzy processing operations. Even further, it can be understood that if directly setting... This would result in multiple blur radii within the same preset interval having the same number of blur iterations, leading to identical blur effects obtained from different blur radii. To address this, the method provided in this application adds 1 to W to differentiate between different blur radii in the final blur processing, thus ensuring that the blur effects corresponding to different blur radii also differ.
[0132] However, it's important to understand that the relationship between the fuzzy radius R and the fuzziness number N described above, combined with Formula 2, is only one possible one. In actual implementation, for example, it can also be set to... The understanding is similar to that described above. Alternatively, the argument of the log function, which serves as the denominator, can be arbitrarily set according to actual needs; this embodiment does not impose any limitations on this. Furthermore, adding one to the result of rounding down can also be understood as rounding up.
[0133] In some examples, the blur radius R and the number of blurs N do not necessarily need to be calculated logarithmically; other mathematical relationships can also be used. For example, the number of blurs corresponding to each preset radius can be pre-defined, as long as the blur radius and the number of blurs are directly proportional. Based on this, the specific implementation of determining the number of blurs based on the blur radius can be arbitrarily extended according to actual needs. However, it is important to understand that, based on the extension of the method of determining the number of blurs based on the blur radius, the calculation methods of subsequent corresponding contents (such as the selection of reference pixels and the determination of weights) also need to be adaptively extended to ensure the visual effect of the image after dynamic blurring.
[0134] Building upon the above introduction, the following section will describe how to perform N blurring operations sequentially on the original image to obtain the target image. The following section will combine... Figures 7 to 11 To introduce, Figure 7 This is a schematic diagram illustrating the implementation of the first direction in an embodiment of this application. Figure 8 This application provides a schematic diagram of the implementation of phased execution of dynamic fuzzing in its embodiments. Figure 1 , Figure 9 A schematic diagram of the first parameter provided for the embodiments of this application. Figure 1 , Figure 10 A schematic diagram of the first parameter provided for the embodiments of this application. Figure 2 , Figure 11 This application provides a schematic diagram of the implementation of phased execution of dynamic fuzzing in its embodiments. Figure 2 .
[0135] In this embodiment, the original image will be blurred N times, and each blurring process is similar. Therefore, the implementation process of any one of the blurring processes will be briefly introduced below:
[0136] In the i-th blurring process, the first image can be determined first. The value of i ranges from 1 to N. If i equals 1, meaning it's the first blurring operation, then the first image described here can be the original image to be blurred. If i ranges from 2 to N, meaning at least one blurring operation has already been performed, then the first image described here can be the image obtained after the (i-1)-th blurring operation, that is, the image output after the previous blurring operation.
[0137] Based on this, for any first pixel in the first image, a weighted processing can be performed based on the pixel value of the first pixel and the pixel value of at least one reference pixel in the first image to obtain the adjusted pixel value of the first pixel.
[0138] Similar processing is performed on each pixel in the first image to obtain the adjusted pixel values for each pixel in the first image. Furthermore, the adjusted pixel values for each pixel in the first image can then be used to construct the second image.
[0139] During the first to N-1th blurring processes, the second image here is the input image for the next blurring process (which is the first image mentioned above). The second image obtained after the Nth blurring process is the final target image, which is also the final blurred result image.
[0140] Based on the above introduction, it can be determined that during the blurring process, a weighted average is required based on the pixel value of the first pixel and the pixel value of the reference pixel in the first image. The following section will combine... Figure 7 The implementation of selecting reference pixels is introduced.
[0141] In one implementation, given a defined fuzzy angle, a first direction can be determined based on the fuzzy angle, wherein the angle between the first direction and the preset direction corresponding to the first pixel is equal to the fuzzy angle. For example, the direction directly to the right of the first direction can be determined as the preset direction (that is, the direction directly to the right of the first direction can be taken as the direction with an angle of 0 degrees).
[0142] Reference Figure 7 As shown, the box in the figure can be understood as the first pixel, and the arrow A in the figure indicates the preset direction of the first pixel.
[0143] like Figure 7 As shown in (a) of the figure, when the ambiguity angle is equal to 0 degrees, the angle between the direction indicated by arrow B1 and the preset direction indicated by arrow A is 0 degrees. Therefore, the direction indicated by arrow B1 can be determined as the first direction. Correspondingly, the direction indicated by arrow B2 is the opposite direction of the first direction.
[0144] like Figure 7 As shown in (b) of the figure, when the ambiguity angle is equal to 90 degrees, the angle between the direction indicated by arrow B1 and the preset direction indicated by arrow A is 90 degrees. Therefore, the direction indicated by arrow B1 can be determined as the first direction. Correspondingly, the direction indicated by arrow B2 is the opposite direction of the first direction.
[0145] like Figure 7As shown in (c), when the ambiguity angle is 45 degrees, the angle between the direction indicated by arrow B1 and the preset direction indicated by arrow A is 45 degrees. Therefore, the direction indicated by arrow B1 can be determined as the first direction. Correspondingly, the direction indicated by arrow B2 is the opposite direction of the first direction.
[0146] After determining the first direction, in each blurring process, K pixels can be selected in the first image along the first direction with the first pixel as the origin, and K pixels can be selected in the opposite direction of the first direction, so as to obtain at least one reference pixel, where K is an integer greater than or equal to 1.
[0147] For example, K can be 2, meaning that 4 reference pixels are selected in each blurring process. Alternatively, the specific value of K can be set according to actual needs, and this embodiment does not limit this.
[0148] In one implementation, when setting the value of K, for example, the total number of reference pixels selected in the N blurring processes can be limited to less than 2R, in order to reduce the computational load and shorten the processing time of the blurring process. Based on this, this application does not restrict the value of K.
[0149] The following example uses a value of K equal to 2. This means that in each blurring process, two pixels are selected along the first direction; these two pixels can be called the second and third pixels. Then, two pixels are selected in the opposite direction; these two pixels can be called the fourth and fifth pixels.
[0150] To ensure a good blurring effect, for example, the second and fourth pixels can be set as symmetrical to the first pixel, meaning the distance between the second and first pixels is the same as the distance between the fourth and first pixels (represented as the first distance). Similarly, the third and fifth pixels can be set as symmetrical to the first pixel, meaning the distance between the third and first pixels is the same as the distance between the fifth and first pixels (represented as the second distance). This allows for the selection of multiple symmetrical pixels along the first direction and its opposite as reference pixels, preventing content offset issues during blurring.
[0151] Furthermore, in order to ensure that the blurring effect of N blurring processes can be effectively transitioned, the distance of the selected reference pixel can be increased sequentially in the N blurring processes.
[0152] For example, the first distance can be set to a.i The second distance is a i+1 In this way, the distance between the selected reference pixel and the first pixel can be increased sequentially during multiple processing steps. For example, the value of 'a' can be equal to 2, or the specific value of 'a' can be arbitrarily set according to actual needs; this embodiment does not impose any restrictions on this.
[0153] Based on the examples introduced above, the following will be combined with... Figure 8 This paper introduces the implementation of multiple blurring processes using a specific example.
[0154] like Figure 8 As shown, assuming the blur angle is 0 degrees, the direction to the right of the first pixel is the first direction, and the direction to the left of the first pixel is the opposite direction of the first direction. Also, assuming the blur radius is 4, as explained above, a blur radius of 4 corresponds to 3 blurring operations. Therefore, the original image needs to be blurred 3 times. In each blurring operation, two pixels are selected to the right of the first pixel and two pixels are selected to the left of the first pixel.
[0155] The following is combined with Figure 8 The three fuzzing processes will be explained separately.
[0156] Based on the above description, it can be determined that in the first blurring process, the first image is the original image to be blurred. In this example, the original image to be blurred is image 1. Therefore, image 1 is used as the first image in this blurring process. Assume that there are 9 pixels in image 1 as shown in the figure (one box represents one pixel). These 9 pixels are, from left to right, pixel 7, pixel 5, pixel 3, pixel 1, pixel 0, pixel 2, pixel 4, pixel 6, and pixel 8 (not labeled in the figure).
[0157] For example, if pixel 0 is the first pixel, then two pixels can be selected to the right of pixel 0. For instance, pixels can be selected to the right of pixel 0 at a distance of 2 (i.e., 2 pixels). 1 The pixel at point 0 is pixel 4. Also, you can select a pixel 4 (or 2 pixels) to the right of pixel 0. 2 The pixel is 8.
[0158] Furthermore, two pixels can be selected to the left of pixel 0. For example, two pixels can be selected to the left of pixel 0 at a distance of 2 (i.e., 2...) from pixel 0. 1 The pixel is 3. Also, you can select a pixel 4 (or 2) to the left of pixel 0.2 The pixel is 7.
[0159] In this way, we can obtain pixels 3, 4, 7, and 8 as reference pixels. Then, we can perform a weighted average based on the pixel values of these four reference pixels and the pixel value of the first pixel to obtain the adjusted pixel value of the first pixel.
[0160] In one implementation, the weights in the weighted processing can be set as follows: the weight corresponding to the first pixel is the first weight, the weights corresponding to the second and fourth pixels are the second weights, and the weights corresponding to the third and fifth pixels are the third weights. In this round of blurring, pixel 0 is the first pixel, pixel 4 is the second pixel, pixel 8 is the third pixel, pixel 3 is the fourth pixel, and pixel 7 is the fifth pixel.
[0161] In this system, the first, second, and third weights are all numbers greater than 0 and less than 1, with the second weight being greater than the third weight. This allows reference pixels closer to the first pixel to be assigned a larger weight.
[0162] For example, the second weight could be set to be equal to the square of the third weight. However, it should be understood that this is only one possible implementation. In actual implementation, the specific relationship between the second and third weights can be set according to actual needs, as long as the second weight is greater than the third weight.
[0163] exist Figure 8 In the example, z represents the first weight and w represents the second weight. For example, if the second weight is set to be equal to the square of the third weight, then the third weight can be represented as w×w.
[0164] Based on this, for example, a weighted calculation can be performed according to the following formula three:
[0165] z×X0+w×(X3+X4+w(X7+X8))=X0 ` Formula 3
[0166] In the above formula, X0 is the pixel value of pixel 0 in image 1, X3 is the pixel value of pixel 3 in image 1, X4 is the pixel value of pixel 4 in image 1, X7 is the pixel value of pixel 7 in image 1, and X8 is the pixel value of pixel 8 in image 1. After processing according to the formula described above, the blurred pixel value X0 of pixel 0 in image 1 can be obtained. ` .
[0167] like Figure 8 As shown, after determining the adjusted pixel values for each pixel in image 1, we can obtain... Figure 8 Image 2 (the second image determined by the first blurring process) shows that the nine pixels from left to right are still represented as: pixel 7, pixel 5, pixel 3, pixel 1, pixel 0, pixel 2, pixel 4, pixel 6, and pixel 8 (not labeled in the figure). Referring to the illustration, it can be determined that the adjusted pixel value corresponding to pixel 0 is X0. ` The adjusted pixel value corresponding to pixel 1 is X1. ` The adjusted pixel value corresponding to pixel 2 is X2. ` The other pixels are similar, so I won't go into details here.
[0168] This completes the first fuzzing process, thus obtaining... Figure 8 Image 2 is shown below. The next blurring process can then be performed based on image 2.
[0169] Based on the above description, it can be determined that in the second blurring process, the first image is the second image determined by the previous blurring process, and the second image determined by the first blurring process is image 2. Therefore, in this blurring process, image 2 is used as the first image. Assume that image 2 contains 11 pixels as shown in the figure (each box represents a pixel). These 11 pixels, from left to right, are: pixel 15, pixel 7, pixel 5, pixel 3, pixel 1, pixel 0, pixel 2, pixel 4, pixel 6, pixel 8, and pixel 16 (not labeled in the figure). There are also several pixels between pixel 15 and pixel 7, and several pixels between pixel 8 and pixel 16, which are not shown in the figure.
[0170] For example, if pixel 0 is the first pixel, then two pixels can be selected to the right of pixel 0. For instance, two pixels can be selected to the right of pixel 0 at a distance of 4 (i.e., 2 pixels). 2 The pixel at point 0 is pixel 8. Also, you can select a pixel 8 (or 2 pixels) to the right of pixel 0. 3 The pixel is 16.
[0171] Furthermore, two pixels can be selected to the left of pixel 0. For example, two pixels can be selected to the left of pixel 0 at a distance of 4 (i.e., 2 pixels). 2 The pixel is 7. Also, you can select a pixel 8 (or 2 pixels) to the left of pixel 0. 3 The pixel is 15.
[0172] In this way, pixels 7, 8, 15, and 16 can be obtained as reference pixels. Then, a weighted average can be performed based on the pixel values of these four reference pixels and the pixel value of the first pixel to obtain the adjusted pixel value of the first pixel. In this round of blurring, pixel 0 is the first pixel, pixel 8 is the second pixel, pixel 16 is the third pixel, pixel 7 is the fourth pixel, and pixel 15 is the fifth pixel.
[0173] The implementation of weights is similar to that described above. For example, weighted calculations can be performed according to Formula 4 below:
[0174] z×X0 ` +w×(X7 ` +X8 ` +w(X15 ` +X16 ` ))=X0 `` Formula 4
[0175] In the above formula, X0 ` X7 is the pixel value of pixel 0 in image 2. ` The pixel value of pixel 7 in image 2, x8 ` The pixel value of pixel 8 in image 2, x15 ` The pixel value of pixel 15 in image 2, x16 ` Let X be the pixel value of pixel 16 in image 2. After processing according to the formula described above, we can obtain the blurred pixel value X0 of pixel 0 in image 2. `` .
[0176] like Figure 8 As shown, after determining the adjusted pixel values for each pixel in image 2, we can obtain... Figure 8 Image 3 (the second image determined by the second blurring process) shows 11 pixels from left to right, which are assumed to still be represented as: pixel 15, pixel 7, pixel 5, pixel 3, pixel 1, pixel 0, pixel 2, pixel 4, pixel 6, pixel 8, and pixel 16 (not labeled in the figure). Referring to the illustration, it can be determined that the adjusted pixel value corresponding to pixel 0 is X0. `` The adjusted pixel value corresponding to pixel 1 is X1. `` The adjusted pixel value corresponding to pixel 2 is X2. `` The other pixels are similar, so I won't go into details here.
[0177] This completes the second fuzzy processing step, thus obtaining... Figure 8 Image 3 is shown below. The next blurring process can then be performed based on image 3.
[0178] Based on the above description, it can be determined that in the third blurring process, the first image is the second image determined by the previous blurring process, and the second image determined by the second blurring process is image 3. Therefore, in this blurring process, image 3 is used as the first image. Assume that image 3 contains 13 pixels as shown in the figure (each box represents a pixel). These 13 pixels, from left to right, are: pixel 31, pixel 15, pixel 7, pixel 5, pixel 3, pixel 1, pixel 0, pixel 2, pixel 4, pixel 6, pixel 8, pixel 16, and pixel 32 (not labeled in the figure). There are also several pixels between pixel 31 and pixel 15, and several pixels between pixel 16 and pixel 32, which are not shown in the figure.
[0179] For example, if pixel 0 is the first pixel, then two pixels can be selected to the right of pixel 0. For instance, two pixels can be selected to the right of pixel 0 at a distance of 8 (i.e., 2 pixels) from pixel 0. 3 The pixel at which pixel 0 is located is pixel 16. Also, you can select a pixel 16 (or 2) to the right of pixel 0. 4 The pixel is 32.
[0180] Furthermore, two pixels can be selected to the left of pixel 0. For example, two pixels can be selected to the left of pixel 0 at a distance of 8 (i.e., 2 pixels) from pixel 0. 3 The pixel at which pixel 0 is located is pixel 15. Also, a pixel can be selected to the left of pixel 0 at a distance of 16 (i.e., 2) from pixel 0. 4 The pixel is 31.
[0181] In this way, pixels 15, 16, 31, and 32 can be obtained as reference pixels. Then, a weighted average can be performed based on the pixel values of these four reference pixels and the pixel value of the first pixel to obtain the adjusted pixel value of the first pixel. In this round of blurring, pixel 0 is the first pixel, pixel 16 is the second pixel, pixel 32 is the third pixel, pixel 15 is the fourth pixel, and pixel 31 is the fifth pixel.
[0182] The implementation of weights is similar to that described above. For example, weighted calculations can be performed according to Formula 5 as follows:
[0183] z×X0 `` +w×(X15 `` +X16 `` +w(X31 `` +X32 ``))=X0 ``` Formula 5
[0184] In the above formula, X0 `` The pixel value of pixel 0 in image 3, x15 `` The pixel value of pixel 15 in image 3, x16 `` X31 is the pixel value of pixel 16 in image 3. `` X32 is the pixel value of pixel 31 in image 3. `` Let X be the pixel value of pixel 32 in image 3. After processing according to the formula described above, we can obtain the blurred pixel value X0 of pixel 0 in image 3. ``` .
[0185] like Figure 8 As shown, after determining the adjusted pixel values for each pixel in image 3, we can obtain... Figure 8 Image 4 (the second image determined by the third blurring process) shows 13 pixels from left to right, which are assumed to still be represented as: pixel 31, pixel 15, pixel 7, pixel 5, pixel 3, pixel 1, pixel 0, pixel 2, pixel 4, pixel 6, pixel 8, pixel 16, and pixel 32 (not labeled in the figure). Referring to the illustration, it can be determined that the adjusted pixel value corresponding to pixel 0 is X0. ``` The adjusted pixel value corresponding to pixel 1 is X1. ``` The adjusted pixel value corresponding to pixel 2 is X2. ``` The other pixels are similar, so I won't go into details here.
[0186] The above describes the process of three blurring steps. The first blurring step targets the original image to be blurred, while each subsequent blurring step targets the image output by the previous blurring step. This step-by-step blurring method can achieve a certain smoothing effect, with each blurring step transitioning gradually to improve the problems of ghosting and content loss caused by the one-time weighted processing of multiple pixels within the blur radius.
[0187] Furthermore, referring to the above embodiments, it can be determined that, since there is a rounding operation when determining the number of blurring operations, in order to achieve different blurring effects corresponding to different blurring radii, this embodiment also sets up differentiated processing based on different blurring radii in the last blurring process.
[0188] Therefore, the weight settings in this application can be understood as follows:
[0189] Case 1: When the value of i is between 1 and N-1
[0190] The first weight is set to L, and the second weight is set to M. This means that in each fuzzing process before the last one, the weights are applied according to a fixed weight to perform the complete fuzzing process.
[0191] For example, such as Figure 8 As shown, the value of the first weight z can be, for example, equal to 0.375 (i.e., L = 0.375), and the value of the second weight w can be, for example, equal to 0.25 (i.e., M = 0.25).
[0192] Furthermore, during the weighted processing, the sum of the weights of each weighted item should equal 1. Therefore, according to the weighting relationship described above, the sum of the first weight, twice the second weight, and twice the third weight can be set to equal 1 (i.e., z + 2w + 2w). 2 =1), where L and M are both numbers greater than 0 and less than 1. Figure 8 The weight values shown are subject to the constraints described herein.
[0193] In actual implementation, the values of L and M can be set according to actual needs, and this embodiment does not impose any restrictions on them, as long as the relevant limitations described above are met.
[0194] Case 2: When the value of i equals N
[0195] The value of the second weight is positively correlated with the first parameter, and the value of the first weight is negatively correlated with the first parameter. The value range of the second weight is 0 to M, and the value range of the first weight is L to 1.
[0196] Wherein, the first parameter is the ratio of the second value to the third value, the second value is the difference between the fuzzy radius and the starting value of the first preset interval, and the third value is the difference between the starting value and the ending value of the first preset interval.
[0197] This can be combined Figure 9 Understanding the first parameter, as described above, we can determine that when the fuzzy radius R = 4, the first preset interval to which the fuzzy radius belongs is [4, 8). Therefore, the second value can be determined as the difference between the fuzzy radius (4) and the starting value (4) of the first preset interval, i.e., the second value equals 0. The third value is the difference between the starting value (4) and the ending value (8) of the first preset interval, i.e., the third value equals 4. Therefore, based on the ratio of the second and third values, we can determine that the first parameter is 0.
[0198] Based on this, it can be understood that the first parameter in this embodiment is also the parameter used to indicate the position of the fuzzy radius within the first preset interval. When the fuzzy radius is equal to 4, its position within the first preset interval [4,8) is position 0.
[0199] For example, when the fuzzy radius R = 5, the first preset interval to which the fuzzy radius belongs is [4, 8). Then, the second value can be determined as the difference between the fuzzy radius (5) and the starting value (4) of the first preset interval, i.e., the second value equals 1. The third value is the difference between the starting value (4) and the ending value (8) of the first preset interval, i.e., the third value equals 4. Therefore, based on the ratio of the second and third values, the first parameter can be determined to be 1 / 4.
[0200] Similarly, in this embodiment, the first parameter is used to indicate the position of the fuzzy radius within its first preset interval. When the fuzzy radius is equal to 5, its position within the first preset interval [4,8) is at the 1 / 4 position. This can also be understood as treating the first preset interval as a 0-1 interval, and then normalizing the fuzzy radius within the 0-1 interval to determine the horizontal coordinate position corresponding to the fuzzy radius within the 0-1 interval.
[0201] After determining the first parameter based on the fuzzy radius, the second weight and the first weight corresponding to the current fuzzy radius can be determined based on the first parameter. In one implementation, the value of the second weight can be positively correlated with the first parameter, and the value of the first weight can be negatively correlated with the first parameter.
[0202] Specifically, the smaller the first parameter, the closer the blur radius is to the starting value of the first preset interval. Therefore, in this blurring process, the weight values of the reference pixels (i.e., the second and third weights) should also be smaller, and the corresponding weight value of the first pixel (i.e., the first weight) should be larger. In other words, the smaller the first parameter, the more likely it is to perform a blurring process with a smaller participation ratio of the reference pixel.
[0203] Conversely, the larger the first parameter, the closer the blur radius is to the end of the first preset interval. Therefore, in this blurring process, the weight values of the reference pixels (i.e., the second and third weights) should also be larger, while the weight value of the first pixel (i.e., the first weight) should be smaller. In other words, the larger the first parameter, the more likely it is to perform a blurring process with a higher participation rate from the reference pixels.
[0204] Meanwhile, when the first weight is L and the second weight is M, a complete weighting process has actually been performed. Therefore, the range of values for the first and second weights should also be restricted. Specifically, the range of the second weight is 0 to M, and the range of the first weight is L to 1.
[0205] Next, let's combine... Figure 8 and Figure 11 The weight settings for the two possible values of the fuzzy radius are described separately.
[0206] Figure 8 The diagram illustrates the implementation of a fuzzy radius of 4. The specific implementation of the fuzzing process can be found in the description of the above embodiments, and will not be repeated here.
[0207] as well as Figure 11 The diagram illustrates the implementation of a fuzzy radius of 5, which corresponds to 3 fuzzing iterations. The understanding of the three fuzzing processes is similar to that of the fuzzy radius of 4 mentioned above. The specific fuzzing processes will not be elaborated further in this embodiment.
[0208] However, the difference lies in the fact that the weight settings are different in the final blurring implementation corresponding to these two blur radii.
[0209] Based on the above description, it can be determined that when the blur radius is equal to 4, the first parameter corresponding to the blur radius is equal to 0. Therefore, the third blurring process should not actually have any effect at this time.
[0210] For example, when the first weight is 0.375 (i.e., L = 0.375) and the second weight is 0.25 (i.e., M = 0.25), the second weight can be calculated based on the following formula:
[0211]
[0212] Where r is the first parameter mentioned above, and the first weight can be calculated, for example, based on the following formula:
[0213] -0.4z + 0.4 = w (Formula 7)
[0214] Referring to Formulas 6 and 7 above, it can be determined that when the fuzzy radius R equals 4, the corresponding first parameter r equals 0, and the second weight w = 0 and the first weight z = 1 can be determined accordingly.
[0215] Thus, the pixel value X0 of pixel 0 in image 4 ``` And the pixel value X0 of pixel 0 in image 3 ``In other words, they are the same. That is to say, although a third blurring process was performed, the third blurring process did not actually achieve the effect of blurring. Image 3 and image 4 are essentially the same image.
[0216] Furthermore, when the blur radius is equal to 5, the first parameter corresponding to the blur radius is equal to 1 / 4. In this case, a third blur processing is required to ensure that the blur effect obtained when the blur radius is equal to 4 is different from that obtained when the blur radius is equal to 5.
[0217] Similar to the above, the weights can be calculated based on Formulas 6 and 7. Referring to Formulas 6 and 7, it can be determined that when the fuzzy radius R equals 5, the corresponding first parameter r equals 1 / 4. Therefore, the second weight w = 0.046875 and the first weight z = 0.8828125 can be determined accordingly.
[0218] Thus, the pixel value X0 of pixel 0 in image 4 ``` And the pixel value X0 of pixel 0 in image 3 `` That is, they are not the same, where pixel value X0 of pixel 0 in image 4 is different. ``` It is obtained by weighting the pixel values of multiple pixels. In other words, the third blurring process performed at this time has the effect of blurring. Image 4 is an image that has been further blurred based on image 3.
[0219] Referring to Formulas 6 and 7 above, it can also be determined that when the first parameter is 0, the second weight is 0 and the first weight is 1, so that the last fuzzy processing does not actually play a role.
[0220] Furthermore, when the first parameter is set to 1, the second weight is set to L, and the first weight is set to M. Specifically, when the first parameter is set to 1, meaning the blur radius equals the end value of the first preset interval, a complete blurring process needs to be performed. However, it's important to note that since each preset interval is essentially an open interval, when the blur radius equals the end value of the first preset interval, the actual complete blurring process performed corresponds to the (N-1)th blurring iteration for the next preset interval.
[0221] For example, in the example described above, when the blur radius R = 8, the blur radius is equal to the end value of the pre-defined interval [4, 8). However, the first pre-defined interval corresponding to the blur radius R = 8 is actually [8, 16). Thus, the number of blurring iterations corresponding to the blur radius R = 8 is actually equal to 4. Therefore, this complete blurring process is actually achieved in the third blurring process.
[0222] It should also be noted that Formulas 6 and 7 described above are specifically designed to determine the first and second weights when the first weight is 0.375 (i.e., L = 0.375) and the second weight is 0.25 (i.e., M = 0.25). When the values of the first and second weights are adjusted, Formulas 6 and 7 are no longer used. In other words, the formulas for calculating the first and second weights need to be set according to their respective values.
[0223] This application does not impose restrictions on the specific weight values or the formula for calculating the weights for the Nth fuzzy processing iteration; these can be arbitrarily set according to actual needs. As long as the following conditions are met: the first and second weights are determined based on the first parameter, and the value of the second weight is positively correlated with the first parameter, while the value of the first weight is negatively correlated with the first parameter. Furthermore, the range of the second weight's value should be limited to 0 to M, and the range of the first weight's value should be L to 1. Based on this, the specific weight calculation formula or the weight determination logic can be arbitrarily set according to actual needs.
[0224] This ensures that the closer the blur radius is to the start of the first preset interval, the greater the weight of the pixel value of the first pixel in the final blurring process. Similarly, the closer the blur radius is to the end of the first preset interval, the greater the weight of the pixel value of the selected reference pixel in the final blurring process. This guarantees the reasonableness of the blurring effect as the blur radius increases.
[0225] Referring to the above embodiments, it can be determined that the technical solution of this application, in the process of selecting a reference pixel for the first pixel, involves selecting K pixels along a first direction with the first pixel as the origin in the first image, and selecting K pixels in the opposite direction of the first direction, thereby obtaining at least one reference pixel. There is a certain positional relationship between the reference pixel and the first pixel; the specific implementation can be found in the above embodiments and will not be repeated here.
[0226] However, for some pixels near the image edge, it may be impossible to select some reference pixels, for example, when referring to... Figure 12 To understand, Figure 12 This is a schematic diagram of image augmentation provided for an embodiment of this application.
[0227] like Figure 12As shown in (a) above, for example, the original image contains 12×12 pixels (a rectangle in the figure represents one pixel). Taking pixel 1401 as an example, according to the example described in the above embodiment, during the first blurring process, a distance of 2 (i.e., 2) can be selected to the right of pixel 1401. 1 The pixel is 1402, as shown in the image. Also, a pixel can be selected to the right of pixel 1401 at a distance of 4 (i.e., 2) from pixel 1401. 2 The pixel is 1403, as shown in the figure.
[0228] The implementation on the left side is similar. During the first blurring process, a distance of 2 (i.e., 2) needs to be selected to the left of pixel 1401. 1 The pixel is located at a distance of 4 (i.e., 2) to the right of pixel 1401. 2 The pixel is shown in the diagram, but as can be understood from the illustration, since pixel 1401 is a pixel located on the edge, the two pixels described here do not exist to its left.
[0229] Furthermore, other pixels in the image may also experience the inability to select a reference pixel, which will not be elaborated upon here. The above explanation uses the first blurring process as an example; the same problem will occur in subsequent blurring processes. Therefore, this application also proposes the following processing method:
[0230] In one implementation, before each blurring process, the first image is first augmented to obtain an augmented first image. Subsequent blurring processes are all performed based on the augmented first image.
[0231] In the edge expansion process, T concentric circles of pixels can be added around the first image. The value of T can be the maximum distance between multiple reference pixels and the first pixel. The distances between the reference pixels and the first pixel can be determined based on the method of selecting the reference pixels; this embodiment does not impose any restrictions on this. This allows any pixel to have a corresponding reference pixel selected based on the expanded first image.
[0232] Furthermore, the pixel values of the added pixels can be preset pixel values, such as the pixel values corresponding to black or white. This embodiment does not limit the specific selection of preset pixel values, which can be determined according to actual needs.
[0233] In some examples, the method provided in this application can also perform mirror copying or rotation copying on the first image to obtain a copied first image. The pixel values of the added pixels can also be pixels from the copied first image.
[0234] For example, in the implementation described above, the furthest distance of the selected reference pixel (that is, the maximum value of the distances between multiple reference pixels and the first pixel) is the second distance. Therefore, the value of T can be, for example, equal to a. i+1 The following assumes that T equals 2. i+1 For example, combined with Figure 12 Please provide an explanation.
[0235] Figure 12 (a) in the diagram can be understood as the original image, which is also the first image corresponding to the first blurring process (corresponding to i=1). Therefore, it can be... Figure 12 Pixel augmentation is performed based on the original image shown in (a). For example, it can be done... Figure 12 Based on the 12×12 pixels shown in (a), 4 more rings are added sequentially (corresponding to 2... 2 ) pixels, thus obtaining Figure 12 The first image shown in (b) is an enlarged image with a size of 20×20.
[0236] Therefore, for pixel 1401, during the first blurring process, a distance of 2 (i.e., 2) needs to be selected to the left of pixel 1401. 1 If the pixels are ), then it can be based on Figure 12 In the expanded first image shown in (b), select pixel 1404 as shown. Also, select a pixel 4 (i.e., 2 pixels) to the right of pixel 1401. 2 If the pixels are ), then it can be based on Figure 12 In the first image after expansion shown in (b), pixel 1405 is selected as shown. This allows for the selection of a corresponding reference pixel for any pixel in the first image before expansion, enabling the weighted processing described above to be performed.
[0237] It is understandable that during the weighted pixel value processing, only reference pixels need to be selected for the original first image (i.e., the first image before augmentation), and the corresponding weighting processing needs to be performed. For the augmented pixels, there is no need to select reference pixels or perform weighting processing.
[0238] The implementation of subsequent blurring processes (second, third, ..., Nth) is similar and will not be elaborated here.
[0239] However, it's understandable that as the blurring process progresses, the size of the first image increases, so the size of the second image output after the Nth blurring step will also be different from the size of the original image. Therefore, after the Nth blurring step, the output second image needs to be cropped to obtain the target image, so that the final output target image and the original image have the same size.
[0240] The cropping process, for example, can be based on the second image output after the Nth blurring process, by sequentially removing 'a' from the outside in. N+1 The image formed by the pixels circled and the remaining pixels is the target image described in this embodiment.
[0241] The above describes an implementation that expands the first image so that a corresponding reference pixel can be selected for each pixel in the first image. Alternatively, in another implementation, the first image can be processed as is, without expanding it.
[0242] For example, in the process of selecting reference pixels for the first pixel, if a corresponding reference pixel exists in the first image, the subsequent weighting processing is performed according to the pixel value of the reference pixel in the first image. However, if a corresponding reference pixel does not exist in the first image, the preset pixel value is directly used as the pixel value of this part of the reference pixels for subsequent weighting processing.
[0243] Still with Figure 12 Taking pixel 1401 as an example (a) in the first image, two reference pixels should be selected to the left of pixel 1401. However, since these two reference pixels do not exist to the left of pixel 1401 in the first image, the preset pixel values can be directly used as the pixel values of these two reference pixels that should have been selected, for subsequent weighted processing. The effect is similar to the image augmentation implementation described above.
[0244] Based on the above introduction, the following can be combined with... Figure 13 Understanding the image effect after dynamic blurring based on the technical solution of this application. Figure 13 The illustration of the dynamic blur effect provided in the embodiments of this application Figure 2 .
[0245] exist Figure 13 The text describes the specific targets for each item. Figure 4The image shown in (a) is one of several images obtained after applying motion blur to the original image. From left to right, these three images are: images with blur angles of 0° and 20°, images with blur angles of 90° and 20°, and images with blur angles of 135° and 20°. Referring to the illustrations, it can be confirmed that the ghosting and content loss issues in these images are effectively improved.
[0246] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.
[0247] In one implementation, this application provides an electronic device. Figure 13 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application.
[0248] like Figure 14 As shown, the electronic device 140 includes: a processor 1401 and a memory 1402; the memory 1402 stores computer execution instructions; the processor 1401 executes the computer execution instructions stored in the memory 1402, causing the electronic device 140 to perform the above-described method.
[0249] When the memory 1402 is set up independently, the electronic device also includes a bus 1403 for connecting the memory 1402 and the processor 1401.
[0250] This application provides a chip. The chip includes a processor, which is used to call a computer program in memory to execute the technical solutions in the above embodiments. Its implementation principle and technical effects are similar to those in the related embodiments described above, and will not be repeated here.
[0251] This application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, it implements the methods described above. The methods described in the above embodiments can be implemented wholly or partially by software, hardware, firmware, or any combination thereof. If implemented in software, the functionality can be stored as one or more instructions or code on or transmitted over the computer-readable medium. The computer-readable medium can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium accessible by a computer.
[0252] In one possible implementation, a computer-readable medium may include random access memory (RAM), read-only memory (ROM), compact discread-only memory (CD-ROM) or other optical disc storage, magnetic disk storage or other magnetic storage devices, or any other medium targeted to carry or to store required program code in the form of instructions or data structures, and accessible by a computer. Furthermore, any connection is appropriately referred to as a computer-readable medium. For example, if software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwave, then coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. As used herein, disks and optical discs include optical discs, laser discs, optical discs, digital versatile discs (DVDs), floppy disks, and Blu-ray discs, where disks typically reproduce data magnetically, while optical discs optically reproduce data using lasers. Combinations of the above should also be included within the scope of computer-readable media.
[0253] This application provides a computer program product, which includes a computer program that, when run, causes a computer to perform the above-described method.
[0254] It should be noted that the modules or components described in the above embodiments can be one or more integrated circuits configured to implement the above methods, such as one or more application-specific integrated circuits (ASICs), one or more digital signal processors (DSPs), or one or more field-programmable gate arrays (FPGAs), etc. Furthermore, when a module is implemented through processing element scheduler code, the processing element can be a general-purpose processor, such as a central processing unit (CPU) or other processors capable of calling program code, such as a controller. Additionally, these modules can be integrated together to implement a system-on-a-chip (SOC).
[0255] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., a solid-state disk (SSD)).
[0256] The term "multiple" in this document refers to two or more. The term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Furthermore, the character " / " in this document generally indicates an "or" relationship between the preceding and following related objects; in formulas, " / " indicates a "division" relationship. Additionally, it should be understood that in the description of this application, words such as "first" and "second" are used only for descriptive purposes and should not be construed as indicating or implying relative importance or order.
[0257] It is understood that the various numerical designations used in the embodiments of this application are merely for descriptive convenience and are not intended to limit the scope of the embodiments of this application.
[0258] It is understood that, in the embodiments of this application, the order of the above-mentioned process numbers does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
Claims
1. An image processing method, characterized in that, The method includes: Based on the fuzzy radius, the number of times N to be executed for fuzzy processing is determined. The fuzzy radius is positively correlated with the number of times N to be executed, and the number of times N to be executed is less than or equal to the fuzzy radius. N is an integer greater than or equal to 1. In the i-th blurring process, for any first pixel in the first image, a weighted processing is performed based on the pixel value of the first pixel and the pixel value of at least one reference pixel in the first image to obtain the adjusted pixel value of the first pixel. The first image is the image obtained after the (i-1)-th blurring process, and the value of i ranges from 1 to N. The adjusted pixel values of multiple pixels in the first image constitute the second image, and the second image obtained after performing the blurring process for the Nth time is the target image.
2. The method according to claim 1, characterized in that, When the fuzzy radius belongs to the first preset interval among multiple preset intervals, N is equal to the number of executions to be performed corresponding to the first preset interval in the first mapping relationship. The first mapping relationship is used to indicate the correspondence between the preset interval and the number of executions to be performed.
3. The method according to claim 1 or 2, characterized in that, The step of determining the number of times N to be executed for fuzzy processing is to be performed based on the fuzzy radius, including: Determine the logarithmic result with base 1 corresponding to the fuzzy radius; The logarithmic result is rounded up to obtain the number of times N to be executed.
4. The method according to any one of claims 1-3, characterized in that, The method further includes: A first direction is determined based on a blur angle, wherein the angle between the first direction and the preset direction corresponding to the first pixel is equal to the blur angle. In the first image, with the first pixel as the origin, K pixels are selected along the first direction, and K pixels are selected in the opposite direction of the first direction to obtain the at least one reference pixel, where K is an integer greater than or equal to 1.
5. The method according to claim 4, characterized in that, The total number of reference pixels selected during the Nth blurring process is less than twice the blur radius.
6. The method according to claim 4 or 5, characterized in that, The step of selecting K pixels along the first direction and K pixels in the opposite direction of the first direction in the first image, with the first pixel as the origin, to obtain the at least one reference pixel, includes: Using the first pixel as the origin, a second pixel and a third pixel are selected in the first image along the first direction, wherein the distance between the second pixel and the first pixel is a first distance, and the distance between the third pixel and the first pixel is a second distance; and... Taking the first pixel as the origin, a fourth pixel and a fifth pixel are selected in the first image in the opposite direction of the first direction, wherein the distance between the fourth pixel and the first pixel is the first distance, and the distance between the fifth pixel and the first pixel is the second distance; Wherein, the first distance is a i The second distance is a i+1 , where a is an integer greater than 1; the at least one reference pixel includes the second pixel, the third pixel, the fourth pixel, and the fifth pixel.
7. The method according to claim 6, characterized in that, The weight corresponding to the first pixel is the first weight, the weights corresponding to the second and fourth pixels are the second weights, and the weights corresponding to the third and fifth pixels are the third weights. Wherein, the first weight, the second weight, and the third weight are all numbers greater than 0 and less than 1, and the second weight is greater than the third weight.
8. The method according to claim 7, characterized in that, The second weight is equal to the square of the third weight.
9. The method according to claim 7 or 8, characterized in that, When the value of i is between 1 and N-1, the value of the first weight is L, the value of the second weight is M, and the sum of the first weight, twice the second weight, and twice the third weight is equal to 1, where L and M are both numbers greater than 0 and less than 1.
10. The method according to any one of claims 7-9, characterized in that, When the value of i is equal to the value of N, the value of the second weight is positively correlated with the first parameter, the value of the first weight is negatively correlated with the first parameter, and the value range of the second weight is 0 to M, while the value range of the first weight is L to 1. Wherein, the first parameter is the ratio of the second value to the third value, the second value is the difference between the fuzzy radius and the starting value of the first preset interval, and the third value is the difference between the starting value and the ending value of the first preset interval.
11. The method according to claim 10, characterized in that, When the value of the first parameter is 0, the value of the second weight is 0, and the value of the first weight is 1.
12. An image processing method, characterized in that, The method includes: Based on the blur radius, it is determined that the original image will undergo two blurring processes; For any pixel in the original image, a weighted average is performed based on the pixel value of the pixel and the pixel values of multiple reference pixels symmetrical to the pixel to obtain a first blurred image. For any pixel in the first blurred image, the target image is obtained by weighting the pixel value and the pixel values of multiple reference pixels symmetrical to the pixel value.
13. The method according to claim 12, characterized in that, The method further includes: A first direction is determined based on a blur angle, wherein the angle between the first direction and the preset direction corresponding to the pixel is equal to the blur angle; wherein, For any pixel in the original image, the plurality of reference pixels include K pixels selected along the first direction with the pixel as the origin in the original image, and K pixels selected in the opposite direction of the first direction, where K is an integer greater than or equal to 1. For any pixel in the first blurred image, the plurality of reference pixels include K pixels selected along the first direction with the pixel as the origin, and K pixels selected in the opposite direction of the first direction, where K is an integer greater than or equal to 1.
14. The method according to claim 12 or 13, characterized in that, The total number of reference pixels selected during the two blurring processes is less than twice the blur radius.
15. The method according to claim 13, characterized in that, For any pixel in the original image, K pixels selected along the first direction include a second pixel and a third pixel, wherein the distance between the second pixel and the first pixel is a first distance, and the distance between the third pixel and the first pixel is a second distance; and, The K pixels selected in the opposite direction of the first direction include a fourth pixel and a fifth pixel, wherein the distance between the fourth pixel and the pixel is the first distance, and the distance between the fifth pixel and the pixel is the second distance; Wherein, the first distance is a j The second distance is a j+1 Both a and j are integers greater than 1.
16. The method according to claim 15, characterized in that, The weight corresponding to the pixel is the first weight, the weight corresponding to the second pixel and the fourth pixel is the second weight, and the weight corresponding to the third pixel and the fifth pixel is the third weight. Wherein, the first weight, the second weight, and the third weight are all numbers greater than 0 and less than 1, and the second weight is greater than the third weight.
17. The method according to claim 16, characterized in that, The first weight is L, the second weight is M, and the sum of the first weight, twice the second weight, and twice the third weight is equal to 1. Both L and M are numbers greater than 0 and less than 1.
18. The method according to claim 17, characterized in that, For any pixel in the first blurred image, K pixels selected along the first direction include a sixth pixel and a seventh pixel, wherein the distance between the sixth pixel and the first pixel is a third distance, and the distance between the seventh pixel and the first pixel is a fourth distance; and, The K pixels selected in the opposite direction of the first direction include an eighth pixel and a ninth pixel, wherein the distance between the eighth pixel and the pixel is the third distance, and the distance between the ninth pixel and the pixel is the fourth distance; Wherein, the third distance is a j+1 The fourth distance is a j+2 Both a and j are integers greater than 1.
19. The method according to claim 18, characterized in that, The weight corresponding to the pixel is the fourth weight, the weight corresponding to the sixth and eighth pixels is the fifth weight, and the weight corresponding to the seventh and ninth pixels is the sixth weight. Wherein, the fourth weight, the fifth weight, and the sixth weight are all numbers greater than 0 and less than 1, and the fifth weight is greater than the sixth weight.
20. The method according to claim 19, characterized in that, The value of the fifth weight is positively correlated with the first parameter, the value of the fourth weight is negatively correlated with the first parameter, and the value range of the fifth weight is 0 to M, while the value range of the fourth weight is L to 1. Wherein, the first parameter is the ratio of the second value to the third value, the second value is the difference between the fuzzy radius and the starting value of the first preset interval to which it belongs, and the third value is the difference between the starting value and the ending value of the first preset interval; the first preset interval is one of a plurality of intervals pre-divided for the fuzzy radius.
21. An electronic device, characterized in that, The electronic device includes: one or more processors and memory; The memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, the one or more processors invoking the computer instructions to cause the electronic device to perform the method as described in any one of claims 1-20.
22. A chip system, characterized in that, The chip system is applied to an electronic device, the chip system including one or more processors, the one or more processors being used to invoke computer instructions to cause the electronic device to perform the method as described in any one of claims 1-20.
23. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1-20.
24. A computer program product, characterized in that, The computer program product includes computer program code that, when run on an electronic device, causes the electronic device to perform the method as described in any one of claims 1-20.