Image processing method and device, computer device and storage medium

CN115239609BActive Publication Date: 2026-10-20GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210850960.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-19
Publication Date
2026-10-20
Estimated Expiration
2042-07-19

AI Technical Summary

Technical Problem

但是,在实际应用中,最终的模糊图像可能存在锯齿状,即模糊效果较差、不稳定,进而影响模糊的视觉体验

Benefits of technology

[0008]第四方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有程序代码,所述程序代码可被处理器调用执行上述的方法。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115239609B_ABST
    Figure CN115239609B_ABST
Patent Text Reader

Abstract

The application discloses an image processing method and device, computer equipment and a storage medium, and relates to the technical field of image processing. The method comprises the following steps: acquiring an image to be processed for blur processing; determining a first blur parameter and a second blur parameter for the blur processing; performing blur processing on the image to be processed based on the first blur parameter to obtain a first blurred image, and performing blur processing on the image to be processed based on the second blur parameter to obtain a second blurred image, wherein the blur degree of the second blurred image is greater than the blur degree of the first blurred image; and fusing the first blurred image and the second blurred image to obtain a target image. In this way, the two blurred images with different blur degrees obtained based on two different blur processes are fused, the blur effect of the target image obtained through fusion is better, the visual effect of blur is better, and higher-quality image blur processing is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to an image processing method, apparatus, computer device and storage medium. Background Technology

[0002] Image blurring is an important image processing method in the field of image processing technology, and it also occupies an important position in the field of post-processing rendering.

[0003] In related technologies, the image to be blurred is typically processed once using pre-set blur parameters to obtain the final blurred image. However, in practical applications, the final blurred image may have jagged edges, meaning the blurring effect is poor and unstable, thus affecting the blurred visual experience. Summary of the Invention

[0004] This application proposes an image processing method, apparatus, computer device, and storage medium to avoid poor blurring effect in the blurred image obtained by performing a single blurring process on the image to be blurred according to preset blurring parameters.

[0005] In a first aspect, embodiments of this application provide an image processing method, the method comprising: acquiring an image to be blurred; determining a first blur parameter and a second blur parameter for the blur processing; blurring the image to be blurred based on the first blur parameter to obtain a first blurred image, and blurring the image to be blurred based on the second blur parameter to obtain a second blurred image, wherein the blur degree of the second blurred image is greater than the blur degree of the first blurred image; and fusing the first blurred image and the second blurred image to obtain a target image.

[0006] Secondly, embodiments of this application provide an image processing apparatus, comprising: an image acquisition module, a parameter determination module, a blur processing module, and an image fusion module. The image acquisition module is used to acquire an image to be blurred; the parameter determination module is used to determine a first blur parameter and a second blur parameter for the blur processing; the blur processing module is used to blur the image to be blurred based on the first blur parameter to obtain a first blurred image, and to blur the image to be blurred based on the second blur parameter to obtain a second blurred image, wherein the blur degree of the second blurred image is greater than that of the first blurred image; the image fusion module is used to fuse the first blurred image and the second blurred image to obtain a target image.

[0007] Thirdly, embodiments of this application provide a computer device, including: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to perform the methods described above.

[0008] Fourthly, embodiments of this application provide a computer-readable storage medium storing program code that can be invoked by a processor to execute the methods described above.

[0009] The solution provided in this application involves acquiring an image to be blurred; determining a first blur parameter and a second blur parameter for blur processing; blurring the image to be blurred based on the first blur parameter to obtain a first blurred image; and blurring the image to be blurred based on the second blur parameter to obtain a second blurred image, wherein the blur degree of the second blurred image is greater than that of the first blurred image; and fusing the first blurred image and the second blurred image to obtain a target image. In related technologies, blurring an image obtained by performing blur processing based on only one blur parameter will result in jagged edges, causing a subjective visual perception of uneven blurring effect when viewing the blurred image, i.e., poor blurring effect. In contrast, the target image in this application is obtained by fusing two blurred images with different blur degrees, increasing blur details and making the blurring effect more delicate, while avoiding the jagged edge problem in the blurred image, thus achieving a better blurring visual effect and higher quality image blurring processing. Attached Figure Description

[0010] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0011] Figure 1 A schematic flowchart of an image processing method provided in an embodiment of this application is shown.

[0012] Figure 2 This illustration shows a schematic diagram of blurring and image fusion provided in an embodiment of this application.

[0013] Figure 3 A flowchart illustrating an image processing method provided in another embodiment of this application is shown.

[0014] Figure 4 It shows Figure 3A schematic diagram of a sub-step in some embodiments of step S230.

[0015] Figure 5 It shows Figure 4 A schematic diagram of a sub-step in some embodiments of step S231.

[0016] Figure 6 It shows Figure 3 A schematic diagram of a sub-step in some embodiments of step S260.

[0017] Figure 7 It shows Figure 3 A schematic diagram of step S270 in some embodiments.

[0018] Figure 8 A schematic flowchart of an image processing method provided in another embodiment of this application is shown.

[0019] Figure 9 A schematic flowchart of an image processing method provided in another embodiment of this application is shown.

[0020] Figure 10 It shows Figure 9 A schematic diagram of step S440 in some embodiments.

[0021] Figure 11 A flowchart illustrating an image processing method provided in yet another embodiment of this application is shown.

[0022] Figure 12 This is a block diagram of an image processing apparatus provided according to an embodiment of this application.

[0023] Figure 13 This is a block diagram of a computer device for performing an image processing method according to an embodiment of this application.

[0024] Figure 14 This is a storage unit in this application embodiment for storing or carrying program code that implements the image processing method according to this application embodiment. Detailed Implementation

[0025] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.

[0026] The inventors propose an image processing method, apparatus, computer device, and storage medium. Based on different blur parameters, the image to be processed is subjected to different degrees of blurring to obtain two blurred images with different degrees of blurring. The two blurred images with different degrees of blurring are then fused to obtain the target image. The image processing method provided in the embodiments of this application is described in detail below.

[0027] Please refer to Figure 1 , Figure 1 This is a schematic flowchart illustrating an image processing method according to an embodiment of this application. The following will be combined with... Figure 1 The image processing method provided in the embodiments of this application will be described in detail. The image processing method may include the following steps:

[0028] Step S110: Obtain the image to be blurred.

[0029] In some implementations, the aforementioned blurring processing can be real-time image blurring processing performed on the image frame sequence of the electronic device's display interface; correspondingly, the image to be processed is each frame of the image displayed on the screen of the electronic device or a portion of each frame of the image. The screen of the electronic device typically refreshes at a fixed frame rate. For example, with a fixed frame rate of 120 Hz, the screen of the electronic device can display 120 frames of images per second. Each frame of these 120 frames can be used as the image to be processed. The electronic device includes, but is not limited to, smartphones, tablets, smart bracelets, smartwatches, and laptops.

[0030] In this method, blurring can be triggered by a user's target gesture. For example, a user can long-press any display component on the electronic device's screen (i.e., touch for more than a target duration) to trigger blurring. Correspondingly, the electronic device will overlay the screen wallpaper and the display component as the image to be processed. Understandably, the image to be processed includes each frame of the screen wallpaper within the target duration and the image obtained by overlaying the corresponding display component. Of course, the target gesture can also include dragging, clicking, or double-clicking gestures on the status bar or display components. Multiple target gestures can be pre-set according to actual needs; this embodiment does not impose any limitations on this. Different target gestures can trigger different types of real-time image blurring. The blurring effects of different types of real-time image blurring can be the same or different; this embodiment does not impose any limitations on this.

[0031] In other embodiments, the above-mentioned blurring process may also be applied to the image to be processed in the image processing software of the electronic device; correspondingly, the image to be processed is an image that the user inputs into the image processing software and needs to be blurred.

[0032] Step S120: Determine the first fuzzy parameter and the second fuzzy parameter for the fuzzing process.

[0033] In this embodiment, the first blur parameter and the second blur parameter can be understood as parameters used to change the degree of blur in the image to be processed. These parameters can be blur radii, where the blur radius characterizes the size of the specified blur sampling region, measured in pixels. Specifically, it refers to the number of pixels blurred outwards from the center point of the pixel to be blurred. A larger blur radius results in a higher degree of blur in the image processed based on that radius. Of course, the first blur parameter and the second blur parameter may also include parameters such as the target blur region; this embodiment does not impose any limitations on this.

