Image processing method, electronic device, storage medium and chip system

By dividing the image into image blocks and selecting a neural network model for processing based on position and frequency information, differentiated deblurring of image areas is achieved, improving the clarity of the image and solving the problem of insufficient image deblurring in the existing technology. Good question.

CN118096592BActive Publication Date: 2024-10-01HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410487039.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-23
Publication Date
2024-10-01
Estimated Expiration
2044-04-23

AI Technical Summary

Technical Problem

Existing image deblurring algorithms based on deconvolution are not effective in improving image clarity, and are difficult to effectively handle differences in different regions in the image, resulting in unsatisfactory image deblurring effects.

Method used

By dividing the initial image into multiple image blocks, determining the sharpness adjustment parameters based on the position information and spatial frequency information of each image block, selecting the corresponding neural network model for processing, achieving differentiated deblurring processing, and finally clearing the image. Blocks are stitched together into a clear image.

Benefits of technology

The intelligence and accuracy of image deblurring processing are improved, the clarity of the image is significantly improved, and the problem of poor image deblurring effect in the existing technology is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118096592B_ABST
    Figure CN118096592B_ABST
Patent Text Reader

Abstract

The present application discloses an image processing method, an electronic device, a storage medium and a chip system. The method may include: dividing an initial image into N initial image blocks; for any of the initial image blocks, combining the image position information and spatial frequency information of the initial image block in the initial image, determining the clarity adjustment parameter of the initial image block. After obtaining the clarity adjustment parameter of each of the N initial image blocks, a neural network model with different clarity adjustment levels is selected for processing according to the clarity adjustment parameters of different initial image blocks to obtain N clear image blocks; the N clear image blocks are spliced ​​together to obtain a clear image corresponding to the initial image. By adopting the present application, differential deblurring processing can be performed on different image areas in the image, which is beneficial to improving the clarity of the image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing, and in particular to an image processing method, electronic equipment, storage medium and chip system. Background Art

[0002] Image deblurring is a very important processing technology in the field of image processing. Through image deblurring, blurred images can be made clear, thereby improving the visual effect of the image. At present, the image deblurring algorithm based on deconvolution is a commonly used solution. In this scheme, the image blurring process is approximately constructed as a convolution model, and then the inverse process of the convolution model, i.e. deconvolution, is used to restore the blurred image to a clear image. However, the image clarity obtained by using this image deblurring scheme is not good. Therefore, how to deblur the image to improve the clarity of the image is a technical problem worthy of study. Summary of the invention

[0003] The embodiments of the present application provide an image processing method, an electronic device, a storage medium, and a chip system, which can perform differentiated deblurring processing on different image areas in an image, thereby helping to improve the clarity of the image.

[0004] In a first aspect, the present application provides an image processing method, the method comprising: dividing an initial image into N initial image blocks, where N is a positive integer greater than 1; determining a clarity adjustment parameter of each initial image block according to image position information of each of the N initial image blocks and spatial frequency information of each initial image block; determining N clear image blocks according to the clarity adjustment parameter of each initial image block and M neural network models; the clarity adjustment level of each neural network model in the M neural network models is different; M is a positive integer greater than 1; and splicing the N clear image blocks to obtain a clear image corresponding to the initial image.

[0005] In the above embodiment, the electronic device can divide the initial image into multiple initial image blocks, and determine the clarity adjustment parameters of the initial image blocks in combination with the image position information and spatial frequency information of the initial image blocks, and then can select neural network models with different clarity adjustment levels for processing according to the clarity adjustment parameters of different initial image blocks to obtain multiple clear image blocks, and finally splice the clear image blocks together to obtain a clear image corresponding to the initial image. In this way, differentiated deblurring processing can be performed on different image areas in the initial image, which is conducive to improving the intelligence and accuracy of image deblurring processing, and thus improving the effect of image deblurring.

[0006] In combination with the first aspect, in one possible manner, the clarity adjustment parameter of an initial image block among the N initial image blocks is positively correlated with the image position information of the initial image block, and negatively correlated with the spatial frequency information of the initial image block. That is, the closer the position of an initial image block in the initial image is to the edge, the larger the clarity adjustment parameter of the initial image block. The larger the spatial frequency of an initial image block, the smaller the clarity adjustment parameter of the initial image block.

[0007] In combination with the first aspect, in one possible manner, the above-mentioned determination of N clear image blocks based on the clarity adjustment parameters of each initial image block and M neural network models includes: determining the initial image blocks input to each of the M neural network models from the N initial image blocks based on the clarity adjustment parameters of each initial image block; calling each of the M neural network models to process the input initial image blocks to obtain image blocks output by each of the M neural network models; and determining N clear image blocks based on the image blocks output by each of the M neural network models. It can be seen that, based on the clarity adjustment parameters of the initial image blocks, inputting the initial image blocks into the neural network model of the corresponding clarity adjustment level for processing is conducive to improving the intelligence of image processing.

[0008] In combination with the first aspect, in one possible manner, the N initial image blocks include a first initial image block and a second initial image block, and in response to a clarity adjustment parameter of the first initial image block being less than a clarity adjustment parameter of the second initial image block and N being equal to M, a clarity adjustment level of the neural network model processing the first initial image block is lower than a clarity adjustment level of the neural network model processing the second initial image block. That is, when the number of initial image blocks and the number of neural network models are the same, an initial image block with a smaller clarity adjustment parameter may be processed using a neural network model with a lower clarity adjustment level.

[0009] In combination with the first aspect, in one possible manner, the method further includes: training M initial neural network models based on M groups of image data sets with different sharpness to obtain M neural network models. It can be seen that the electronic device can train the M initial neural network models by itself to obtain M neural network models with different sharpness adjustment levels. This helps to improve the intelligence of the electronic device.

[0010] In combination with the first aspect, in a possible manner, the above-mentioned determination of N clear image blocks based on the clarity adjustment parameters of each initial image block and M neural network models includes: determining M1 neural network models from the M neural network models based on the order of clarity adjustment levels from high to low; M1 is a positive integer less than M; determining the initial image blocks input to each neural network model in the M1 neural network models from the N initial image blocks based on the clarity adjustment parameters of each initial image block; calling each neural network model in the M1 neural network models to process the input initial image blocks to obtain the image blocks output by each neural network model in the M1 neural network models; determining N clear image blocks based on the image blocks output by each neural network model in the M1 neural network models. It can be seen that firstly selecting M1 neural network models with higher clarity adjustment levels from the M neural network models, and then using the selected M1 neural network models to process the N initial image blocks is conducive to improving the flexibility of image processing.

[0011] In combination with the first aspect, in a possible manner, the method further includes: performing fast Fourier transform processing on each of the N initial image blocks to obtain frequency domain information of each initial image block; determining spatial frequency information of each initial image block based on the frequency domain information of each initial image block, wherein the spatial frequency information of an initial image block includes a maximum frequency of the initial image block. In other words, the image frequency information of an initial image block can be represented by the maximum frequency of the initial image block.

