Fuzzy processing method, electronic equipment and computer readable storage medium
By adaptively adjusting the downsampling ratio of the fuzzy processing method, the problem of high computational overhead in large-size image areas in image processing is solved, and the image details are retained while reducing the computational load. It is suitable for image production and editing scenarios of terminal devices.
Patent Information
- Application Number
- CN202410389397.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-28
- Publication Date
- 2025-09-30
AI Technical Summary
In image processing, blurring a large image area to be blurred will result in excessive computational overhead for the terminal device. Existing technologies reduce the load by lowering the image resolution, but this results in image distortion and makes fine adjustment impossible.
A blur processing method with adaptive downsampling ratio is adopted. Different downsampling ratios are set according to different blur levels. Blurring is performed at different blur levels and the downsampling ratio is matched to reduce computational overhead and retain image details.
While reducing the computing overhead of the terminal device, the details of the image area to be blurred are retained to the greatest extent possible, achieving efficient processing at high blur and fine adjustment at low blur, taking into account both performance and effects.
Smart Images

Figure CN120725943A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a blur processing method, an electronic device, and a computer-readable storage medium. Background Art
[0002] In some image processing scenarios, blurring of image areas is often involved. When the image area to be blurred is large, the computational overhead of the blurring algorithm will be very large, thus placing high performance requirements on the terminal device.
[0003] Currently, reducing the image resolution is often used to reduce the load on the terminal device caused by the blur algorithm when blurring the image area. However, reducing the image resolution will cause image distortion and cannot achieve fine adjustment. Summary of the Invention
[0004] The present application provides a blur processing method, electronic device and computer-readable storage medium, which can adaptively adjust the downsampling ratio according to the blur to be adjusted, taking into account both performance and blur effect, while reducing the computing overhead of the terminal device and ensuring the performance of the terminal device, while retaining the details of the image area to be blurred to the greatest extent.
[0005] To achieve the above objectives, this application adopts the following technical solutions:
[0006] In a first aspect, a blur processing method is provided, the method comprising: obtaining a first blur degree of an image area to be blurred of a first image; performing a first blur processing on the image area to be blurred based on the first blur degree to obtain a second image; obtaining a second blur degree of the image area to be blurred, the first blur degree and the second blur degree being different; performing a second blur processing on the image area to be blurred based on the second blur degree to obtain a third image; the first blur processing and the second blur processing use different downsampled image areas, and the different downsampled image areas are obtained by downsampling the image area to be blurred at different downsampling ratios corresponding to the first blur degree and the second blur degree.
[0007] The solution provided in the first aspect above, by setting different downsampling ratios at different blur levels, can use a downsampling ratio that matches the blur level when performing blur adjustment. Therefore, when blurring the downsampled image area corresponding to the downsampling ratio, it can reduce the computational overhead of the terminal device, ensure the performance of the terminal device, and retain the details of the image area to be blurred to the greatest extent. In particular, under high blur adjustment, it can reduce the computational overhead brought by the blur algorithm and ensure the performance of the terminal device, and under low blur adjustment, it can achieve fine adjustment of the image area to be blurred, retaining the details of the image area to be blurred to the greatest extent, thereby achieving the goal of balancing performance and effect.
[0008] As one possible implementation, the image region to be blurred has multiple downsampling ratios corresponding to it, and different downsampling ratios correspond to different blurrinesses. The downsampling ratio corresponding to the first blurriness is one of the multiple downsampling ratios corresponding to the image region to be blurred, and the downsampling ratio corresponding to the second blurriness is one of the multiple downsampling ratios corresponding to the image region to be blurred. Thus, by setting different downsampling ratios for different blurrinesses, the downsampling ratio that matches the blurriness can be used during blur adjustment. This allows blurring based on the downsampled image region corresponding to the downsampling ratio to reduce the computational overhead of the terminal device, ensuring terminal device performance, while preserving the details of the image region to be blurred to the greatest extent possible.
[0009] As one possible implementation, the downsampling ratio of the image region to be blurred is determined based on the image size of the image region to be blurred. Thus, by setting the downsampling ratio of the image region to be blurred based on the image size, the resulting downsampling ratio can meet the blurring requirements of the image region to be blurred.
[0010] As one possible implementation, the image size of the image region to be blurred is positively correlated with the number of downsampling ratios corresponding to the image region to be blurred. Thus, as the image size of the image region to be blurred increases, the number of downsampling ratios corresponding to the image region to be blurred increases. As the image size of the image region to be blurred decreases, the number of downsampling ratios corresponding to the image region to be blurred decreases, thereby ensuring that the resulting downsampling ratios meet the blurring requirements of the image region to be blurred.
[0011] As a possible implementation, the downsampling ratio is negatively correlated with the blurriness. Thus, by setting different downsampling ratios at different blurrinesses, the downsampling ratio and the blurriness are negatively correlated. This allows for blurriness adjustment of the image area to be blurred based on the corresponding relationship between the downsampling ratio and the blurriness. This reduces the computing overhead of the terminal device, ensures the performance of the terminal device, and preserves the details of the image area to be blurred to the greatest extent possible.
[0012] As a possible implementation, obtaining a first blur degree of the image region to be blurred of the first image includes: obtaining the first blur degree in response to a first blur setting set by a user for the image region to be blurred. In this way, a blur degree that meets user needs can be obtained with convenient operation.
[0013] As a possible implementation, obtaining the second blurriness of the image region to be blurred includes: obtaining the second blurriness in response to a second blur setting set by the user for the image region to be blurred. In this way, a blurriness that meets the user's needs can be obtained with convenient operation.
[0014] As a possible implementation, performing a first blurring process on the image region to be blurred based on a first blurriness includes: obtaining a first downsampled image region corresponding to a first downsampling ratio, where the first downsampling ratio is the downsampling ratio corresponding to the first blurriness; and blurring the first downsampled image region based on the first blurriness. Thus, by setting different downsampling ratios for different blurrinesses, a downsampling ratio that matches the blurriness can be used during blur adjustment. Thus, when blurring the downsampled image region corresponding to the downsampling ratio, the computational overhead of the terminal device can be reduced, ensuring terminal device performance while preserving details of the image region to be blurred to the greatest extent possible.
[0015] As a possible implementation, performing a second blurring process on the image region to be blurred based on a second blurriness includes: obtaining a second downsampled image region corresponding to a second downsampling ratio, where the second downsampling ratio is the downsampling ratio corresponding to the second blurriness; and blurring the second downsampled image region based on the second blurriness. Thus, by setting different downsampling ratios for different blurrinesses, the downsampling ratio that matches the blurriness can be used during blur adjustment. Thus, when blurring the downsampled image region corresponding to the downsampling ratio, the computational overhead of the terminal device can be reduced, ensuring terminal device performance while preserving the details of the image region to be blurred to the greatest extent possible.
[0016] As a possible implementation, obtaining a first downsampled image region corresponding to a first downsampling ratio includes: obtaining the first downsampled image region from downsampled image regions corresponding to multiple downsampling ratios of the image region to be blurred, according to the first downsampling ratio, where the first downsampled image region is one of the downsampled image regions corresponding to the multiple downsampling ratios; or obtaining the first downsampled image region from downsampled image regions corresponding to a target downsampling ratio, according to the first downsampling ratio, where the target downsampling ratio is the downsampling ratio corresponding to a predicted blurriness. In this manner, by pre-creating downsampled image regions corresponding to multiple downsampling ratios of the image region to be blurred or a downsampled image region corresponding to the target downsampling ratio, after obtaining the first downsampling ratio corresponding to the first blurriness, the first downsampled image region corresponding to the first downsampling ratio can be quickly obtained.
[0017] As a possible implementation, obtaining the second downsampled image region corresponding to the second downsampling ratio includes: obtaining the second downsampled image region from downsampled image regions corresponding to multiple downsampling ratios of the image region to be blurred, according to the second downsampling ratio, where the second downsampled image region is one of the downsampled image regions corresponding to the multiple downsampling ratios; or obtaining the second downsampled image region from downsampled image regions corresponding to a target downsampling ratio, according to the second downsampling ratio, where the target downsampling ratio is the downsampling ratio corresponding to the predicted blurriness. In this manner, by pre-creating downsampled image regions corresponding to multiple downsampling ratios of the image region to be blurred or a downsampled image region corresponding to the target downsampling ratio, after obtaining the second downsampling ratio corresponding to the second blurriness, the second downsampled image region corresponding to the second downsampling ratio can be quickly obtained.
[0018] As a possible implementation, before performing a first blurring process on the image region to be blurred according to the first blurriness to obtain a second image, the method further includes: when a first condition is met, downsampling the image region to be blurred according to multiple downsampling ratios corresponding to the image region to be blurred, thereby obtaining downsampled image regions corresponding to the multiple downsampling ratios; when the first condition is not met, downsampling the image region to be blurred according to a target downsampling ratio, thereby obtaining a downsampled image region corresponding to the target downsampling ratio; the first condition includes one or more of the following: the image size of the image region to be blurred is less than a set size threshold, and the available memory is greater than a set memory threshold. In this way, by detecting the image size and the size of the available memory, when the image size is small and the memory space is sufficient, downsampled image regions corresponding to all downsampling ratios can be pre-created, thereby improving the efficiency of subsequently obtaining downsampled image regions. When the image size is large and the memory space is small, downsampled image regions can be dynamically created to reduce memory usage.
[0019] As a possible implementation, before performing a second blurring process on the image region to be blurred according to the second blurriness to obtain a third image, the method further includes: when a first condition is met, downsampling the image region to be blurred according to multiple downsampling ratios corresponding to the image region to be blurred, thereby obtaining downsampled image regions corresponding to the multiple downsampling ratios; when the first condition is not met, downsampling the image region to be blurred according to a target downsampling ratio, thereby obtaining a downsampled image region corresponding to the target downsampling ratio; the first condition includes one or more of the following: the image size of the image region to be blurred is less than a set size threshold, and the available memory is greater than a set memory threshold. In this way, by detecting the image size and the size of the available memory, when the image size is small and the memory space is sufficient, downsampled image regions corresponding to all downsampling ratios can be pre-created, thereby improving the efficiency of subsequently obtaining downsampled image regions. When the image size is large and the memory space is small, downsampled image regions can be dynamically created to reduce memory usage.
[0020] As a possible implementation, the method further includes: obtaining a first blur adjustment rate set by the user for the image region to be blurred; and obtaining a predicted blur degree based on the first blur adjustment rate and the first blur degree. Thus, by determining the predicted blur degree based on the user's blur adjustment rate, and dynamically creating the required downsampled image region based on the predicted blur degree, memory usage can be effectively reduced.
[0021] As a possible implementation, the method further includes: obtaining a downsampling ratio to be processed based on the downsampling ratio corresponding to the first blurriness and the downsampling ratio corresponding to the predicted blurriness; and deleting a downsampled image region corresponding to the downsampling ratio to be processed, where the downsampled image region corresponding to the downsampling ratio to be processed is obtained by downsampling the image region to be blurred based on the downsampling ratio to be processed. In this way, by dynamically deleting unnecessary downsampled image regions, memory usage can be effectively reduced.
[0022] As a possible implementation, the method further includes: obtaining a second blur adjustment rate set by the user for the image region to be blurred; and obtaining a predicted blur degree based on the second blur adjustment rate and the second blur degree. Thus, by determining the predicted blur degree based on the user's blur adjustment rate, and dynamically creating the required downsampled image region based on the predicted blur degree, memory usage can be effectively reduced.
[0023] Exemplarily, the second blur adjustment rate represents the blur adjustment rate of the user when adjusting to the second blur level.
[0024] As a possible implementation, the method further includes: obtaining a downsampling ratio to be processed based on the downsampling ratio corresponding to the second blurriness and the downsampling ratio corresponding to the predicted blurriness; and deleting a downsampled image region corresponding to the downsampling ratio to be processed, where the downsampled image region corresponding to the downsampling ratio to be processed is obtained by downsampling the image region to be blurred based on the downsampling ratio to be processed. In this way, by dynamically deleting unnecessary downsampled image regions, memory usage can be effectively reduced.
[0025] In a second aspect, a blur processing device is provided, comprising a blur degree acquisition module and a blur processing module. The blur degree acquisition module is configured to acquire a first blur degree of an image region to be blurred in a first image; the blur processing module is configured to perform a first blur processing on the image region to be blurred based on the first blur degree to obtain a second image; the blur degree acquisition module is further configured to acquire a second blur degree of the image region to be blurred, wherein the first blur degree and the second blur degree are different; the blur processing module is further configured to perform a second blur processing on the image region to be blurred based on the second blur degree to obtain a third image; the first blur processing and the second blur processing utilize different downsampled image regions, and the different downsampled image regions are obtained by downsampling the image region to be blurred at different downsampling ratios corresponding to the first blur degree and the second blur degree.
[0026] The solution provided in the second aspect above, by setting different downsampling ratios at different blur levels, can use a downsampling ratio that matches the blur level when performing blur adjustment. Therefore, when blurring the downsampled image area corresponding to the downsampling ratio, it can reduce the computational overhead of the terminal device and ensure the performance of the terminal device while retaining the details of the image area to be blurred to the greatest extent. In particular, under high blur adjustment, it can reduce the computational overhead brought by the blur algorithm and ensure the performance of the terminal device, and under low blur adjustment, it can achieve fine adjustment of the image area to be blurred, retaining the details of the image area to be blurred to the greatest extent, thereby achieving the goal of balancing performance and effect.
[0027] As one possible implementation, the image region to be blurred has multiple downsampling ratios corresponding to it, and different downsampling ratios correspond to different blurrinesses. The downsampling ratio corresponding to the first blurriness is one of the multiple downsampling ratios corresponding to the image region to be blurred, and the downsampling ratio corresponding to the second blurriness is one of the multiple downsampling ratios corresponding to the image region to be blurred. Thus, by setting different downsampling ratios for different blurrinesses, the downsampling ratio that matches the blurriness can be used during blur adjustment. This allows blurring based on the downsampled image region corresponding to the downsampling ratio to reduce the computational overhead of the terminal device, ensuring terminal device performance, while preserving the details of the image region to be blurred to the greatest extent possible.
[0028] As one possible implementation, the downsampling ratio of the image region to be blurred is determined based on the image size of the image region to be blurred. Thus, by setting the downsampling ratio of the image region to be blurred based on the image size, the resulting downsampling ratio can meet the blurring requirements of the image region to be blurred.
[0029] As one possible implementation, the image size of the image region to be blurred is positively correlated with the number of downsampling ratios corresponding to the image region to be blurred. Thus, as the image size of the image region to be blurred increases, the number of downsampling ratios corresponding to the image region to be blurred increases. As the image size of the image region to be blurred decreases, the number of downsampling ratios corresponding to the image region to be blurred decreases, thereby ensuring that the resulting downsampling ratios meet the blurring requirements of the image region to be blurred.
[0030] As a possible implementation, the downsampling ratio is negatively correlated with the blurriness. Thus, by setting different downsampling ratios at different blurrinesses, the downsampling ratio and the blurriness are negatively correlated. This allows for blurriness adjustment of the image area to be blurred based on the corresponding relationship between the downsampling ratio and the blurriness. This reduces the computing overhead of the terminal device, ensures the performance of the terminal device, and preserves the details of the image area to be blurred to the greatest extent possible.
[0031] As a possible implementation, the blur acquisition module is specifically configured to obtain a first blur in response to a first blur setting set by a user for the image region to be blurred. In this way, a blur that meets the user's needs can be obtained with convenient operation.
[0032] As a possible implementation, the blur acquisition module is specifically configured to obtain a second blur in response to a second blur setting set by the user for the image region to be blurred. In this way, a blur that meets the user's needs can be obtained with convenient operation.
[0033] As one possible implementation, the blur processing module is specifically configured to: obtain a first downsampled image region corresponding to a first downsampling ratio, where the first downsampling ratio is the downsampling ratio corresponding to a first blur level; and perform blur processing on the first downsampled image region based on the first blur level. Thus, by setting different downsampling ratios at different blur levels, the downsampling ratio that matches the blur level can be used during blur adjustment. Thus, when blurring the downsampled image region corresponding to the downsampling ratio, the computational overhead of the terminal device can be reduced, ensuring the performance of the terminal device while preserving the details of the image region to be blurred to the greatest extent possible.
[0034] As a possible implementation, the blur processing module is specifically configured to: obtain a second downsampled image region corresponding to a second downsampling ratio, where the second downsampling ratio is a downsampling ratio corresponding to a second blur level; and perform blur processing on the second downsampled image region based on the second blur level. Thus, by setting different downsampling ratios at different blur levels, a downsampling ratio that matches the blur level can be used when blurring is adjusted. Thus, when blurring is performed on the downsampled image region corresponding to the downsampling ratio, the computational overhead of the terminal device can be reduced, ensuring the performance of the terminal device while preserving the details of the image region to be blurred to the greatest extent possible.
[0035] As a possible implementation, the blur processing module is specifically configured to: obtain, based on a first downsampling ratio, a first downsampled image region from downsampled image regions corresponding to multiple downsampling ratios of the image region to be blurred, where the first downsampled image region is one of the downsampled image regions corresponding to the multiple downsampling ratios; or obtain, based on the first downsampling ratio, the first downsampled image region from downsampled image regions corresponding to a target downsampling ratio, where the target downsampling ratio is the downsampling ratio corresponding to a predicted blurriness. In this manner, by pre-creating downsampled image regions corresponding to multiple downsampling ratios of the image region to be blurred or a downsampled image region corresponding to the target downsampling ratio, after obtaining the first downsampling ratio corresponding to the first blurriness, the first downsampled image region corresponding to the first downsampling ratio can be quickly obtained.
[0036] As a possible implementation, the blur processing module is specifically configured to: obtain, based on the second downsampling ratio, a second downsampled image region from downsampled image regions corresponding to multiple downsampling ratios of the image region to be blurred, where the second downsampled image region is one of the downsampled image regions corresponding to the multiple downsampling ratios; or obtain, based on the second downsampling ratio, a second downsampled image region from downsampled image regions corresponding to a target downsampling ratio, where the target downsampling ratio is the downsampling ratio corresponding to the predicted blurriness. In this manner, by pre-creating downsampled image regions corresponding to multiple downsampling ratios of the image region to be blurred or a downsampled image region corresponding to the target downsampling ratio, after obtaining the second downsampling ratio corresponding to the second blurriness, the second downsampled image region corresponding to the second downsampling ratio can be quickly obtained.
[0037] As a possible implementation, before performing a first blurring process on the image region to be blurred according to the first blurriness to obtain a second image, the blurring processing module is further configured to: when a first condition is met, downsample the image region to be blurred according to multiple downsampling ratios corresponding to the image region to be blurred, thereby obtaining downsampled image regions corresponding to the multiple downsampling ratios; when the first condition is not met, downsample the image region to be blurred according to a target downsampling ratio, thereby obtaining a downsampled image region corresponding to the target downsampling ratio; the first condition includes one or more of the following: the image size of the image region to be blurred is less than a set size threshold, and the available memory is greater than a set memory threshold. In this way, by detecting the image size and the size of the available memory, when the image size is small and the memory space is sufficient, downsampled image regions corresponding to all downsampling ratios can be pre-created, thereby improving the efficiency of subsequently obtaining downsampled image regions; and when the image size is large and the memory space is small, downsampled image regions can be dynamically created, thereby reducing memory usage.
[0038] As a possible implementation, before performing a second blurring process on the image region to be blurred according to the second blurriness to obtain a third image, the blurring processing module is further configured to: when a first condition is met, downsample the image region to be blurred according to multiple downsampling ratios corresponding to the image region to be blurred, thereby obtaining downsampled image regions corresponding to the multiple downsampling ratios; when the first condition is not met, downsample the image region to be blurred according to a target downsampling ratio, thereby obtaining a downsampled image region corresponding to the target downsampling ratio; the first condition includes one or more of the following: the image size of the image region to be blurred is less than a set size threshold, and the available memory is greater than a set memory threshold. In this way, by detecting the image size and the size of the available memory, when the image size is small and the memory space is sufficient, downsampled image regions corresponding to all downsampling ratios can be pre-created, thereby improving the efficiency of subsequently obtaining downsampled image regions; and when the image size is large and the memory space is small, downsampled image regions can be dynamically created, thereby reducing memory usage.
[0039] As one possible implementation, the blur processing module is configured to obtain a first blur adjustment rate set by the user for the image region to be blurred; and to obtain a predicted blur degree based on the first blur adjustment rate and the first blur degree. Thus, by determining the predicted blur degree based on the user's blur adjustment rate, and dynamically creating the required downsampled image region based on the predicted blur degree, memory usage can be effectively reduced.
[0040] As one possible implementation, the blur processing module is configured to: determine a downsampling ratio to be processed based on the downsampling ratio corresponding to the first blur level and the downsampling ratio corresponding to the predicted blur level; and delete the downsampled image region corresponding to the downsampled image region to be processed, where the downsampled image region corresponding to the downsampled image region to be processed is obtained by downsampling the image region to be blurred based on the downsampled image region to be processed. This dynamic deletion of unnecessary downsampled image regions effectively reduces memory usage.
[0041] As one possible implementation, the blur processing module is configured to obtain a second blur adjustment rate set by the user for the image region to be blurred; and to obtain a predicted blur degree based on the second blur adjustment rate and the second blur degree. Thus, by determining the predicted blur degree based on the user's blur adjustment rate, and dynamically creating the required downsampled image region based on the predicted blur degree, memory usage can be effectively reduced.
[0042] Exemplarily, the second blur adjustment rate represents the blur adjustment rate of the user when adjusting to the second blur level.
[0043] As one possible implementation, the blur processing module is configured to: determine a downsampling ratio to be processed based on the downsampling ratio corresponding to the second blur level and the downsampling ratio corresponding to the predicted blur level; and delete the downsampled image region corresponding to the downsampled image region to be processed, where the downsampled image region to be processed is obtained by downsampling the image region to be blurred based on the downsampling ratio to be processed. In this way, by dynamically deleting unnecessary downsampled image regions, memory usage can be effectively reduced.
[0044] In a third aspect, an electronic device is provided, comprising: a memory for storing computer program instructions; and a processor for executing the computer program instructions to support the electronic device in implementing a method as any possible implementation method in the first aspect.
[0045] Exemplarily, the electronic device is a terminal device.
[0046] In a fourth aspect, a computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processing circuit, a method as in any possible implementation manner of the first aspect is implemented.
[0047] In a fifth aspect, a chip system is provided, which includes a processing circuit and a storage medium, wherein the storage medium stores computer program instructions; when the computer program instructions are executed by the processing circuit, a method as in any possible implementation method of the first aspect is implemented.
[0048] In a sixth aspect, a computer program product comprising instructions is provided, which, when the computer program product is run on a computer, enables the computer to execute a method as in any possible implementation manner of the first aspect.
[0049] In a seventh aspect, an operating system is provided, which, when running on a computer, enables the computer to execute the method of any possible implementation manner in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application;
[0051] Figure 2 This is a flowchart of the fuzzy processing method provided in an embodiment of the present application;
[0052] Figure 3 A schematic diagram of an image display interface provided in an embodiment of the present application;
[0053] Figure 4 A schematic diagram of a region selection interface provided in an embodiment of the present application;
[0054] Figure 5 A schematic diagram of the fuzziness setting interface provided in an embodiment of the present application;
[0055] Figure 6 A graph showing the relationship between blur and downsampling ratio provided in an embodiment of the present application;
[0056] Figure 7 The second flowchart of the fuzzy processing method provided in the embodiment of the present application;
[0057] Figure 8 A schematic diagram of a blurred image display interface provided in an embodiment of the present application;
[0058] Figure 9 A schematic diagram of the structure of a fuzzy processing device 400 provided in an embodiment of the present application;
[0059] Figure 10 A schematic diagram of the structure of a fuzzy processing device 500 provided in an embodiment of the present application;
[0060] Figure 11 A schematic diagram of the working process of the fuzzy processing device 500 provided in an embodiment of the present application. DETAILED DESCRIPTION
[0061] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0062] The terms "including," "having," and any variations thereof mentioned in the description of the embodiments of the present application are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or units is not limited to the listed steps or units, but may optionally include other steps or units not listed, or may optionally include other steps or units inherent to the process, method, product, or apparatus.
[0063] In the following, the terms "first," "second," etc. are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the quantity of the technical features indicated. Therefore, a feature specified as "first," "second," etc. may explicitly or implicitly include one or more of the features.
[0064] In the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0065] In the description of the embodiments of this application, unless otherwise specified, "plurality" means two or more. "And / or" in this document is merely a description of the association relationship between associated objects, indicating that three relationships can exist. For example, "A and / or B" can mean: A exists alone, A and B exist simultaneously, or B exists alone.
[0066] As described in the background, some image processing scenarios often involve blurring image regions. When the image region to be blurred is large, the computational overhead of the blurring algorithm is significant, placing high demands on the performance of the terminal device. For example, when performing electronic painting on a terminal device such as a tablet or personal computer (PC), the user can add a blur effect to the created layer as needed. However, when the created layer is large, the computational overhead of the blurring algorithm is significant.
[0067] Currently, a fixed resolution reduction approach is often used to reduce the load on the terminal device when blurring image regions. This approach involves reducing the image resolution to a set resolution. However, this resolution reduction can cause image distortion, making fine adjustment impossible in some low-blur scenes.
[0068] Based on the above problems, an embodiment of the present application provides a blur processing method. The blur processing method provided in the embodiment of the present application is used for a terminal device. Specifically, it is used in an image production scenario of a terminal device, such as a scenario in which a painting application is used to adjust blur effects, or a scenario in which a camera application is used to perform image blur editing.
[0069] The terminal device may be, but is not limited to, a smart phone, a tablet computer, a laptop computer, or a personal computer (PC).
[0070] For ease of understanding, the following first introduces the structure of the terminal device. Figure 1 , Figure 1 A schematic diagram of the structure of the terminal device 100 provided in the embodiment of the present application. Figure 1 As shown, the terminal device 100 provided in the embodiment of the present application includes a processor 110, a memory 120, a display screen 130 and a communication module 140.
[0071] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.
[0072] The controller may be the nerve center and command center of the terminal device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0073] In some examples, the processor 110 is used for image processing, including downsampling of images, blurring of images, image segmentation, image stitching, etc.
[0074] The memory 120 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the terminal device 100 by running the instructions stored in the memory 120. The memory 120 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area can store data created during the use of the terminal device 100, etc. In addition, the memory 120 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0075] In some examples, the memory 120 is also used to store image data, such as an image to be blurred, an image area after downsampling processing, an image after blurring processing, etc.
[0076] In some examples, processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the instruction or data again, it can directly access the memory. This avoids repeated accesses, reduces processor 110 latency, and thus improves efficiency.
[0077] In the embodiments of the present application, the terminal device 100 implements display functions through a GPU, a display screen 130, and an application processor. The GPU is a microprocessor for image processing that connects the display screen 130 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0078] The display screen 130 is used to display images, videos, etc. The display screen 130 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLed, or a quantum dot light-emitting diode (QLED). In some embodiments, the terminal device 100 may include one or N display screens 130, where N is a positive integer greater than 1.
[0079] The communication module 140 is used to communicate with other devices. For example, the communication module 140 receives image data sent by other devices, or sends image data to other devices.
[0080] It should be understood that the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the terminal device 100. In other embodiments of the present application, the terminal device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0081] As an example, the obfuscation processing method provided in the embodiment of the present application can be pre-loaded into the memory 120 of the terminal device 100 in the form of a computer program product, and the processor 110 of the terminal device 100 implements the steps of the obfuscation processing method provided in the embodiment of the present application by executing the instructions in the memory 120.
[0082] For ease of understanding, the fuzzy processing method provided by the embodiment of the present application will be specifically described below with reference to the accompanying drawings. Figure 2 , Figure 2 A flowchart of the fuzzy processing method provided in an embodiment of the present application is shown below. Figure 2 The method shown is applied to Figure 1 The terminal equipment shown. Figure 2 As shown, the fuzzy processing method provided in the embodiment of the present application includes steps S201 to S202.
[0083] S201: Obtain a first blurriness of an image area to be blurred in a first image.
[0084] The first image refers to the image to be blurred. As an example, the first image can be an image captured by a camera, an image downloaded from a webpage, an image drawn using a painting application, an image received from another device, etc. This embodiment of the application does not specifically limit the source of the first image.
[0085] As an example, Figure 3 As shown, to facilitate user blur adjustment, the terminal device provides the user with an image display interface via a display screen. The image display interface includes an image display area and a function control area. The image display area is used to display a first image, and the function control area is used to display function controls, including blur, crop, and share function controls. After the terminal device displays the first image to the user, if the user wishes to adjust the blur of the first image, they operate the blur function control. Based on the user's operation, the terminal device enters the blur adjustment mode.
[0086] In the embodiments of the present application, the image region to be blurred refers to the region in the first image that needs to be blurred. As an example, the image region to be blurred is the entire region of the first image. In other examples, the image region to be blurred is a partial region in the first image.
[0087] When the image area to be blurred is the entire area of the first image, the image size of the image area to be blurred is the same as the image size of the first image, and blurring the image area to be blurred means blurring the entire area of the first image. When the image area to be blurred is a partial area of the first image, the image size of the image area to be blurred is smaller than the image size of the first image, and blurring the image area to be blurred means blurring the partial area of the first image. The length and width of the image size are measured in pixels. A larger image size means more pixels, and thus a higher resolution.
[0088] After entering the blur adjustment, the user can determine the area in the first image that needs to be blurred.
[0089] As an example, after entering the blur adjustment mode, the terminal device displays an image interface to the user through the display screen. The image interface includes a first image. The user operates the first image (such as long pressing or clicking) to enter the image area selection to be blurred. As an example, the image interface displayed to the user by the terminal device may also include an area selection control. The user operates the area selection control to enter the image area selection to be blurred. After entering the image area selection to be blurred, the user selects the area to be blurred in the first image. The terminal device obtains the image area to be blurred based on the user's selection operation on the first image.
[0090] As an example, to facilitate user operation, the terminal device divides the first image into regions and provides the user with region selection based on the regions obtained by the division. The user selects the image region to be blurred based on the region provided by the terminal device. Figure 4 As shown, after entering the blur adjustment, the terminal device divides the first image into regions, obtaining region 1, region 2, region 3, and region 4. The terminal device displays a region selection interface to the user. The region selection interface displays the regions divided on the first image, namely region 1, region 2, region 3, and region 4, as well as region selection controls. The region selection controls include a region 1 selection control, a region 2 selection control, a region 3 selection control, and a region 4 selection control. When the user needs to blur region 1, the region 1 selection control is operated, and the terminal device determines region 1 as the image region to be blurred. Correspondingly, when the user needs to blur region 2, the region 2 selection operation is operated, and the terminal device determines region 2 as the image region to be blurred.
[0091] Optionally, the terminal device divides the first image into regions by image segmentation, such as by threshold segmentation, region segmentation, edge detection, etc. There is no specific limitation and the method is set according to actual needs.
[0092] The above is only an example of obtaining the image area to be blurred in the first image in the embodiment of the present application and is not intended to be limiting. The specific configuration is based on actual needs. For example, the terminal device can also perform target feature recognition on the image and automatically determine the image area to be blurred in the first image.
[0093] As an example, after the terminal device obtains the image area to be blurred of the first image, it enters the initialization stage of blur adjustment, and then adjusts the blurriness of the image area to be blurred.
[0094] In the embodiment of the present application, the first blur degree refers to the blur degree that the image area to be blurred should reach after blurring. Different blur degrees correspond to different blur radii. When the blur degree is larger, the blur radius is larger, and thus the degree of blurring of the image is higher.
[0095] As an example, the first blurriness is set by the user for the image region to be blurred. For example, after obtaining the image region to be blurred in the first image, the user can set the first blurriness for the image region to be blurred according to blur adjustment requirements.
[0096] As an example, to facilitate user adjustment of the image blur, the terminal device may set the blur adjustment range to [0, 100]. Each value in the adjustment range represents a blur, with larger values representing greater blur. The user may set a first blur for the image area to be blurred based on the adjustment range. For example, if the user requires a medium blur for the image area to be blurred, the blur can be set to 50. Based on this, the terminal device may determine that the first blur for the image area to be blurred is 50. For another example, if the user requires a high blur for the image area to be blurred, the blur can be set to 90. Based on this, the terminal device may determine that the first blur for the image area to be blurred is 90. For another example, if the user requires a light blur for the image area to be blurred, the blur can be set to 10. Based on this, the terminal device may determine that the first blur for the image area to be blurred is 10.
[0097] As an example, a user can set the first blurriness of the image area to be blurred through voice input or interface input. Taking voice input as an example, after obtaining the image area to be blurred, the user inputs a voice message "blurriness 50" into the terminal device. After the terminal device receives the user's voice input, the first blurriness of the image area to be blurred is set to 50.
[0098] For example, a terminal device may display a blur setting interface to a user via a display screen. The blur setting interface includes a blur setting control, through which the user sets the blur of the image area to be blurred. After the user sets the blur of the image area to be blurred via the blur setting control, the terminal device may determine a first blur of the image area to be blurred in response to the user's blur setting for the image area to be blurred.
[0099] like Figure 5 As shown in (a) of Figure 1, the blur setting interface includes a blur input area and blur adjustment information. The blur adjustment information indicates the blur that the user can adjust. For example, if the blur adjustment range is [0, 100], the blur adjustment information can be a message such as "Please enter a value between 0 and 100." Based on the blur adjustment information, the user can enter the blur of the image area to be blurred in the blur input area according to their needs. The terminal device responds to the user's operation and obtains the blur of the image area to be blurred.
[0100] In order to facilitate the user to adjust the blurriness of the image area to be blurred, in the blurriness setting interface, the blurriness setting control can also be a slide bar, and the user can set the blurriness of the image area to be blurred through the slide bar. Figure 5 As shown in (b) of the figure, the slider includes a track and a slider. The user adjusts the blurriness of the image area to be blurred by adjusting the position of the slider within the track. Each pixel in the track corresponds to a blurriness. The terminal device monitors the position of the slider within the track to determine the target pixel corresponding to the slider and, therefore, the blurriness corresponding to the target pixel. This blurriness is the blurriness set by the user for the image area to be blurred.
[0101] The above is merely an example of obtaining the first blur level of the image region to be blurred in an embodiment of the present application and is not intended to be a specific limitation. In some examples, other implementation methods may be employed, depending on actual needs. For example, the terminal device may also provide the user with a blur mode selection, with different blur modes corresponding to different blur levels. The user selects a blur mode for the image region to be blurred based on the blur mode provided by the terminal device. The terminal device then obtains the first blur level of the image region to be blurred based on the blur mode selected by the user. For example, the terminal device may provide the user with a light blur mode, a medium blur mode, and a heavy blur mode. The light blur mode corresponds to a blur level a, the medium blur mode corresponds to a blur level b, and the heavy blur mode corresponds to a blur level c, where a < b < c. When the user selects the light blur mode, the terminal device responds to the user's selection and obtains a first blur level a for the image region to be blurred. When the user selects the medium blur mode, the terminal device responds to the user's selection and obtains b first blur level b for the image region to be blurred. When the user selects the heavy blur mode, the terminal device responds to the user's selection and obtains c first blur level c for the image region to be blurred.
[0102] S202 , performing a first blurring process on the image area to be blurred according to the first blurriness to obtain a second image.
[0103] As an example, after obtaining the first blur degree, the terminal device can blur the image area to be blurred according to the blur radius corresponding to the first blur degree. Optionally, the blur algorithm used to blur the image area to be blurred includes, but is not limited to, Gaussian blur, dynamic blur, motion blur, and flooding blur algorithms. The embodiment of the present application does not impose any restrictions on the blur algorithm used to blur the image area to be blurred and is set according to actual needs.
[0104] In an embodiment of the present application, when the image area to be blurred is the entire area of the first image, the second image is the first image after the first blurring process. When the image area to be blurred is a partial area of the first image, the second image is a spliced image of the blurred image area to be blurred and the image area that has not been blurred. For example, if the first image includes area 1, area 2, area 3, and area 4, and the image area to be blurred is area 1 of the first image, then the second image is the spliced image of area 2, area 3, area 4, and the blurred area 1.
[0105] In some examples, the second image may also only represent the image area to be blurred after the blurring process.
[0106] In order to reduce the computing overhead of the terminal device, ensure the performance of the terminal device, and retain the details of the image area to be blurred to the greatest extent, in an embodiment of the present application, the downsampling ratio used when processing the image area to be blurred can be determined based on the correspondence between multiple downsampling ratios and blurriness of the image area to be blurred determined and saved in the terminal device according to the blurriness set by the user.
[0107] Among them, the downsampling ratio refers to the ratio of the image size after downsampling of the image area to be blurred to the original image size before downsampling of the image area to be blurred, that is, downsampling ratio = image size after downsampling of the image area to be blurred / original image size before downsampling of the image area to be blurred.
[0108] In the embodiment of the present application, the number of downsampling ratios corresponding to the image region to be blurred is related to the image size of the image region to be blurred. For example, the image size of the image region to be blurred is positively correlated with the number of downsampling ratios corresponding to the image region to be blurred. As the image size of the image region to be blurred increases, the number of downsampling ratios corresponding to the image region to be blurred increases.
[0109] As an example, for the image area to be blurred, the terminal device can determine the image size of the image area to be blurred after downsampling based on the set sampling interval M, and then obtain the downsampling ratio corresponding to the image area to be blurred based on the image size of the image area to be blurred after downsampling and the original image size of the image area to be blurred without downsampling.
[0110] Taking the image size of the image region to be blurred as 4096×4096 as an example, that is, the length of the image region to be blurred is 4096 pixels, the width is 4096 pixels, the sampling interval M is set to 256, and the minimum size is 1024×1024, then the image sizes of the image region to be blurred after downsampling are 1024×1024, 1280×1280, 1536×1536, ..., 3584×3584, 3840×3840, and 4096×4096, and the corresponding downsampling ratios are 0.0625, 0.098, 0.141, ..., 0.766, 0.879, and 1, respectively. The details are shown in Table 1.
[0111] Table 1
[0112] Image size 1024×1024 1280×1280 1536×1536 … 3584×3584 3840×3840 4096×4096 Downsampling ratio 0.0625 0.098 0.141 … 0.766 0.879 1
[0113] In the embodiment of the present application, the sampling interval M is set according to actual needs and is not specifically limited. For example, to avoid excessive downsampling ratios that result in a large amount of calculation, a larger sampling interval M can be set.
[0114] In the embodiment of the present application, the minimum size refers to the minimum size that the image area to be blurred can reach after downsampling. The minimum size is set according to actual needs and is not specifically limited.
[0115] As an example, for different image sizes, corresponding downsampling ratios may be set. The larger the image size, the more ratios may be set.
[0116] In this way, for the image area to be blurred, the terminal device can first obtain the sampling spacing corresponding to the image area to be blurred based on the proportional number corresponding to the image size of the image area to be blurred, and then obtain the downsampling ratio corresponding to the image area to be blurred based on the sampling spacing.
[0117] For example, if the image size of the image area to be blurred is set to 4096×4096, the corresponding downsampling ratio is 12, and the minimum size is 1024×1024, then the sampling pitch can be obtained as 256. After obtaining the sampling pitch, the image size of the image area to be blurred after downsampling can be determined according to the sampling pitch, and then the downsampling ratio corresponding to the image area to be blurred can be obtained according to the image size of the image area to be blurred after downsampling and the original image size of the image area to be blurred before downsampling.
[0118] For another example, if the image size of the image area to be blurred is set to 2048×2048, the corresponding downsampling ratio is 6, and the minimum size is 1024×1024, then the sampling pitch can be obtained as 171. After obtaining the sampling pitch, the image size of the image area to be blurred after downsampling can be determined according to the sampling pitch, and then the downsampling ratio corresponding to the image area to be blurred can be obtained according to the image size of the image area to be blurred after downsampling and the original image size of the image area to be blurred before downsampling.
[0119] In the embodiment of the present application, as the image size of the image region to be blurred increases, the number of downsampling ratios corresponding to the image region to be blurred increases, and as the image size of the image region to be blurred decreases, the number of downsampling ratios corresponding to the image region to be blurred decreases. Thus, by setting the downsampling ratio corresponding to the image region to be blurred based on the image size of the image region to be blurred, the resulting downsampling ratio can be made to meet the blurring requirements of the image region to be blurred.
[0120] In the embodiment of the present application, after obtaining multiple downsampling ratios corresponding to the image area to be blurred, a correspondence between the multiple downsampling ratios and blurriness can be established to obtain the blurriness corresponding to each downsampling ratio.
[0121] In the embodiment of the present application, if the blurriness of the image area to be blurred is high, in order to reduce the computational overhead of the blur algorithm and ensure the performance of the terminal device, the image area to be blurred can be significantly downsampled. If the blurriness of the image area to be blurred is low, in order to reduce the computational overhead of the blur algorithm and ensure the performance of the terminal device while retaining the details of the image area to be blurred to the greatest extent, it can be considered to slightly downsample the image to be blurred.
[0122] Based on this, in the embodiment of the present application, for the same image size, when the blur value is larger, the corresponding downsampling ratio value is smaller, and when the blur value is smaller, the corresponding downsampling ratio value is larger. In other words, in the embodiment of the present application, the size of the downsampling ratio is negatively correlated with the size of the blur value.
[0123] As an example, when determining the correspondence between multiple downsampling ratios and blurriness for an image region to be blurred, the terminal device may first divide the blurriness adjustment interval according to the number of downsampling ratios corresponding to the image region to be blurred (e.g., N, where N is an integer greater than 1), thereby obtaining multiple (e.g., N) blurriness intervals. Then, based on the negative correlation between the downsampling ratio and the blurriness, the downsampling ratio corresponding to each blurriness interval is determined. In this way, the correspondence between multiple downsampling ratios and blurriness for the image region to be blurred can be determined.
[0124] For example, there are five downsampling ratios corresponding to the image area to be blurred: a1, a2, a3, a4, and a5, where a1 < a2 < a3 < a4 < a5. Assuming the blur adjustment range is [0, 100], the blur adjustment range is divided according to the number of downsampling ratios corresponding to the image area to be blurred, resulting in five blur intervals: [0, 20], [20, 40], [40, 60], [60, 80], and [80, 100]. Based on the negative correlation between downsampling ratio and blur, we can determine that the downsampling ratio for the blur interval [0, 20) is a5, the downsampling ratio for the blur interval [20, 40) is a4, the downsampling ratio for the blur interval [40, 60) is a3, the downsampling ratio for the blur interval [60, 80) is a2, and the downsampling ratio for the blur interval [80, 100] is a1. Furthermore, the ambiguity corresponding to the downsampling ratio a1 is the ambiguity in the ambiguity interval [80,100], the ambiguity corresponding to the downsampling ratio a2 is the ambiguity in the ambiguity interval [60,80), the ambiguity corresponding to the downsampling ratio a3 is the ambiguity in the ambiguity interval [40,60), the ambiguity corresponding to the downsampling ratio a4 is the ambiguity in the ambiguity interval [20,40), and the ambiguity corresponding to the downsampling ratio a5 is the ambiguity in the ambiguity interval [0,20].
[0125] As an example, when determining the correspondence between multiple downsampling ratios and blurriness for the image region to be blurred, the terminal device first divides the blurriness adjustment range according to a set blurriness threshold to obtain a first blurriness range and a second blurriness range. The first blurriness range is a low blurriness adjustment range, and the second blurriness range is a high blurriness adjustment range.
[0126] The fuzziness threshold refers to the threshold for dividing the low fuzziness adjustment interval and the high fuzziness adjustment interval. The value of the fuzziness threshold is set according to actual needs and is not specifically limited in the embodiments of the present application.
[0127] The terminal device then divides the number of downsampling ratios corresponding to the image area to be blurred according to a set ratio, obtaining a first number and a second number. The set ratio refers to the ratio of the number of downsampling ratios corresponding to the low blur adjustment interval to the number of downsampling ratios corresponding to the high blur adjustment interval. The first number refers to the number of downsampling ratios corresponding to the first blur adjustment interval, and the second number refers to the number of downsampling ratios corresponding to the second blur adjustment interval.
[0128] Since smaller downsampling ratios result in more drastic downsampling changes, and larger downsampling ratios result in greater computational overhead for the fuzzy algorithm, to mitigate the severity of downsampling changes and reduce the computational overhead for the fuzzy algorithm, the number of downsampling ratios corresponding to low fuzziness adjustment intervals can be set to be greater than the number of downsampling ratios corresponding to high fuzziness adjustment intervals, i.e., the first number is greater than the second number.
[0129] like Figure 6 As shown, in low blur adjustment scenarios (such as blur adjustment scenarios between 0 and 40), the lower the blur, the more frequent the changes in the downsampling ratio, and the greater the number of downsampling ratios. In high blur adjustment scenarios (such as blur adjustment scenarios between 40 and 100), the higher the blur, the smoother the changes in the downsampling ratio, and the smaller the number of downsampling ratios.
[0130] After obtaining the first and second quantities, the terminal device can divide the first ambiguity interval according to the first quantity to obtain one or more first sub-ambiguity intervals, and divide the second ambiguity interval according to the second quantity to obtain one or more second sub-ambiguity intervals. Based on the negative correlation between the downsampling ratio and the ambiguity, the downsampling ratio corresponding to each first sub-ambiguity interval and the downsampling ratio corresponding to each second sub-ambiguity interval can be obtained. In this way, the correspondence between multiple downsampling ratios and ambiguities for the image region to be blurred can be obtained.
[0131] For example, the adjustment range of the blurriness is [0,100], the blurriness threshold is 40, and the first blurriness range obtained based on the blurriness threshold is [0,40], and the second blurriness range is (40,100]. Assume that the number of downsampling ratios corresponding to the image area to be blurred is 6, namely b1, b2, b3, b4, b5 and b6, where b1<b2<b3<b4<b5<b6. The ratio is set to 2 / 1, then the first number corresponding to the first blurriness area is 4, and the second number corresponding to the second blurriness range is 2. The first blurriness range is divided according to the first number, and the first sub-blurriness ranges are [0,10), [10,20), [20,30), and [30,40]. The second blurriness range is divided according to the second number, and the second sub-blurriness ranges are (40,70] and (70,100).
[0132] After obtaining the ambiguity intervals [0,10), [10,20), [20,30), [30,40], (40,70], and (70,100), according to the negative correlation between the downsampling ratio and the ambiguity, it can be obtained that the downsampling ratio corresponding to the ambiguity interval [0,10) is b6, the downsampling ratio corresponding to the ambiguity interval [10,20) is b5, the downsampling ratio corresponding to the ambiguity interval [20,30) is b4, the downsampling ratio corresponding to the ambiguity interval [30,40] is b3, the downsampling ratio corresponding to the ambiguity interval (40,70] is b2, and the downsampling ratio corresponding to the ambiguity interval (70,100) is b1.
[0133] The embodiment of the present application sets the correspondence between the downsampling ratio and the blurriness so that the size of the downsampling ratio is negatively correlated with the size of the blurriness. Therefore, when the blurriness of the image area to be blurred is adjusted through the correspondence between the downsampling ratio and the blurriness, the computing overhead of the terminal device can be reduced, while ensuring the performance of the terminal device, the details of the image area to be blurred can be retained to the greatest extent. In particular, at high blurriness, the computing overhead brought by the blurring algorithm can be significantly reduced, ensuring the performance of the terminal device, and at low blurriness, the image area to be blurred can be finely adjusted, and the details of the image area to be blurred can be significantly retained.
[0134] After obtaining the correspondence between the downsampling ratio and the blurriness, when the user adjusts the image area to be blurred, the terminal device can downsample the image area to be blurred according to the downsampling ratio corresponding to the blurriness set by the user, and blur the image area to be blurred after the downsampling.
[0135] Based on this, in the embodiment of the present application, step S202, the step of performing a first blurring process on the image area to be blurred according to the first blurriness, may also include step (a) and step (b).
[0136] (a) Obtaining a first downsampling image region corresponding to a first downsampling ratio, where the first downsampling ratio is a downsampling ratio corresponding to a first blurriness.
[0137] After obtaining the first blurriness, the terminal device can obtain the downsampling ratio corresponding to the first blurriness, i.e., the first downsampling ratio, based on the correspondence between the downsampling ratio and the blurriness. It is understandable that the first downsampling ratio is one of multiple downsampling ratios corresponding to the image area to be blurred.
[0138] In the embodiment of the present application, the first down-sampled image region refers to a down-sampled image region obtained by down-sampling the image region to be blurred according to a first down-sampling ratio.
[0139] As an example, after obtaining the first blurriness, the terminal device may downsample the image area to be blurred according to a first downsampling ratio corresponding to the first blurriness to obtain a first downsampled image area.
[0140] Here, downsampling the image area to be blurred according to the downsampling ratio refers to reducing the image area to be blurred according to the downsampling ratio. The specific process refers to conventional technology and will not be described in detail here.
[0141] (b) Blurring the first downsampled image region according to the first blurriness.
[0142] After obtaining the first downsampled image region, the terminal device may blur the first downsampled image region according to the blur radius corresponding to the first blur degree. Optionally, the blurring algorithm used to blur the first downsampled image region includes, but is not limited to, Gaussian blur, dynamic blur, motion blur, and blooming. This embodiment of the present application does not impose any restrictions on the blurring algorithm used to blur the first downsampled image region, and the blurring algorithm may be selected based on actual needs.
[0143] In the embodiment of the present application, after blurring the first down-sampled image region according to the first blurriness, a blurred first down-sampled image region can be obtained.
[0144] Since the first downsampled image area is obtained by downsampling the image area to be blurred according to the first downsampling ratio, in order to better display the blurring effect, after obtaining the blurred first downsampled image area, the terminal device can also upsample the blurred first downsampled image interval according to the first downsampling ratio to obtain a first blurred image area with the same image size as the image area to be blurred.
[0145] As an example, when the image area to be blurred is a portion of the first image, after obtaining the first blurred image area, the terminal device may further splice the target blurred area with other unblurred image areas to obtain the second image. When the image area to be blurred is the entire first image, the obtained first blurred image area is the second image.
[0146] By setting different downsampling ratios at different blur levels, the embodiment of the present application can use a downsampling ratio that matches the blur level when performing blur adjustment. Therefore, when blurring the downsampled image area corresponding to the downsampling ratio is performed, the computing overhead of the terminal device can be reduced, the performance of the terminal device can be ensured, and the details of the image area to be blurred can be retained to the greatest extent, thereby achieving the goal of balancing performance and effect.
[0147] As an example, after obtaining the second image, the terminal device displays the second image to the user via a display screen. The user can then use the displayed second image to determine whether blur adjustment is still required. If the blur effect of the second image does not achieve the desired effect, the user can continue to adjust the blur of the image area to be blurred.
[0148] Based on this, please refer to Figure 7 The fuzzy processing method provided in the embodiment of the present application may further include steps S301 to S304.
[0149] S301: Obtain a first blurriness of an image area to be blurred in a first image.
[0150] S302: Perform a first blurring process on the image area to be blurred according to the first blurriness to obtain a second image.
[0151] The processes of step S301 and step S302 may refer to the processes of step S201 to step S202 and are not described in detail here.
[0152] S303: Acquire a second blurriness of the image area to be blurred, where the first blurriness is different from the second blurriness.
[0153] The process of obtaining the second blurriness of the image area to be blurred may refer to the above-mentioned step S201 and will not be described in detail here.
[0154] S304, performing a second blurring process on the image area to be blurred according to the second blurriness to obtain a third image, wherein the first blurring process and the second blurring process use different downsampled image areas, and the different downsampled image areas are obtained by downsampling the image area to be blurred at different downsampling ratios corresponding to the first blurriness and the second blurriness.
[0155] The downsampling ratio corresponding to the first blurriness is one of the multiple downsampling ratios corresponding to the image area to be blurred, and correspondingly, the downsampling ratio corresponding to the second blurriness is also one of the multiple downsampling ratios corresponding to the image area to be blurred.
[0156] For this explanation, let's take the example of a first downsampling ratio corresponding to a first blurriness as the first downsampling ratio, and a second downsampling ratio corresponding to a second blurriness as the second downsampling ratio. When the first blurriness and the second blurriness differ, the first downsampling ratio and the second downsampling ratio differ. When the first downsampling ratio and the second downsampling ratio differ, the downsampled image area corresponding to the first downsampling ratio and the downsampled image area corresponding to the second downsampling ratio also differ. Therefore, the first and second blurring processes utilize different downsampled image areas.
[0157] For example, the downsampled image region corresponding to the first downsampling ratio is referred to as the first downsampled image region, and the downsampled image region corresponding to the second downsampling ratio is referred to as the second downsampled image region. During the first blurring process, the first downsampled image region corresponding to the first downsampling ratio is obtained based on the first blurriness, and then the first downsampled image region is blurred based on the first blurriness. Accordingly, during the second blurring process, the second downsampled image region corresponding to the second downsampling ratio is obtained based on the second blurriness, and then the second downsampled image region is blurred based on the second blurriness. The specific process can be referred to the description of steps (a) and (b) above and will not be repeated here.
[0158] Accordingly, after blurring the second downsampled image region according to the second blur degree, a blurred second downsampled image region can be obtained. After obtaining the blurred second downsampled image region, the blurred second downsampled image region can also be upsampled according to the second downsampling ratio to obtain a second blurred image region having the same image size as the image region to be blurred.
[0159] As an example, when the image area to be blurred is a portion of the first image, after obtaining the second blurred image area, the target blurred area can be spliced with other unblurred image areas to obtain a third image. When the image area to be blurred is the entire first image, the obtained second blurred image area is the third image.
[0160] After obtaining the third image, the terminal device displays the third image to the user via a display screen. The user can then use the third image to determine whether further blur adjustment is required. If the blurring effect of the third image still does not achieve the desired effect, the user can continue to adjust the blurriness of the image area to be blurred. Accordingly, the terminal device can continue to respond to the user's blurriness adjustment of the image area to be blurred, obtain a third blurriness, and perform a third blurring process on the image area to be blurred based on the third blurriness. This process continues, and so on, until the user completes adjusting the blurriness of the image area to be blurred.
[0161] As an example, Figure 8As shown, the terminal device displays a blurred image display interface to the user through the display screen. The blurred image display interface includes the blurred image (such as the second image and the third image), an end control, and a continue control. When the user needs to end the blur adjustment of the image area to be blurred, the end control is operated, and the terminal device responds to the user's operation and exits the blur adjustment of the image area to be blurred. When the user needs to continue to adjust the blur of the image area to be blurred, the continue control is operated, and the terminal device responds to the user's operation and continues to adjust the blur of the image area to be blurred, such as jumping to the blur setting interface so that the user can continue to input the blur.
[0162] The embodiment of the present application adaptively adjusts the downsampling ratio through the image size and the blur to be adjusted, and can be applied to blur effect adjustment scenarios of blur algorithms such as Gaussian blur, dynamic blur, motion blur, and bloom, to achieve the effect of fine adjustment of low blur and efficient adjustment of high blur.
[0163] As an example, to facilitate the rapid acquisition of downsampled image areas corresponding to downsampling ratios, after obtaining multiple downsampling ratios corresponding to the image area to be blurred, the terminal device can downsample the image area to be blurred according to the multiple downsampling ratios corresponding to the image area to be blurred, obtain downsampled image areas corresponding to the multiple downsampling ratios, and store the downsampled image areas corresponding to the multiple downsampling ratios. For example, after a user selects an image area to be blurred, during the initialization phase of blur adjustment, the terminal device can create multiple downsampled image areas corresponding to the multiple downsampling ratios based on the multiple downsampling ratios corresponding to the image area to be blurred, and store the downsampled image areas corresponding to the multiple downsampling ratios.
[0164] For illustration, the first blurriness is used as the blurriness currently set by the user. After obtaining the first blurriness of the image region to be blurred, a first downsampled image region can be obtained from the downsampled image regions corresponding to the multiple downsampling ratios of the image region to be blurred, based on the first downsampling ratio corresponding to the first blurriness. For example, the terminal device can determine, from the downsampled image regions corresponding to the multiple downsampling ratios of the image region to be blurred, a downsampled image region that matches the first downsampling ratio, i.e., the first downsampled image region.
[0165] Among them, the image area to be blurred is downsampled according to multiple downsampling ratios corresponding to the image area to be blurred, which means that for each downsampling ratio corresponding to the image area to be blurred, the image area to be blurred will be downsampled according to the downsampling ratio.
[0166] Considering that pre-creating and storing downsampled image areas for multiple downsampling ratios corresponding to the image area to be blurred will result in additional memory overhead, in order to reduce memory, in an embodiment of the present application, the terminal device can also predict the blurriness that the user will subsequently adjust, obtain the predicted blurriness, and create the downsampled image area based on the downsampling ratio corresponding to the predicted blurriness. In this way, there is no need to pre-create downsampled image areas for all downsampling ratios corresponding to the image area to be blurred, thereby reducing the memory usage of the downsampled image areas. Based on this, in an embodiment of the present application, when obtaining a downsampled image area, it can also be obtained from the downsampled image area created based on the downsampling ratio corresponding to the predicted blurriness.
[0167] This description uses the example of obtaining a first downsampled image region corresponding to a first downsampling ratio, using a first blurriness as the blurriness currently set by the user. When obtaining the first downsampled image region corresponding to the first downsampling ratio, the terminal device can, based on the first downsampling ratio, obtain the first downsampled image region from a downsampled image region corresponding to a target downsampling ratio. The target downsampling ratio is the downsampling ratio corresponding to a pre-predicted blurriness. The target downsampling ratio is one or more of multiple downsampling ratios corresponding to the image region to be blurred.
[0168] As an example, the terminal device may predict the blurriness that the user may set next based on the blurriness currently set by the user and the blur adjustment rate of the image area to be blurred by the user.
[0169] For example, the first blurriness is the blurriness currently set by the user, and the first blur adjustment rate is the blur adjustment rate currently set by the user for the image area to be blurred. The terminal device obtains the first blur adjustment rate of the user for the image area to be blurred and, based on the first blur adjustment rate and the first blurriness, obtains a predicted blurriness. The predicted blurriness is the blurriness that the user is likely to set in the future.
[0170] An example is given in which a user sets the blurriness of an image area to be blurred using a slider.
[0171] When the user adjusts the blurriness of the image area to be blurred through the slider in the sliding bar, the terminal device detects the user's sliding operation based on the slider to obtain the pixel points that the slider slides over within the unit time length, and obtains the user's first blur adjustment rate for the image area to be blurred based on the blurriness corresponding to each pixel point and the pixel points that the slider slides over within the unit time length.
[0172] For example, the unit time is T, and the slider slides from pixel point a to pixel point b within the unit time, where the blurriness corresponding to pixel point a is A, and the blurriness corresponding to pixel point b is B, then the first blur adjustment rate is (BA) / T.
[0173] The first blurriness is the blurriness currently set by the user. For example, if the currently detected position of the slider corresponds to pixel b, the blurriness corresponding to pixel b is the first blurriness.
[0174] After obtaining the first fuzzy adjustment rate and the first fuzziness, the terminal device can predict the predicted fuzziness based on the first fuzzy adjustment rate and the first fuzziness. For example, taking the predicted fuzziness as the fuzziness set 1 ms in the future as an example, the first fuzzy adjustment rate is set to L, the first fuzziness is set to B, and the predicted fuzziness is L*1ms+B.
[0175] As an example, multiple predicted ambiguities can be obtained, that is, there can be multiple predicted ambiguities. The number of predicted ambiguities is determined based on the set future time. For example, if the ambiguities corresponding to the future time 1ms and 2ms need to be predicted, there are two predicted ambiguities: the ambiguity corresponding to the future time 1ms and the ambiguity corresponding to the future time 2ms. The future time is set based on actual needs and is not specifically limited in this embodiment.
[0176] After obtaining the predicted ambiguity, the terminal device can obtain the downsampling ratio corresponding to the predicted ambiguity based on the corresponding relationship between the downsampling ratio and the ambiguity.
[0177] For ease of description, the following description uses the downsampling ratio corresponding to the predicted ambiguity as the target downsampling ratio.
[0178] After obtaining the target downsampling ratio corresponding to the predicted blur, the terminal device can downsample the image area to be blurred according to the target downsampling ratio to obtain a downsampled image area corresponding to the target downsampling ratio.
[0179] After obtaining the downsampled image area corresponding to the target downsampling ratio, the terminal device may store the downsampled image area corresponding to the target downsampling ratio. Subsequently, after obtaining the blurriness set by the user for the image area to be blurred, the terminal device may obtain the downsampling ratio corresponding to the obtained blurriness based on the correspondence between the downsampling ratio and the blurriness. Then, when the downsampling ratio corresponding to the obtained blurriness is included in the target downsampling ratio, the terminal device may determine, from the downsampled image area corresponding to the target downsampling ratio, a downsampled image area that matches the downsampling ratio corresponding to the obtained blurriness, and then blur the matched downsampled image area based on the obtained blurriness.
[0180] It is understandable that after obtaining the blur degree, the terminal device can predict the next blur degree based on the blur degree and the detected blur adjustment rate of the user on the image area to be blurred. This process is repeated until the user completes blur adjustment on the image area to be blurred.
[0181] As an example, if the target downsampling ratio does not include the downsampling ratio corresponding to the blurriness obtained by the terminal device, the terminal device can directly downsample the blurred image area according to the downsampling ratio corresponding to the obtained blurriness to obtain the required downsampled image area.
[0182] As an example, to balance efficiency and memory usage, when the first condition is met, the terminal device may downsample the image area to be blurred according to multiple downsampling ratios corresponding to the image area to be blurred, obtain downsampled image areas corresponding to the multiple downsampling ratios, and store the downsampled image areas corresponding to the multiple downsampling ratios. When the first condition is not met, the terminal device may downsample the image area to be blurred according to the target downsampling ratio to obtain a downsampled image area corresponding to the target downsampling ratio.
[0183] The first condition includes one or more of the following: the image size of the image area to be blurred is smaller than a set size threshold, and the available memory is larger than a set memory threshold.
[0184] Among them, the size threshold and memory threshold are set according to actual needs and are not specifically limited in the embodiments of the present application.
[0185] When the image size of the image area to be blurred is less than or equal to the set size threshold, it means that the number of downsampling ratios that can be obtained is small, and thus the number of downsampling image areas obtained based on the downsampling ratios is also small, and the memory space occupied is also low. Therefore, the terminal device can downsample the image area to be blurred according to the multiple downsampling ratios corresponding to the image area to be blurred, obtain downsampled image areas corresponding to the multiple downsampling ratios, and store the downsampled image areas corresponding to the multiple downsampling ratios.
[0186] When the image size of the image area to be blurred is larger than the set size threshold, it means that a large number of downsampling ratios can be obtained, and thus a large number of downsampled image areas can be obtained based on the downsampling ratios, which also requires more memory space. When the available memory is larger than the set memory threshold, it means that there is more available memory space and more downsampled image areas can be stored.
[0187] Therefore, when the available memory is greater than the set memory threshold, the terminal device can downsample the image area to be blurred according to the multiple downsampling ratios corresponding to the image area to be blurred, obtain downsampled image areas corresponding to the multiple downsampling ratios, and store the downsampled image areas corresponding to the multiple downsampling ratios.
[0188] When the first condition is not met, that is, the image size of the image area to be blurred is greater than the set size threshold and the available memory is less than or equal to the set memory threshold, in order to reduce memory usage, the terminal device can adopt a method of dynamically creating a downsampled image area, that is, according to the target downsampling ratio, the image area to be blurred is downsampled to obtain a downsampled image area corresponding to the target downsampling ratio.
[0189] By detecting the image size and available memory size, the present embodiment can pre-create downsampled image regions corresponding to all downsampling ratios when the image size is small and memory space is sufficient, thereby improving the efficiency of subsequent acquisition of downsampled image regions. Furthermore, when the image size is large and memory space is limited, downsampled image regions can be dynamically created to reduce memory usage.
[0190] In order to further reduce memory usage, in an embodiment of the present application, the terminal device may also delete the created downsampled image area based on the user's blur adjustment rate.
[0191] For example, the first blurriness is the blurriness currently set by the user, and the first blur adjustment rate is the blur adjustment rate currently set by the user for the image region to be blurred. Based on the first blurriness and the first blur adjustment rate, the terminal device predicts the blurriness that the user may set in the future, i.e., the predicted blurriness. The terminal device can then downsample the image region to be blurred according to the downsampling ratio corresponding to the predicted blurriness. Furthermore, the terminal device can determine the downsampling ratio to be processed based on the downsampling ratio corresponding to the first blurriness and the downsampling ratio corresponding to the predicted blurriness, and delete the downsampled image region corresponding to the downsampling ratio to be processed.
[0192] The downsampled image region corresponding to the downsampling ratio to be processed is obtained by downsampling the image region to be blurred according to the downsampling ratio to be processed.
[0193] The to-be-processed downsampling ratio is used to represent a downsampling ratio that will not be used among multiple downsampling ratios corresponding to the image to be blurred.
[0194] As an example, the terminal device can obtain the trend change of the downsampling ratio based on the downsampling ratio corresponding to the first ambiguity and the downsampling ratio corresponding to the predicted ambiguity, such as the value of the downsampling ratio shows a decreasing trend or an increasing trend, and then obtain the downsampling ratio to be processed based on the trend change of the downsampling ratio.
[0195] For example, multiple downsampling ratios corresponding to the image area to be blurred are set to include downsampling ratio a1, downsampling ratio a2, downsampling ratio a3, downsampling ratio a4, downsampling ratio a5, and downsampling ratio a6, wherein downsampling ratio a1 < downsampling ratio a2 < downsampling ratio a3 < downsampling ratio a4 < downsampling ratio a5 < downsampling ratio a6. The downsampling ratio corresponding to the first blurriness is set to be downsampling ratio a3, and the downsampling ratios corresponding to the predicted blurriness include downsampling ratios a4 and a5. It can be found that the trend change of the downsampling ratio shows an increasing trend. When the trend change of the downsampling ratio shows an increasing trend, the terminal device can determine that the downsampling ratio smaller than the downsampling ratio corresponding to the first blurriness is the downsampling ratio to be processed, that is, the downsampling ratio to be processed is downsampling ratio a1 and downsampling ratio a2.
[0196] In order to improve accuracy, the terminal device can also refer to the user's blur adjustment rate for the blurred image, and obtain the downsampling ratio to be processed based on the blur adjustment rate and trend changes. Take the first blur as the blur currently set by the user, and the first blur adjustment rate as the user's current blur adjustment rate for the blurred image area as an example for explanation. When the first blur adjustment rate is greater than the set rate threshold, it means that the user's blur adjustment rate for the blurred image area is faster, and the user is adjusting the blur quickly. When the first blur adjustment rate is not greater than the set rate threshold, it means that the user's blur adjustment rate for the blurred image area is slower, and the user is slowly adjusting the blur.
[0197] When a user adjusts the blurriness quickly, they typically do not adjust the blurriness repeatedly. Therefore, when the first blurriness adjustment rate is greater than a set rate threshold and the trend is increasing, the terminal device may determine a downsampling ratio that is less than the downsampling ratio corresponding to the first blurriness as the downsampling ratio to be processed. When the first blurriness adjustment rate is not greater than the set rate threshold and the trend is decreasing, the terminal device may determine a downsampling ratio that is greater than the downsampling ratio corresponding to the first blurriness as the downsampling ratio to be processed.
[0198] When a user slowly adjusts the blur, they typically adjust the blur repeatedly. For example, when slowly adjusting the blur, they may adjust from blur A to blur B, then from blur B to blur C, and then from blur C back to blur B. When the blur changes repeatedly, the downsampling ratio is also repeatedly used. For example, when the blur changes from blur A to blur B, and then from blur C to blur B, the downsampling ratio corresponding to blur B is repeatedly used.
[0199] In a scenario where the fuzziness is repeatedly adjusted, the downsampling ratios adjacent to the downsampling ratio corresponding to the current fuzziness may be used repeatedly. Therefore, when the first fuzzy adjustment rate is less than the set rate threshold, the terminal device can first determine at least one adjacent downsampling ratio adjacent to the downsampling ratio corresponding to the first fuzziness based on the trend change, and then obtain the downsampling ratio to be processed based on the trend change and the adjacent downsampling ratio. Exemplarily, when the trend change is increasing, the terminal device determines the downsampling ratio that is less than the adjacent downsampling ratio as the downsampling ratio to be processed; when the trend change is decreasing, the terminal device determines the downsampling ratio that is greater than the adjacent downsampling ratio as the downsampling ratio to be processed.
[0200] The number of adjacent downsampling ratios is set according to actual needs and is not specifically limited.
[0201] Optionally, when the trend change is increasing, the adjacent downsampling ratio is a downsampling ratio that is smaller than the downsampling ratio corresponding to the first ambiguity and is adjacent to the downsampling ratio corresponding to the first ambiguity. When the trend change is decreasing, the adjacent downsampling ratio is a downsampling ratio that is larger than the downsampling ratio corresponding to the first ambiguity and is adjacent to the downsampling ratio corresponding to the first ambiguity.
[0202] For example, determining two adjacent downsampling ratios is used as an example. Multiple downsampling ratios corresponding to the image region to be blurred are set, including downsampling ratio a1, downsampling ratio a2, downsampling ratio a3, downsampling ratio a4, downsampling ratio a5, and downsampling ratio a6, where downsampling ratio a1 < downsampling ratio a2 < downsampling ratio a3 < downsampling ratio a4 < downsampling ratio a5 < downsampling ratio a6. The downsampling ratio corresponding to the first blur level is set as downsampling ratio a4. When the downsampling ratios show an increasing trend, downsampling ratios a2 and a3 are considered adjacent downsampling ratios. When the downsampling ratios show a decreasing trend, downsampling ratios a5 and a6 are considered adjacent downsampling ratios. If only one adjacent downsampling ratio is determined, and when the downsampling ratios show an increasing trend, downsampling ratio a3 is considered the adjacent downsampling ratio. When the downsampling ratios show a decreasing trend, downsampling ratio a5 is considered the adjacent downsampling ratio.
[0203] Wherein, when there are multiple adjacent downsampling ratios, determining a downsampling ratio smaller than the adjacent downsampling ratio as the downsampling ratio to be processed means determining a downsampling ratio smaller than the minimum adjacent downsampling ratio as the downsampling ratio to be processed. Determining a downsampling ratio greater than the adjacent downsampling ratio as the downsampling ratio to be processed means determining a downsampling ratio greater than the maximum adjacent downsampling ratio as the downsampling ratio to be processed.
[0204] For example, multiple downsampling ratios corresponding to the image area to be blurred are set to include downsampling ratio a1, downsampling ratio a2, downsampling ratio a3, downsampling ratio a4, downsampling ratio a5, downsampling ratio a6, and downsampling ratio a7, where downsampling ratio a1 < downsampling ratio a2 < downsampling ratio a3 < downsampling ratio a4 < downsampling ratio a5 < downsampling ratio a6 < downsampling ratio a7. The downsampling ratio corresponding to the first blurriness is set as downsampling ratio a4. When the downsampling ratio trend shows an increasing trend, downsampling ratios a2 and a3 are adjacent downsampling ratios, and downsampling ratio a1 is the downsampling ratio to be processed. When the downsampling ratio trend shows a decreasing trend, downsampling ratios a5 and a6 are adjacent downsampling ratios, and downsampling ratio a7 is the downsampling ratio to be processed.
[0205] To reduce memory usage, after obtaining the downsampling ratio to be processed, the terminal device deletes the downsampled image area corresponding to the downsampling ratio to be processed. If there is no downsampled image area corresponding to the downsampling ratio to be processed, no processing is performed.
[0206] The embodiment of the present application dynamically creates the required downsampled image area and deletes the unnecessary downsampled image area based on the user's blur adjustment rate, which can effectively reduce memory usage.
[0207] Based on the same inventive concept, the embodiment of the present application provides a fuzzy processing device 400. The fuzzy processing device 400 provided in the embodiment of the present application is applied to Figure 1 The terminal equipment shown. Figure 9 As shown, the blur processing device 400 provided in the embodiment of the present application includes a blur degree acquisition module 401 and a blur processing module 402. The blur degree acquisition module 401 is used to acquire a first blur degree of the image region to be blurred of the first image; the blur processing module 402 is used to perform a first blur processing on the image region to be blurred based on the first blur degree to obtain a second image; the blur degree acquisition module 401 is used to acquire a second blur degree of the image region to be blurred; the first blur degree and the second blur degree are different; the blur processing module 402 is used to perform a second blur processing on the image region to be blurred based on the second blur degree to obtain a third image; the first blur processing and the second blur processing use different downsampled image regions, and the different downsampled image regions are obtained by downsampling the image region to be blurred at different downsampling ratios corresponding to the first blur degree and the second blur degree.
[0208] For the convenience and brevity of description, the specific working process of the fuzzy processing device 400 described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0209] Based on the above, the embodiment of the present application provides a fuzzy processing device 500. The fuzzy processing device 500 provided in the embodiment of the present application is applied to Figure 1 The terminal equipment shown. Figure 10 As shown, the blur processing device 500 provided in this embodiment of the present application includes a blur parameter management module 501 and a blur texture management module 502. The blur parameter management module 501 is configured to obtain, based on the image size of the image region to be blurred, a downsampling ratio corresponding to the image region to be blurred and a blur degree corresponding to each downsampling ratio. The blur texture management module 502 is configured to create and / or delete downsampled image regions.
[0210] For example, Figure 11As shown, after the user enters the blur adjustment, the user operates the slider to adjust the blur of the image area to be blurred. The blur parameter management module 501 is used to predict the blur that the user will set next, i.e., the predicted blur, based on the user's blur adjustment rate and the currently set blur, and determine the target downsampling ratio corresponding to the predicted blur and the current downsampling ratio corresponding to the currently set blur. The blur texture management module 502 is used to downsample the image area to be blurred according to the target downsampling ratio, create a downsampled image area corresponding to the target downsampling ratio, delete redundant downsampled image areas according to the target downsampling ratio and the current downsampling ratio, and blur the downsampled image area corresponding to the current downsampling ratio.
[0211] The fuzzy texture management module 502 can downsample the image area to be blurred and blur the downsampled image area by calling the GPU. The GPU has a fuzzy algorithm deployed, and the downsampled image area is the input of the fuzzy algorithm. The GPU blurs the downsampled image area using the fuzzy algorithm.
[0212] For the convenience and brevity of description, the specific working process of the fuzzy processing device 500 described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0213] In addition, an embodiment of the present application further provides an electronic device, comprising: a memory for storing computer program instructions; a processor for executing the computer program instructions to support the electronic device in implementing the method in the above embodiment. For example, the electronic device is Figure 1 The terminal device in.
[0214] An embodiment of the present application further provides a computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are executed by a processing circuit, the functions or steps in the above-mentioned fuzzy processing method are implemented.
[0215] In addition, an embodiment of the present application may also provide a computer program product containing instructions, which, when the computer program product is run on a computer, enables the computer to execute the functions or steps in the above-mentioned fuzzy processing method.
[0216] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and conciseness of description, the specific working processes of the chip system, computer-readable storage medium, computer program product containing instructions, and electronic device described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0217] It is understandable that the steps of the method or algorithm described in conjunction with the embodiments of the present application can be implemented in a hardware manner, or can be implemented by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in a random access memory, a flash memory, an erasable programmable read-only memory, an electrically erasable programmable read-only memory, a register, a hard disk, a mobile hard disk, a read-only optical disc, or any other form of storage medium. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and can write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). In addition, the ASIC can be located in an electronic device. Of course, the processor and the storage medium can also be present in an electronic device as discrete components.
[0218] In an optional manner, when software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is implemented in whole or in part. 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 computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disk (DVD)), or a semiconductor medium (e.g., a solid state disk (SSD)).
[0219] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present invention should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.
Claims
1. A fuzzy processing method, characterized in that: The method comprises: Obtaining a first blurriness of the image area to be blurred of the first image; performing a first blurring process on the image region to be blurred according to the first blurriness to obtain a second image; Acquiring a second blurriness of the image area to be blurred, where the first blurriness is different from the second blurriness; performing a second blurring process on the image region to be blurred according to the second blurriness to obtain a third image; The first blurring process and the second blurring process use different downsampled image areas, and the different downsampled image areas are obtained by downsampling the image area to be blurred at different downsampling ratios corresponding to the first blurriness and the second blurriness.
2. The fuzzy processing method according to claim 1, characterized in that: The image area to be blurred corresponds to a plurality of downsampling ratios, and different downsampling ratios correspond to different blurring degrees; The downsampling ratio corresponding to the first blurriness is one of multiple downsampling ratios corresponding to the image area to be blurred, and the downsampling ratio corresponding to the second blurriness is one of multiple downsampling ratios corresponding to the image area to be blurred.
3. The fuzzy processing method according to claim 2, characterized in that: The downsampling ratio of the image region to be blurred is obtained according to the image size of the image region to be blurred.
4. The fuzzy processing method according to claim 3, characterized in that: The image size of the image region to be blurred is positively correlated with the number of downsampling ratios corresponding to the image region to be blurred.
5. The fuzzy processing method according to any one of claims 2 to 4, characterized in that: The downsampling ratio is negatively correlated with the blurriness.
6. The fuzzy processing method according to any one of claims 1 to 5, characterized in that: The obtaining of a first blurriness of the image area to be blurred of the first image includes: The first blur degree is obtained in response to a first blur setting of the image area to be blurred by a user.
7. The fuzzy processing method according to any one of claims 1 to 6, characterized in that: The step of performing a first blurring process on the image area to be blurred according to the first blurriness includes: Acquire a first down-sampling image area corresponding to a first down-sampling ratio, where the first down-sampling ratio is a down-sampling ratio corresponding to the first blurriness; Blurring is performed on the first downsampled image region according to the first blurriness.
8. The fuzzy processing method according to claim 7, characterized in that: The obtaining of the first down-sampling image area corresponding to the first down-sampling ratio includes: obtaining, according to the first downsampling ratio, the first downsampling image region from downsampling image regions corresponding to multiple downsampling ratios of the image region to be blurred, wherein the first downsampling image region is one of the downsampling image regions corresponding to the multiple downsampling ratios; or According to the first downsampling ratio, the first downsampling image area is obtained from a downsampling image area corresponding to a target downsampling ratio, where the target downsampling ratio is a downsampling ratio corresponding to the predicted blurriness.
9. The fuzzy processing method according to claim 8, characterized in that: Before performing a first blurring process on the image region to be blurred according to the first blurriness to obtain a second image, the method further includes: When the first condition is met, downsampling the image region to be blurred according to the multiple downsampling ratios corresponding to the image region to be blurred, to obtain downsampled image regions corresponding to the multiple downsampling ratios; When the first condition is not met, downsampling the image area to be blurred according to the target downsampling ratio to obtain a downsampled image area corresponding to the target downsampling ratio; The first condition includes one or more of the following: the image size of the image area to be blurred is smaller than a set size threshold, and the available memory is larger than a set memory threshold.
10. The fuzzy processing method according to claim 8 or 9, characterized in that: The method further comprises: Acquiring a first blur adjustment rate of the image area to be blurred by the user; A predicted fuzziness is obtained according to the first fuzziness adjustment rate and the first fuzziness.
11. The fuzzy processing method according to claim 10, characterized in that: The method further comprises: Obtaining a downsampling ratio to be processed according to the downsampling ratio corresponding to the first ambiguity and the downsampling ratio corresponding to the predicted ambiguity; The downsampled image region corresponding to the downsampling ratio to be processed is deleted, where the downsampled image region corresponding to the downsampling ratio to be processed is obtained by downsampling the image region to be blurred according to the downsampling ratio to be processed.
12. An electronic device, characterized in that: include: a memory for storing computer program instructions; A processor is configured to execute the computer program instructions to support the electronic device in implementing the method according to any one of claims 1 to 11.
13. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer program instructions, which implement the method according to any one of claims 1 to 11 when executed by a processing circuit.
14. A chip system, characterized in that: The chip system includes a processing circuit and a storage medium, wherein the storage medium stores computer program instructions; when the computer program instructions are executed by the processing circuit, the method according to any one of claims 1 to 11 is implemented.
15. An operating system, characterized in that: When the operating system is run on a computer, the computer is enabled to execute the method according to any one of claims 1 to 11.
16. A computer program product comprising instructions, characterized in that When the computer program product is run on a computer, the computer is caused to perform the method according to any one of claims 1 to 11.
Citation Information
Cited By
Image blurring method and device based on double blurring, terminal and medium
CN121437328A