[0034] Understandably, to avoid jagged edges in images obtained by directly blurring an image with a single blur radius, two blur parameters can be determined. This allows the image to be blurred twice, resulting in two blurred images with different degrees of blur. These two images with different degrees of blur can then be merged to obtain a more refined and smoother blurred image without jagged edges. In practical applications, the degree of blur in the resulting image depends not only on the blur parameters but also on the original size of the image during blurring. For example, using different blur radii for images of the same size can yield two blurred images with different degrees of blur. Conversely, even using the same blur radius for images of different sizes can result in two blurred images with different degrees of blur.

[0035] In other words, the values ​​of the first blur parameter and the second blur parameter determined above can be the same or different. Under the same circumstances, the aforementioned two different blurring processes can be understood as two blurring processes performed on images of different sizes using the same blur parameter; under different circumstances, the aforementioned two different blurring processes can be understood as two blurring processes performed on images of the same size using two different blur parameters.

[0036] In some implementations, the image to be processed may carry a third blur parameter, which can be a third blur radius. In this case, the first blur parameter can be a first blur radius, and the second blur parameter can be a second blur radius. Since the degree of blur is positively correlated with the size of the blur radius—the larger the blur radius, the higher the degree of blur—for images of the same size undergoing blur processing, a blur radius smaller than the third blur radius and whose difference from the third blur radius is within a first preset difference can be obtained as the first blur radius; a blur radius larger than the third blur radius and whose difference from the third blur radius is within a second preset difference can be obtained as the second blur radius. Thus, the image to be processed can be blurred twice based on the first and second blur radii, resulting in a blurred image with a larger and smaller blur radius. This avoids jagged edges in the final blurred image, increases blur detail, improves blur uniformity, and makes the blur effect more delicate, especially in scenarios where blur processing is performed on the image to be processed in image processing software.

[0037] Optionally, for the aforementioned real-time image blurring scenario, the third blurring parameter can be a blurring parameter carried by each frame of the image. For each type of real-time image blurring, a preset blurring parameter value can be set for each frame within a target duration after the detection of the target operation gesture, according to a specified parameter configuration strategy and the sequential order of the time of each frame. The specified parameter configuration strategy can be to set the same blurring parameter value for each frame, or to set a gradually increasing or gradually decreasing blurring parameter value. The specific setting can be determined based on the actual blurring display effect. In this case, the first blurring parameter is the blurring parameter corresponding to the image to be processed, set according to the time information of the image to be processed and the specified parameter configuration strategy. If a gradually increasing or gradually decreasing blurring parameter value is set, then real-time image blurring with a gradual change in blur level is achieved.

[0038] For example, when a user performs a long press operation on a game display component on the display interface of an electronic device, triggering the aforementioned blurring process, if there are 120 image frames within a target duration (e.g., 1 second) after the target operation gesture is detected, a strategy can be configured according to specified parameters, and each image frame can be set with corresponding blurring parameters in the order of their time from earliest to latest. That is, each image frame can carry blurring parameters.

[0039] Optionally, for scenarios involving image blurring using image processing software, the third blur parameter is the blur parameter input by the user. For example, the blur radius corresponding to the blur level input by the user can be determined and used as the third blur parameter; or, for example, the blur radius input by the user can be used as the third blur parameter.

[0040] In other embodiments, when blurring images of different sizes, preset blurring parameters corresponding to the application scenario can be determined based on the application scenario of the image to be processed. These preset blurring parameters serve as the first and second blurring parameters. In this case, the first and second blurring parameters have the same value, both being preset blurring parameters. Therefore, in scenarios where real-time image blurring is performed on image frame sequences of an electronic device's display interface, the same preset blurring parameters are used for blurring. This avoids problems such as jitter and abrupt changes in blurring effects in adjacent blurred images caused by different blurring parameters used in adjacent image frames.

[0041] Step S130: Based on the first blur parameter, blur the image to be processed to obtain a first blurred image, and based on the second blur parameter, blur the image to be processed to obtain a second blurred image, wherein the blur degree of the second blurred image is greater than that of the first blurred image.

[0042] In this embodiment, the blurriness of the blurred image obtained by directly blurring based on the third blur parameter is the desired blurriness of the target image. However, the blurred image obtained by directly blurring based on the third blur parameter will have jagged edges, causing the human eye to have a subjective visual perception of uneven blurring effect when viewing the blurred image, i.e., a poor blurring effect. Therefore, it is possible to obtain a blurred image with a blurriness greater than the desired blurriness of the target image and a blurred image with a blurriness less than the desired blurriness of the target image. In this way, by fusing two blurred images with different blurriness levels compared to the desired target image, a target image with the desired blurriness level can be obtained, with the blurriness level between that of the second blurred image and the first blurred image. Here, image fusion can be understood as a weighted average of the pixels in the two images, thereby reducing the difference between the pixel value of a certain pixel in an image and the pixel value of its neighboring pixels, thus greatly reducing or avoiding the occurrence of problems such as jagged edges in the image.

[0043] In some implementations, the first blur parameter can be a first blur radius, and the second blur parameter can be a second blur radius, where the second blur radius is larger than the first blur radius. This ensures that the blurriness of the second blurred image is greater than that of the first blurred image, while both blur radii are close to a third blur radius. Therefore, the blurriness of the first and second blurred images differs but is similar, resulting in a visually better target image obtained by fusing the first and second blurred images. The blurring effect of the target image is more delicate, and it also avoids problems such as fade-in / fade-out issues that can occur when fusing two images with significantly different blurriness levels.

[0044] In other embodiments, the image to be processed can be reduced in size according to different scaling parameters, such as a first scaling parameter and a second scaling parameter, to obtain two images of different sizes. The difference between the parameter values ​​of the first and second scaling parameters is within a preset threshold. Then, using a first and a second blur radius with the same parameter values, the two images of different sizes are blurred, resulting in two blurred images with different degrees of blur. Since the difference between the parameter values ​​of the first and second scaling parameters is within the preset threshold, it can be ensured that the two images to be processed after being reduced in size are different but similar in size, thus making the first and second blurred images after the two blurring processes have different but similar degrees of blur. The scaling parameter is the sampling factor, which includes an upsampling factor and a downsampling factor. The upsampling factor is used to upsample the image, increasing the pixel density and enlarging the image size. It is generally an integer or rational number greater than 1. The downsampling factor is used to downsample the image, reducing the pixel density and shrinking the image size. It is generally an integer or rational number greater than 1. In this case, the aforementioned difference can be understood as the difference between the first downsampling factor and the second downsampling factor, that is, the difference in the scaling factor.

[0045] The blurring algorithms used for the above blurring processing include, but are not limited to, mean blurring algorithm, radial blurring algorithm, distant blurring algorithm, Gaussian blurring algorithm, Kawase blurring algorithm, Dual-Kawase blurring algorithm, etc. All blurring algorithms that can blur an image are within the protection scope of this application.

[0046] In practical applications, when using blur algorithms to blur images, the blurring effect and computational cost are related to the blur radius. For example, the Kawase blur algorithm has a better blurring effect and lower computational cost when the blur radius is small; however, when the blur radius is large, the blurring effect of the Kawase blur algorithm will degrade significantly. The Gaussian blur algorithm can still maintain a good blurring effect when the blur radius is large, but its computational cost will increase significantly.

[0047] Therefore, before blurring the first image and the second image, the image to be processed is blurred according to the preset blurring algorithm corresponding to the first blurring parameter and the first blurring parameter to obtain the first blurred image; the image to be processed is blurred according to the preset blurring algorithm corresponding to the second blurring parameter and the second blurring parameter to obtain the second blurred image.