[0012] In a second aspect, the present application provides an electronic device, comprising: one or more processors, a display screen and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute: dividing an initial image into N initial image blocks, where N is a positive integer greater than 1; determining a clarity adjustment parameter of each initial image block according to image position information of each initial image block in the N initial image blocks, and spatial frequency information of each initial image block; determining N clear image blocks according to the clarity adjustment parameter of each initial image block and M neural network models; the clarity adjustment level of each neural network model in the M neural network models is different; M is a positive integer greater than 1; splicing the N clear image blocks to obtain a clear image corresponding to the initial image.

[0013] In combination with the second aspect, in a possible manner, a definition adjustment parameter of an initial image block among the N initial image blocks is positively correlated with image position information of the initial image block, and negatively correlated with spatial frequency information of the initial image block.

[0014] In combination with the second aspect, in one possible manner, the one or more processors call the computer instructions to cause the electronic device to execute: determine, from the N initial image blocks, the initial image blocks input to each of the M neural network models based on the clarity adjustment parameters of each initial image block; call each of the M neural network models to process the input initial image blocks to obtain image blocks output by each of the M neural network models; and determine N clear image blocks based on the image blocks output by each of the M neural network models.

[0015] In combination with the second aspect, in one possible manner, the N initial image blocks include a first initial image block and a second initial image block, and in response to a clarity adjustment parameter of the first initial image block being less than a clarity adjustment parameter of the second initial image block and N being equal to M, a clarity adjustment level of a neural network model processing the first initial image block is lower than a clarity adjustment level of a neural network model processing the second initial image block.

[0016] In combination with the second aspect, in one possible manner, the one or more processors call the computer instructions to cause the electronic device to execute: training M initial neural network models based on M groups of image data sets with different clarity, respectively, to obtain M neural network models.

[0017] In combination with the second aspect, in one possible manner, the one or more processors call the computer instructions to cause the electronic device to execute: based on the order of clarity adjustment levels from high to low, determine M1 neural network models from M neural network models; M1 is a positive integer less than M; according to the clarity adjustment parameters of each initial image block, determine the initial image blocks input to each of the M1 neural network models from the N initial image blocks; call each of the M1 neural network models to process the input initial image blocks to obtain image blocks output by each of the M1 neural network models; and determine N clear image blocks based on the image blocks output by each of the M1 neural network models.

[0018] In combination with the second aspect, in one possible manner, the one or more processors call the computer instructions to cause the electronic device to execute: performing fast Fourier transform processing on each of the N initial image blocks to obtain frequency domain information of each initial image block; determining the spatial frequency information of each initial image block based on the frequency domain information of each initial image block, the spatial frequency information of an initial image block including the maximum frequency of an initial image block.

[0019] In a third aspect, the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the method described in the first aspect above.

[0020] In a fourth aspect, the present application provides a chip system, which is coupled to a memory, and the chip system is used to read and execute a computer program stored in the memory to implement the method described in the first aspect above.

[0021] In a fifth aspect, the present application provides a computer program product comprising instructions, which, when executed on an electronic device, enables the electronic device to execute the method described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1A This is a schematic diagram of an image captured by an electronic device provided in an embodiment of the present application;

[0023] Figure 1B is a schematic diagram of image deblurring provided in an embodiment of the present application;

[0024] Figure 2A This is a schematic diagram of an application scenario provided by an embodiment of the present application;

[0025] Figure 2B This is another application scenario schematic diagram provided by an embodiment of the present application;

[0026] Figure 3 It is a flowchart of an image processing method provided in an embodiment of the present application;

[0027] Figure 4 is a schematic diagram of dividing an initial image into N initial image blocks provided by an embodiment of the present application;

[0028] Figure 5 is a schematic diagram of a neural network training method provided in an embodiment of the present application;

[0029] Fig. 6A is a schematic diagram of determining N clear image blocks provided by an embodiment of the present application;

[0030] Figure 6B is another schematic diagram of determining N clear image blocks provided by an embodiment of the present application;

[0031] Figure 7 is a flowchart of another image processing method provided in an embodiment of the present application;

[0032] Figure 8 It is a schematic diagram of the software structure of an electronic device provided in an embodiment of the present application;

[0033] Fig. 9 It is a software workflow diagram of an electronic device provided in an embodiment of the present application;

[0034] Fig.10 It is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0035] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0036] The terms "first", "second", "third", etc. in the embodiments of the present application are distinguished from different objects, rather than being used to describe a specific order. In addition, the terms "include" and "have" and any variation thereof are intended to cover non-exclusive inclusions. For example, a series of steps or units are included, or alternatively, steps or units not listed are also included, or other steps or units inherent to these processes, methods, products or devices are optionally included. The terms "one embodiment" or "some embodiments", etc. mean that the specific features, structures or characteristics described in conjunction with the embodiment are included in one or more embodiments of the present application. Thus, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in the differences in the embodiments of the present application are not necessarily all with reference to the same embodiment, but mean "one or more but not all embodiments", unless otherwise particularly emphasized.

[0037] In addition, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the objects before and after the association are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can mean: a, or b, or c, or a and b, or a and c, or b and c, or a, b and c, where a, b, c can be single or plural.

[0038] When using an electronic device equipped with a camera (such as a smartphone) to take pictures, the clarity of different image areas in the captured image varies due to the different amounts of light entering the center and edge of the field of view when the optical lens forms an image. For example, the edge of the field of view has less light than the center of the field of view, and the clarity of the image area at the edge of the field of view is often lower than that at the center of the field of view, that is, the image area at the edge of the field of view tends to be more blurred.

[0039] For example, see Figure 1A , Figure 1A Schematic diagram of an image captured by an electronic device provided in an embodiment of the present application. Figure 1A As shown, Figure 1A (a) is the image area located at the center of the field of view. Figure 1A (b) is the image area at the edge of the field of view. It can be seen that compared with Figure 1A (b) in the above equation, Figure 1A (a) has more light entering and is brighter. Figure 1A The clarity of (a) is higher than Figure 1A The clarity of (b).

[0040] In addition, the image itself contains spatial information of different frequencies, among which the high-frequency image area is often clearer than the low-frequency image area. When deblurring the image, if the high-frequency image area is deblurred too much, ringing phenomenon is likely to occur, and if the low-frequency image area is not deblurred enough, it is easy to lack clarity due to under-resolution.

[0041] For example, see Figure 1B , Figure 1B is a schematic diagram of image deblurring provided in an embodiment of the present application. Figure 1B As shown, Figure 1B (a) is an image obtained after deblurring the original image, wherein region 1010 is a high-frequency image region, and region 1011 is a low-frequency image region. Figure 1B (b) in FIG. 1 corresponds to region 1010 . It can be seen that region 1010 has a ringing phenomenon due to excessive deblurring. Figure 1B (c) in the figure corresponds to the area 1011. It can be seen that the area 1011 is not clear enough due to insufficient deblurring and under-resolution.

[0042] In order to improve the clarity of blurred images, an embodiment of the present application provides an image processing method that can be executed by an electronic device. The electronic device can divide an image into multiple image blocks and perform deblurring processing separately. For any image block among the multiple image blocks, the electronic device can determine the clarity adjustment parameter of the image block in combination with the position of the image block in the image and the spatial frequency of the image block. After obtaining the clarity adjustment parameter of each image block, the electronic device can select a corresponding neural network model according to the clarity adjustment parameter of each image block. Furthermore, the electronic device can input different image blocks into different neural network models for processing to obtain each clear image block after deblurring processing. Finally, the clear image blocks are spliced ​​together to obtain a clear image.

[0043] The embodiment of the present application can adopt different deblurring processing methods for different image blocks in the same image by introducing clarity adjustment parameters for image blocks. When determining the clarity adjustment parameters for each image block, the position of each image block in the image and the spatial frequency of each image block are comprehensively considered, which is conducive to improving the effect of deblurring the image blocks. At the same time, by selecting the neural network model corresponding to different clarity adjustment parameters to process each image block, each clear image block can be obtained more intelligently, which is conducive to improving the intelligence level of image processing by electronic equipment. The deblurring processing for an image is realized by splicing the various clear image blocks, and finally an image with higher clarity is obtained.

[0044] The application scenarios of the embodiments of the present application are introduced below.

[0045] The embodiments of the present application can be applied to scenarios where electronic devices remove image blur. For example, the electronic device can be equipped with a camera. After the camera captures an image, the electronic device can use the image processing method provided by the embodiments of the present application to automatically deblur the captured image, thereby improving the clarity of the image. For example, see Figure 2A , Figure 2A This is a schematic diagram of an application scenario provided by an embodiment of the present application. Figure 2A As shown in (a), the electronic device may turn on the camera in response to the start instruction for the camera application 201, so that the electronic device enters the shooting mode and displays the following Figure 2A The interface shown in (b). Figure 2A (b) shows the real-time preview image currently captured by the camera of the electronic device. Due to the influence of the environment (such as insufficient light, shooting jitter, etc.) and / or the influence of camera imaging, Figure 2A The preview image displayed in (b) is blurred. Figure 2AIn the selection instruction of the camera button 202 in (b), the image processing method of the embodiment of the present application can be used to automatically deblur the preview image currently captured by the camera, and the result is as follows: Figure 2A (c) shows a clear image, and can be Figure 2A The clear image shown in (c) is saved to the photo album.

[0046] For another example, the electronic device may also obtain a blurred image to be processed from a local storage space or from a server, and then use the image processing method provided in the embodiment of the present application to deblur the blurred image to be processed, thereby obtaining a clear image. Optionally, the electronic device may be installed with an image processing application, which may be integrated with an image deblurring function, and the image deblurring function may be implemented using the image processing method provided in the embodiment of the present application. For example, see Figure 2B , Figure 2B This is another application scenario diagram provided by the embodiment of the present application. Figure 2B As shown in (a), the electronic device may display a start instruction for the image processing application 211 in response to the start instruction for the image processing application 211. Figure 2B The electronic device responds to the initial interface shown in (b). Figure 2B The selection instruction of the import image button 212 in (b) can import the blurred image to be processed from the local storage space or from the server, and display the following after the image import is completed: Figure 2B The electronic device responds to the image editing interface shown in (c). Figure 2B The selection instruction of the deblur button 213 in (c) can use the image processing provided in the embodiment of the present application to perform deblurring on the blurred image to be processed, and obtain the following Figure 2B (d) shows the clear image.

[0047] It is understandable that the above Figure 2A and Figure 2B The application scenarios shown are only examples and do not constitute a limitation to the present application. The embodiments of the present application can be applied to any scenario where image deblurring is required.

[0048] In the embodiments of the present application, the electronic device may be a mobile phone, a tablet computer, a laptop computer, a camera, a video recorder, a PDA, a mobile internet device (MID), a wearable device, a virtual reality (VR) device, an augmented reality (AR) device, a wireless terminal in industrial control, a wireless terminal in self driving, a wireless terminal in remote medical surgery, a wireless terminal in a smart grid, a wireless terminal in transportation safety, a wireless terminal in a smart city, a wireless terminal in a smart home, a personal digital assistant (PDA), etc., and the embodiments of the present application are not limited to this.

[0049] The execution subject of the image processing method provided in the embodiment of the present application may be an electronic device, or a functional module and / or functional entity in the electronic device that can implement the image processing method. The image processing method provided in the embodiment of the present application is introduced below by taking the electronic device executing the embodiment of the present application as an example and combining with the accompanying drawings.

[0050] See also Figure 3 , Figure 3 is a flow chart of an image processing method provided in an embodiment of the present application. Figure 3 As shown, the method may include but is not limited to the following steps:

[0051] S301, dividing an initial image into N initial image blocks.

[0052] In the embodiment of the present application, N is an integer greater than 1, that is, the electronic device can divide an initial image into multiple initial image blocks. The initial image can be understood as a blurred image to be processed, and correspondingly, the initial image block is a blurred image block to be processed. By dividing an image into multiple image blocks, different processing can be performed on different image areas.

[0053] In some embodiments, the electronic device may divide the initial image into N initial image blocks according to the image information of the initial image. Optionally, the image information of the initial image may include brightness information, color information, contrast information, semantic information, etc. of the initial image. The N initial image blocks may be initial image blocks of the same size, or all or part of the N initial image blocks may be of different sizes. It can be understood that the principle of dividing the initial image is that the N initial image blocks obtained by the division can be spliced ​​and restored to the initial image. Specifically, the division can be performed according to a set division method. The embodiment of the present application does not limit the division method of the initial image.

[0054] In some embodiments, the initial image may be a preview image acquired by the electronic device from a camera in real time. Optionally, the electronic device may turn on the camera through a camera application, or may turn on the camera through a third-party application, for example, may turn on the camera through a third-party chat application. After the electronic device turns on the camera, in response to a photo taking instruction received at the first moment, the preview image acquired from the camera at the first moment may be divided into N preview image blocks. The first moment may be any moment.

[0055] In some embodiments, the initial image may also be a blurred image to be processed that the electronic device obtains from a local storage space or a server. For example, a user may trigger an instruction to import an image through an image processing application or an image processing applet, and the electronic device may obtain the blurred image to be processed from a local storage space or a server in response to the instruction to import the image. After obtaining the blurred image to be processed, the electronic device may divide the blurred image to be processed into N blurred image blocks to be processed through the image processing application or the image processing applet. Optionally, after the electronic device obtains the blurred image to be processed, it may store the blurred image to be processed in the storage space corresponding to the image processing application or the image processing applet, so that the image processing may be performed more efficiently through the image processing application or the image processing applet.

[0056] After the electronic device divides the initial image into N initial image blocks, it can perform image deblurring processing on each of the N initial image blocks. For ease of understanding, the following steps S302 to S305 take an initial image block as an example to introduce the process of image deblurring processing in the image processing method provided in the embodiment of the present application.