[0048] In some implementations, a first preset blurring algorithm matching the first blur radius can be selected from a variety of preset blurring algorithms, based on the size of the first blur radius. This algorithm is then used as the first preset blurring algorithm. The first image is then blurred based on the first blur radius and the first preset blurring algorithm to obtain a first blurred image. Simultaneously, a second preset blurring algorithm matching the second blur radius can be selected from a variety of preset blurring algorithms, based on the second blur radius. The second image is then blurred based on the second blur radius and the second preset blurring algorithm to obtain a second blurred image. This approach achieves a balance between blurring computation cost and blurring effect while maintaining the blurring effect, further reducing the overall computational cost of blurring processing.

[0049] For example, when the first blur radius is less than a preset blur radius threshold, i.e. when the first blur radius is small, the Kawase blur algorithm is used to save blur calculations; when the second blur radius is greater than the preset blur radius threshold, i.e. when the second blur radius is large, the Gaussian blur algorithm is used to obtain a better blur effect, so as to achieve a balance between blur calculation consumption and blur effect.

[0050] In other implementations, different blurred scenes generally have different requirements for blurring effect, blurring processing speed, and blurring degree. Therefore, before blurring the image to be processed, the blurred scene corresponding to the image to be processed can be obtained first. Then, according to the preset blurring algorithm corresponding to the blurred scene and the first blurring parameter, the image to be processed is blurred to obtain the first blurred image. Then, according to the preset blurring algorithm and the second blurring parameter, the image to be processed is blurred to obtain the second blurred image. In this way, the first blurred image and the second blurred image can better meet the blurring requirements of the blurred scene corresponding to the image to be processed.

[0051] Optionally, the blurred scene corresponding to the scene identifier carried by the image to be processed can be determined as the blurred scene of the image to be processed. For example, for real-time image blurring, each image frame carries a corresponding scene identifier, and the electronic device can directly determine the corresponding blurred scene based on the scene identifier, which is highly efficient.

[0052] Optionally, the blurred scene corresponding to the gesture operation that triggers the blur processing can be determined as the blurred scene corresponding to the image to be processed. For example, a long press gesture on a display component corresponds to blurred scene A. When the electronic device detects a long press gesture on the display component, it uses blurred scene A as the blurred scene for each image frame in the blur processing triggered by the gesture operation.

[0053] Step S140: Fuse the first blurred image and the second blurred image to obtain the target image.

[0054] Furthermore, after acquiring the first blurred image and the second blurred image, they can be fused to obtain the target image. The target image has a higher degree of blurriness than the first blurred image but lower than the second blurred image. In simpler terms, through two blurring processes, a first blurred image with a lower degree of blurriness than the target and a second blurred image with a higher degree of blurriness are obtained. These two blurred images are then fused to obtain the target image with the desired degree of blurriness. Image fusion can be achieved by weighted averaging of the pixel values ​​of each pixel in the first blurred image and the corresponding pixel values ​​in the second blurred image.

[0055] For example, please refer to Figure 2 , Figure 2 The image to be processed, A, is shown to be blurred to obtain a first blurred image B1 and a second blurred image B2. The first blurred image B1 and the second blurred image B2 are then image fused to obtain a target image C.

[0056] In this embodiment, two blurred images with different degrees of blur, obtained by performing two blurring processes based on the first and second blurring parameters, are fused together. This increases blurring details, making the blurring effect more delicate, while avoiding jagged edges in the blurred image, thus resulting in a better visual effect and achieving higher-quality image blurring processing. Furthermore, in scenarios involving real-time image blurring processing for electronic device display interfaces, fusing multiple blurred images to obtain the final target image can reduce the jitter and abrupt changes in blurring effect caused by blurring processing, thereby improving the visual experience.

[0057] Please refer to Figure 3 , Figure 3 This is a schematic flowchart illustrating an image processing method according to another embodiment of this application. The following will be combined with... Figure 3 The image processing method provided in the embodiments of this application will be described in detail. The image processing method may include the following steps:

[0058] Step S210: Obtain the image to be blurred, the image carrying a third blur parameter.

[0059] In this embodiment, the specific implementation of step S210 can be found in the foregoing embodiments, and will not be repeated here.

[0060] Step S220: Determine a first fuzzy parameter and a second fuzzy parameter for the fuzzing process, wherein the parameter value of the first fuzzy parameter is the same as the parameter value of the second fuzzy parameter.

[0061] In this embodiment, the blur parameter is the blur radius. Correspondingly, the third blur parameter can be the third blur radius. When blurring images of different sizes, a preset blur parameter corresponding to the application scenario can be determined based on the application scenario of the image to be processed. This preset blur parameter serves as the first blur parameter and the second blur parameter. Correspondingly, the first blur parameter is the first blur radius, and the second blur parameter is the second blur radius. Since the first and second blur parameters have the same value (both are preset blur parameters), by using different scaling parameters to adjust the image to different sizes and then using the two blur parameters with the same value for blurring, two blurred images with different degrees of blur can be obtained.

[0062] Step S230: Determine the first scaling parameter and the second scaling parameter corresponding to the third fuzzy parameter.

[0063] In some implementations, please refer to Figure 4 Step S230 may include the contents of steps S231 to S233:

[0064] Step S231: Based on the third fuzzy parameter, determine a fourth fuzzy parameter and a fifth fuzzy parameter from a plurality of preset fuzzy parameters, wherein the parameter value of the fourth fuzzy parameter is less than or equal to the parameter value of the third fuzzy parameter, and the parameter value of the fifth fuzzy parameter is greater than the parameter value of the third fuzzy parameter.

[0065] In one possible implementation, please refer to Figure 5 Step S231 may include the contents of steps S2311 to S2312:

[0066] Step S2311: From the first preset fuzzy parameters of the plurality of preset fuzzy parameters, obtain a first preset fuzzy parameter whose parameter value difference with the third fuzzy parameter satisfies a first preset difference condition, and use it as the fourth fuzzy parameter, wherein the parameter value of the first preset fuzzy parameter is less than or equal to the parameter value of the third fuzzy parameter.

[0067] In this embodiment, the first preset difference condition can be that the difference between the parameter value of the third fuzzy parameter and the parameter value of the first preset fuzzy parameter is the minimum value. That is, from the first preset fuzzy parameters of multiple preset fuzzy parameters, the first preset fuzzy parameter with the minimum difference between its parameter value and the parameter value of the third fuzzy parameter is obtained as the fourth fuzzy parameter.

[0068] Among them, the preset blur parameter can be the preset blur radius, and the third blur parameter can be the third blur radius.

[0069] In some implementations, the third fuzzy radius can be expressed as R. in Multiple preset fuzzy radii can be represented as R0, R1, ..., R n Where n is a positive integer greater than 1; for any natural number x less than or equal to n, R x This can be expressed as the following formula:

[0070] R x =sig(x)·C r ·a x-1

[0071]

[0072] Where sig(x) is the sign function; C r It is the magnification factor of the fuzzy radius, 'a' is a conventional parameter with no physical meaning, and C... r The value of a can be any rational number greater than or equal to 1.

[0073] Based on this, a fuzzy radius smaller than the target fuzzy radius can be determined from a plurality of preset fuzzy radii. in The first preset fuzzy radius R0,R1,…,R x Furthermore, the first preset fuzzy radius can be used as a reference. x The middle determined to be related to R in The first preset fuzzy radius R with the smallest difference x At this point, R x Set the fourth blur radius, i.e., the fourth blur parameter. Where R... x It can be equal to R in R in With R x When the difference is 0, the first preset difference condition is also satisfied.

[0074] Step S2312: From the second preset fuzzy parameters of the plurality of preset fuzzy parameters, obtain a second preset fuzzy parameter whose parameter value difference with the third fuzzy parameter satisfies the second preset difference condition, and use it as the fifth fuzzy parameter, wherein the parameter value of the second preset fuzzy parameter is greater than the parameter value of the third fuzzy parameter.

[0075] Optionally, the second preset difference condition can be that the difference between the parameter values ​​of the third fuzzy parameter and the second preset fuzzy parameter is the minimum value.

[0076] Taking the previous example, a fuzzy radius greater than the third fuzzy radius can be determined from multiple preset fuzzy radii. in The second preset fuzzy radius R x+1 ,R x+2 ,…,R n Furthermore, it can be determined from the second preset fuzzy radius R x+1 ,R x+2 ,…,R n Determine the relationship with R in The second preset fuzzy radius R with the smallest difference x+1 At this point, R x+1 Set it to the fifth fuzz radius, which is the fifth fuzz parameter.