[0057] S302: Determine image position information d of a first initial image block and spatial frequency information f of the first initial image block.

[0058] In an embodiment of the present application, when performing deblurring processing on a first initial image block, the electronic device may first determine image position information of the first initial image block and spatial frequency information of the first initial image block, wherein the first initial image block may be any initial image block among the N initial image blocks.

[0059] In some embodiments, the electronic device may determine the position information of the first initial image block by determining the image position information of the first initial image block based on the coordinate information of the central pixel of the first initial image block in the initial image and the coordinate information of the central pixel of the initial image. That is, for an initial image block, the image position information of an initial image block may be represented by the distance between the central pixel of the initial image block and the central pixel of the initial image. The larger the distance between the central pixel of an initial image block and the central pixel of the initial image, the farther the initial image block is from the center position of the initial image.

[0060] For example, see Figure 4 , Figure 4 is a schematic diagram of dividing an initial image into N initial image blocks provided by an embodiment of the present application. Figure 4 As shown, the initial image can be divided into 16 initial image blocks of the same size, the coordinate information of the central pixel point of the initial image is (a, b), the coordinate information of the central pixel point of the initial image block 401 is (m, n), and the coordinate information of the central pixel point of the initial image block 402 is (i, j). The image position information d1 of the initial image block 401 can be calculated using the following formula (1):

[0061] (1)

[0062] Similarly, the image position information d2 of the initial image block 402 can be calculated using the following formula (2):

[0063] (2)

[0064] Depend on Figure 4 It can be seen that the distance d1 between the central pixel point of the initial image block 401 and the central pixel point of the initial image is greater than the distance d2 between the central pixel point of the initial image block 402 and the central pixel point of the initial image. The initial image block 401 is farther from the center position of the initial image than the initial image block 402.

[0065] In some embodiments, the electronic device may determine the spatial frequency information of the first initial image block by first performing fast Fourier transform (FFT) processing on the first initial image block to obtain the frequency domain information of the first initial image block. Then, the spatial frequency information of the first initial image block is determined based on the frequency domain information of the first initial image block. By performing fast Fourier transform processing on the first initial image block, the pixel value of the first initial image block can be converted from the time domain to the frequency domain, that is, the frequency domain information of the first initial image block is obtained. Optionally, the spatial frequency information of the first initial image block may be the maximum spatial frequency obtained based on the frequency domain information of the first initial image block, or the spatial frequency information of the first initial image block may also be the average spatial frequency obtained based on the frequency domain information of the first initial image block, or the spatial frequency information of the first initial image block may also be the median of the spatial frequency obtained based on the frequency domain information of the first initial image block.

[0066] S303 : Determine a definition adjustment parameter S of the first initial image block according to the image position information d of the first initial image block and the spatial frequency information f of the first initial image block.

[0067] In an embodiment of the present application, the image position information of different initial image blocks is different, and the spatial frequency information of different initial image blocks is also different, so the degree of deblurring processing required for each initial image block is also different. After the electronic device obtains the image position information of the first initial image block and the spatial frequency information of the first initial image block, it can determine the clarity adjustment parameter of the first initial image block according to the image position information of the first initial image block and the spatial frequency information of the first initial image block. The clarity adjustment parameter of the first initial image block can be used to measure the degree to which the first initial image block needs to be deblurred. Among them, the larger the clarity adjustment parameter of the first initial image block, the blurrier the first initial image block is, and the greater the degree of deblurring processing required.

[0068] Since the initial image block that is farther away from the center position of the initial image requires a greater degree of deblurring, and the initial image block that has a larger spatial frequency information requires a smaller degree of deblurring. Therefore, the clarity adjustment parameter of an initial image block may be positively correlated with the image position information of the initial image block, and negatively correlated with the spatial frequency information of the initial image block. In other words, the larger the image position information of an initial image block, and the smaller the spatial frequency information of the initial image block, the larger the clarity adjustment parameter of the initial image block, that is, the greater the degree of deblurring required for the initial image block. Correspondingly, the smaller the image position information of an initial image block, and the larger the spatial frequency information of the initial image block, the smaller the clarity adjustment parameter of the initial image block, that is, the smaller the degree of deblurring required for the initial image block.

[0069] Optionally, the definition adjustment parameter of the first initial image block may be calculated using the following formula (3):

[0070] (3)

[0071] Wherein, f represents the spatial frequency information of the initial image block, and d represents the image position information of the initial image block. k and p can be understood as dynamic parameters, and the values ​​can be dynamically adjusted according to the needs.

[0072] Optionally, the definition adjustment parameter of the first initial image block may also be calculated using the following formula (4):

[0073] (4)

[0074] Wherein, f represents the spatial frequency information of the initial image block, d represents the image position information of the initial image block, and w can be understood as a dynamic parameter, and the value can also be dynamically adjusted according to the needs.

[0075] It should be noted that the embodiment of the present application does not limit the calculation method of the clarity adjustment parameter of an initial image block. As long as the clarity adjustment parameter of an initial image block is positively correlated with the image position information of the initial image block and negatively correlated with the spatial frequency information of the initial image block, the specific calculation method can be flexibly selected according to the actual application.

[0076] S304: Determine a first neural network model from the M neural network models according to the clarity adjustment parameter S of the first initial image block.

[0077] In an embodiment of the present application, after the electronic device obtains the clarity adjustment parameters of the first initial image block, M neural network models can be obtained. Then, the first neural network model is determined from the M neural network models according to the clarity adjustment parameters of the first initial image block, and the first neural network model is a neural network model used to process the first initial image block. Among them, the clarity adjustment level of each neural network model in the M neural network models is different, and M is an integer greater than 1. Here, the neural network model can be used to deblur the initial image block, and the clarity adjustment level of the neural network model can be understood as the degree to which the neural network model deblurs the initial image. The greater the clarity adjustment level of the neural network model, the greater the degree to which the initial image is deblurred. In this way, according to the clarity adjustment parameters of different initial image blocks, neural network models with different clarity adjustment levels can be selected for deblurring, thereby achieving differentiated processing of different initial image blocks, which is beneficial to improving the clarity of the image.

[0078] In some embodiments, the M neural network models can be obtained by training the M initial neural network models based on M groups of image data sets with different clarity. The M groups of image data sets with different clarity can be open source image data sets or generated image data sets. Among them, the method of generating M groups of image data sets with different clarity can be, for example, first obtaining a clear image data set, and then blurring the clear image data to different degrees to obtain image data sets with different clarity, that is, obtaining M groups of image data sets with different degrees of blur. For example, by convolving the clear image data set with M Gaussian blur kernels of different sizes, M groups of image data sets with different clarity can be obtained. For another example, by superimposing the clear image data set with M transparent image templates with different degrees of blur, M groups of image data sets with different clarity can also be obtained.

[0079] When training an initial neural network model, the blurred images in a set of blurred image data sets can be deblurred by the initial neural network model to obtain a reference image corresponding to the blurred image. Then, based on the approximation between the reference image and the clear image in the clear image data set, the loss of the initial neural network model can be determined. The smaller the loss, the better the deblurring effect of the initial neural network model. After determining the loss of the initial neural network model, the model parameters of the initial neural network model can be adjusted according to the loss, and then the blurred image can be deblurred again by the initial neural network model after adjusting the model parameters, and the reference image can be obtained again, and the loss of the initial neural network model can be obtained again, and this cycle is repeated until the model training conditions are met, that is, a trained neural network model is obtained. Optionally, the model training conditions can be, for example, that the number of model training times reaches a first threshold, or that the loss is less than a second loss threshold.

[0080] By using M sets of image data sets with different sharpness to train the initial neural network model, M neural network models with different sharpness adjustment levels can be obtained. Among them, the higher the blur level of the image data set used to train the initial neural network model, the higher the sharpness adjustment level of the trained neural network model.

[0081] For example, see Figure 5 , Figure 5 Schematic diagram of a neural network training method provided in the embodiment of the present application. Figure 5 As shown, Figure 5 (a) Based on the image dataset with lower blur and the clear image dataset, the initial neural network is trained to obtain a neural network model with lower clarity adjustment level; Figure 5 In (b), the initial neural network model is trained based on a data set of images with a high degree of blur and a data set of clarity, and a neural network model with a higher level of clarity adjustment can be obtained.

[0082] Optionally, the initial neural network model can be a convolutional neural network (CNN), which can be used to extract feature information of the input blurred image. A convolutional neural network is a neural network structure that can automatically learn feature expression, and can extract the input initial image block layer by layer through multiple layers of convolution kernel pooling layers to obtain a high-dimensional feature representation of the blurred image. This high-dimensional feature representation can better reflect the structure and texture information of the blurred image, so that the blurred image block can be better deblurred. The initial neural network model is trained by using a blurred image dataset and a clear image dataset corresponding to the blurred image dataset, so that the trained neural network model can learn the mapping relationship between the blurred image and the clear image, so that the trained neural network model can accurately deblur the input new blurred image.

[0083] Optionally, the initial neural network model may also be a recurrent neural network (RNN), a feedforward neural network (FNN), etc.

[0084] In some embodiments, the electronic device can train M initial neural networks based on M groups of image data sets with different clarity, thereby obtaining M neural network models. Alternatively, the electronic device can also directly obtain the pre-trained M neural network models. The pre-trained M neural network models can be obtained by the electronic device from a local storage space or from a server, and this application does not limit this.

[0085] After the electronic device obtains the M neural network models, it can determine the first neural network model for processing the first initial image block from the M neural network models according to the clarity adjustment parameters of the first initial image block. Optionally, the electronic device can store a mapping relationship between the clarity adjustment parameters of the N initial image blocks and the clarity adjustment levels of the M neural network models. The electronic device can determine the first neural network model from the M neural network models according to the clarity adjustment parameters of the first initial image block and the mapping relationship between the clarity adjustment parameters of the N initial image blocks and the clarity adjustment levels of the M neural network models. The clarity adjustment parameters of the first initial image block correspond to the clarity adjustment level of the first neural network model.

[0086] S305: Determine a first clear image block according to the first initial image block and the first neural network model.

[0087] In an embodiment of the present application, after the electronic device determines the first neural network model for processing the first initial image block from M neural network models, the first initial image block can be input into the first neural network model to obtain a first clear image block output by the first neural network model, where the first clear image block is the clear image block after deblurring of the first initial image block.

[0088] According to the above steps S302 to S305, the electronic device can perform deblurring processing on the N initial image blocks respectively, and thus obtain N clear image blocks.

[0089] In some embodiments, in order to obtain N clear image blocks, the electronic device may utilize all of the M neural network models, or may utilize some of the M neural network models.

[0090] The following are two ways for electronic devices to obtain N clear image blocks:

[0091] Method 1: Determine N clear image blocks according to the clarity adjustment parameters of each of the N initial image blocks and all of the M neural network models.

[0092] In this manner, the electronic device can first adjust the parameters according to the clarity of each initial image block, and determine the initial image block input to each of the M neural network models from the N initial image blocks, that is, determine the neural network model input to each initial image block. Different initial image blocks can input the same or different neural network models.

[0093] Optionally, when N is equal to M, the electronic device may input the N initial image blocks into M neural network models for processing in the order of the clarity adjustment parameters of the N initial image blocks from high to low and the clarity adjustment levels of the M neural network models from high to low, with one initial image block corresponding to one neural network model. For example, if the clarity adjustment parameter of the first initial image block is less than the clarity adjustment parameter of the second initial image block, then the clarity adjustment level of the neural network model processing the first initial image block is less than the clarity adjustment level of the neural network model processing the second initial image block.

[0094] Optionally, when N is greater than M, the electronic device may map the clarity adjustment parameters of the N initial image blocks to multiple target intervals based on the clarity adjustment parameters of the N initial image blocks and the number of M neural network models, and then determine the initial image blocks input to each of the M neural network models based on the target interval corresponding to each initial image block and the clarity adjustment level of the M neural network models.

[0095] For example, assuming that the electronic device divides the initial image into 4 initial image blocks, the clarity adjustment parameter of the first initial image block is 2, the clarity adjustment parameter of the second initial image block is 3, the clarity adjustment parameter of the third initial image block is 2.5, and the clarity adjustment parameter of the fourth initial image block is 5, the electronic device obtains 3 neural network models with different clarity adjustment levels. Among them, the clarity adjustment level of the first neural network model is lower than the clarity adjustment level of the second neural network model, and the clarity adjustment level of the second neural network model is lower than the clarity adjustment level of the third neural network model. The electronic device can specifically map the clarity adjustment parameters of the 4 initial image blocks to the 3 target intervals respectively through the following steps:

[0096] ① According to the difference 3 between the maximum value 5 and the minimum value 2 of the clarity adjustment parameter of the four initial image blocks and the number 3 of the neural network models, the interval length of each target interval is determined. The interval length of each target interval is the difference between the maximum value and the minimum value of the clarity adjustment parameter divided by the number of neural network models, that is, 3 / 3=1;

[0097] ② According to the maximum value 5 and the minimum value 2 of the clarity adjustment parameters of the four initial image blocks, and the interval length 1 of each target interval, three target intervals are determined, that is, the first target interval is [2,3], the second target interval is [3,4], and the third target interval is [4,5];

[0098] ③ Map the clarity adjustment parameters of the four initial image blocks to three target intervals respectively, that is, the clarity adjustment parameter 2 of the first initial image block is mapped to the first target interval [2,3], the clarity adjustment parameter 3 of the second initial image block is mapped to the second target interval [3,4], the clarity adjustment parameter 2.5 of the third initial image block is mapped to the first target interval [2,3], and the clarity adjustment parameter 5 of the fourth initial image block is mapped to the third target interval [4,5]. Optionally, the clarity adjustment parameter 3 of the second initial image block may also be mapped to the first target interval [2,3], or the electronic device may also map the clarity adjustment parameter of the second initial image block to the first target interval and the second target interval in sequence, and then compare the processing results of the neural network model, and finally select a target interval corresponding to a better processing result.