[0077] In some implementations, the multiple preset fuzzy radii are obtained by sorting them in order of size; therefore, the first preset fuzzy radius R can be determined. x Then, obtain the value from multiple preset fuzzy radii that matches the first preset fuzzy radius R. x Adjacent and greater than the first preset blur radius R x Preset blur radius R x+1 As the fifth fuzzy radius R x+1 In other words, R x ≤R in <R x+1 .

[0078] Step S232: Obtain the scaling parameter corresponding to the fourth blur parameter as the first scaling parameter. The parameter value of the scaling parameter is positively correlated with the parameter value of the preset blur parameter.

[0079] In this embodiment, a larger blur radius results in a larger number of pixels being blurred outwards from the pixel to be blurred in the image to be processed, and correspondingly, the computational load of blur processing gradually increases. To avoid the increased computational load of image processing due to a larger blur radius, which could lead to problems such as the GPU being overloaded and causing stuttering, the computational load of image processing can be reduced by decreasing the pixel density of the image to be processed. Therefore, a scaling parameter (i.e., a downsampling factor) can be pre-set for each preset blur radius, where the downsampling factor is positively correlated with the size of the preset blur radius. A larger preset blur radius results in a higher degree of blur and a greater computational load; correspondingly, a larger downsampling factor is set, which in turn makes the size of the image to be processed smaller based on the downsampling factor, i.e., the pixel density in the reduced image to be processed is lower. In this way, the degree of blur in the image to be processed is increased while the computational load of blur processing is reduced.

[0080] In some implementations, the plurality of downsampling factors, which are the downsampling factors corresponding to each preset fuzzy radius, can be represented as M0, M1, ..., M n The downsampling factor can be expressed as M. x Where n is a positive integer greater than 1; for any natural number x less than or equal to n, M x This can be expressed as the following formula:

[0081] M x =sig(x)·C m ·a x-1

[0082]

[0083] Where sig(x) is the sign function; C m It is the amplification factor of the downsampling factor, 'a' is a conventional parameter with no physical meaning, and C... m The values ​​of and can be any rational number greater than or equal to 1. Multiple downsampling factors M0, M1, ..., M n With multiple preset fuzzy radii R0, R1, ..., R n One-to-one correspondence.

[0084] For example, if the obtained fourth fuzzy parameter is R x Correspondingly, the fourth fuzzy parameter R is obtained from multiple downsampling factors. x The corresponding downsampling factor M x , which serves as the first scaling parameter, i.e., the first downsampling factor.

[0085] Step S233: Obtain the scaling parameter corresponding to the fifth blur parameter, and use it as the second scaling parameter.

[0086] Optionally, if the obtained fifth fuzzy parameter is R x+1 Correspondingly, the fifth fuzzy parameter R is obtained from multiple downsampling factors. x+1 The corresponding downsampling factor M x+1 , which serves as the second scaling parameter, i.e., the second downsampling factor.

[0087] Step S240: Reduce the size of the image to be processed according to the first scaling parameter to obtain the first image.

[0088] Furthermore, after obtaining the first downsampling factor, the image to be processed can be downsampled based on the first downsampling factor to obtain the first image with reduced pixel density.

[0089] For example, the original resolution of the image to be processed is W×H, where W and H are both positive integers, representing a width of W pixels and a height of H pixels, based on the first downsampling factor M. x After downsampling the image to be processed, the resolution of the first image is:

[0090] Step S250: Reduce the size of the image to be processed according to the second scaling parameter to obtain a second image.

[0091] Optionally, after obtaining the second downsampling factor, the image to be processed can be downsampled based on the second downsampling factor to obtain a second image with reduced pixel density.

[0092] For example, the original resolution of the image to be processed is W×H, where W and H are both positive integers, representing a width of W pixels and a height of H pixels, based on the first downsampling factor M. x After downsampling the image to be processed, the resolution of the first image is:

[0093] Therefore, by using a downsampling factor, both the length and width of the image to be processed are reduced, and the number of pixels in the first image is reduced to the number of pixels in the image to be processed. The number of pixels in the second image is reduced to the number of pixels in the image to be processed. Therefore, the percentage improvement in computational cost compared to not performing downsampling can be calculated using the following formula:

[0094]

[0095] Without affecting the blurring effect, option C can be selected. m=2, a=2; when x=1, the optimization ratio for blurring computation is the smallest, approximately 68.75%; when x=2, the optimization ratio exceeds 90%; and as the value of x increases, the optimization ratio continues to increase. In the process of implementing gradient blurring on an electronic device's display interface, the degree of blur gradually increases, and the blur radius used for post-processing each image frame also gradually increases. However, in this solution, as the blur radius increases, the optimization ratio for computation also increases. This means that in implementing gradient blurring effects on an electronic device's display interface, the increased computation due to the increased blur radius does not cause GPU overload and stuttering; instead, it significantly reduces the computational load.

[0096] Step S260: Based on the first blur parameter, blur the first image to obtain the first blurred image, and based on the second blur parameter, blur the second image to obtain the second blurred image.

[0097] In this embodiment, the values ​​of the first blur parameter and the second blur parameter are the same, both being a pre-set specified blur radius. The value of the specified blur radius can be adjusted according to different blur scenarios. For example, the specified blur radius for a blur scenario triggered by a long press on the display component can be set to Rset1, and the specified blur radius for a blur scenario triggered by a pull-down status bar can be set to Rset2. That is, for each image frame under the same blur scenario, the same specified blur parameter is used to blur the first image and the second image obtained from processing each image frame, resulting in a first blurred image corresponding to the first image and a second blurred image corresponding to the second image. Thus, when the first blur radius changes dynamically, using the specified blur parameter as the baseline blur parameter ensures that the blur baseline effect is the same for each image frame, achieving a smoother blur gradient effect without abrupt changes.

[0098] In some implementations, please refer to Figure 6 Step S260 may include the contents of steps S261 to S262:

[0099] Step S261: Based on the preset blur algorithm corresponding to the fourth blur parameter and the first blur parameter, perform blur processing on the first image to obtain a first blurred image.

[0100] Step S262: Based on the preset blur algorithm corresponding to the fifth blur parameter and the second blur parameter, perform blur processing on the second image to obtain a second blurred image.

[0101] In this embodiment, although the first blurred image and the second blurred image are obtained by blurring using the same first and second blur parameters, the degree of blurring in the two images is different. This difference in blurring degree is caused by different scaling parameters determined according to the fourth and fifth blur parameters, resulting in different sizes for the first and second images obtained by scaling down the image twice. Different sized images contain different numbers of pixels, and correspondingly, the computational cost of blurring images of different sizes is also different. Therefore, a preset blur algorithm corresponding to the fourth blur parameter can be used when blurring the first image, and a preset blur algorithm corresponding to the fifth blur parameter can be used when blurring the second image. In this way, while maintaining the blurring effect, excessive blurring computation is avoided, further reducing the overall computational cost of blurring processing, thus achieving a balance between blurring computation cost and blurring effect.

[0102] Step S270: Fuse the first blurred image and the second blurred image to obtain the target image.

[0103] In some implementations, please refer to Figure 7 Step S270 may include the contents of steps S271 to S273:

[0104] Step S271: Increase the size of the first blurred image according to the first scaling parameter to obtain the third blurred image.

[0105] In this embodiment, the first blurred image is obtained by blurring a first image that has been scaled down according to a first downsampling factor (first scaling parameter). This means the resolution of the first blurred image is smaller than the original resolution of the image to be processed. Therefore, the value of the first downsampling factor can be used as the value of the first upsampling factor. The first blurred image is then upsampled according to the first upsampling factor to increase its pixel density, i.e., increase its size. This restores the resolution of the first blurred image to the original resolution of the image to be processed, resulting in the third blurred image. The resolution of the third blurred image is the same as the original resolution of the image to be processed.