[0099] In this way, after mapping the clarity adjustment parameters of the four initial image blocks to the three target intervals respectively, the initial image blocks inputted by each of the three neural network models can be determined according to the target intervals corresponding to the four initial image blocks and the clarity adjustment levels of the three neural network models (clarity adjustment level of the first neural network model < clarity adjustment level of the second neural network model < clarity adjustment level of the third neural network model), that is, the first initial image block and the third initial image block corresponding to the first target interval inputted by the first neural network model, the second initial image block corresponding to the second target interval inputted by the second neural network model, and the fourth initial image block corresponding to the third target interval inputted by the third neural network model.

[0100] After the electronic device determines the initial image block input by each of the M neural network models in this way, it can then call each of the M neural network models to process the input initial image block to obtain the image block output by each of the M neural network models. The processing of the input initial image block by the neural network model is to deblur the input initial image block, and the image block output by the neural network model is a clear image block.

[0101] Finally, the electronic device can determine N clear image blocks based on the image blocks output by each of the M neural network models. Optionally, all of the N clear image blocks can be obtained based on the image blocks output by each of the M neural network models, or some of the N clear image blocks can be obtained based on the image blocks output by each of the M neural network models.

[0102] For the situation where all the N clear image blocks are obtained based on the image blocks output by each of the M neural network models, it means that the electronic device inputs all the N initial image blocks into the neural network for deblurring processing to obtain N clear image blocks.

[0103] For example, see Fig. 6A , Fig. 6A FIG. 1 is a schematic diagram of determining N clear image blocks provided by an embodiment of the present application. Fig. 6A As shown, the electronic device can input N initial image blocks into their respective corresponding neural network models, and then call each of the M neural network models to deblur the input initial image blocks, and finally obtain N clear image blocks output by the M neural network models.

[0104] For the case where some of the N clear image blocks are obtained based on the image blocks output by each of the M neural network models, it means that the electronic device can select some of the initial image blocks from the N initial image blocks and not input them into the neural network for deblurring. For example, the electronic device can determine the n initial image blocks to be input into the M neural network models based on the clarity adjustment parameters of the N initial image blocks and the clarity adjustment threshold, where n is a positive integer less than N. Optionally, the clarity adjustment threshold can be a smaller value. If the clarity adjustment parameter of an initial image block is less than or equal to the clarity adjustment threshold, it can indicate that the clarity of the initial image block meets the requirements and no deblurring is required based on the neural network model; if the clarity adjustment parameter of an initial image block is greater than the clarity adjustment threshold, it can indicate that the clarity of the initial image block does not meet the requirements and deblurring is required based on the neural network model.

[0105] For example, see Figure 6B , Figure 6B FIG. 1 is another schematic diagram of determining N clear image blocks provided by an embodiment of the present application. Figure 6BAs shown, the electronic device can select n initial image blocks whose clarity adjustment parameters are greater than the clarity adjustment threshold from N initial image blocks, and then input the n initial image blocks into their corresponding neural network models respectively, and then call each of the M neural network models to perform deblurring processing on the input initial image blocks to obtain n clear image blocks output by the neural network, and finally combine the n clear image blocks with the initial image blocks whose clarity adjustment parameters are less than or equal to the clarity adjustment threshold to obtain N clear image blocks.

[0106] Method 2: Determine N clear image blocks according to the clarity adjustment parameter of each of the N initial image blocks and a partial neural network model among the M neural network models.

[0107] In this manner, the electronic device may first determine M1 neural network models from the M neural network models based on the order of clarity adjustment levels from high to low, where M1 is a positive integer less than M. That is to say, the electronic device may first select some neural network models with higher clarity adjustment levels from the M neural network models. For example, assuming that the clarity adjustment level of the first neural network model < the clarity adjustment level of the second neural network model < the clarity adjustment level of the third neural network model < the clarity adjustment level of the fourth neural network model, when M1 is equal to 2, it means that the two neural network models with the highest clarity adjustment levels are selected, namely the fourth neural network model and the third neural network model. The number of M1 can be set flexibly, and this application does not limit this.

[0108] After determining the M1 neural network models, the electronic device can adjust the parameters according to the clarity of each initial image block, and determine the initial image blocks input to each neural network model in the M1 neural network models from the N initial image blocks. Then, each neural network model in the M1 neural network models is called to process the input initial image blocks to obtain the image blocks output by each neural network model in the M1 neural network models. Finally, N clear image blocks can be determined based on the image blocks output by each neural network model in the M1 neural network models.

[0109] Here, the processing process after the electronic device determines M1 neural network models in method 2 can refer to the description in method 1. The difference between method 2 and method 1 is that method 2 selects some neural network models whose clarity adjustment levels meet the requirements from the M neural network models, which is conducive to improving the flexibility of electronic device processing.

[0110] S306, performing splicing processing on the N clear image blocks to obtain a clear image corresponding to the initial image.

[0111] In the embodiment of the present application, after the electronic device obtains N clear image blocks, the N clear image blocks can be re-stitched together to obtain a complete clear image corresponding to the initial image.

[0112] In some embodiments, the electronic device may perform stitching processing on N clear image blocks based on the image position information of the initial image block corresponding to each of the N clear image blocks. The image position information of the initial image block corresponding to a clear image block may be the coordinate information of the central pixel point of the initial image block in the initial image. For example, assuming that the image position information of the initial image block A corresponding to the clear image block A is (5,5), which means that the coordinate information of the central pixel point of the initial image block A in the initial image is (5,5), then the coordinate information of the central pixel point of the clear image block A in the clear image should also be (5,5). In this way, the position of each clear image block in the clear image can be determined, and the final complete clear image can be stitched together.

[0113] In some embodiments, the electronic device may also perform splicing processing on the N clear image blocks based on the position order of the N initial image blocks. For example, assuming that the initial image is divided into 4 initial image blocks, the position order of the 4 initial image blocks in the initial image is 1, 2, 3, 4, and after obtaining the clear image blocks corresponding to the 4 initial image blocks, the initial image blocks corresponding to the 4 clear image blocks are sequentially spliced ​​together according to the position order of 1, 2, 3, 4 in the initial image, and a complete clear image can also be obtained.

[0114] In addition, in some application scenarios, the image processing method provided in the embodiment of the present application can also be used to deblur a video. For example, the electronic device can obtain a blurred video frame to be processed from a video, and the blurred video frame to be processed can be regarded as the above-mentioned initial image. The electronic device can use the above-mentioned steps S301 to S304 to deblur the blurred video frame to be processed to obtain a clear video frame.

[0115] By implementing the embodiments of the present application, the electronic device can divide the initial image into multiple initial image blocks, and determine the clarity adjustment parameters of the initial image blocks in combination with the image position information and spatial frequency information of the initial image blocks, and then can select neural network models with different clarity adjustment levels for processing according to the clarity adjustment parameters of different initial image blocks to obtain multiple clear image blocks, and finally splice the clear image blocks together to obtain a clear image corresponding to the initial image. In this way, differentiated deblurring processing can be performed on different image areas in the initial image, which is conducive to improving the intelligence and accuracy of image deblurring processing, and thus improving the effect of image deblurring.

[0116] For ease of understanding, the image processing method provided by the embodiment of the present application is introduced below with a specific example. Figure 7 , Figure 7 It is a flowchart of another image processing method provided in an embodiment of the present application.

[0117] exist Figure 7 In the example shown, taking the number of initial image blocks N being equal to the number of neural network models M as an example, wherein the initial image is a blurred image to be processed, the electronic device may divide the initial image into N initial image blocks, namely initial image block 1, initial image block 2, ... initial image block N. Then, according to the image position information of initial image block 1 and the spatial frequency information of initial image block 1, the clarity adjustment parameter of initial image block 1 may be determined; according to the image position information of initial image block 2 and the spatial frequency information of initial image block 2, the clarity adjustment parameter of initial image block 2 may be determined; until the clarity adjustment parameter of each of the N initial image blocks is determined.

[0118] After obtaining the clarity adjustment parameters of each initial image block, the neural network model 1 used to process the initial image block 1 can be determined according to the clarity adjustment parameters of the initial image block 1; the neural network model 2 used to process the initial image block 2 can be determined according to the clarity adjustment parameters of the initial image block 2... According to the clarity adjustment parameters of the initial image block N, the neural network model M used for the initial image block N can be determined. Among them, the M neural network models are trained based on M groups of image data sets with different clarity, and the clarity adjustments of these M neural network models are different. The initial image block with a high clarity adjustment parameter can correspond to a neural network model with a high clarity adjustment level. For example, assuming that the clarity adjustment parameter of the initial image block 1 is higher than the clarity adjustment parameter of the initial image block 2, the clarity adjustment level of the neural network model 1 can be higher than the clarity adjustment level of the neural network model 2.

[0119] By inputting the initial image block 1 into the neural network model 1, a clear image block 1 output by the neural network model 1 can be obtained; by inputting the initial image block 2 into the neural network model 2, a clear image block 2 output by the neural network model 2 can be obtained... By inputting the initial image block N into the neural network model N, a clear image block N output by the neural network model N can be obtained. Finally, the N clear image blocks are spliced ​​together to obtain a clear image corresponding to the initial image.

[0120] It should be noted that Figure 7 Taking the example that the number of initial image blocks N is equal to the number of neural network models M, in the present application, the number of initial image blocks N can also be greater than or less than the number of neural network models M, and the embodiments of the present application do not limit this.

[0121] pass Figure 7 In the example shown, the electronic device can adapt neural network models with different clarity adjustment levels for different initial image blocks, so as to achieve different degrees of deblurring processing for each initial image block, which is beneficial to improving the clarity of the image.

[0122] It can be understood that the methods and operations implemented by electronic devices in the above-mentioned various method embodiments can also be implemented by components (such as chips or circuits) that can be used in electronic devices.

[0123] In the following, taking the electronic device in the embodiment of the present application as a mobile phone as an example, the software structure and hardware structure of the electronic device are respectively introduced.

[0124] See also Figure 8 , Figure 8 It is a schematic diagram of the software structure of an electronic device provided in an embodiment of the present application.

[0125] In the embodiment of the present application, the software structure of the electronic device can adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system with a layered architecture as an example to introduce the software structure of the electronic device.

[0126] like Figure 8 As shown, the layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers, from top to bottom, namely, the application layer, the application framework layer, the Android runtime and system library, the hardware abstraction layer, and the kernel layer.

[0127] The application layer can include a series of application packages, which can include applications such as camera, gallery, chat, map, calendar, music, call, video, etc.

[0128] In an embodiment of the present application, the application layer may further include an image processing module, which may be an application or a functional module integrated in the application. The image processing module may be used to deblur the blurred image to be processed using the image processing method of an embodiment of the present application to obtain a clear image. For example, the image processing module may be integrated into a camera application to implement an image deblurring function in the camera mode of the camera application; or, the image processing module may also be integrated into a gallery application or other third-party applications.

[0129] The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions.

[0130] like Figure 8 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, etc. In an embodiment of the present application, the application framework layer may also include a camera access interface and an image management module. The camera access interface is used to provide an interface for accessing the camera. In addition, the camera access interface can also be used to provide an interface for accessing the image management module. The image management module can be used to store multiple blurred images to be processed, as well as clear images after deblurring. Among them, the blurred image to be processed can be collected by the camera of the electronic device, or it can be obtained by the electronic device from a gallery. The embodiment of the present application does not limit the specific source of the initial image.

[0131] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.

[0132] Content providers are used to store and retrieve data and make it accessible to applications. The data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0133] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.

[0134] The phone manager is used to provide communication functions for electronic devices, such as the management of call status (including answering, hanging up, etc.).

[0135] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0136] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages, and can stay for a short time and then disappear automatically without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of an icon or scroll bar text, such as notifications from applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is prompted in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.

[0137] Android Runtime includes core libraries and virtual machines. Android Runtime is responsible for scheduling and management of the Android system.

[0138] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.

[0139] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0140] The system library may include multiple functional modules, such as a surface manager, a media library, a 3D graphics processing library (such as OpenGL ES), a 2D graphics engine (such as SGL), etc. In an embodiment of the present application, the system library may also include an image processing algorithm library.

[0141] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.

[0142] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc.

[0143] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0144] A 2D graphics engine is a drawing engine for 2D drawings.

[0145] The image processing algorithm library may include the software algorithm of the image processing method in the embodiment of the present application.

[0146] The hardware abstraction layer is an abstract interface of the device kernel driver, which is used to provide an application programming interface for accessing the underlying device to a higher-level Java API framework. In the embodiment of the present application, the hardware abstraction layer may include, for example, a camera hardware abstraction layer.

[0147] The kernel layer is the layer between hardware and software. The kernel layer includes at least display driver, camera driver, audio driver, sensor driver, processor driver, etc.

[0148] It should be noted that the various functional modules included in the above software structure are only exemplary and do not constitute a specific limitation on the software architecture of the mobile phone of the present application. In other embodiments, the various functional modules included in the above software structure may be more or less, and the present application does not limit this. Although the embodiments of the present application are described with the Android system, the principle of the image processing method is also applicable to electronic devices with operating systems such as iOS or Windows.

[0149] The following describes the workflow of electronic device software in combination with the scene of electronic device taking photos. Fig. 9 , Fig. 9 It is a software workflow diagram of an electronic device provided in an embodiment of the present application.