[0106] Step S272: Increase the size of the second blurred image according to the second scaling parameter to obtain the fourth blurred image.

[0107] Similarly, the value of the second downsampling factor (second scaling parameter) can be used as the value of the second upsampling factor. Then, the second blurred image is upsampled according to the second upsampling factor to increase its pixel density, i.e., increase its size. This restores the image resolution of the second blurred image to the original resolution of the image to be processed, resulting in the fourth blurred image. The image resolution of the fourth blurred image is the same as the original resolution of the image to be processed.

[0108] Step S273: Fuse the third blurred image and the fourth blurred image to obtain the target image.

[0109] Finally, the third and fourth blurred images are fused to obtain the target image with the same resolution as the original image. This achieves both blurring of the image to be processed and ensures that the resolution of the final target image remains unchanged, thus guaranteeing the blurred visual effect. Furthermore, by restoring both the first and second blurred images to the same original resolution before image fusion, problems such as inaccurate image fusion, uneven blurring of the target image, and poor blurring effect caused by the different resolutions of the two blurred images can be avoided.

[0110] In this embodiment, before blurring the image to be processed, its size is first reduced by a downsampling factor, thereby reducing the number of pixels to be blurred and thus reducing the amount of blurring computation. Secondly, the downsampling factor is positively correlated with the blur radius; the larger the blur radius, the larger the downsampling factor, which improves the blur level while reducing the computational cost. Furthermore, for dynamic blur radius scenarios, two images with different resolutions are blurred using set blur parameters to obtain two blurred images with different degrees of blur. These two blurred images with different degrees of blur are then fused, resulting in a better visual effect for the fused target image, without producing inter-frame jitter or abrupt visual transitions.

[0111] Please refer to Figure 8 , Figure 8 This is a schematic flowchart illustrating an image processing method according to another embodiment of this application. The following will be combined with... Figure 8 The image processing method provided in the embodiments of this application will be described in detail. The image processing method may include the following steps:

[0112] Step S310: Obtain the image to be blurred, the image carrying a third blur parameter.

[0113] In this embodiment, the specific implementation of step S310 can be found in the foregoing embodiments, and will not be repeated here.

[0114] Step S320: Determine a first fuzzy parameter and a second fuzzy parameter for the fuzzing process, wherein the parameter value of the first fuzzy parameter is less than the parameter value of the third fuzzy parameter, and the parameter value of the second fuzzy parameter is greater than the parameter value of the third fuzzy parameter.

[0115] In this embodiment, obtaining two blurred images with different degrees of blurriness can be achieved by using two blur parameters with different values ​​to perform two different blurring processes on the same size image. That is, obtaining two blurred images with different degrees of blurriness compared to the blurred image obtained based on the third blur parameter. Therefore, based on the third blur parameter, a first blur parameter with a value less than the third blur parameter and a second blur parameter with a value greater than the third blur parameter can be determined. The specific determination method can be found in the content of the fourth and fifth blur parameters in the aforementioned embodiments, and will not be repeated here.

[0116] Step S330: Reduce the size of the image to be processed according to the third scaling parameter to obtain the third image.

[0117] In this embodiment, the value of the third scaling parameter can be a pre-set fixed value. Before blurring the image to be processed, the size of the image is reduced according to the third scaling parameter to decrease the number of pixels in the image, thereby reducing the amount of blurring calculation. Alternatively, the third scaling parameter can be set with different values ​​for images of different sizes. The value of the scaling parameter is positively correlated with the original size of the image to be processed. That is, a formula for calculating the third scaling parameter is pre-set, and the computer device can calculate the third scaling parameter for reducing the size of the image to be processed based on the original size of the image to be processed and the formula. In other words, for images with larger original sizes, a larger scaling parameter value is used to reduce their size, avoiding an increase in the amount of blurring calculation caused by an excessive number of pixels, thus ensuring the processing efficiency of image blurring.

[0118] Step S340: Based on the first blur parameter, blur the third image to obtain the first blurred image, and based on the second blur parameter, blur the third image to obtain the second blurred image.

[0119] Furthermore, after obtaining the reduced-size third image, the third image can be blurred based on the first blur parameter to obtain the first blurred image, and the third image can be blurred based on the second blur parameter to obtain the second blurred image. Since the parameter value of the second blur parameter is greater than the parameter value of the third blur parameter, the degree of blur in the second blurred image is greater than the degree of blur in the first blurred image.

[0120] Step S350: Fuse the first blurred image and the second blurred image to obtain the target image.

[0121] In some implementations, the first blurred image and the second blurred image are fused to obtain a fifth blurred image. Since the image size of the fifth blurred image is smaller than the image to be processed, the size of the fifth blurred image is increased according to the third scaling parameter to obtain the target image. This ensures that blurring the image to be processed does not change the original size of the image.

[0122] In other implementations, before image fusion, the sizes of the first blurred image and the second blurred image are increased according to a third scaling parameter; then, the increased-sized first blurred image and the increased-sized second blurred image are fused to obtain the target image. This ensures that blurring the image to be processed does not change the original size of the image.

[0123] In this embodiment, two blur parameters with different values ​​are determined using a third blur parameter. Different blurring processes are then applied to the image to be processed at the same size based on these different blur parameters, resulting in two blurred images with different degrees of blur. These two blurred images with different degrees of blur are then fused to obtain the final target image. This results in a better blur effect and a superior visual blurring effect in the fused target image, achieving higher quality image blurring processing. Furthermore, the size of the image to be processed is reduced before blurring, significantly decreasing the computational load of the blurring process.

[0124] Please refer to Figure 9 , Figure 9 This is a schematic flowchart illustrating an image processing method provided in another embodiment of this application. The following will be combined with... Figure 9 The image processing method provided in the embodiments of this application will be described in detail. The image processing method may include the following steps:

[0125] Step S410: Obtain the image to be blurred, the image carrying a third blur parameter.

[0126] Step S420: Determine the first fuzzy parameter and the second fuzzy parameter for the fuzzing process.

[0127] Step S430: Based on the first blur parameter, blur the image to be processed to obtain a first blurred image, and based on the second blur parameter, blur the image to be processed to obtain a second blurred image, wherein the blur degree of the second blurred image is greater than that of the first blurred image.

[0128] In this embodiment, the specific implementation of steps S410 to S430 can be found in the foregoing embodiments, and will not be repeated here.

[0129] Step S440: Determine the first blending weight corresponding to the first blurred image and the second blending weight corresponding to the second blurred image based on the fourth blurring parameter, the fifth blurring parameter and the third blurring parameter.

[0130] In this embodiment, since the first blurred image and the second blurred image have different degrees of blur, the required blur level of the fused target image is between the blur levels of the first blurred image and the second blurred image. Therefore, before image fusion, the mixing weights of the first blurred image and the second blurred image during image fusion can be calculated based on the fourth blur parameter, the fifth blur parameter, and the third blur parameter, so that the fused target image can achieve the required blur level. In other words, by adjusting the mixing weights, the required blur level of the fused target image can be more accurately determined between the blur levels of the first blurred image and the second blurred image.

[0131] The definitions of the fourth and fifth fuzzy parameters are the same as those in the previous embodiments, and can be found in the previous embodiments. They will not be repeated here.

[0132] In some implementations, please refer to Figure 10 Step S440 may include the contents of steps S441 to S445:

[0133] Step S441: Obtain the difference between the parameter values ​​of the third fuzzy parameter and the fourth fuzzy parameter, and use it as the first relative difference.

[0134] In this embodiment, with the image resolution of the image to be processed remaining unchanged, the degree of blurring of the image to be processed is positively correlated with the parameter value of the blurring parameter. Therefore, the blurring parameter can be used to a certain extent to characterize the degree of blurring of the image to be processed after blurring.

[0135] Based on this, the difference between the parameter values ​​of the third blur parameter and the fourth blur parameter can be obtained as the first relative difference. The first relative difference can be regarded as the difference in blur degree between the blur degree represented by the third blur parameter and the blur degree represented by the fourth blur parameter; it can also be understood as the degree of blur offset of the target image to be finally fused relative to the blur degree of the first blur image.