[0150] like Fig. 9 As shown, the image processing module can be integrated in the camera application, and the electronic device can respond to the received startup instruction for the camera application through the camera access interface of the application framework layer, and send the received startup instruction to the camera hardware abstraction layer, so that the camera hardware abstraction layer calls the camera driver in the kernel layer according to the received startup instruction, and the camera driver drives the camera and other hardware devices to respond to the startup instruction to start collecting the shooting picture, that is, collecting the initial image. Then, the camera can pass the collected initial image to the camera hardware abstraction layer through the camera driver. Optionally, after the camera hardware abstraction layer receives the initial image collected by the camera, the initial image collected by the camera can be reported to the camera application through the camera access interface, or the image processing algorithm library can be called to perform deblurring on the collected initial image. Among them, the camera hardware abstraction layer can perform deblurring on the collected initial image through a separate processor or an integrated processor to obtain a clear image. After obtaining the clear image, the camera hardware abstraction layer can pass the clear image to the camera application through the camera access interface for display, or it can also pass it to the image management module through the camera access interface for storage.

[0151] See also Fig.10 , Fig.10 It is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.

[0152] like Fig.10As shown, the electronic device may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. Among them, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0153] 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 processor (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), etc. Different processing units may be independent devices or integrated into one or more processors.

[0154] NPU is a neural network computing processor. It can quickly process input information and continuously self-learn by drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain. NPU can realize applications such as intelligent cognition of electronic devices, such as image recognition, face recognition, voice recognition, text understanding, etc.

[0155] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0156] In the embodiment of the present application, the processor 110 can run the image processing method provided in the embodiment of the present application to improve the clarity of the blurred image. The processor 110 may include different devices. For example, when a CPU and a GPU are integrated, the CPU and the GPU can cooperate to execute the image processing method provided in the embodiment of the present application. For example, part of the algorithm in the image processing method is executed by the CPU, and another part of the algorithm is executed by the GPU to obtain faster processing efficiency.

[0157] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The processor 110 executes various functional applications and data processing of the electronic device by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store codes of operating systems, application programs (such as camera applications, image processing applications, etc.), etc. The data storage area can store data created during the use of the electronic device (such as images and videos collected by camera applications, etc.), etc.

[0158] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0159] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to electronic devices. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0160] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (e.g., a speaker 170A, a receiver 170B), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.

[0161] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as WiFi networks), Bluetooth (Blue Tooth, BT), BLE broadcasting, global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc., which are applied to electronic devices. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0162] The camera 193 (a front camera or a rear camera, or one camera can be used as both a front camera and a rear camera) is used to capture still images or videos. Generally, the camera 193 may include a photosensitive element such as a lens group and an image sensor, wherein the lens group includes a plurality of lenses (convex lenses or concave lenses) for collecting light signals reflected by the object to be photographed and transmitting the collected light signals to the image sensor. The image sensor generates an original image of the object to be photographed based on the light signal. In an embodiment of the present application, the camera 193 can be used to obtain a blurred image to be processed, i.e., an initial image.

[0163] The display screen 194 is used to display images, videos, etc. The display screen 194 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 or an active matrix organic light emitting diode (AMOLED), a flexible light emitting diode (FLED), Miniled, MicroLed, MicrooLed, a quantum dot light emitting diode (QLED), etc. In some embodiments, the electronic device may include 1 or N display screens 194, where N is a positive integer greater than 1. The display screen 194 can be used to display information input by a user or information provided to a user, as well as various graphical user interfaces (GUI). For example, the display screen 194 can display photos, videos, web pages, etc. In an embodiment of the present application, the display screen 194 can be used to display the above Figure 2A or Figure 2B The interface shown.

[0164] It is to be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device. In other embodiments, the electronic device may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0165] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, 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 this application is generated 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 a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk), etc.

[0166] It should be noted that, for the above-mentioned various method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

[0167] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs.

[0168] The modules in the device of the embodiment of the present application can be merged, divided and deleted according to actual needs.

[0169] A person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing the relevant hardware through a program, and the program may be stored in a computer-readable storage medium, which may include a flash drive, ROM, RAM, a magnetic disk or an optical disk, etc.

[0170] The above disclosure is only a preferred embodiment of the present application, which is only a part of the embodiments of the present application and cannot be used to limit the scope of rights of the present application.

Claims

1. An image processing method, characterized in that: The method comprises: Divide the initial image into N initial image blocks, where N is a positive integer greater than 1; Determine the definition adjustment parameter of each initial image block according to the image position information of each initial image block in the N initial image blocks and the spatial frequency information of each initial image block; determine the definition adjustment parameter of one initial image block in the N initial image blocks ; Wherein, f represents the spatial frequency information of the initial image block, the spatial frequency information of the initial image block is the maximum spatial frequency of the initial image block, d represents the image position information of the initial image block, and k and p represent dynamic adjustment parameters; Determine N clear image blocks according to the definition adjustment parameter of each initial image block and M neural network models; the definition adjustment level of each neural network model in the M neural network models is different; M is a positive integer greater than 1; The N clear image blocks are spliced ​​to obtain a clear image corresponding to the initial image.

2. The method according to claim 1, characterized in that The step of determining N clear image blocks according to the definition adjustment parameter of each initial image block and the M neural network models comprises: According to the definition adjustment parameter of each initial image block, determining an initial image block input to each neural network model in the M neural network models from the N initial image blocks; Calling each of the M neural network models to process the input initial image block to obtain an image block output by each of the M neural network models; Based on the image blocks output by each of the M neural network models, N clear image blocks are determined.

3. The method according to claim 2, characterized in that The N initial image blocks include a first initial image block and a second initial image block. In response to a clarity adjustment parameter of the first initial image block being less than a clarity adjustment parameter of the second initial image block and N being equal to M, a clarity adjustment level of a neural network model processing the first initial image block is lower than a clarity adjustment level of a neural network model processing the second initial image block.

4. The method according to claim 2, characterized in that The method further comprises: Based on M groups of image data sets with different clarity, M initial neural network models are trained respectively to obtain M neural network models.

5. The method according to claim 1, characterized in that The step of determining N clear image blocks according to the definition adjustment parameter of each initial image block and the M neural network models comprises: Based on the order of clarity adjustment levels from high to low, M1 neural network models are determined from the M neural network models; M1 is a positive integer less than M; According to the definition adjustment parameter of each initial image block, determining the initial image block input to each neural network model in the M1 neural network models from the N initial image blocks; Calling each of the M1 neural network models to process the input initial image block to obtain an image block output by each of the M1 neural network models; Based on the image blocks output by each of the M1 neural network models, N clear image blocks are determined.

6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: Performing fast Fourier transform processing on each of the N initial image blocks to obtain frequency domain information of each initial image block; The spatial frequency information of each initial image block is determined based on the frequency domain information of each initial image block, and the spatial frequency information of one initial image block includes the maximum spatial frequency of the one initial image block.

7. An electronic device, characterized in that: It includes a memory and one or more processors; the memory is coupled to the one or more processors and is used to store a computer program, and the computer program includes program instructions; the one or more processors call the program instructions so that the electronic device executes the method as described in any one of claims 1-6.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

9. A chip system, characterized in that: The chip system is coupled to a memory, and the chip system is used to read and execute a computer program stored in the memory to implement the method according to any one of claims 1 to 6.