[0136] Step S442: Obtain the difference between the parameter values ​​of the fifth fuzzy parameter and the third fuzzy parameter, and use it as the second relative difference.

[0137] Understandably, since the target image is obtained by fusing the first blurred image and the second blurred image, the degree of blur of the target image can be offset from the degree of blur of the second blurred image. That is, the degree of blur is obtained between the degree of blur represented by the fifth blur parameter and the degree of blur represented by the third blur parameter. Therefore, the parameter values ​​of the fifth blur parameter and the third blur parameter are obtained as the second relative difference.

[0138] Step S443: Obtain the difference between the parameter values ​​of the fifth fuzzy parameter and the fourth fuzzy parameter, and use it as the total difference.

[0139] To better determine the degree of blur offset of the third blur parameter relative to the blur levels represented by the fifth and fourth blur parameters, the difference between the parameter values ​​of the fifth and fourth blur parameters can be obtained as the total difference. This total difference can be used to characterize the difference in blur level between the blur levels represented by the fifth and fourth blur parameters, that is, the degree of blur offset of the second blurred image relative to the blur level of the first blurred image.

[0140] Step S444: Determine the first mixed weight based on the ratio of the first relative difference to the total difference.

[0141] Furthermore, the ratio of the first relative difference to the total difference can be obtained. This ratio can, to some extent, characterize the position of the target blur radius between the fourth and fifth blur parameters. That is, based on this ratio, it can be seen whether the third blur parameter is closer to the fourth or the fifth blur parameter. Therefore, the first mixing weight corresponding to the first blurred image can be calculated based on the preset mixing function and this ratio. The preset mixing function can be any function that satisfies five conditions: a domain of [0,1], a range of [0,1], continuous differentiability within the domain, monotonically increasing within the domain, and equal derivatives at 0 and 1.

[0142] For example, the preset mixing function can be expressed as f(z) = z, 0 ≤ z ≤ 1, and the third fuzzy parameter can be expressed as the third fuzzy radius R. in The fourth fuzzy parameter is represented by the fourth fuzzy radius R. x The fifth fuzzy parameter is represented by the fifth fuzzy radius R. x+1 Based on this, the first relative difference can be calculated as R. in -R x The second relative difference is R. x+1 -R in The total difference is R x+1 -R x The ratio of the first relative difference to the total difference is Furthermore, by using this ratio as the independent variable in the preset mixing function, the value of the first function can be calculated. The smaller the first function value, the smaller the shift in blur level between the desired target image and the first blurred image; that is, the closer the desired blur level of the target image is to the blur level of the first blurred image. Therefore, the first mixing weight corresponding to the first blurred image is also higher. At this point, 1 and the first function value can be obtained. The difference is used as the first mixture weight.

[0143] Step S445: Determine the second mixed weight based on the ratio of the second relative difference to the total difference.

[0144] Similarly, the second mixing weight corresponding to the second blurred image can be determined based on the aforementioned preset mixing function and the ratio of the second relative difference to the total difference.

[0145] Using the example above, the ratio of the second relative difference to the total difference can be used as the independent variable in the preset mixing function to calculate the value of the second function. And obtain 1 and the second function value. The difference is used as the second mixing weight.

[0146] In other implementations, since the sum of the first mixed weight and the second mixed weight is 1, the difference between 1 and the first mixed weight can be directly obtained after obtaining the first mixed weight, and used as the second mixed weight.

[0147] For example, after obtaining the first mixed weights Then, obtain 1-F mix1 As the second mixing weight, F mix2 =1-F mix1 .

[0148] In some implementations, as mentioned in the foregoing embodiments, there is a mathematical correspondence between the scaling parameters and the corresponding preset blur radius. Therefore, the calculation formula for the hybrid weight can also be calculated based on the first scaling parameter and the second scaling parameter. The specific calculation formula can be adjusted according to the aforementioned mathematical correspondence, which will not be elaborated here.

[0149] Step S450: Based on the first mixing weight and the second mixing weight, fuse the first blurred image and the second blurred image to obtain the target image.

[0150] Specifically, based on the first mixing weight, the pixel value of each pixel in the first blurred image is adjusted, and based on the second mixing weight, the pixel value of each pixel in the second blurred image is adjusted; the adjusted first blurred image and the adjusted second blurred image are then superimposed to obtain the target image. This can be understood as follows: the RGB color value of each pixel in the fused target image is equal to the sum of the RGB color value of the corresponding pixel in the first blurred image multiplied by the first mixing weight, plus the sum of the RGB color value of the corresponding pixel in the second blurred image multiplied by the second mixing weight; T new Representing the target image, denoted by T x The first blurred image is represented by F. mix1 Indicates the first mixed weight, denoted by T. x+1 The second blurred image is represented by F. mix2 The second blending weight is represented by the formula used to calculate the RGB color value of each pixel in the target image:

[0151] RGB(T new ) = RGB(T x )·F mix1 +RGB(T x+1 )·F mix2

[0152] Among them, RGB(T) new ), RGB(T) x ), RGB(T) x+1 ) represent the image T respectively new T x T x+1 The RGB color value includes the luminance values ​​of the R channel, G channel, and B channel. When calculating the RGB color value of each pixel, the above formula can be used to calculate the luminance values ​​of the R channel, G channel, and B channel respectively.

[0153] In this embodiment, for real-time image blurring scenarios, the image to be processed is an image frame in an image frame sequence. The image frames in the image frame sequence can be different. For example, if the user's electronic device uses a dynamic interface wallpaper, then blurring is performed on the image obtained by overlaying each frame of the dynamic interface wallpaper and its corresponding display component. Optionally, the image frames in the image frame sequence can all be the same. For example, if the user's electronic device uses a static interface wallpaper, then only the first image frame in the same blurring scenario needs to be blurred once, according to the set blurring parameters, to obtain a first blurred image and a second blurred image, which are then saved. For subsequent image frames, only the first and second mixing weights need to be recalculated, and the image is fused according to the two mixing weights to obtain the target image, greatly improving the blurring efficiency in real-time blurring scenarios.

[0154] In this embodiment, two mixing weights are determined based on the fourth, fifth, and third blur parameters. Then, based on these mixing weights, the first and second blurred images are fused to obtain the final target image with a blurred effect. This ensures that the blur level of the fused target image is the same as that obtained by directly blurring based on the third blur parameter, thus meeting the blur level requirements of the image being processed. Furthermore, the blurred effect of the fused target image is more refined and better; especially for blurring image frames in real-time blurring scenarios where the blur radius is dynamically changing, the visual blurring effect is superior, without producing inter-frame jitter or abrupt visual changes.

[0155] Please refer to Figure 11 , Figure 11 This is a data flow diagram of an image processing method provided in yet another embodiment of this application. The following will be combined with... Figure 11 The image processing method provided in the embodiments of this application will be described in detail. This image processing method may include the following:

[0156] In this embodiment, multiple preset blur radii and scaling parameters (i.e., downsampling factors) corresponding to each preset blur radius are predefined. Two preset blur radii are determined based on the third blur radius, and the scaling parameters corresponding to the two preset blur radii are obtained respectively, resulting in the first scaling parameter and the second scaling parameter. Further, in the sampler, the image to be blurred in the GPU is downsampled according to the first scaling parameter and the second scaling parameter respectively, resulting in the first image and the second image after downsampling (i.e., size reduction). Then, using an image blurring algorithm and a specified blur radius, the downsampled first image and the downsampled second image are blurred, resulting in two blurred images with different resolutions: the first blurred image and the second blurred image. Then, the first blurred image and the second blurred image are sent back to the sampler, which upsamples the first blurred image according to the first scaling parameter (i.e., size increase), that is, restoring the resolution of the first blurred image to the original resolution, resulting in the third blurred image. Similarly, the sampler upsamples the second blurred image according to the second scaling parameter, that is, restoring the resolution of the second blurred image to the original resolution, resulting in the fourth blurred image. Here, the sampler is essentially the code in the GPU that has the function of upsampling and downsampling images. Finally, the blending weights are calculated based on the third blur radius and two predetermined blur radii. In the mixer, the two upsampled third and fourth blurred images are blended according to these blending weights to obtain the target image, which is then output to the GPU. The GPU uses the blended target image as the content to be displayed and sends it to the display device, which then displays the target image with the blurred effect. The mixer is essentially a code segment in the GPU that enables image blending. The blending weights include a first blending weight and a second blending weight. The relevant data in this embodiment can be found in the preceding embodiments and will not be repeated here.

[0157] In this embodiment, multiple blurred images with varying degrees of blurring are fused to obtain the target image, which is then displayed. A specified blur radius is used throughout the blurring process, reducing the algorithm's sensitivity to changes in the blur radius. Therefore, for real-time blurring scenarios with dynamic blur radii, the visual effect is better, avoiding inter-frame jitter or abrupt changes. Simultaneously, determining the downsampling factor based on the input blur radius ensures that the downsampling factor increases as the input blur radius increases, reducing the number of pixels required for blurring and thus reducing the computational load. This demonstrates the achievement of fast and high-quality real-time image blurring.

[0158] Please refer to Figure 12The diagram shows a structural block diagram of an image processing apparatus 500 according to an embodiment of this application. The apparatus 500 may include: an image acquisition module 510, a parameter determination module 520, a blur processing module 530, and an image fusion module 540.

[0159] The image acquisition module 510 is used to acquire the image to be blurred.

[0160] The parameter determination module 520 is used to determine the first fuzzy parameter and the second fuzzy parameter for the fuzzy processing.

[0161] The blurring module 530 is used to blur the image to be processed based on the first blurring parameter to obtain a first blurred image, and to blur the image to be processed based on the second blurring parameter to obtain a second blurred image, wherein the blurring degree of the second blurred image is greater than that of the first blurred image.

[0162] The image fusion module 540 is used to fuse the first blurred image and the second blurred image to obtain the target image.

[0163] In some embodiments, the image to be processed carries a third blur parameter, and the parameter value of the first blur parameter is the same as the parameter value of the second blur parameter. The blur processing module 530 may include: a scaling parameter determination unit, an image scaling unit, and an image blurring unit. The scaling parameter determination unit can be used to determine a first scaling parameter and a second scaling parameter corresponding to the third blur parameter. The image scaling unit can be used to reduce the size of the image to be processed according to the first scaling parameter to obtain a first image; and to reduce the size of the image to be processed according to the second scaling parameter to obtain a second image. The image blurring unit can be used to blur the first image based on the first blur parameter to obtain a first blurred image, and to blur the second image based on the second blur parameter to obtain a second blurred image.

[0164] In this approach, the scaling parameter determination unit may include a preset parameter determination subunit and a scaling parameter determination subunit. The preset parameter determination subunit can be used to determine a fourth fuzzy parameter and a fifth fuzzy parameter from a plurality of preset fuzzy parameters based on the third fuzzy parameter, wherein the value of the fourth fuzzy parameter is less than the value of the third fuzzy parameter, and the value of the fifth fuzzy parameter is greater than the value of the third fuzzy parameter. The scaling parameter determination subunit can be used to obtain the scaling parameter corresponding to the fourth fuzzy parameter as the first scaling parameter, wherein the value of the scaling parameter is positively correlated with the value of the preset fuzzy parameter; and to obtain the scaling parameter corresponding to the fifth fuzzy parameter as the second scaling parameter.

[0165] In some implementations, the preset parameter determination subunit may be specifically used to: obtain, from the first preset fuzzy parameters of the plurality of preset fuzzy parameters, a first preset fuzzy parameter whose parameter value difference with the third fuzzy parameter satisfies a first preset difference condition, as the fourth fuzzy parameter, wherein the parameter value of the first preset fuzzy parameter is less than the parameter value of the third fuzzy parameter; and obtain, from the second preset fuzzy parameters of the plurality of preset fuzzy parameters, a second preset fuzzy parameter whose parameter value difference with the third fuzzy parameter satisfies a second preset difference condition, as the fifth fuzzy parameter, wherein the parameter value of the second preset fuzzy parameter is greater than the parameter value of the third fuzzy parameter.

[0166] In some embodiments, the image fusion module 540 may include a weight determination unit and an image fusion unit. The weight determination unit may be used to determine a first blending weight corresponding to the first blurred image and a second blending weight corresponding to the second blurred image based on the obtained fourth blurring parameter, fifth blurring parameter, and third blurring parameter. The image fusion unit may be used to fuse the first blurred image and the second blurred image according to the first blending weight and the second blending weight to obtain the target image.

[0167] In this approach, the weight determination unit can be specifically used to: obtain the difference between the parameter values ​​of the third fuzzy parameter and the fourth fuzzy parameter as a first relative difference; obtain the difference between the parameter values ​​of the fifth fuzzy parameter and the third fuzzy parameter as a second relative difference; obtain the difference between the parameter values ​​of the fifth fuzzy parameter and the fourth fuzzy parameter as a total difference; determine the first mixed weight based on the ratio of the first relative difference to the total difference; and determine the second mixed weight based on the ratio of the second relative difference to the total difference.

[0168] In this manner, the image fusion unit can be specifically used to adjust the pixel value of each pixel in the first blurred image based on the first mixing weight, and to adjust the pixel value of each pixel in the second blurred image based on the second mixing weight; the adjusted first blurred image and the adjusted second blurred image are then fused to obtain the target image.

[0169] In some embodiments, the image fusion module 540 may include a size enlargement unit and an image fusion unit. The size enlargement unit may be used to enlarge the size of the first blurred image according to the first scaling parameter to obtain a third blurred image; and to enlarge the size of the second blurred image according to the second scaling parameter to obtain a fourth blurred image. The image fusion unit may be used to fuse the third blurred image and the fourth blurred image to obtain the target image.

[0170] In some embodiments, the image to be processed carries a third blur parameter, where the value of the first blur parameter is less than the value of the third blur parameter, and the value of the second blur parameter is greater than the value of the third blur parameter. The blur processing module 530 can be specifically used to: reduce the size of the image to be processed according to the third scaling parameter to obtain a third image; perform blur processing on the third image based on the first blur parameter to obtain the first blurred image; and perform blur processing on the third image based on the second blur parameter to obtain the second blurred image.

[0171] In this mode, the image fusion module 540 can be specifically used to fuse the first blurred image and the second blurred image to obtain a fifth blurred image; and increase the size of the fifth blurred image according to the third scaling parameter to obtain the target image.

[0172] In some implementations, the blurring module 530 may be specifically used to: perform blurring processing on the image to be processed according to the preset blurring algorithm corresponding to the first blurring parameter and the first blurring parameter to obtain the first blurred image; and perform blurring processing on the image to be processed according to the preset blurring algorithm corresponding to the second blurring parameter and the second blurring parameter to obtain the second blurred image.

[0173] In other embodiments, the blur processing module 530 may be specifically used to: acquire the blurred scene corresponding to the image to be processed; perform blur processing on the image to be processed according to the preset blur algorithm corresponding to the blurred scene and the first blur parameter to obtain the first blurred image; and perform blur processing on the image to be processed according to the preset blur algorithm and the second blur parameter to obtain the second blurred image.

[0174] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described device and module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0175] In the several embodiments provided in this application, the coupling between modules can be electrical, mechanical, or other forms of coupling.

[0176] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0177] In summary, the solution provided in this application involves: acquiring an image to be blurred; determining a first blur parameter and a second blur parameter for the blurring process; blurring the image to be blurred based on the first blur parameter to obtain a first blurred image; and blurring the image to be blurred based on the second blur parameter to obtain a second blurred image, wherein the blur degree of the second blurred image is greater than that of the first blurred image; and fusing the first blurred image and the second blurred image to obtain a target image. In related technologies, directly blurring an image based on a single blur parameter can result in jagged edges, leading to a subjective visual perception of uneven blurring effects, i.e., poor blurring quality. In contrast, the target image in this application is obtained by fusing two blurred images with different blur degrees, increasing blur details and making the blurring effect more delicate. This avoids the jagged edge problem in blurred images, resulting in a better visual blurring effect and achieving higher quality image blurring processing.

[0178] The following will combine Figure 13 This application describes a computer device.

[0179] Reference Figure 13 , Figure 13 The diagram shows a structural block diagram of a computer device 600 provided in an embodiment of this application. The above-mentioned method provided in this embodiment can be executed by the computer device 600. The computer device 600 can be an electronic device such as a smartphone, tablet computer, smart bracelet, smartwatch, laptop computer or desktop computer. Of course, it can also be a physical server or cloud server. This embodiment does not limit it.

[0180] The computer device 600 in this embodiment may include one or more of the following components: processor 601, memory 602, and one or more application programs, wherein the one or more application programs may be stored in memory 602 and configured to be executed by one or more processors 601, and the one or more programs are configured to perform the methods as described in the foregoing method embodiments.

[0181] Processor 601 may include one or more processing cores. Processor 601 connects to various parts within the computer device 600 using various interfaces and lines, and performs various functions and processes data of the computer device 600 by running or executing instructions, programs, code sets, or instruction sets stored in memory 602, and by calling data stored in memory 602. Optionally, processor 601 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). Processor 601 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the aforementioned modem can also be integrated into processor 601 and implemented as a separate communication chip.

[0182] The memory 602 may include random access memory (RAM) or read-only memory (ROM). The memory 602 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 602 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), and instructions for implementing the various method embodiments described below. The data storage area may also store data created by the computer device 600 during use (such as the various correspondences described above).

[0183] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described device and module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0184] In the several embodiments provided in this application, the coupling or direct coupling or communication connection between the modules shown or discussed may be an indirect coupling or communication connection through some interface, device or module, and may be electrical, mechanical or other forms.

[0185] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0186] Please refer to Figure 14 This diagram illustrates a structural block diagram of a computer-readable storage medium provided in an embodiment of this application. The computer-readable medium 700 stores program code that can be called by a processor to execute the methods described in the above method embodiments.

[0187] The computer-readable storage medium 700 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 700 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 700 has storage space for program code 710 that performs any of the method steps described above. This program code can be read from or written to one or more computer program products. The program code 710 may, for example, be compressed in a suitable form.

[0188] In some embodiments, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, causing the computer device to perform the steps in the above-described method embodiments.

[0189] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. An image processing method, characterized in that, The method includes: Obtain the image to be blurred, the image carrying a third blur parameter; Determine the first fuzzy parameter and the second fuzzy parameter used for the fuzzy processing; Based on the first blur parameter, the image to be processed is blurred to obtain a first blurred image, and based on the second blur parameter, the image to be processed is blurred to obtain a second blurred image, wherein the blur degree of the second blurred image is greater than that of the first blurred image. The first blurred image and the second blurred image are fused to obtain the target image; The parameter value of the first blur parameter is the same as the parameter value of the second blur parameter. The process of blurring the image to be processed based on the first blur parameter to obtain a first blurred image, and blurring the image to be processed based on the second blur parameter to obtain a second blurred image, wherein the blur degree of the second blurred image is greater than that of the first blurred image, includes: Based on the third fuzzy parameter, a fourth fuzzy parameter and a fifth fuzzy parameter are determined from a plurality of preset fuzzy parameters, wherein the parameter value of the fourth fuzzy parameter is less than or equal to the parameter value of the third fuzzy parameter, and the parameter value of the fifth fuzzy parameter is greater than the parameter value of the third fuzzy parameter. Obtain the scaling parameter corresponding to the fourth blur parameter as the first scaling parameter. The value of the scaling parameter is positively correlated with the value of the preset blur parameter. Obtain the scaling parameter corresponding to the fifth blur parameter, and use it as the second scaling parameter; The size of the image to be processed is reduced according to the first scaling parameter to obtain the first image; The size of the image to be processed is reduced according to the second scaling parameter to obtain a second image; Based on the first blur parameter, the first image is blurred to obtain a first blurred image, and based on the second blur parameter, the second image is blurred to obtain a second blurred image; The process of fusing the first blurred image and the second blurred image to obtain the target image includes: Based on the fourth blur parameter, the fifth blur parameter, and the third blur parameter, determine the first blending weight corresponding to the first blurred image and the second blending weight corresponding to the second blurred image; The first blurred image and the second blurred image are fused according to the first mixing weight and the second mixing weight to obtain the target image.

2. The method according to claim 1, characterized in that, The step of determining the fourth and fifth fuzzy parameters from a plurality of preset fuzzy parameters based on the third fuzzy parameter includes: From the first preset fuzzy parameters of the plurality of preset fuzzy parameters, the first preset fuzzy parameter whose difference with the third fuzzy parameter satisfies the first preset difference condition is obtained as the fourth fuzzy parameter, wherein the parameter value of the first preset fuzzy parameter is less than or equal to the parameter value of the third fuzzy parameter; From the second preset fuzzy parameters of the plurality of preset fuzzy parameters, the second preset fuzzy parameter whose parameter value difference with the third fuzzy parameter satisfies the second preset difference condition is obtained as the fifth fuzzy parameter, wherein the parameter value of the second preset fuzzy parameter is greater than the parameter value of the third fuzzy parameter.

3. The method according to claim 1, characterized in that, The step of determining the first blending weight corresponding to the first blurred image and the second blending weight corresponding to the second blurred image based on the fourth blurring parameter, the fifth blurring parameter, and the third blurring parameter includes: The difference between the parameter values ​​of the third fuzzy parameter and the fourth fuzzy parameter is obtained as the first relative difference; The difference between the parameter values ​​of the fifth fuzzy parameter and the third fuzzy parameter is obtained as the second relative difference; The difference between the parameter values ​​of the fifth fuzzy parameter and the fourth fuzzy parameter is obtained as the total difference. The first mixed weight is determined based on the ratio of the first relative difference to the total difference; The second mixed weight is determined based on the ratio of the second relative difference to the total difference.

4. The method according to claim 1, characterized in that, The step of fusing the first blurred image and the second blurred image according to the first mixing weight and the second mixing weight to obtain the target image includes: Based on the first mixing weight, the pixel value of each pixel in the first blurred image is adjusted, and based on the second mixing weight, the pixel value of each pixel in the second blurred image is adjusted. The adjusted first blurred image and the adjusted second blurred image are fused together to obtain the target image.

5. An image processing apparatus, characterized in that, The device includes: The image acquisition module is used to acquire the image to be blurred, the image carrying a third blur parameter; The parameter determination module is used to determine a first fuzzy parameter and a second fuzzy parameter for the fuzzy processing, wherein the parameter values ​​of the first fuzzy parameter and the second fuzzy parameter are the same. A blurring module is configured to: determine a fourth blurring parameter and a fifth blurring parameter from a plurality of preset blurring parameters based on the third blurring parameter, wherein the parameter value of the fourth blurring parameter is less than or equal to the parameter value of the third blurring parameter, and the parameter value of the fifth blurring parameter is greater than the parameter value of the third blurring parameter; obtain a scaling parameter corresponding to the fourth blurring parameter as a first scaling parameter, wherein the parameter value of the scaling parameter is positively correlated with the parameter value of the preset blurring parameter; obtain a scaling parameter corresponding to the fifth blurring parameter as a second scaling parameter; reduce the size of the image to be processed according to the first scaling parameter to obtain a first image; reduce the size of the image to be processed according to the second scaling parameter to obtain a second image; perform blurring processing on the first image based on the first blurring parameter to obtain a first blurred image, and perform blurring processing on the second image based on the second blurring parameter to obtain a second blurred image, wherein the blur degree of the second blurred image is greater than the blur degree of the first blurred image; The image fusion module is used to determine a first blending weight corresponding to the first blurred image and a second blending weight corresponding to the second blurred image based on the fourth blurring parameter, the fifth blurring parameter, and the third blurring parameter; and to fuse the first blurred image and the second blurred image based on the first blending weight and the second blending weight to obtain a target image.

6. A computer device, characterized in that, include: One or more processors; Memory; One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs being configured to perform the method as described in any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores program code that can be invoked by a processor to execute the method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Generation method of image bokeh effect and image acquisition device

    CN105450943A

  • Image processing method and device

    CN108765271A

  • Image blurring processing method and device, computer equipment and storage medium

    CN110728632A