Image enhancement method and device

By utilizing neural networks to process the image to be enhanced in conjunction with information from the guiding image, the distortion problem in the image enhancement process in complex scenes is solved, and the image clarity and quality are improved.

CN112712470BActive Publication Date: 2024-09-06HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201911026078.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-10-25
Publication Date
2024-09-06
Estimated Expiration
2039-10-25

AI Technical Summary

Technical Problem

Existing technologies are prone to distortion when enhancing images in complex scenes, especially facial images which have many details, resulting in poor enhancement effects.

Method used

By acquiring target object information from the guide image, a neural network is used to enhance the image to be enhanced. The clarity of the guide image is higher than that of the image to be enhanced, and the information in the guide image is used for further processing.

Benefits of technology

It effectively avoids distortion during the image enhancement process and improves the enhancement effect, especially in the detail clarity and quality of facial images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112712470B
    Figure CN112712470B
Patent Text Reader

Abstract

The embodiment of the present application provides an image enhancement method, including: acquiring a first image, the first image including a target object; acquiring a guide image according to the first image, the guide image including the target object, the clarity of the target object in the guide image is greater than the clarity of the target object in the first image; enhancing the target object in the first image through a neural network according to the target object in the guide image to obtain a target image, the target image including the enhanced target object, the clarity of the enhanced target object is greater than the clarity of the target object in the first image. In the present application, the enhanced target image will not be distorted, and the enhancement effect is good.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of electronic technology, and in particular to an image enhancement method and device. Background Art

[0002] Images taken by users often have poor quality due to external factors (such as low brightness).

[0003] In the prior art, images are often enhanced based on super-resolution processing. However, in complex scenes (such as enhancing images including faces), the enhanced images are prone to distortion due to the large number of details in the images themselves, which reduces the enhancement effect. Summary of the invention

[0004] The embodiments of the present application provide an image enhancement method and device, which enhances the image to be enhanced (first image) by using a guide image through a neural network. Since the information in the guide image is borrowed, compared with the traditional face enhancement technology that directly processes the image to be enhanced, there is no distortion and the enhancement effect is better.

[0005] In a first aspect, an embodiment of the present application provides an image enhancement method, the method comprising:

[0006] Acquire a first image, wherein the first image includes a target object;

[0007] Acquire a guide image according to the first image, the guide image including the target object, and the clarity of the target object in the guide image is greater than the clarity of the target object in the first image;

[0008] The target object in the first image is enhanced through a neural network according to the target object in the guide image to obtain a target image, wherein the target image includes the enhanced target object, and the clarity of the enhanced target object is greater than the clarity of the target object in the first image.

[0009] The present application provides an image enhancement method, including: acquiring a first image, the first image including a target object; acquiring a guide image according to the first image, the guide image including the target object, the clarity of the target object in the guide image is greater than the clarity of the target object in the first image; enhancing the target object in the first image through a neural network according to the target object in the guide image to obtain a target image, the target image including the enhanced target object, the clarity of the enhanced target object is greater than the clarity of the target object in the first image. In the above manner, the guide image is used to enhance the image to be enhanced (the first image) through a neural network. Since the information in the guide image is used, compared with the traditional face enhancement technology that directly processes the image to be enhanced, no distortion will occur, and the enhancement effect is better.

[0010] In an optional design of the first aspect, the target object includes at least one of the following objects: a face, an eye, an ear, a nose, an eyebrow or a mouth of the same person.

[0011] In an optional design of the first aspect, a difference between a posture of the target object in the guide image and a posture of the target object in the first image is within a preset range.

[0012] In an optional design of the first aspect, the step of following according to the first image includes:

[0013] The guide image is determined from the at least one second image according to a difference between a posture of the target object in the first image and a posture of each of the at least one second image.

[0014] In an optional design of the first aspect, before determining the difference between a posture of the target object in the first image and a posture of each second image in at least one second image, the method further includes:

[0015] Displaying a first image selection interface, wherein the first image selection interface includes at least one image;

[0016] A first image selection instruction is received, where the first image selection instruction indicates selecting the at least one second image from at least one image included in the first image selection interface.

[0017] In an optional design of the first aspect, the step of following according to the first image includes:

[0018] Determine at least one third image according to the posture of the target object in the first image, wherein each of the at least one third image includes the target object, and a difference between the posture of the target object included in each third image and the posture of the target object in the first image is within a preset range;

[0019] displaying a second image selection interface, wherein the second image selection interface includes the at least one third image;

[0020] A second image selection instruction is received, where the second image selection instruction indicates selecting the guide image from at least one third image included in the second image selection interface.

[0021] In an optional design of the first aspect, the difference between the posture of the target object in the guide image and the posture of the target object in the first image is within a preset range, including:

[0022] The difference between the contour shape of the target object in the guide image and the contour shape of the target object in the first image is within a preset range.

[0023] In an optional design of the first aspect, the clarity of the target object in the guide image is greater than the clarity of the target object in the first image.

[0024] In an optional design of the first aspect, the target image includes an enhanced target object, and a guide image feature of the enhanced target object is closer to the target object in the guide image than the target object in the first image, wherein the guide image feature includes at least one of the following image features:

[0025] Dynamic range of brightness, hue, contrast, saturation, texture information, and contour information.

[0026] In an optional design of the first aspect, the target image includes an enhanced target object, and the clarity of the enhanced target object is greater than the clarity of the target object in the first image.

[0027] In an optional design of the first aspect, the target image includes an enhanced target object, and a posture of the enhanced target object is different from a posture of the target object in the first image within a preset range.

[0028] In an optional design of the first aspect, acquiring the first image includes:

[0029] Display the camera shooting interface;

[0030] receiving a shooting operation of a user, and acquiring the first image in response to the shooting operation; or

[0031] or, displaying a camera album interface, wherein the album interface includes a plurality of images;

[0032] A third image selection instruction is received, where the third image selection instruction indicates selecting the first image from a plurality of images included in the album interface.

[0033] In an optional design of the first aspect, acquiring the guidance image includes:

[0034] The guide image sent by the server is received.

[0035] In a second aspect, the present application provides an image enhancement device, which is applied to an electronic device or a server, and the image enhancement device includes:

[0036] an acquisition module, configured to acquire a first image, wherein the first image includes a target object; and acquire a guide image according to the first image, wherein the guide image includes the target object, and the clarity of the target object in the guide image is greater than the clarity of the target object in the first image;

[0037] A processing module is used to enhance the target object in the first image through a neural network according to the target object in the guide image to obtain a target image, wherein the target image includes the enhanced target object, and the clarity of the enhanced target object is greater than the clarity of the target object in the first image.

[0038] In an optional design of the second aspect, a difference between a posture of the target object in the guide image and a posture of the target object in the first image is within a preset range.

[0039] In an optional design of the second aspect, the acquisition module is specifically used to:

[0040] The guide image is determined from the at least one second image according to a difference between a posture of the target object in the first image and a posture of each of the at least one second image.

[0041] In an optional design of the second aspect, the electronic module further includes:

[0042] A display module, configured to display a first image selection interface, wherein the first image selection interface includes at least one image;

[0043] The receiving module is used to receive a first image selection instruction, where the first image selection instruction indicates selecting the at least one second image from at least one image included in the first image selection interface.

[0044] In an optional design of the second aspect, the processing module is specifically used to:

[0045] Determine at least one third image according to the posture of the target object in the first image, wherein each of the at least one third image includes the target object, and a difference between the posture of the target object included in each third image and the posture of the target object in the first image is within a preset range;

[0046] The display module is further used to display a second image selection interface, where the second image selection interface includes the at least one third image;

[0047] The receiving module is further configured to receive a second image selection instruction, where the second image selection instruction indicates selecting the guide image from at least one third image included in the second image selection interface.

[0048] In an optional design of the second aspect, the target image includes an enhanced target object, and a guide image feature of the enhanced target object is closer to the target object in the guide image than the target object in the first image, wherein the guide image feature includes at least one of the following image features:

[0049] Dynamic range of brightness, hue, contrast, saturation, texture information, and contour information.

[0050] In an optional design of the second aspect, the target image includes an enhanced target object, and a difference between a posture of the enhanced target object and a posture of the target object in the first image is within a preset range.

[0051] In an optional design of the second aspect, the display module is further used for:

[0052] Display the camera shooting interface;

[0053] The acquisition module is specifically configured to receive a shooting operation of a user, and acquire the first image in response to the shooting operation;

[0054] Or, the display module is further used for:

[0055] Displaying a camera album interface, wherein the album interface includes a plurality of images;

[0056] The acquisition module is specifically used to receive a third image selection instruction, where the third image selection instruction indicates selecting the first image from a plurality of images included in the album interface.

[0057] In an optional design of the second aspect, the acquisition module is specifically used to:

[0058] The guide image sent by the server is received.

[0059] In a third aspect, the present application provides an image enhancement method, comprising:

[0060] Receiving a first image sent by an electronic device, wherein the first image includes a target object;

[0061] Acquire a guide image according to the first image, the guide image including the target object, and the clarity of the target object in the guide image is greater than the clarity of the target object in the first image;

[0062] The target object in the first image is enhanced through a neural network according to the target object in the guide image to obtain a target image, wherein the target image includes the enhanced target object, and the clarity of the enhanced target object is greater than the clarity of the target object in the first image.

[0063] The target image is sent to the electronic device.

[0064] In an optional design of the third aspect, the target object includes at least one of the following objects: a face, an eye, an ear, a nose, an eyebrow or a mouth of the same person.

[0065] In an optional design of the third aspect, a difference between a posture of the target object in the guide image and a posture of the target object in the first image is within a preset range.

[0066] In an optional design of the third aspect, the target image includes an enhanced target object, and a guide image feature of the enhanced target object is closer to the target object in the guide image than the target object in the first image, wherein the guide image feature includes at least one of the following image features:

[0067] Dynamic range of brightness, hue, contrast, saturation, texture information, and contour information.

[0068] In an optional design of the third aspect, the target image includes an enhanced target object, and a difference between a posture of the enhanced target object and a posture of the target object in the first image is within a preset range.

[0069] In a fourth aspect, the present application provides a server, including:

[0070] a receiving module, configured to receive a first image sent by an electronic device, wherein the first image includes a target object; and obtain a guide image according to the first image, wherein the guide image includes the target object, and the clarity of the target object in the guide image is greater than the clarity of the target object in the first image;

[0071] A processing module is used to enhance the target object in the first image through a neural network according to the target object in the guide image to obtain a target image, wherein the target image includes the enhanced target object, and the clarity of the enhanced target object is greater than the clarity of the target object in the first image.

[0072] A sending module is used to send the target image to the electronic device.

[0073] In an optional design of the fourth aspect, the target object includes at least one of the following objects: a face, an eye, an ear, a nose, an eyebrow or a mouth of the same person.

[0074] In an optional design of the fourth aspect, a difference between a posture of the target object in the guide image and a posture of the target object in the first image is within a preset range.

[0075] In an optional design of the fourth aspect, the target image includes an enhanced target object, and a guide image feature of the enhanced target object is closer to the target object in the guide image than the target object in the first image, wherein the guide image feature includes at least one of the following image features:

[0076] Dynamic range of brightness, hue, contrast, saturation, texture information, and contour information.

[0077] In an optional design of the fourth aspect, the target image includes an enhanced target object, and a difference between a posture of the enhanced target object and a posture of the target object in the first image is within a preset range.

[0078] In a fifth aspect, an embodiment of the present application provides an image enhancement method, the method comprising:

[0079] Acquire a first image, wherein the first image includes a target object;

[0080] Acquire a guide image according to the first image, the guide image including the target object, and the clarity of the target object in the guide image is greater than the clarity of the target object in the first image;

[0081] The target object in the first image is enhanced according to the target object in the guide image to obtain a target image, wherein the target image includes the enhanced target object, and the clarity of the enhanced target object is greater than the clarity of the target object in the first image.

[0082] In an optional design of the fifth aspect, the target object is the moon.

[0083] In a sixth aspect, the present application provides an electronic device comprising: one or more processors; one or more memories; multiple applications; and one or more programs, wherein the one or more programs are stored in the memories, and when the one or more programs are executed by the processor, the electronic device performs the steps of any one of the above-mentioned first aspect and possible implementation methods of the first aspect.

[0084] In the seventh aspect, the present application provides a server, comprising: one or more processors; one or more memories; and one or more programs, wherein the one or more programs are stored in the memories, and when the one or more programs are executed by the processors, the server performs the steps of any one of the above-mentioned first aspect, third aspect, possible implementation method of the first aspect and possible implementation method of the third aspect.

[0085] In an eighth aspect, the present application provides a device, which is included in an electronic device, and has the function of implementing any electronic device behavior in the first aspect above. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above functions. For example, a display module, an acquisition module, a processing module, etc.

[0086] In a ninth aspect, the present application provides an electronic device, comprising: a touch display screen, wherein the touch display screen comprises a touch-sensitive surface and a display; a camera; one or more processors; a memory; a plurality of applications; and one or more computer programs. The one or more computer programs are stored in the memory, and the one or more computer programs comprise instructions. When the instructions are executed by the electronic device, the electronic device performs the image enhancement method in any possible implementation of the first aspect.

[0087] In a tenth aspect, the present application provides a computer storage medium comprising computer instructions, which, when executed on an electronic device or a server, enables the electronic device to execute any possible image enhancement method in any of the above aspects.

[0088] In an eleventh aspect, the present application provides a computer program product, which, when executed on an electronic device or a server, enables the electronic device to execute any possible image enhancement method according to any of the above aspects.

[0089] The present application provides an image enhancement method, including: acquiring a first image, the first image including a target object; acquiring a guide image according to the first image, the guide image including the target object, the clarity of the target object in the guide image is greater than the clarity of the target object in the first image; enhancing the target object in the first image through a neural network according to the target object in the guide image to obtain a target image, the target image including the enhanced target object, the clarity of the enhanced target object is greater than the clarity of the target object in the first image. In the above manner, the guide image is used to enhance the image to be enhanced (the first image) through a neural network. Since the information in the guide image is used, compared with the traditional face enhancement technology that directly processes the image to be enhanced, no distortion will occur, and the enhancement effect is better. BRIEF DESCRIPTION OF THE DRAWINGS

[0090] Figure 1 A schematic diagram of an application scenario architecture of an embodiment of the present application;

[0091] Figure 2 A schematic diagram of the structure of an electronic device;

[0092] Figure 3a is a software structure block diagram of the electronic device of the embodiment of the present application;

[0093] Figure 3b A schematic diagram of an embodiment of an image enhancement method provided in an embodiment of the present application;

[0094] FIG4( a) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0095] FIG4( b ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0096] FIG4( c ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0097] FIG4( d ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0098] FIG5( a) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0099] FIG5( b ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0100] FIG5( c ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0101] FIG6( a) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0102] FIG6( b ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0103] FIG6( c ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0104] FIG. 7( a ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0105] FIG. 7( b ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0106] FIG7( c ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0107] Figure 8 is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0108] Fig. 9 is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0109] FIG10( a) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0110] FIG10( b ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0111] FIG10( c ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0112] FIG10( d ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0113] FIG10( e ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0114] FIG10( f) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0115] FIG11( a) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0116] FIG11( b ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0117] FIG11( c ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0118] FIG12( a) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0119] FIG12( b ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0120] FIG12( c ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0121] FIG12( d ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0122] FIG12( e) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0123] FIG13( a) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0124] FIG13( b ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0125] FIG13( c ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0126] FIG14( a) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0127] FIG14( b ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0128] FIG14( c ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0129] FIG15( a) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0130] FIG15( b ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0131] FIG15( c ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0132] FIG15( d ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0133] FIG16( a) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0134] FIG16( b ) is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0135] Fig.17 is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0136] Fig.18is a schematic diagram of an example of an image enhancement processing interface provided in an embodiment of the present application;

[0137] Fig.19 A schematic diagram of an image provided in an embodiment of the present application;

[0138] FIG20( a ) is a schematic diagram of a first image;

[0139] FIG20( b ) is a schematic diagram of a guide image;

[0140] FIG. 21( a ) is a schematic diagram of a guide image;

[0141] FIG21( b ) is a schematic diagram of a guide image;

[0142] FIG21( c ) is a schematic diagram of face region recognition;

[0143] FIG22( a ) is a schematic diagram of a target object;

[0144] FIG22( b ) is a schematic diagram of a target object;

[0145] FIG23( a ) is a schematic diagram of a target object;

[0146] FIG23( b ) is a schematic diagram of a target object after registration;

[0147] FIG23( c ) is a schematic diagram of comparison between a target object and a registered target object;

[0148] FIG23( d ) is a schematic diagram of image enhancement;

[0149] FIG23( e ) is a schematic diagram of an image enhancement;

[0150] FIG23( f) is a schematic diagram of image enhancement;

[0151] FIG23( g) is a schematic diagram of image enhancement;

[0152] Fig.24 A schematic diagram of an embodiment of an image enhancement method provided in an embodiment of the present application;

[0153] Fig.25a A system architecture diagram of an image enhancement system provided in an embodiment of the present application;

[0154] Fig.25b A schematic diagram of a convolution operation performed on an image by a convolution kernel provided in an embodiment of the present application;

[0155] Fig.25c A schematic diagram of a neural network provided in an embodiment of the present application;

[0156] Fig.26 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0157] Fig. 27 A schematic diagram of the structure of a server provided in an embodiment of the present application;

[0158] Fig.28 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0159] Fig.29 This is a schematic diagram of the structure of a server provided in an embodiment of the present application;

[0160] Fig.30 A schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION

[0161] The embodiments of the present application provide an image enhancement method, an electronic device and a server. In the above manner, a guide image is used to enhance an image to be enhanced (a first image) through a neural network. Since the information in the guide image is borrowed, compared with the traditional face enhancement technology that directly processes the image to be enhanced, no distortion will occur and the enhancement effect is better.

[0162] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0163] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0164] Reference Figure 1 , Figure 1 This is a schematic diagram of an application scenario architecture of an embodiment of the present application. Figure 1 As shown in the figure, the image enhancement method provided in the embodiment of the present application can be implemented based on the electronic device 101, and the image enhancement method provided in the embodiment of the present application can also be implemented based on the interaction between the electronic device 101 and the server 102.

[0165] The image enhancement method provided in the embodiments of the present application can be applied to electronic devices such as mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR) / virtual reality (VR) devices, laptop computers, ultra-mobile personal computers (UMPC), netbooks, personal digital assistants (PDA), etc. The embodiments of the present application do not impose any restrictions on the specific types of electronic devices.

[0166] For example, Figure 2 The structure diagram of the electronic device 200 is shown. The electronic device 200 may include a processor 210, an external memory interface 220, an internal memory 221, a universal serial bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 250, a wireless communication module 260, an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, an earphone interface 270D, a sensor module 280, a button 290, a motor 291, an indicator 292, a camera 293, a display screen 294, and a subscriber identification module (SIM) card interface 295. The sensor module 280 may include a pressure sensor 280A, a gyroscope sensor 280B, an air pressure sensor 280C, a magnetic sensor 280D, an acceleration sensor 280E, a distance sensor 280F, a proximity light sensor 280G, a fingerprint sensor 280H, a temperature sensor 280J, a touch sensor 280K, an ambient light sensor 280L, a bone conduction sensor 280M, etc.

[0167] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 200. In other embodiments of the present application, the electronic device 200 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.

[0168] The processor 210 may include one or more processing units, for example, the processor 210 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.

[0169] The controller may be the nerve center and command center of the electronic device 200. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0170] The processor 210 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 210 is a cache memory. The memory may store instructions or data that the processor 210 has just used or cyclically used. If the processor 210 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 210, and thus improves the efficiency of the system.

[0171] In some embodiments, the processor 210 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0172] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 210 may be coupled to the touch sensor 280K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces. For example: the processor 210 may be coupled to the touch sensor 280K through the I2C interface, so that the processor 210 communicates with the touch sensor 280K through the I2C bus interface to realize the touch function of the electronic device 200.

[0173] The I2S interface can be used for audio communication. In some embodiments, the processor 210 can include multiple I2S buses. The processor 210 can be coupled to the audio module 270 via the I2S bus to achieve communication between the processor 210 and the audio module 270.

[0174] The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 270 and the wireless communication module 260 can be coupled via a PCM bus interface. In some embodiments, the audio module 270 can also transmit audio signals to the wireless communication module 260 via the PCM interface to realize the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.

[0175] The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 210 and the wireless communication module 260. For example, the processor 210 communicates with the Bluetooth module in the wireless communication module 260 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 270 can transmit an audio signal to the wireless communication module 260 through the UART interface to implement the function of playing music through a Bluetooth headset.

[0176] The MIPI interface can be used to connect the processor 210 with peripheral devices such as the display screen 294 and the camera 293. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 210 and the camera 293 communicate via the CSI interface to realize the shooting function of the electronic device 200. The processor 210 and the display screen 294 communicate via the DSI interface to realize the display function of the electronic device 200.

[0177] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 210 with the camera 293, the display screen 294, the wireless communication module 260, the audio module 270, the sensor module 280, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.

[0178] The USB interface 230 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 230 can be used to connect a charger to charge the electronic device 200, and can also be used to transfer data between the electronic device 200 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.

[0179] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 200. In other embodiments of the present application, the electronic device 200 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0180] The charging management module 240 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 240 may receive charging input from a wired charger through the USB interface 230. In some wireless charging embodiments, the charging management module 240 may receive wireless charging input through a wireless charging coil of the electronic device 200. While the charging management module 240 is charging the battery 242, it may also power the electronic device through the power management module 241.

[0181] The power management module 241 is used to connect the battery 242, the charging management module 240 and the processor 210. The power management module 241 receives input from the battery 242 and / or the charging management module 240, and supplies power to the processor 210, the internal memory 221, the external memory, the display screen 294, the camera 293, and the wireless communication module 260. The power management module 241 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 241 can also be set in the processor 210. In other embodiments, the power management module 241 and the charging management module 240 can also be set in the same device.

[0182] The wireless communication function of the electronic device 200 can be implemented through the antenna 1, the antenna 2, the mobile communication module 250, the wireless communication module 260, the modem processor and the baseband processor.

[0183] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 200 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.

[0184] The mobile communication module 250 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 200. The mobile communication module 250 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 250 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 250 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 250 can be set in the processor 210. In some embodiments, at least some of the functional modules of the mobile communication module 250 can be set in the same device as at least some of the modules of the processor 210.

[0185] 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 (not limited to a speaker 270A, a receiver 270B, etc.), or displays an image or video through a display screen 294. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 210 and be set in the same device as the mobile communication module 250 or other functional modules.

[0186] The wireless communication module 260 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 200. The wireless communication module 260 can be one or more devices integrating at least one communication processing module. The wireless communication module 260 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 210. The wireless communication module 260 can also receive the signal to be sent from the processor 210, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0187] In some embodiments, the antenna 1 of the electronic device 200 is coupled to the mobile communication module 250, and the antenna 2 is coupled to the wireless communication module 260, so that the electronic device 200 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

[0188] The electronic device 200 implements the display function through a GPU, a display screen 294, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 294 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 210 may include one or more GPUs, which execute program instructions to generate or change display information.

[0189] The display screen 294 is used to display images, videos, etc. The display screen 294 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, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 200 may include 1 or N display screens 294, where N is a positive integer greater than 1.

[0190] The electronic device 200 can realize the shooting function through ISP, camera 293, video codec, GPU, display screen 294 and application processor.

[0191] The ISP is used to process the data fed back by the camera 293. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. The ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP can be set in the camera 293.

[0192] The camera 293 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 200 may include 1 or N cameras 293, where N is a positive integer greater than 1.

[0193] For example, in the image processing method provided in this application, the camera can capture images and display the captured images in the preview interface. The photosensitive element converts the captured light signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for related image processing.

[0194] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 200 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0195] Video codecs are used to compress or decompress digital videos. The electronic device 200 may support one or more video codecs. Thus, the electronic device 200 may play or record videos in a variety of coding formats, such as moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0196] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of the electronic device 200 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.

[0197] The external memory interface 220 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 200. The external memory card communicates with the processor 210 through the external memory interface 220 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0198] The internal memory 221 can be used to store computer executable program codes, which include instructions. The processor 210 executes various functional applications and data processing of the electronic device 200 by running the instructions stored in the internal memory 221. The internal memory 221 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 200 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 221 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0199] The electronic device 200 can implement audio functions such as music playing and recording through the audio module 270, the speaker 270A, the receiver 270B, the microphone 270C, the headphone jack 270D, and the application processor.

[0200] The audio module 270 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signal. The audio module 270 can also be used to encode and decode audio signals. In some embodiments, the audio module 270 can be arranged in the processor 210, or some functional modules of the audio module 270 can be arranged in the processor 210.

[0201] The speaker 270A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 200 can listen to music or listen to a hands-free call through the speaker 270A.

[0202] The receiver 270B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 200 receives a call or voice message, the voice can be received by placing the receiver 270B close to the human ear.

[0203] Microphone 270C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to the microphone 270C to input the sound signal into the microphone 270C. The electronic device 200 can be provided with at least one microphone 270C. In other embodiments, the electronic device 200 can be provided with two microphones 270C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 200 can also be provided with three, four or more microphones 270C to collect sound signals, reduce noise, identify the sound source, realize directional recording function, etc.

[0204] The earphone interface 270D is used to connect a wired earphone and can be a USB interface 230 or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0205] The pressure sensor 280A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 280A can be set on the display screen 294. There are many types of pressure sensors 280A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 280A, the capacitance between the electrodes changes. The electronic device 200 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 294, the electronic device 200 detects the touch operation intensity according to the pressure sensor 280A. The electronic device 200 can also calculate the touch position according to the detection signal of the pressure sensor 280A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.

[0206] The gyro sensor 280B can be used to determine the motion posture of the electronic device 200. In some embodiments, the angular velocity of the electronic device 200 around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 280B. The gyro sensor 280B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 280B detects the angle of the electronic device 200 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 200 through reverse movement to achieve anti-shake. The gyro sensor 280B can also be used for navigation and somatosensory game scenes.

[0207] The air pressure sensor 280C is used to measure air pressure. In some embodiments, the electronic device 200 calculates the altitude through the air pressure value measured by the air pressure sensor 280C to assist in positioning and navigation.

[0208] The magnetic sensor 280D includes a Hall sensor. The electronic device 200 can use the magnetic sensor 280D to detect the opening and closing of the flip leather case. In some embodiments, when the electronic device 200 is a flip phone, the electronic device 200 can detect the opening and closing of the flip cover according to the magnetic sensor 280D. Then, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, the flip cover automatic unlocking and other features are set.

[0209] The acceleration sensor 280E can detect the magnitude of the acceleration of the electronic device 200 in all directions (generally three axes). When the electronic device 200 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.

[0210] The distance sensor 280F is used to measure the distance. The electronic device 200 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 200 can use the distance sensor 280F to measure the distance to achieve fast focusing.

[0211] For example, in the image processing method provided in the present application, during the process of the camera capturing an image, the autofocus process can measure the distance based on the distance sensor 280F, thereby achieving fast autofocus.

[0212] The proximity light sensor 280G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 200 emits infrared light outward through the light emitting diode. The electronic device 200 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 200. When insufficient reflected light is detected, the electronic device 200 can determine that there is no object near the electronic device 200. The electronic device 200 can use the proximity light sensor 280G to detect that the user holds the electronic device 200 close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 280G can also be used in leather case mode and pocket mode to automatically unlock and lock the screen.

[0213] The ambient light sensor 280L is used to sense the ambient light brightness. The electronic device 200 can adaptively adjust the brightness of the display screen 294 according to the perceived ambient light brightness. The ambient light sensor 280L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 280L can also cooperate with the proximity light sensor 280G to detect whether the electronic device 200 is in a pocket to prevent accidental touch.

[0214] The fingerprint sensor 280H is used to collect fingerprints. The electronic device 200 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access application locks, fingerprint photography, fingerprint answering calls, etc.

[0215] The temperature sensor 280J is used to detect temperature. In some embodiments, the electronic device 200 uses the temperature detected by the temperature sensor 280J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 280J exceeds a threshold, the electronic device 200 reduces the performance of the processor located near the temperature sensor 280J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 200 heats the battery 242 to avoid abnormal shutdown of the electronic device 200 due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device 200 performs a boost on the output voltage of the battery 242 to avoid abnormal shutdown caused by low temperature.

[0216] The touch sensor 280K is also called a "touch panel". The touch sensor 280K can be set on the display screen 294, and the touch sensor 280K and the display screen 294 form a touch screen, also called a "touch screen". The touch sensor 280K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 294. In other embodiments, the touch sensor 280K can also be set on the surface of the electronic device 200, which is different from the position of the display screen 294.

[0217] The bone conduction sensor 280M can obtain a vibration signal. In some embodiments, the bone conduction sensor 280M can obtain a vibration signal of a vibrating bone block of the vocal part of the human body. The bone conduction sensor 280M can also contact the human pulse to receive a blood pressure beat signal. In some embodiments, the bone conduction sensor 280M can also be set in an earphone and combined into a bone conduction earphone. The audio module 270 can parse out a voice signal based on the vibration signal of the vibrating bone block of the vocal part obtained by the bone conduction sensor 280M to realize a voice function. The application processor can parse the heart rate information based on the blood pressure beat signal obtained by the bone conduction sensor 280M to realize a heart rate detection function.

[0218] The key 290 includes a power key, a volume key, etc. The key 290 can be a mechanical key or a touch key. The electronic device 200 can receive key input and generate key signal input related to user settings and function control of the electronic device 200.

[0219] Motor 291 can generate vibration prompts. Motor 291 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 294, motor 291 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0220] Indicator 292 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.

[0221] The SIM card interface 295 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 200 by inserting it into the SIM card interface 295 or pulling it out from the SIM card interface 295. The electronic device 200 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 295 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 295 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 295 can also be compatible with different types of SIM cards. The SIM card interface 295 can also be compatible with external memory cards. The electronic device 200 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device 200 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 200 and cannot be separated from the electronic device 200.

[0222] The software system of the electronic device 200 may 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 of the layered architecture as an example to exemplify the software structure of the electronic device 200.

[0223] Figure 3a 1 is a software structure diagram of the electronic device 200 of the embodiment of the present application. The layered architecture divides the software into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, respectively, the application layer, the application framework layer, the Android runtime (Android runtime) and the system library, and the kernel layer. The application layer can include a series of application packages.

[0224] like Figure 3a As shown, the application package may include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.

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

[0226] like Figure 3a 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, and the like.

[0227] 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.

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

[0229] 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.

[0230] The phone manager is used to provide communication functions of the electronic device 200, such as management of call status (including connecting, hanging up, etc.).

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

[0232] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay 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 a chart or scroll bar text, such as notifications of 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 displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.

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

[0234] 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.

[0235] 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.

[0236] The system library may include multiple functional modules, such as surface manager, media libraries, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.

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

[0238] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

[0239] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing. The 2D graphics engine is a drawing engine for 2D drawing. The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.

[0240] For ease of understanding, the following embodiments of the present application will be described in detail with Figure 2 and Figure 3a Taking the electronic device with the structure shown as an example, an image enhancement method provided in an embodiment of the present application is specifically described in combination with the accompanying drawings and application scenarios.

[0241] Reference Figure 3b , Figure 3b A schematic diagram of an embodiment of an image enhancement method provided in an embodiment of the present application is shown in FIG. Figure 3b As shown in the figure, an image enhancement method provided by an embodiment of the present application includes:

[0242] 301. An electronic device acquires a first image, where the first image includes a target object.

[0243] In the embodiment of the present application, the electronic device can determine the first image that needs to be enhanced based on the user's selection.

[0244] In the embodiment of the present application, the first image may include a target object obtained by photographing a human face, wherein the target object may be a human face.

[0245] Next, it is introduced how the electronic device acquires the first image.

[0246] Optionally, in an embodiment, the first image may be a facial image obtained by a user taking real-time photos of the face using a camera (eg, a camera) of an electronic device.

[0247] Optionally, in one embodiment, the user selects a stored facial image from a local gallery or a cloud album of the electronic device, where the cloud album may refer to an online album located on a cloud computing platform.

[0248] Optionally, in one embodiment, the electronic device may determine whether images stored in a local album can be enhanced, and based on the determination result, prompt the user to enhance the images that can be enhanced, and then the user may select a first image from the images that can be enhanced prompted by the electronic device.

[0249] Optionally, in another scenario, the electronic device may set an enhanced function in the shooting interface, and accordingly, without the need for user selection, after the user captures the image, the electronic device may automatically use the image captured by the user as the first image.

[0250] Next, we will explain them separately:

[0251] First, a user captures a first image to be enhanced by using a camera of an electronic device.

[0252] In this embodiment, the electronic device may display a shooting interface of the camera, receive a shooting operation of the user, and acquire the first image in response to the shooting operation.

[0253] Specifically, the electronic device can display the camera's shooting interface. After the camera is aimed at a face, the user can click the shooting control in the shooting interface. Accordingly, the electronic device can receive the user's shooting operation, respond to the shooting operation, shoot, and obtain the first image, wherein the first image includes a target object corresponding to the face or a local area of ​​the face.

[0254] Specifically, FIG. 4(a) is a schematic diagram of an example of an image enhancement processing interface (graphical user interface, GUI) provided in an embodiment of the present application. FIG. 4(a) illustrates that in the unlocked mode of a mobile phone, the screen display system of the mobile phone displays the currently output interface content 401, and the interface content 401 is the main interface of the mobile phone. The interface content 401 displays a plurality of third-party applications (applications, Apps), such as Alipay, task card store, Weibo, photo album, WeChat, card wallet, settings, and camera. It should be understood that the interface content 401 may also include other more applications, and the present application does not limit this.

[0255] When the mobile phone detects that the user clicks the icon 402 of the camera application on the main interface 401, the camera application can be started and the interface shown in FIG. 4( b) can be displayed, which can be called the camera shooting interface 403. The shooting interface 403 may include a viewfinder, an album icon 404, a shooting control 405, and a camera rotation control 406.

[0256] Among them, the viewfinder is used to obtain the preview image of the shooting, and the preview image is displayed in real time, such as the preview image of a face in Figure 4(b). The album icon 404 is used to quickly enter the album. When the mobile phone detects that the user clicks the album icon 404, it can display the photos or videos that have been taken on the touch screen, or display the photos or videos downloaded and saved from the network. The shooting control 405 is used to take photos or videos. When the mobile phone detects that the user clicks the shooting control 405, the mobile phone performs the shooting operation and saves the taken photos; or, when the mobile phone is in the video recording mode, after the user clicks the shooting control 405, the mobile phone performs the video recording operation and saves the recorded video. The camera rotation control 406 can be used to control the switching of the front camera and the rear camera.

[0257] In addition, the shooting interface 403 also includes functional controls for setting shooting modes, such as portrait mode, photo mode, video mode, professional mode and more modes in Figure 4(b). It should be understood that when the user clicks icon 402, in response to the click operation, the mobile phone opens the camera application by default in the photo mode, and this application does not limit this.

[0258] As shown in FIG4(b), in the normal photographing mode, the user can click the photographing control 405 to take a photograph. In response to the user clicking the photographing control 405, the mobile phone performs a photographing operation and acquires a first image obtained by taking the photograph.

[0259] In one embodiment, after the user takes a photo using a camera of an electronic device, the image quality of the first image taken is low. It should be noted that the low image quality of the first image can be understood as the low image quality of the face area in the first image, or the low image quality of a part of the face area (such as a certain facial feature) in the first image, which is not limited here. It should be noted that the low image quality can be judged based on the user's vision. Exemplarily, the low image quality can include at least one of the following image features: poor brightness, poor hue, and low detail clarity, for example: poor brightness or hue of the face, low detail clarity of the face, poor brightness or hue of one or more facial features, or low detail clarity of one or more facial features.

[0260] At this time, the user can enhance the first image captured, for example, by clicking the "Enhance" control shown in FIG. 4(c). As shown in FIG. 4(c), after executing the shooting operation, the mobile phone can display the captured photo in the photo display area 409. In addition, the display interface of the mobile phone can also display the "Enhance" control and the "Save" control. The user can click the "Save" control. Accordingly, the mobile phone can receive a save instruction. In response to the save instruction, the captured photo is saved in the album icon 404. In addition, the user can click the "Enhance" control. Accordingly, the mobile phone can receive an enhancement instruction. In response to the enhancement instruction, the mobile phone can determine that the user wants to enhance the photo displayed on the current display interface. It should be noted that, for the convenience of description, the image to be enhanced is referred to as the first image below.

[0261] The above describes an embodiment in which a mobile phone enhances a first image captured. Optionally, in another scenario, a user may directly select a first image to be enhanced from an album.

[0262] In this embodiment, the electronic device may display a camera album interface, the album interface including multiple images, and receive a third image selection instruction, the third image selection instruction indicating selection of the first image from the multiple images included in the album interface.

[0263] Specifically, as shown in FIG5(a), FIG5(a) shows an image display interface of an album, which may include images previously taken by a user and images downloaded from a network, etc. As shown in FIG5(b), a user may select one of the images, for example, by clicking or long pressing the selected image. In response to the above operation, the mobile phone may display an interface as shown in FIG5(c), wherein, in addition to conventional image previews and “delete” controls, an “enhance” control may also be included. The user may click on the “enhance” control. In response to the user clicking on the “enhance” control, the mobile phone may enhance the image, for example, may display an enhancement area selection interface as shown in FIG4(d).

[0264] It should be noted that the control settings and display contents in the above embodiments are only for illustration and are not limited in this application.

[0265] Optionally, in another scenario, the mobile phone may determine whether the images stored in the local photo album can be enhanced, and based on the determination result, prompt the user to enhance the images that can be enhanced.

[0266] Specifically, the mobile phone can make judgments based on the dynamic range of the brightness, hue, skin texture, and whether there are high-definition guide images with similar facial postures of the photos. For example, the brightness of the first image in Figure 6(a) is lower than that of the second image, and the facial posture therein is similar to that of the first image. Therefore, the first image can be determined as an image that can be enhanced. Exemplarily, as shown in FIG6(a), FIG6(a) shows an image display interface of an album, wherein the interface includes, in addition to images previously taken by the user and images downloaded from the network, an "enhanced image" control. As shown in FIG6(b), the user can click on the "enhanced image" control. In response to the user's operation, the mobile phone can display an enhanceable image display interface as shown in FIG6(b). As shown in FIG6(b), the user can click on the image to be enhanced in the enhanceable image display interface. In response to the user's operation, the mobile phone can display an image preview interface as shown in FIG6(c), wherein, in addition to conventional image previews, "delete" controls, etc., an "enhance" control can also be included. The user can click on the above-mentioned "enhance" control. In response to the user clicking on the "enhance" control, the mobile phone can enhance the image, for example, it can display an enhancement area selection interface as shown in FIG4(d).

[0267] It should be noted that the control settings and display contents in the above embodiments are only for illustration and are not limited in this application.

[0268] Optionally, in another scenario, the mobile phone can set enhancement functions in the shooting interface.

[0269] Exemplarily, as shown in FIG. 7(a), the shooting interface 403 includes a functional control for setting the shooting mode, such as the portrait mode, the photo mode, the video mode, the enhancement mode and more modes in FIG. 7(a). It should be understood that when the user slides the icon of the enhancement mode to the current mode, the mobile phone enters the enhancement mode in response to the click operation. As shown in FIG. 7(b), the user can click the photo control 405, and the mobile phone responds to the operation and displays the captured image in the display interface shown in FIG. 7(c). In addition, the display interface may also include a "save" control and an "enhance" control. If the user clicks the "save" control, the mobile phone may respond to the operation without enhancing the image, but directly save it to the local album. If the user clicks the "enhance" control, the mobile phone may respond to the operation and enhance the image, for example, a guide image may be obtained, and the first image obtained by the above-mentioned shooting may be enhanced based on the guide image.

[0270] Optionally, in another embodiment, the mobile phone may enter the enhanced mode not based on the user's operation, but may determine whether to enter the enhanced mode based on an image quality analysis of the preview image on the shooting interface.

[0271] like Figure 8 As shown in , when the mobile phone recognizes that the clarity of the photographed face is too low, it can automatically enter the enhanced mode. In addition, the mobile phone can also determine whether to enter the enhanced mode based on the length of time the face appears on the preview interface, which can reduce the misjudgment rate and reduce the impact of the user's operation such as moving the mobile phone. For example, if the mobile phone recognizes that the clarity of the face photographed on the preview interface is too low, but the face only appears for 1 second, and there is no face on the preview interface within the next second, the mobile phone may not enter the enhanced mode.

[0272] It should be noted that the setting method and display content of the controls in the above interface are only for reference and are not limited here.

[0273] After the mobile phone enters the enhancement mode, the image in the image preview area can be analyzed, and a guiding image that can be used as a guiding image for the image in the image preview area can be obtained. For example, a guiding image that can meet the requirements of being a guiding image for the image in the image preview area (similar facial posture and expression, better brightness and hue, etc.) can be searched in a local album, a local enhanced image library, or a cloud enhanced image library. If a guiding image is obtained, the first image can be automatically enhanced based on the guiding image after the user takes a photo and the mobile phone obtains the first image.

[0274] After the mobile phone enters enhanced mode, Figure 8 As shown in FIG. 1 , the preview interface of the mobile phone may include a reminder box, which may be used to prompt the user to enter the enhanced mode for the current shooting. The reminder box may include text content of the enhanced mode and a close control (eg, Figure 8 )

[0275] Among them, when the user clicks the close control, in response to the user's click operation, the mobile phone shooting can exit the enhanced mode. For example, due to other operations, the user may have a face with a low dynamic range of brightness or clarity on the preview interface of the mobile phone for a certain period of time. The mobile phone recognizes the face with a low dynamic range of brightness or clarity and enters the enhanced mode. At this time, the user may not want to enter the enhanced mode to shoot a face picture; or when the user wants to exit the enhanced mode and enter the normal mode after taking a face picture, the user can click the close control in the reminder box, so that the shooting preview interface can be closed. Figure 8 Switch to the display interface of the normal mode. In addition, there may be other methods for closing the enhanced mode, which are not limited in this application.

[0276] Optionally, in another embodiment, when the mobile phone recognizes that the dynamic range of brightness or clarity of the photographed face is too low, a guide allowing the user to choose to enter the enhanced mode may be displayed.

[0277] like Fig. 9 As shown in , the preview interface of the mobile phone may include a reminder box, which can be used to prompt the user to enter the enhanced mode when selecting. The reminder box may include text content of the enhanced mode, a confirmation control, and a hidden control. Specifically, when the mobile phone recognizes that the dynamic range of the brightness or the clarity of the photographed face is too low, a guide for the user to choose to enter the enhanced mode may be displayed, such as Fig. 9 As shown in , the user can click the "Enter" control to cause the phone to enter enhanced mode.

[0278] It should be noted that the setting method and display content of the controls in the above interface are only for reference and are not limited here.

[0279] In the embodiment of the present application, the user can select the target object to be enhanced in the first image.

[0280] Specifically, the mobile phone can display a target object selection control. Specifically, as shown in Figure 4(d), the target object selection control can include an "all" control, a "facial features" control, and a "custom area" control. Among them, the "all" control can provide a function of enhancing the face area of ​​the currently taken photo, the "facial features" control can provide a function of enhancing the facial features in the currently taken photo, and the "custom area" control can provide a function of enhancing the custom area in the currently taken photo.

[0281] It should be noted that the above target object selection control is only an illustration. In actual applications, the target object selection control may also be of other types, which is not limited in this application.

[0282] 302. The electronic device obtains a guidance image according to the first image, where the guidance image includes the target object, and the clarity of the target object in the guidance image is greater than the clarity of the target object in the first image.

[0283] In an embodiment of the present application, a user can select a guide image for enhancing the first image from a local album or a cloud album, or an electronic device can select a guide image that can be used to enhance the first image, which will be explained below respectively.

[0284] First, we introduce how users can select a guide image from local photo albums or cloud photo albums.

[0285] As shown in Figure 10(a), the user can click the "All" control shown in Figure 4(d), and accordingly, the mobile phone can receive an instruction to enhance the face area of ​​the taken photo. In response to the instruction, the mobile phone can display a guide image selection interface. For the convenience of description, the guide image that serves as the enhanced first image will be referred to as the guide image below.

[0286] Optionally, as shown in FIG. 10( b ), in one embodiment, the mobile phone may display a guide image selection interface, which may include a “select from local album” control and a “smart selection” control. The user may click “select from local album”, and accordingly, the mobile phone may receive an instruction to select a guide image from the local album. In response to the instruction, the mobile phone may open the local album and display the guide image selection interface as shown in FIG. 10( c ) on the display interface. Optionally, FIG. 10( c ) may include an album display area 501 and a to-be-enhanced image display area 502 , wherein the album display area 501 may display a preview of a photo saved in the local album, and the to-be-enhanced image display area 502 may display a preview of a photo to be enhanced. The above control settings may allow the user to visually compare the to-be-enhanced image and the guide image, and select a guide image with a posture closer to the to-be-enhanced image and a higher detail clarity.

[0287] It should be understood that as used herein, the terms "high" and "low" (e.g., the terms "high quality" and "high resolution") do not refer to specific thresholds, but rather to a relationship relative to one another. Thus, a "high resolution" image does not require a resolution greater than a certain value, but has a higher resolution than a related "low resolution" image.

[0288] It should be noted that the setting of the above-mentioned guide image selection interface is only an illustration and is not limited in this application.

[0289] Optionally, as shown in FIG. 10( c ), the user can select an image from the album display area 501 as a guide image. Accordingly, the mobile phone can receive the user's picture selection instruction and obtain the image selected by the user. The mobile phone can determine the guide image selected by the user as the guide image of the image taken by the user in FIG. 4( b ).

[0290] Optionally, in one embodiment, after acquiring the guide image, the mobile phone can judge whether the posture and expression of the faces in the first image and the guide image are similar based on the similarity of the postures of the faces in the first image and the guide image. If the posture and expression of the faces in the first image and the guide image are similar, it can be determined that the guide image selected by the user can be used as the guide image of the first image; if the posture and expression of the faces in the first image and the guide image are not similar, it can be determined that the guide image selected by the user cannot be used as the guide image of the first image.

[0291] It should be noted that how to determine the similarity between the posture and expression of the face in the first image and the guide image will be described later and will not be repeated here.

[0292] Exemplarily, as shown in FIG10(c), if the user selects the first image in the album display area 501, since the first image in the album display area 501 and the first image have similar posture and expression, the mobile phone can determine that the guide image can be used as the guide image of the first image after judging the similarity of the postures of the faces in the images, and enhance the first image based on the image enhancement method. As shown in FIG10(f), after enhancing the first image based on the image enhancement method, the mobile phone can display the target image.

[0293] Exemplarily, as shown in FIG. 10( d ), if the user selects the second image in the album display area 501 , since the first image in the album display area 501 and the first image have different posture expressions (the orientation of the faces is very different), the mobile phone can determine that the guide image cannot be used as the guide image for the first image after judging the similarity of the postures of the faces in the images. At this time, the mobile phone can prompt the user to reselect the guide image. Optionally, as shown in FIG. 10( e ), the mobile phone can display a prompt on the interface saying “The posture difference is too large, please reselect” and return to the guide image selection interface shown in FIG. 10( c ), so that the user can reselect a guide image whose posture is closer to the first image. For example, if the user reselects the first image in the album display area 501, since the first image in the album display area 501 and the first image have similar postures and expressions, the mobile phone can determine that the guide image can be used as the guide image of the first image after judging the similarity of the postures of the faces in the images, and enhance the first image based on the image enhancement method. As shown in FIG10(f), after enhancing the first image based on the image enhancement method, the mobile phone can display the target image.

[0294] Optionally, in another embodiment, after the mobile phone acquires the first image and the guide image, it can send the first image and the guide image to the server. The server enhances the first image based on an image enhancement method and sends the target image to the mobile phone. Further, the mobile phone can display the target image.

[0295] How the mobile phone or the server enhances the first image based on the image enhancement method will be described later and will not be described in detail here.

[0296] Next, it is introduced how the electronic device automatically selects a guide image that can be used as the guide image of the first image.

[0297] In an embodiment of the present application, the electronic device can select an image with better brightness and tone, higher detail clarity, and high facial posture similarity from a local album or a cloud album as a guide image based on facial posture matching strategies and other image processing strategies to enhance the first image.

[0298] Exemplarily, as shown in FIG. 10( b), when the user clicks on the “Smart Select” control, the mobile phone can receive the user's click on the “Smart Select” control and select an image with better brightness and tone, higher detail clarity, and high facial posture similarity from a local album or a cloud album as a guide image based on the facial posture matching strategy and other image processing strategies to enhance the first image.

[0299] The dynamic range of brightness may refer to the number of gray levels between the brightest pixel and the darkest pixel in the target object or pixels included in the target object.

[0300] Optionally, in another embodiment, the guide image can be selected by the server without guiding the user to select. Specifically, as shown in Figure 10(b), when the user clicks the "Smart Selection" control, the mobile phone can receive the user's click on the "Smart Selection" control and send the first image to the server. The server can select an image with better brightness and tone, higher detail clarity, and high facial posture similarity from a local album or a cloud album based on facial posture matching strategies and other image processing strategies as a guide image to enhance the first image.

[0301] Optionally, in the embodiment of the present application, the mobile phone can display the target image after enhancing the first image based on the image enhancement method. In addition, other controls can be displayed on the display interface, such as the "Save" control and the "Cancel" control shown in Figure 10(f).

[0302] Specifically, if the user clicks the above-mentioned "save" control, the mobile phone can save the displayed target image to a local photo album or other storage location, such as the cloud, in response to the user's operation.

[0303] Optionally, in response to the user clicking the “Save” control, the mobile phone can save both the first image and the enhanced first image to a local photo album or other storage location, such as a cloud, etc., which is not limited here.

[0304] If the user clicks the "Cancel" control, it means that the user may not be satisfied with the enhancement effect of the target image. Optionally, the mobile phone can respond to the user clicking the "Cancel" control and return to the camera shooting interface, such as the interface shown in Figure 4(b). Alternatively, the mobile phone can respond to the user clicking the "Cancel" control and return to the interface in Figure 10(b), prompting the user to re-select the guide image. Alternatively, the mobile phone can respond to the user clicking the "Cancel" control and return to the interface shown in Figure 10(c), prompting the user to re-select the guide image.

[0305] It should be noted that the control types of the above-mentioned interfaces and the display contents of the mobile phone display interface are merely illustrative and are not limited in this application.

[0306] Optionally, in one embodiment, the user may enhance only a local area in the first image, for example, only enhance one or more facial features, or other areas in the first image, which is not limited here.

[0307] Specifically, as shown in FIG. 11( a ), the user can click on the “facial features” control shown therein, and accordingly, the mobile phone can receive an instruction to enhance the facial features area of ​​the taken photo. In response to the instruction, the mobile phone can display a facial features area selection interface.

[0308] Optionally, as shown in FIG. 11( b), in one embodiment, the mobile phone may display a facial feature area selection interface, which may include selection guide controls for each facial feature, such as the "left eye" control, "right eye" control, "lip" control, "nose" control, "left ear" control, "right ear" control, "left eyebrow" control, and "right eyebrow" control shown in FIG. 11( b). Among them, the user can click on the control corresponding to the facial feature to be enhanced, and accordingly, the mobile phone can receive an instruction from the user to click on the control corresponding to the facial feature to be enhanced, and in response to the instruction, based on the face recognition strategy, identify the facial feature area corresponding to the user's selection in the first image. Exemplarily, in FIG. 11( b), the user clicks on the "left eye" control, and accordingly, the mobile phone can receive an instruction from the user to click on the "left eye" control, and in response to the instruction, based on the face recognition strategy, identify the left eye area of ​​the face in the first image, and optionally, the mobile phone can circle the left eye area through a prompt box.

[0309] It should be noted that the control settings and display content of the above-mentioned facial feature area selection interface are only for reference and are not limited in this application.

[0310] It should be noted that how to identify the facial feature area corresponding to the user's selection in the first image based on the face recognition strategy will be described later and will not be repeated here.

[0311] Optionally, the facial features area selection interface may also include an "OK" control and a "Return" control. As shown in FIG11(c), the user may click on the "left eye" control and the "lips" control. Accordingly, the mobile phone may receive instructions from the user to click on the "left eye" control and the "lips" control. In response to the instructions, the left eye area and the lip area of ​​the face in the first image are identified based on the face recognition strategy. The user may click on the "OK" control. Accordingly, the mobile phone may receive instructions from the user to click on the "OK" control. In response to the instructions, the mobile phone may display a guide image selection interface. For the guide image selection interface, reference may be made to FIG11(b) and its corresponding description in the above embodiment, which will not be repeated here.

[0312] It should be noted that the control types of the above-mentioned interfaces and the display contents of the mobile phone display interface are merely illustrative and are not limited in this application.

[0313] Optionally, in one embodiment, as shown in FIG. 12( a), the user can click on the “Custom Area” control shown therein, which can instruct the user to select an enhanced area in the first image. Accordingly, the mobile phone can receive an instruction from the user to click on the “Custom Area” control. In response to the instruction, the mobile phone can display an enhanced area selection interface as shown in FIG. 12( b).

[0314] Optionally, FIG. 12(b) shows a schematic diagram of an enhanced area selection interface, in which the user can manually circle the enhanced area. As shown in FIG. 12(c), after the user completes the circle of the enhanced area, the mobile phone can display an "OK" control and a "Continue to Select" control. The user can click the "OK" control, and in response to the user's instruction to click the "OK" control, the mobile phone can display a guide image selection interface. The guide image selection interface can refer to FIG. 12(b) and its corresponding description in the above embodiment, and will not be repeated here.

[0315] Optionally, the user can click the "Continue Selection" control. In response to the user's instruction to click the "Continue Selection" control, the mobile phone can display an enhancement area selection interface. The user can continue to circle the enhancement area in the enhancement area selection interface, as shown in Figure 12(d). The user can manually circle the enhancement area in the enhancement area selection interface, and after the circle is completed, in the interface shown in Figure 12(e), click the "OK" control to enter the guide image selection interface.

[0316] Optionally, in another embodiment, the user can click on the "custom area" control shown therein, and the control can instruct the user to select the enhancement area in the first image. Accordingly, the mobile phone can receive the instruction of the user clicking on the "custom area" control, and in response to the instruction, the mobile phone can display the enhancement area selection interface, and the above Figure 12(b) to Figure 12(e) The difference is that, as shown in FIG13(a), the mobile phone can display a guide frame of a preset size on the display interface. For example, a rectangular frame of a preset size can be displayed in the center of the interface. The user can drag the rectangular frame to the position of the enhancement area (as shown in FIG13(a)), and change the size of the enhancement area by changing the size of the rectangular frame (as shown in FIG13(b)). Accordingly, the mobile phone can determine the enhancement area based on the user's operation on the guide frame. As shown in FIG13(c), after the user completes the circling, he clicks the "OK" control to enter the guide image selection interface, or he can click the "Continue Selection" control to enter the guide image selection interface.

[0317] Optionally, in one embodiment, the electronic device may construct an album specifically for storing the guide image.

[0318] Referring to FIG. 14(a), as shown in FIG. 14(a), when image guidance is performed, the guidance image display interface of the mobile phone can also display a "select from the guidance image gallery" control. Specifically, the user can click the "select from the guidance image gallery" control. In response to the user's operation, the mobile phone can display the interface of the guidance image gallery. As shown in FIG. 14(b), the images in the guidance image gallery can be classified based on preset rules, such as by people, scenery, animals, etc. Further, in the classification of people, it can also be classified according to different people, which is not limited in this application. As shown in FIG. 14(b), the guidance image gallery display interface may include a "people" control and a "scenery" control. When the user clicks the "people" control, a person selection interface as shown in FIG. 14(c) may be displayed, wherein the interface may include a selection control corresponding to a person's name. The user can click the corresponding control to instruct the mobile phone to display an album constructed by the image of the corresponding person. Then, the user can select a guidance image in the album displayed on the mobile phone.

[0319] Optionally, the mobile phone can install a guide image gallery application. As shown in Figure 15(a), the user can click on the icon corresponding to the "Guide Image Gallery" application. Accordingly, the mobile phone can receive the user's instruction to click on the "Guide Image Gallery" application. In response to the instruction, the mobile phone can display the display interface of the guide image gallery. Optionally, in one embodiment, the mobile phone can display the guide image gallery interface as shown in Figure 15(b). As shown in Figure 15(b), the guide image gallery display interface may include a "person" control and a "scenery" control. When the user clicks on the "person" control, a person selection interface as shown in Figure 15(c) can be displayed, wherein the interface may include a selection control corresponding to a person's name. The user can click on the corresponding control to instruct the mobile phone to display an album constructed with images of the corresponding person. As shown in Figure 15(c), the user can click on the "Zhang San" control. Accordingly, the mobile phone can obtain the user's instruction to click on the "Zhang San" control and display the album as shown in Figure 15(d).

[0320] Optionally, in one embodiment, the album display interface may further include a control for modifying the album, such as the "+" control shown in FIG. 15( d). Specifically, the user may click the "+" control to add images to the album. For example, after the user clicks the "+" control, the mobile phone may respond to the operation by displaying the local album and guiding the user to select the images to be added to the album. In addition, the user may also delete images that have been added to the album.

[0321] It should be noted that the control settings and display contents in the above-mentioned album display interface are only for illustration and are not limited in this application.

[0322] Optionally, in one embodiment, the user can directly add the displayed image into the guide image gallery from a third-party application.

[0323] As shown in FIG. 16(a), FIG. 16(a) shows a schematic diagram of a chat interface. Zhang San sends an image. After the mobile phone receives the image, it can be displayed on the chat interface. As shown in FIG. 16(b), the user can long press the image. In response to the operation, the mobile phone can display a guide for operating the image, such as Fig.17 As shown in FIG. 1 , the guide may include a “save to album” control, a “save to guide image gallery” control, and a “copy” control. The user may click the “save to guide image gallery” control, and the mobile phone may respond to the operation and save the image to the guide image gallery (e.g. Fig.17 ), or displaying the display interface as shown in FIG. 15( b), to guide the user to save the image to the album of the corresponding category.

[0324] It should be noted that the control settings and display contents in the above embodiments are only for illustration and are not limited in this application.

[0325] 303. The electronic device enhances the target object in the first image through a neural network according to the target object in the guide image to obtain a target image, wherein the target image includes the enhanced target object, and the clarity of the enhanced target object is greater than the clarity of the target object in the first image.

[0326] In an embodiment of the present application, since the image quality of the first image is relatively low (for example, the brightness or hue of the face is poor, the clarity of the face details is low, the brightness or hue of one or more facial features is poor, or the clarity of the details of one or more facial features is low), the captured first image can be enhanced. For example, by clicking the "Enhance" control as shown in Figure 4(c), the electronic device is equivalent to receiving an enhancement instruction.

[0327] Optionally, in one embodiment, the user needs to enhance an image stored in an album in the electronic device. For example, in one scenario, the user wants to send a selfie to other users, but after opening the image, finds that the image quality is very low (for example: the face brightness or tone is poor, the face details are low in clarity, one or more facial features have poor brightness or tone, or one or more facial features have low in clarity in detail). The user can open the album and enhance the selfie (first image) to be sent in the album, for example, by clicking on the "Enhance" control as shown in FIG. 12(c). Then, the electronic device is equivalent to receiving an enhancement instruction.

[0328] In an embodiment of the present application, the electronic device can enhance the target object in the first image based on the target object in the guide image through a neural network.

[0329] It should be noted that the target object can also be understood as the same facial features of different people. For example, the first image is obtained by photographing Zhang San's front face, so the first image includes Zhang San's eyes (target object). Correspondingly, the guide image is obtained by photographing Li Si's front face, so the guide image includes Li Si's eyes. If the posture information of Zhang San and Li Si's eyes is very similar, Li Si's eyes in the guide image can also be used as the target object for enhancing the target object (Zhang San's eyes).

[0330] In the embodiment of the present application, since the principle of image enhancement is to improve the image quality of the first image without making the target image too distorted compared to the first image, when it is necessary to enhance the target object in the first image, the guide image used as the guide image of the first image, wherein the target object relative to the target object and the target object have a posture difference that cannot be too large, therefore, the difference between the posture information of the target object and the posture information of the target object is within a preset range.

[0331] Optionally, in one embodiment, after receiving an enhancement instruction, the electronic device may display an album interface in response to the enhancement instruction to guide the user to select a guide image. For example, as shown in FIG15(c), the user may select a guide image in the guide image selection interface shown in FIG15(c). In response to the user's image selection operation, the electronic device may obtain a guide image corresponding to the image selection operation.

[0332] Optionally, in one embodiment, if the user needs to enhance the entire face or part of the face in the first image (how the user selects the area to be enhanced (target object) can be described with reference to Figure 4(d) and its corresponding embodiment, which will not be repeated here), at this time, the first image includes a face or part of the face (target object). Accordingly, after acquiring the guide image, the electronic device will determine whether there is a target object in the guide image that is similar to the target object in the first image.

[0333] In the embodiment of the present application, since the principle of image enhancement is to improve the image quality of the first image without making the target image too distorted compared to the first image, when it is necessary to enhance the target object in the first image, the guide image used as the guide image of the first image, wherein the target object relative to the target object and the target object have a posture difference that cannot be too large, therefore, the difference between the posture information of the target object and the posture information of the target object is within a preset range.

[0334] Next, it is described how to determine the difference between the postures of the target object in the first image and the target object in the guide image.

[0335] In one embodiment, the electronic device can determine whether there is a target object in the guide image with a similar facial posture to that in the first image based on a facial key point landmark detection method. Among them, facial key points can also be called facial feature points, which usually include points that constitute the facial features (eyebrows, eyes, nose, mouth and ears) and the facial contour. The method of detecting a facial image and marking one or more key points in the facial image can be called a facial key point detection method or a facial alignment detection method. By performing facial alignment detection on the facial image, the characteristic areas in the facial image can be determined, and the characteristic areas here can include but are not limited to: eyebrow area, eye area, nose area, mouth area, ear area, and the like.

[0336] In an embodiment of the present application, the electronic device can implement the difference judgment of the posture information between the target object and the target object based on a face key point detection model. Specifically, after acquiring the first image and the guide image, the face key point detection model can be called to perform face detection on the first image and the guide image respectively to determine multiple key points in the first image and the guide image and the annotation information of each key point. The key points here may include but are not limited to: mouth key points, eyebrow key points, eye key points, nose key points, ear key points and face contour key points, etc.; the annotation information of the key points may include but is not limited to: position annotation information (such as marking the position of the key point), shape annotation information (such as marking as a dot shape), feature information, etc., wherein the feature information is used to indicate the category of the key point. For example, if the feature information is the feature information of the eye, it indicates that the key point is the key point of the eye. If the feature information is the feature information of the nose, it indicates that the key point is the key point of the nose, and so on. The multiple key points determined in the first image and the guide image can be as follows: Fig.18 After determining a plurality of key points, the similarity between the target object and the posture information of the target object can be determined based on the annotation information of the key points and the position annotation information (for example, the pixel coordinates of the key points).

[0337] It should be noted that, before comparing the difference in posture information based on the pixel coordinates of the feature points of the target object and the target object, the electronic device may first perform cropping on the first image and the guide image so that the position and posture of the target object in the first image are close to the position and posture of the target object in the guide image. Optionally, taking the target object and the target object as a face as an example, the scope of the cropping process may be below the eyebrows (including the eyebrows), above the chin, and bounded by the edge of the face contour on the left and right (may include the ears).

[0338] Optionally, if the target object and the target object have different sizes, the cropped image may be scaled so that the target object and the target object have the same size.

[0339] Optionally, if the target object and the face of the target object are different, the cropped image can be rotated to make the target object and the target object the same. Rotation refers to rotating the target object or the target object at a certain rotation angle clockwise or counterclockwise with the target object or the center point of the target object as the origin.

[0340] Optionally, for the purpose of subsequent pixel registration, a certain area may be appropriately reserved around the circled area. Fig.19 As shown in FIG. 1 , the region 1903 is the target object and the region of the target object circled by the electronic device, and the region 1902 is a region appropriately left around the region circled by the electronic device, which is equivalent to the cropped image being Fig.19 Area 1902 and area 1903 in the.

[0341] Exemplarily, as shown in Figures 20(a) and 20(b), Figure 20(a) shows a schematic diagram of a first image, and Figure 20(b) shows a schematic diagram of a guide image, wherein the target object and the target object are faces in the first image and the guide image, respectively, however, the posture difference between the faces in Figures 20(a) and 20(b) is too large, and the electronic device can perform image processing on the guide image in Figure 20(b).

[0342] As shown in FIG. 21(a), the target object may be rotated first so that the position and posture of the rotated target object are substantially consistent with the target object, as shown in FIG. 21(b), which is a schematic diagram of the guide image after rotation. Next, the size of the target object may be scaled so that the size of the scaled target object is substantially consistent with the size of the target object, as shown in FIG. 21(c), which is a schematic diagram of the guide image after scaling.

[0343] It should be noted that this is only an illustration, and the first image in Figure 20(a) may also be processed, and this application is not limited to this.

[0344] Exemplarily, if the target object is a full face, the electronic device can obtain key points within the face range in the first image and the guide image based on the annotation information, as well as the pixel coordinates corresponding to each key point within the face range. The electronic device can calculate the sum of squares of the differences between the pixel coordinates corresponding to each key point within the face range in the first image and the guide image, respectively. If the sum of squares calculated above exceeds a preset threshold, it is considered that the difference in posture information between the target object in the first image and the target object in the guide image is too large. Optionally, after determining that the difference in posture information between the target object in the first image and the target object in the guide image is too large (not within a preset range), the electronic device can prompt the user to reselect the guide image. Specifically, reference can be made to the description in FIG. 10(d) and its corresponding embodiments, which will not be repeated here.

[0345] Exemplarily, if the target object is the left eye, the electronic device can obtain the key points within the left eye range in the first image and the guide image based on the annotation information, as well as the pixel coordinates corresponding to each key point within the left eye range. The electronic device can respectively calculate the sum of the squares of the differences between the pixel coordinates corresponding to each key point within the left eye range in the first image and the guide image. If the sum of the squares calculated above exceeds a preset threshold, it is considered that the difference in posture information between the target object in the first image and the target object in the guide image is too large. Optionally, after determining that the difference in posture information between the target object in the first image and the target object in the guide image is too large (not within a preset range), the electronic device can prompt the user to reselect the guide image. Specifically, reference can be made to the description in FIG. 10(d) and its corresponding embodiments, which will not be repeated here.

[0346] Optionally, in another embodiment, after obtaining multiple key points, the characteristic region of the target object in the first image and the characteristic region of the target object in the guide image can be determined based on the annotation information of each key point in the multiple key points. As can be seen from the foregoing, the annotation information may include: characteristic information, position annotation information, etc. Therefore, in one embodiment, the characteristic region can be determined based on the characteristic information of each key point. Specifically, the category of each target key point can be determined based on the characteristic information of each key point, and the area formed by the target key points of the same category can be used as a characteristic region, and the category can be used as the category of the characteristic region. For example, key points whose characteristic information is all the characteristic information of the nose are selected, and the categories of these key points are all nose key points; the area formed by these target key points is used as the nose area.

[0347] In another embodiment, the feature area can be determined based on the position annotation information of each key point. Specifically, the annotation position of each key point can be determined based on the position annotation information, and the key points at adjacent positions can be connected. If the shape obtained by the connection is similar to any one of the facial features (eyebrows, eyes, nose, mouth, ears), the area formed by the key points at these adjacent positions is determined as the feature area, and the category of the feature area is determined based on the shape. For example, if the shape obtained by connecting the target key points at adjacent positions is similar to the shape of the nose, the area formed by the key points at these adjacent positions can be determined as the nose area. Accordingly, the electronic device can determine the difference between the posture information of the target object and the target object based on the comparison of the shape of the feature area corresponding to the target object and the shape of the feature area corresponding to the target object.

[0348] For example, if the target object is a human face, since the human face is composed of cheeks, left and right eyes, nose, lips, left and right ears, and left and right eyebrows, the electronic device can determine the cheek area, left and right eye areas, nose area, lip area, left and right ear areas, and left and right eyebrow areas in the first image, and determine the cheek area, left and right eye areas, nose area, lip area, left and right ear areas, and left and right eyebrow areas in the guide image, and respectively compare the shapes of the feature areas in the first image and the guide image:

[0349] Performing shape comparison between the left eye region in the first image and the left eye region in the guide image;

[0350] Performing shape comparison between the right eye region in the first image and the right eye region in the guide image;

[0351] Performing shape comparison of the cheek region in the first image and the cheek region in the guide image;

[0352] Compare the shape of the nose region in the first image with the nose region in the guide image;

[0353] Compare the shape of the lip region in the first image with the lip region in the guide image;

[0354] Performing shape comparison on the left ear region in the first image and the left ear region in the guide image;

[0355] Performing shape comparison on the right ear region in the first image and the right ear region in the guide image;

[0356] Performing shape comparison between the left eyebrow region in the first image and the left eyebrow region in the guide image;

[0357] Performing shape comparison between the right eyebrow region in the first image and the right eyebrow region in the guide image;

[0358] And based on the comparison result, the difference in posture information between the target object and the target object is determined. Specifically, the difference in posture information between the target object and the target object can be determined by comprehensively comparing the comparison results of each of the above-mentioned areas. For example, when the comparison result of one area is that the difference is too large, it is determined that the difference in posture information between the target object and the target object is too large. Alternatively, when the comparison result of one area is that the difference is not large, it is determined that the difference in posture information between the target object and the target object is not large. At this time, only the facial features areas with small differences can be enhanced subsequently.

[0359] It should be noted that the above-mentioned facial key point detection model can be obtained by hierarchical fitting training using a face alignment algorithm and a sample data set. The face alignment algorithm here may include but is not limited to: a machine learning regression algorithm, such as a supervised descent method (SDM), a local binary features (LBF) algorithm; or a convolutional neural network (CNN) algorithm, such as a facial landmark detection by deep multi-task learning (TCDCN) algorithm, a 3D dense face alignment (3DDFA) algorithm, etc. Based on these algorithms, an original model can be designed, and then after training based on the original model and the sample data set, a facial key point detection model can be finally obtained.

[0360] It should be noted that if the electronic device determines that the difference in posture information between the target object and the target object is too large, it can prompt the user to reselect the guide image. As shown in Figure 15(d), if the user selects the second image as the guide image of the first image, the electronic device can determine that the difference in posture information between the target object (face) of the first image and the target object (face) of the guide image is too large. Therefore, the user can be prompted that the posture difference is too large in the interface shown in Figure 10(d), and the user can be guided to reselect the guide image.

[0361] Optionally, in one embodiment, on the user's guide image selection interface, the electronic device can calculate, for each image, the degree of proximity between the target object and the target object in terms of posture information, detail clarity, etc., and prompt the user for reference (displayed in the interface or played to the user through voice).

[0362] Optionally, in an embodiment, the user may select multiple guide images as the guide images of the first image.

[0363] It should be noted that the electronic device can provide a special user library for storing guide images. When the user takes a face photo or downloads a face photo from the Internet, a part of it with higher quality (excellent brightness and high detail clarity) is stored in the library for storing guide images. For example, the user takes a face photo of his own target object, and stores a part of it with higher quality (excellent brightness and high detail clarity) in the library for storing guide images. After that, when the user takes a face photo of his own target object, he can use the guide image in this library to perform guide enhancement on it. The guide images are collected and accumulated by the user himself, and a guide image library can be created by category, which supports real-time updating and deletion. The guide image storage area can be a local storage medium of the electronic device, or it can be stored in the cloud. For details, please refer to the description of Figure 14 (a) and its related embodiments, which will not be repeated here.

[0364] Optionally, in one embodiment, the selection of the guide image can be automatically completed by the electronic device. Optionally, the electronic device can select an image that is closest to the posture information of the target object in the first image as the guide image, or consider other criteria, such as the dynamic range DR of brightness, detail clarity information, etc. If the electronic device detects multiple guide images of the target object including posture information and close to the target object, the guide image can be obtained based on the above criteria, either by random screening, or by presenting it to the user through an interface for the user to select. In this embodiment, the detail clarity of the target object is greater than the detail clarity of the target object.

[0365] In this embodiment, the electronic device may provide a neural network to guide the target object in the image to enhance the target object in the first image.

[0366] Specifically, the electronic device may first perform pixel alignment on the target object in the first image and the target object in the guide image, and determine a second pixel point corresponding to each of the M first pixel points, where the second pixel point is a pixel point included in the target object.

[0367] It should be noted that the electronic device can first divide the first image and the second image into grids, and align the coordinate points of the grid in the first image with the coordinate points of the grid in the second image, and then calculate the correspondence between the pixel points of the target object in the first image and the pixel points of the target object in the guide image through an interpolation algorithm.

[0368] In an embodiment of the present application, the target object in the guide image may include M first pixel points, and the electronic device may perform pixel alignment between the target object and the target object based on a neural network or other alignment algorithm to determine a second pixel point corresponding to each first pixel point in the M first pixel points, where the second pixel point is a pixel point included in the target object.

[0369] Optionally, in one embodiment, as shown in Figure 22(a), the target object includes a first pixel point A1, and mathematical analysis is performed on the pixel point information around the first pixel point A1 to extract features. Correspondingly, mathematical analysis is also performed on the pixel point information of the target object in the first image to extract features. A second pixel point A2 on the target object can be found (as shown in Figure 22(b)), and the features extracted from the image information around it are most matched / close to the features extracted from the image information around the first pixel point A1. Therefore, it can be determined that the first pixel point A1 corresponds to the second pixel point A2.

[0370] Similarly, the second pixel point included in the target object in the guide image corresponding to each first pixel point in the M first pixel points can be determined.

[0371] How to determine the second pixel point corresponding to each of the M first pixel points will be Figures 25a to 25c As well as the description in the corresponding embodiments, they will not be repeated here.

[0372] In this embodiment, the electronic device may fuse each second pixel with the corresponding first pixel in the first image to obtain a target image.

[0373] In an embodiment of the present application, based on the correspondence between the second pixel point and the first pixel point obtained as described above, the second pixel point and the corresponding first pixel point may be pixel-fused in the first image to obtain a target image.

[0374] Optionally, in one embodiment, after determining the correspondence between the second pixel point and the first pixel point, the pixel displacement between each second pixel point and the corresponding first pixel point can be determined, and each second pixel is translated based on the pixel displacement to obtain a registered target object, the registered target object also includes N third pixel points, each of the third pixel points is generated by interpolation based on the pixel values ​​of the adjacent first pixel points, N is a positive integer, and the registered target object is fused with the target object to obtain a target image.

[0375] Optionally, in an embodiment of the present application, when fusing a target object in a first image and a target object in a guide image, the electronic device may obtain high-frequency information of the second pixel; obtain low-frequency information of the first pixel; and fuse the low-frequency information and the high-frequency information.

[0376] As shown in Figures 23(a) and 23(b), Figure 23(a) shows a schematic diagram of a target object, and Figure 23(b) shows a schematic diagram of a registered target object. As shown in Figure 23(c), the registered target object and the target object in the first image also have non-overlapping areas (B1 and B2). At this time, if the target object in the first image is directly fused with the registered target object, artifacts will appear, that is, when the information of the registered target object is "pasted" / fused to the target object in the first image, it is "pasted" / fused to the wrong position. Therefore, in the present application, only the area in the registered target object that overlaps with the target object in the first image can be pixel fused, and for the area in the registered target object that does not overlap with the target object in the first image, the super-resolution enhancement process can be performed on the area. That is: the target object in the first image includes a first area, the registered target object includes a second area, the first area overlaps with the second area, and the pixels of the first area and the second area are fused. The target object in the first image also includes a third area, the third area is staggered with the registered target object, and super-resolution enhancement processing is performed on the third area.

[0377] As shown in FIG. 23( d ), the pixel fusion method in the embodiment of the present application can be implemented based on an AI network, for example, by training:

[0378] a. Encoder 1 is only responsible for encoding the low-frequency information of the image and automatically filters out the high-frequency information.

[0379] b. Encoder 2 can encode the high-frequency and low-frequency information of the image, and its corresponding decoder 2 can restore the high- and low-frequency encoded information output by encoder 2 to the original input image, where the encoding of the low-frequency information is similar to that of encoder 1. For example:

[0380] i. If the aligned guide image is passed through encoder 1, the output result is similar to the low-frequency coding information output by encoder 2 after the aligned guide image is passed through encoder 2.

[0381] ii. The enhanced image is passed through encoder 1, and the output result is similar to the low-frequency coding information output by encoder 2 of the aligned guide image.

[0382] In the embodiment of the present application, after each second pixel is fused with the corresponding first pixel, the edge area of ​​the target object can be smoothed in the first image. In this way, the contour area of ​​the target object in the target image will not be distorted, thereby improving the effect of image enhancement.

[0383] Optionally, in an embodiment of the present application, the target image includes an enhanced target object, and the difference between the dynamic range DR of the brightness of the enhanced target object and the DR of the brightness of the target object in the guide image is smaller than the difference between the DR of the brightness of the target object in the first image and the DR of the brightness of the target object.

[0384] Optionally, in an embodiment of the present application, the target image includes an enhanced target object, and the difference between the hue of the enhanced target object and the hue of the target object in the guide image is smaller than the difference between the hue of the target object in the first image and the hue of the target object.

[0385] Optionally, in an embodiment of the present application, the target image includes an enhanced target object, and detail clarity of the enhanced target object is greater than detail clarity of the target object in the first image.

[0386] Optionally, in another embodiment, the target object in the first image may be directly replaced by the target object in the guide image, that is, the enhanced target object may be directly the target object in the guide image, which is not limited in the present application.

[0387] It should be noted that the pixel fusion module shown in Figure 23(d) can be integrated into the decoder, and the codec can be implemented based on a traditional algorithm or based on an AI network.

[0388] It should be noted that the name of the module in Figure 23(d) is only for illustration and does not constitute a limitation on the present application. For example, the pixel fusion module can also be understood as a coding fusion module, which is not limited here.

[0389] In the above, an image enhancement method provided by an embodiment of the present application is introduced by taking a human face or a local area in a human face as the target object. Next, another image enhancement method is introduced by taking the moon as an example of the target object.

[0390] The electronic device can acquire a first image including the target object being the moon, as shown in FIG23( e ), which shows a schematic diagram of a first image including the moon.

[0391] Regarding how the electronic device acquires the first image, reference may be made to the description in the above embodiment, which is not limited here.

[0392] In an embodiment of the present application, after acquiring the first image, the electronic device can detect that the first image includes the moon. Specifically, the electronic device can detect whether the first image includes the moon based on a trained AI network, which is not limited in the present application.

[0393] The electronic device can obtain a guidance image including the target object being the moon. Different from the above-mentioned enhancement of the face area, since the rotation period of the moon is equal to the period of its rotation around the earth, it always faces the earth with the same side. Therefore, when there is no occlusion, the posture information (texture features) of the moon in the first image and the guidance image are basically the same. Therefore, the electronic device does not need to determine whether the posture information is similar, as shown in FIG23(f). FIG23(f) shows a schematic diagram of a guidance image including the moon.

[0394] It should be noted that some scenes are not suitable for guided enhancement and can be excluded through scene judgment. For example, if the moon in the first image is severely obscured by clouds, buildings, or other scenes and objects, the user can be prompted that the first image is not suitable for guided enhancement.

[0395] It should be noted that the electronic device can automatically select the guide image. If the influence caused by libration is not ignored, the part of the moon surface visible to people on the ground is constantly changing. At this time, the electronic device can infer the actual visible moon surface that night through the synchronization of date, time and location, and select the guide image from the guide image gallery / album, etc., wherein the moon posture information included in the guide image is close to the posture information of the moon surface that is actually visible that night.

[0396] It should be noted that the electronic device can select the guide image with reference to the scene where the moon is located in the first image. For example, if the environment where the moon is located in the first image is an ancient European castle under the night sky, a guide image including a blood wolf moon can be selected as the guide image of the first image.

[0397] The electronic device may enhance the moon included in the first image by using the moon included in the guide image to obtain a target image.

[0398] Optionally, in one embodiment, the electronic device may obtain area A of the moon in the first image and area B of the moon in the guide image, and align area A of the moon with area B of the moon, so that the aligned area A and area B basically completely overlap. For the convenience of description, the first image is referred to as Figure A, the guide image is referred to as Figure R, area A of the moon in the first image is referred to as Figure a, and area B of the moon in the guide image is referred to as Figure r.

[0399] Optionally, in one embodiment, Figure a can be first translated so that the center (or center of the circle) of the moon in Figure a coincides with the center (or center of the circle) of the moon in Figure r after the translation, to obtain Figure b. Furthermore, a plane coordinate system can be established with the center of Figure b as the origin, and the angle between the x-axis (or y-axis) of the coordinate system and the horizontal line of the image is denoted as theta. Figure b can be scaled in the x-axis and y-axis directions of the coordinate system, and appropriate theta and scaling factor can be selected to allow area A of the moon in Figure b and area B of the moon in Figure r to be accurately aligned, to obtain Figure c.

[0400] It should be noted that if the moon phase in Figure A is not a full moon, or there is a certain amount of occlusion on the moon, then as long as: the moon region in Figure c is an incomplete perfect circle, that is, there is a perfect circle outline, and the moon region can be restored to a perfect circle by extending the perfect circle trajectory along the outline, the restoration result and the moon region in Figure r (also a perfect circle) basically completely overlap, and it can be considered that a successful registration has been performed.

[0401] In the embodiment of the present application, referring to the transformation from Figure a to Figure c, Figure A is also acted on to obtain Figure C, and Figure C is rotated around the center of the figure until the position of the moon texture coincides with that in Figure R, to obtain Figure D. The rotation angle is denoted as q.

[0402] In the embodiment of the present application, the affine transformation matrix W for directly transforming image A to image D and the inverse matrix W of the affine transformation matrix W can be calculated: -1 , and apply W to graph a to get graph d, and apply W -1 Applying image r results in image p. Compare image d with image r, and image p with image a. If the moon area is very different, it means that the registration has failed, and the subsequent guided enhancement is stopped, and the system reports an error (prompting the user that the enhancement has failed).

[0403] Optionally, the comparison criteria may be to satisfy the following conditions:

[0404] Condition 1: The area of ​​the moon region in Figure d beyond the outline of the moon region in Figure r is less than a certain threshold;

[0405] Condition 2: The minimum distance between the contour line of the moon region in Figure d and the contour line of the moon region in Figure r is less than a certain threshold;

[0406] Condition 3: The area of ​​the moon region in Figure p that exceeds the outline of the moon region in Figure a is less than a certain threshold;

[0407] Condition 4: The minimum distance between the contour line of the moon region in Figure p and the contour line of the moon region in Figure a is less than a certain threshold.

[0408] It should be noted that if you set the scene to process only the full moon or quasi-full moon (including slight occlusion), you can also add the following conditions:

[0409] Condition 5: The intersection area of ​​the moon regions of Figure d and Figure r divided by the area of ​​the moon region of Figure r should be greater than a certain threshold;

[0410] Condition 6: The intersection area of ​​the moon regions of Figure p and Figure a divided by the area of ​​the moon region of Figure a is greater than a certain threshold.

[0411] In the embodiment of the present application, W -1 Apply to image R to get image P. Perform post-processing. Finally, embed (merge) the result back into the original photo. Scale images P, p, A, and a to the size of the original cropped image A before scaling.

[0412] First, in order to perfectly integrate Figure P with Figure A, we need to obtain the intersection of the moon in Figure P and Figure A:

[0413] Graph p1 = Graph p ∩ Graph a; Graph P1 = Graph P ∩ Graph p1; Graph A1 = Graph A ∩ Graph p1;

[0414] In order to preserve some detailed features of the original moon in Figure L (or Figure A), that is, to assign some detailed features of Figure A1 to Figure P1, the following operations can be performed:

[0415] Figure M = Figure p1 / 255.0;

[0416] lM=e_protect / 10.0+the sum of pixel values ​​of image M, where the numerical protection value e_protect can be 1.0 / 255.0;

[0417] l0max = maximum pixel value of Figure A1 / 255.0;

[0418] l0 = the sum of pixel values ​​in Figure A1 / 255.0 / lM;

[0419] Figure tmp = Figure A1 + (255 - Figure p1);

[0420] l0min = minimum pixel value of image tmp / 255.0;

[0421] Figure T = (Figure A1 / 255.0+l0*(1.0-Figure M)-l0)*Amp / (l0max-l0min+e_protect), where Amp is an adjustable parameter that controls the intensity of inheriting some detailed features of the original moon in Figure L. If it is 0, it will not be inherited.

[0422] Figure IMG = (Figure P1*l0 / l1+Figure T).*Figure M, where.* indicates point-to-point multiplication of the elements;

[0423] Lmax = maximum pixel value of image IMG;

[0424] Figure IMGs = (UINT8)(Figure IMG), if Lmax is less than or equal to 255, otherwise it is equal to (UINT8)(255.0*Figure IMG / Lmax), where UINT8 refers to the corresponding data type conversion of the pixel values ​​in the figure.

[0425] The image p1 is blurred, that is, a certain number of up- and down-sampling and blur operations are performed to obtain the image p1v. Therefore, the output result of the post-processing that retains some detailed features of the original moon in the image L is:

[0426] ImageIMGs.*imagep1v / 255.0+imageA.*(1.0-imagep1v / 255.0). Replace imageA and embed it back into imageL to complete the moon enhancement.

[0427] If the image is processed in yuv format, the above results are only used for the y channel. If it is in rgb format, all three channels r, g, and b are used.

[0428] Generally speaking, if you want to focus on maintaining the realism after beautification, only the (HD) texture details of the moon in the guide image are used for beautification, not its color. Therefore, in yuv format, the y channel is usually super-beautified for the moon, while the uv color channel is kept unchanged, that is, the result will inherit the color of the original moon in image L. However, if you want to use the color information of the moon in the guide image, you can follow the steps below:

[0429] The original moon uv channel color information in the image L is UVL, and the moon uv channel color information in the guided image is UVR. UVR is calculated by the matrix W. -1 After the transformation, it becomes UVP, and the median of UVP (or UVR) is uvp (including one u channel and one v channel). To color the moon area in Figure L with the color of the moon in the guide image, you can use the corresponding UVP for the moon area in Figure P1; and fill the moon area from Figure L to the moon area in Figure P1 with uvp, or use the UVP information value of the edge of Figure P1 to expand outward to fill the moon area from Figure L to the moon area in Figure P1. After coloring, the color information of the moon uv channel of Figure L is UVf, and UVf needs to be merged with the uv channel color information outside the moon area of ​​Figure L. After enhancement, the uv channel color information of Figure L is finally replaced by the uv of Figure A:

[0430] UVf.*Figure av / 255.0+UVA.*(1.0–Figure av / 255.0), where Figure av is the blurring result of Figure a.

[0431] It should be noted that post-processing may also be performed, wherein the post-processing may also include, for example, deblurring, background noise reduction, etc., to achieve a better enhancement effect, as shown in FIG23( g ), which shows a schematic diagram of a target image.

[0432] The embodiment of the present application provides an image enhancement method, including: acquiring a first image, the first image including a target object; acquiring a guide image, the guide image including the target object, the clarity of the target object in the guide image is greater than the clarity of the target object in the first image; enhancing the target object in the first image through a neural network according to the target object in the guide image, to obtain a target image, the target image including the enhanced target object, the clarity of the enhanced target object is greater than the clarity of the target object in the first image. In the above manner, the guide image is used to enhance the image to be enhanced (the first image) through a neural network. Since the information in the guide image is used, compared with the traditional face enhancement technology that directly processes the image to be enhanced, no distortion will occur, and the enhancement effect is better.

[0433] The present application also provides an image enhancement method, referring to Fig.24 , Fig.24 A schematic diagram of an embodiment of an image enhancement method provided in an embodiment of the present application is shown in FIG. Fig.24 As shown in FIG. 1 , the image enhancement method provided in this embodiment includes:

[0434] 2401. A server receives a first image sent by an electronic device, where the first image includes a target object.

[0435] 2402. The server obtains a guide image according to the first image, where the guide image includes the target object, and clarity of the target object in the guide image is greater than clarity of the target object in the first image.

[0436] 2403. The server enhances the target object in the first image through a neural network according to the target object in the guide image to obtain a target image, wherein the target image includes the enhanced target object, and the clarity of the enhanced target object is greater than the clarity of the target object in the first image.

[0437] 2404. The server sends the target image to the electronic device.

[0438] Regarding how the server executes the above-mentioned image enhancement method, reference may be made to the description of the steps executed by the electronic device in the above-mentioned embodiment, and similarities will not be repeated here.

[0439] Please read first Fig.25a , Fig.25aA system architecture diagram of an image enhancement system provided in an embodiment of the present application, in Fig.25a In the embodiment, the image enhancement system 2500 includes an execution device 2510, a training device 2520, a database 2530, a client device 2540 and a data storage system 2550, and the execution device 2510 includes a computing module 2511. The client device 2540 may be the electronic device in the above embodiment, and the execution device may be the electronic device or server in the above embodiment.

[0440] The database 2530 stores an image set, the training device 2520 generates a target model / rule 2501 for processing the first image and the guide image, and iteratively trains the target model / rule 2501 using the image set in the database to obtain a mature target model / rule 2501. In the embodiment of the present application, the target model / rule 2501 is described as a convolutional neural network.

[0441] The convolutional neural network obtained by the training device 2520 can be applied to different systems or devices, such as mobile phones, tablets, laptops, VR devices, server data processing systems, etc. Among them, the execution device 2510 can call the data, code, etc. in the data storage system 2550, and can also store data, instructions, etc. in the data storage system 2550. The data storage system 2550 can be placed in the execution device 2510, or the data storage system 2550 can be an external memory relative to the execution device 2510.

[0442] The computing module 2511 can perform a convolution operation on the first image and the guide image acquired by the client device 2540 through a convolutional neural network, and after extracting the first feature plane and the second feature plane, the first feature plane and the second feature plane can be spliced. Based on performing the convolution operation on the first feature plane and the second feature plane, the second pixel point corresponding to each of the M first pixel points is determined.

[0443] In some embodiments of this application, please refer to Fig.25a The execution device 2510 and the client device 2540 can be independent devices. The execution device 2510 is configured with an I / O interface 2512 to interact with the client device 2540 for data. The "user" can input the first image and the guide image to the I / O interface 212 through the client device 2540, and the execution device 210 returns the target image to the client device 2540 through the I / O interface 2512 and provides it to the user.

[0444] It is worth noting that Fig.25aIt is only a schematic diagram of the architecture of two image enhancement systems provided by an embodiment of the present invention, and the positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation. For example, in other embodiments of the present application, the execution device 2510 can be configured in the client device 2540. As an example, when the client device is a mobile phone or a tablet, the execution device 2510 can be a module for performing array image processing in the host processor (Host CPU) of the mobile phone or tablet. The execution device 2510 can also be a graphics processing unit (GPU) or a neural network processor (NPU) in the mobile phone or tablet. The GPU or NPU is mounted on the host processor as a coprocessor, and the host processor assigns tasks.

[0445] Next, the convolutional neural network used in the embodiment of the present application is introduced. The convolutional neural network is a deep learning architecture. The deep learning architecture refers to multiple levels of learning at different abstract levels through machine learning algorithms. As a deep learning architecture, CNN is a feed-forward artificial neural network, and each neuron in the feed-forward artificial neural network responds to the overlapping areas in the image input therein. Among them, the convolutional neural network can logically include an input layer, a convolutional layer, and a neural network layer, but because the role of the input layer and the output layer is mainly to facilitate the import and export of data, with the continuous development of the convolutional neural network, in practical applications, the concepts of the input layer and the output layer are gradually diluted, but the functions of the input layer and the output layer are realized by the convolutional layer. Of course, other types of layers can also be included in the high-dimensional convolutional neural network, which are not specifically limited here.

[0446] Convolutional Layer:

[0447] The output of the convolution layer can be used as the input of the subsequent pooling layer, or as the input of another convolution layer to continue the convolution operation. The convolution layer can include many convolution kernels, which can also be called filters or convolution operators, which are used to extract specific information from the input array matrix (that is, the digitized array image). A convolution kernel can essentially be a weight matrix, which is usually pre-defined. The size of each weight matrix should be related to the size of each angle image in an array image. In the process of convolution operation on the array image, the weight matrix is ​​usually processed one pixel by one pixel (or two pixels by two pixels... depending on the value of the stride) in the horizontal direction on each angle image of the array image, so as to complete the work of extracting specific features from the image. The weight values ​​in these weight matrices need to be obtained through a lot of training in practical applications. The weight matrices formed by the weight values ​​obtained through training can extract information from the input angle image, thereby helping the high-dimensional convolutional neural network to make correct predictions.

[0448] It should be noted that the depth dimension of the weight matrix is ​​the same as the depth dimension of the input array image. During the convolution operation, the weight matrix will extend to the entire depth of the input image. Therefore, convolution with a weight matrix of a single depth dimension will produce a convolution output of a single depth dimension. However, in most cases, a single depth dimension weight matrix is ​​not used. Instead, weight matrices of different depth dimensions are used to extract different features in the image. For example, a weight matrix of a depth dimension is used to extract image edge information, another weight matrix of a depth dimension is used to extract specific colors of the image, and another weight matrix of a depth dimension is used to blur unwanted noise in the image... The multiple weight matrices have the same dimensions, and the feature planes extracted by the weight matrices of the same dimensions are also the same. The extracted feature maps of the same dimensions are then merged to form the output of the convolution operation.

[0449] For an example, see Fig.25b , Fig.25b A schematic diagram of a convolution kernel provided in an embodiment of the present application performing a convolution operation on an image, Fig.25bIn the figure, a 6×6 image and a 2×2 convolution module are used as examples for explanation, where s refers to the horizontal coordinate of the image in the angular dimension, t refers to the vertical coordinate of the image in the angular dimension, x refers to the horizontal coordinate in an image, y refers to the vertical coordinate in an image, and a pixel point on the image can be determined by (x, y, s, t). m refers to the horizontal coordinate of multiple convolution modules in the angular dimension, n refers to the vertical coordinate of multiple convolution modules in the angular dimension, p refers to the horizontal coordinate in a convolution module, q refers to the vertical coordinate in a convolution module, and a convolution kernel can be determined from multiple convolution modules by (m, n, p, q).

[0450] Neural Network Layers:

[0451] After being processed by the convolution layer / pooling layer, the high-dimensional convolutional neural network is not sufficient to output the required output information. Because as mentioned above, the convolution layer / pooling layer will only extract features and reduce the parameters brought by the input image. However, in order to generate the final output information (the required class information or other related information), the convolutional neural network needs to use the neural network layer to generate one or a group of outputs of the required number of classes. Therefore, the neural network layer may include multiple hidden layers, and the parameters contained in the multiple hidden layers can be pre-trained according to the relevant training data of the specific task type. For example, the task type may include image recognition, image classification, image super-resolution reconstruction, etc.

[0452] Optionally, in one embodiment, a convolution operation can be performed on the target object in the first image and the target object in the guide image based on the above neural network. Specifically, the cropped guide image (including the target object) and the cropped first image (including the target object) can be scaled to the same specific size and input into the network. For the cropped first image, the scaled image size becomes (D+d)*(D+d), where D is the side length of the center area and d is the side length of the margin area.

[0453] In the embodiment of the present application, the central D×D area can be evenly divided into N×N blocks, with the center of each block as the basic grid point, and the width d of the margin area is the maximum allowable pixel displacement value set in the registration. For the convenience of network design, d can be optionally set to X times (integer multiples) of D / N. In this way, the cropped first image and the guide image are evenly divided into (2M+N)×(2M+N) blocks.

[0454] like Fig.25cAs shown in , the cropped first image (including the margin area) and the guide image (including the margin area) are convolved based on the convolution layer sets CNNgG and CNNgL to extract features Gcf and Lcf, respectively, which may be contour features.

[0455] Gcf and Lcf are concatenated, and the convolution layer set CNNg2 is designed. The concatenated Gcf and Lcf are convolved to obtain GLcf.

[0456] In the penultimate section of the network, convolutional layer sets CNNgs and CNNgc are designed to process GLcf respectively and output feature GLcfs and feature GLcfc. Optionally, the side length ratio of feature GLcfs and feature GLcfc is (2M+N):(2M+N-1).

[0457] Based on the convolutional layer set CNNgf at the end of the network, the features GLcfs and GLcfc are processed to obtain the features GLcfsf of size (2M+N)×(2M+N)×2 and the features GLcfcf of size (2M+N-1)×(2M+N-1)×2. Take the N×N×2 at the center of GLcfsf and the (N-1)×(N-1)×2 at the center of GLcfcf, that is, the coordinate point displacement corresponding to the grid points of the output "N×N" basic grid and the "(N-1)×(N-1)" embedded grid, where ×2 can refer to the displacement in the x and y directions. The meaning of the grid point displacement is: to guide the image to be registered on the image to be enhanced, and the coordinate point displacement of the grid position should have.

[0458] In the embodiment of the present application, the displacement of each pixel point can be interpolated from the displacement of the grid point coordinates.

[0459] In the embodiment of the present application, the above-mentioned grid point can be the geometric center of the receptive field range of the convolution kernel corresponding to each convolution operation in the guide image, or a pixel position not far from the geometric center (the interval between the grid point and the geometric center of the receptive field range is less than a preset value), which is not limited here. Among them, in a convolutional neural network, the receptive field can be the area range of the pixel points on the feature map output by each layer of the convolutional neural network mapped on the input image.

[0460] It should be noted that the calculation range of the receptive field may also infinitely extend the first image outward to ensure that the receptive field range is not cut off by the boundary of the first image when reaching the boundary of the first image.

[0461] Among them, in the present application, it may be the receptive field range of the convolution kernel in the guide image in the last layer of convolution operation. It should be noted that, in the present application, the receptive field may include the area where the edge of the feature layer is padded with 0 in the convolution operation.

[0462] The present application also provides an electronic device. Fig.26 , Fig.26 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, the electronic device includes:

[0463] An acquisition module 2601 is configured to acquire a first image, wherein the first image includes a target object; and acquire a guide image according to the first image, wherein the guide image includes the target object, and the clarity of the target object in the guide image is greater than the clarity of the target object in the first image;

[0464] The processing module 2602 is used to enhance the target object in the first image through a neural network according to the target object in the guide image to obtain a target image, wherein the target image includes the enhanced target object, and the clarity of the enhanced target object is greater than the clarity of the target object in the first image.

[0465] Optionally, a difference between a posture of the target object in the guide image and a posture of the target object in the first image is within a preset range.

[0466] Optionally, the acquisition module 2601 is specifically used to:

[0467] The guide image is determined from the at least one second image according to a difference between a posture of the target object in the first image and a posture of each of the at least one second image.

[0468] Optionally, the electronic module further includes:

[0469] Display module 2603, used to display a first image selection interface, where the first image selection interface includes at least one image;

[0470] The receiving module 2604 is configured to receive a first image selection instruction, where the first image selection instruction indicates selecting the at least one second image from at least one image included in the first image selection interface.

[0471] Optionally, the processing module is specifically used to:

[0472] Determine at least one third image according to the posture of the target object in the first image, wherein each of the at least one third image includes the target object, and a difference between the posture of the target object included in each third image and the posture of the target object in the first image is within a preset range;

[0473] The display module is further used to display a second image selection interface, where the second image selection interface includes the at least one third image;

[0474] The receiving module is further configured to receive a second image selection instruction, where the second image selection instruction indicates selecting the guide image from at least one third image included in the second image selection interface.

[0475] Optionally, the target image includes an enhanced target object, and a guide image feature of the enhanced target object is closer to the target object in the guide image than the target object in the first image, wherein the guide image feature includes at least one of the following image features:

[0476] Dynamic range of brightness, hue, contrast, saturation, texture information, and contour information.

[0477] Optionally, the target image includes an enhanced target object, and a difference between a posture of the enhanced target object and a posture of the target object in the first image is within a preset range.

[0478] Optionally, the display module 2603 is further used for:

[0479] Display the camera shooting interface;

[0480] The acquisition module 2601 is specifically configured to receive a shooting operation of a user, and acquire the first image in response to the shooting operation;

[0481] Alternatively, the display module 2603 is further used for:

[0482] Displaying a camera album interface, wherein the album interface includes a plurality of images;

[0483] The acquisition module 2601 is specifically configured to receive a third image selection instruction, where the third image selection instruction indicates selecting the first image from a plurality of images included in the album interface.

[0484] Optionally, the acquisition module 2601 is specifically used to:

[0485] The guide image sent by the server is received.

[0486] Optionally, the processing module 2602 is specifically used to obtain high-frequency information of each second pixel point; obtain low-frequency information of each first pixel point, the second pixel point is a pixel point in the guide image, and the first pixel point is a pixel point in the first image; and fuse the low-frequency information and the corresponding high-frequency information.

[0487] Optionally, the processing module 2602 is further configured to smooth an edge region of the target object in the first image after fusing each second pixel point with the corresponding first pixel point.

[0488] Optionally, the processing module 2602 is further used to determine a pixel displacement between each second pixel point and the corresponding first pixel point; and translate each second pixel based on the pixel displacement to obtain a registered target object.

[0489] Optionally, the processing module 2602 is specifically configured to fuse the registered target object with the target object.

[0490] Optionally, the target object includes a first area, the registered target object includes a second area, the first area overlaps with the second area, and the processing module 2602 is specifically used to fuse the pixels of the first area and the second area.

[0491] Optionally, the target object further includes a third region, and the third region is staggered with the registered target object. The processing module 2602 is further configured to perform super-resolution enhancement processing on the third region.

[0492] Optionally, the registered target object further includes N third pixel points, each of the third pixel points is generated by interpolation according to pixel values ​​of adjacent first pixel points, and N is a positive integer.

[0493] Optionally, the processing module 2602 is specifically used to perform a convolution operation on the first image to obtain a first feature plane; perform a convolution operation on the guide image to obtain a second feature plane; and determine the second pixel point corresponding to each first pixel point in the M first pixel points based on performing a convolution operation on the first feature plane and the second feature plane, wherein the interval between the coordinate position of each grid point and the geometric center of the convolution kernel corresponding to a convolution operation is less than a preset value.

[0494] The present application also provides a server. Fig. 27 , Fig. 27 A schematic diagram of the structure of a server provided in an embodiment of the present application, the server includes:

[0495] The receiving module 2701 is configured to receive a first image sent by an electronic device, wherein the first image includes a target object; and obtain a guide image, wherein the guide image includes the target object, and the clarity of the target object in the guide image is greater than the clarity of the target object in the first image.

[0496] A processing module 2702 is used to enhance the target object in the first image through a neural network according to the target object in the guide image to obtain a target image, wherein the target image includes the enhanced target object, and the clarity of the enhanced target object is greater than the clarity of the target object in the first image;

[0497] The sending module 2703 is used to send the target image to the electronic device.

[0498] Optionally, a difference between a posture of the target object in the guide image and a posture of the target object in the first image is within a preset range.

[0499] Optionally, the receiving module 2701 is specifically used for:

[0500] The guide image is determined from the at least one second image according to a difference between a posture of the target object in the first image and a posture of each of the at least one second image.

[0501] Optionally, the target image includes an enhanced target object, and a guide image feature of the enhanced target object is closer to the target object in the guide image than the target object in the first image, wherein the guide image feature includes at least one of the following image features:

[0502] Dynamic range of brightness, hue, contrast, saturation, texture information, and contour information.

[0503] Optionally, the target image includes an enhanced target object, and a difference between a posture of the enhanced target object and a posture of the target object in the first image is within a preset range.

[0504] Next, an electronic device provided by an embodiment of the present application is introduced. Fig.28 , Fig.28 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 2800 can be specifically a virtual reality VR device, a mobile phone, a tablet, a laptop computer, a smart wearable device, etc., which is not limited here. Specifically, the electronic device 2800 includes: a receiver 2801, a transmitter 2802, a processor 2803 and a memory 2804 (wherein the number of processors 2803 in the electronic device 2800 can be one or more, Fig.28 In the example of FIG. 2803 , the processor 2803 may include an application processor 28031 and a communication processor 28032. In some embodiments of the present application, the receiver 2801, the transmitter 2802, the processor 2803 and the memory 2804 may be connected via a bus or other means.

[0505] The memory 2804 may include a read-only memory and a random access memory, and provides instructions and data to the processor 2803. A portion of the memory 2804 may also include a non-volatile random access memory (NVRAM). The memory 2804 stores processor and operation instructions, executable modules or data structures, or subsets thereof, or extended sets thereof, wherein the operation instructions may include various operation instructions for implementing various operations.

[0506] The processor 2803 controls the operation of the electronic device. In a specific application, the various components of the electronic device are coupled together through a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus, and a status signal bus, etc. However, for the sake of clarity, various buses are referred to as bus systems in the figure.

[0507] The method disclosed in the above embodiment of the present application can be applied to the processor 2803, or implemented by the processor 2803. The processor 2803 can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 2803. The above processor 2803 can be a general processor, a digital signal processor (digital signal processing, DSP), a microprocessor or a microcontroller, and can further include an application specific integrated circuit (application specific integrated circuit, ASIC), a field programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The processor 2803 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software modules in the decoding processor can be combined and executed. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 2804, and the processor 2803 reads the information in the memory 2804 and completes the steps of the above method in combination with its hardware.

[0508] The receiver 2801 can be used to receive input digital or character information and generate signal input related to the relevant settings and function control of the electronic device. The transmitter 2802 can be used to output digital or character information through the first interface; the transmitter 2802 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; the transmitter 2802 can also include a display device such as a display screen.

[0509] In an embodiment of the present application, in one case, the processor 2803 is used to execute the processing-related steps in the image enhancement method in the above embodiment.

[0510] The present application also provides a server. Fig.29 , Fig.29 It is a structural diagram of a server provided in an embodiment of the present application. The server may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 2922 (for example, one or more processors) and memory 2932, and one or more storage media 2930 (for example, one or more mass storage devices) storing application programs 2942 or data 2944. Among them, the memory 2932 and the storage medium 2930 can be short-term storage or permanent storage. The program stored in the storage medium 2930 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the training device. Furthermore, the central processing unit 2922 can be configured to communicate with the storage medium 2930 and execute a series of instruction operations in the storage medium 2930 on the server 2900.

[0511] The server 2900 may also include one or more power supplies 2926, one or more wired or wireless network interfaces 2950, ​​one or more input and output interfaces 2958, and / or one or more operating systems 2941, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0512] In the embodiment of the present application, the central processing unit 2922 is used to execute the image enhancement method described in the above embodiment.

[0513] An embodiment of the present application also provides a computer program product, which, when executed on a computer, enables the computer to execute the steps of the image enhancement method.

[0514] A computer-readable storage medium is also provided in an embodiment of the present application. The computer-readable storage medium stores a program for performing signal processing. When the program is run on a computer, the computer executes the steps of the image enhancement method in the method described in the aforementioned embodiment.

[0515] The execution device and training device provided in the embodiments of the present application may specifically be a chip, and the chip includes: a processing unit and a communication unit, wherein the processing unit may be, for example, a processor, and the communication unit may be, for example, an input / output interface, a pin or a circuit, etc. The processing unit may execute the computer execution instructions stored in the storage unit so that the chip in the execution device executes the image enhancement method described in the above embodiment, or so that the chip in the training device executes the image enhancement method described in the above embodiment. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc. The storage unit may also be a storage unit located outside the chip in the wireless access device, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.

[0516] For details, please refer to Fig.30 , Fig.30 A schematic diagram of the structure of a chip provided in an embodiment of the present application, the chip can be expressed as a neural network processor NPU 300, NPU 300 is mounted on the host CPU (Host CPU) as a coprocessor, and the Host CPU assigns tasks. The core part of the NPU is the operation circuit 3003, which is controlled by the controller 3004 to extract matrix data from the memory and perform multiplication operations.

[0517] In some implementations, the operation circuit 3003 includes multiple processing units (Process Engine, PE) inside. In some implementations, the operation circuit 3003 is a two-dimensional systolic array. The operation circuit 3003 can also be a one-dimensional systolic array or other electronic circuits capable of performing mathematical operations such as multiplication and addition. In some implementations, the operation circuit 3003 is a general-purpose matrix processor.

[0518] For example, assume there is an input matrix A, a weight matrix B, and an output matrix C. The operation circuit takes the corresponding data of matrix B from the weight memory 3002 and caches it on each PE in the operation circuit. The operation circuit takes the matrix A data from the input memory 3001 and performs matrix operation with matrix B. The partial result or final result of the matrix is ​​stored in the accumulator 3008.

[0519] The unified memory 3006 is used to store input data and output data. The weight data is directly transferred to the weight memory 3002 through the direct memory access controller (DMAC) 3005. The input data is also transferred to the unified memory 3006 through the DMAC.

[0520] BIU stands for Bus Interface Unit, i.e., bus interface unit 3010 , which is used for the interaction between AXI bus, DMAC and instruction fetch buffer (IFB) 3009 .

[0521] The bus interface unit 3010 (Bus Interface Unit, BIU for short) is used for the instruction fetch memory 3009 to obtain instructions from the external memory, and is also used for the storage unit access controller 3005 to obtain the original data of the input matrix A or the weight matrix B from the external memory.

[0522] DMAC is mainly used to transfer input data in the external memory DDR to the unified memory 3006 or to transfer weight data to the weight memory 3002 or to transfer input data to the input memory 3001.

[0523] The vector calculation unit 3007 includes multiple operation processing units, which further process the output of the operation circuit when necessary, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. It is mainly used for non-convolutional / fully connected layer network calculations in neural networks, such as Batch Normalization, pixel-level summation, upsampling of feature planes, etc.

[0524] In some implementations, the vector calculation unit 3007 can store the processed output vector to the unified memory 3006. For example, the vector calculation unit 3007 can apply a linear function and / or a nonlinear function to the output of the operation circuit 3003, such as linear interpolation of the feature plane extracted by the convolution layer, and then, for example, a vector of accumulated values ​​to generate an activation value. In some implementations, the vector calculation unit 3007 generates a normalized value, a pixel-level summed value, or both. In some implementations, the processed output vector can be used as an activation input to the operation circuit 3003, for example, for use in a subsequent layer in a neural network.

[0525] An instruction fetch buffer 3009 connected to the controller 3004 is used to store instructions used by the controller 3004;

[0526] Unified memory 3006, input memory 3001, weight memory 3002 and instruction fetch memory 3009 are all On-Chip memories. External memories are private to the NPU hardware architecture.

[0527] The processor mentioned in any of the above places may be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the program of the above-mentioned image enhancement method.

[0528] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.

[0529] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0530] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0531] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may 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 may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may 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 drive (SSD)), etc.

Claims

1. An image enhancement method, characterized in that: The method comprises: Acquire a first image, wherein the first image includes a target object; Acquire a guide image according to the first image, the guide image including the target object, the clarity of the target object in the guide image is greater than the clarity of the target object in the first image, and the difference between the posture of the target object in the guide image and the posture of the target object in the first image is within a preset range; According to the target object in the guide image, the target object in the first image is enhanced by a neural network to obtain a target image, wherein the target image includes the enhanced target object, and the clarity of the enhanced target object is greater than the clarity of the target object in the first image; The step of acquiring a guidance image according to the first image comprises: The guide image is determined from the at least one second image based on the difference between the posture of the target object in the first image and the posture of each of the at least one second image, the brightness of each of the at least one second image, the hue of each of the at least one second image, and the detail clarity of each of the at least one second image.

2. The method according to claim 1, characterized in that The target object includes at least one of the following objects: cheek, eye, ear, nose, eyebrow or mouth of the same person.

3. The method according to claim 1, characterized in that: Before determining the difference between the posture of the target object in the first image and the posture of each of the at least one second image, the method further comprises: Displaying a first image selection interface, wherein the first image selection interface includes at least one image; A first image selection instruction is received, where the first image selection instruction indicates selecting the at least one second image from at least one image included in the first image selection interface.

4. The method according to any one of claims 1 to 3, characterized in that: The enhanced guiding image feature of the target object is closer to the target object in the guiding image than the target object in the first image, wherein the guiding image feature includes at least one of the following image features: Dynamic range of brightness, hue, contrast, saturation, texture information, and contour information.

5. The method according to any one of claims 1 to 3, characterized in that: The difference between the posture of the enhanced target object and the posture of the target object in the first image is within a preset range.

6. The method according to any one of claims 1 to 3, characterized in that: The acquiring of the first image comprises: Display the camera shooting interface; receiving a shooting operation of a user, and acquiring the first image in response to the shooting operation; or displaying an album interface of a camera, wherein the album interface includes a plurality of images; A third image selection instruction is received, where the third image selection instruction indicates selecting the first image from a plurality of images included in the album interface.

7. An image enhancement device, characterized in that: Applied to electronic equipment or server, the image enhancement device comprises: an acquisition module, configured to acquire a first image, the first image including a target object; and acquire a guide image according to the first image, the guide image including the target object, the clarity of the target object in the guide image being greater than the clarity of the target object in the first image, and the difference between the posture of the target object in the guide image and the posture of the target object in the first image being within a preset range; a processing module, configured to enhance the target object in the first image through a neural network according to the target object in the guide image to obtain a target image, wherein the target image includes the enhanced target object, and the clarity of the enhanced target object is greater than the clarity of the target object in the first image; The acquisition module is specifically used for: The guide image is determined from the at least one second image based on the difference between the posture of the target object in the first image and the posture of each of the at least one second image, the brightness of each of the at least one second image, the hue of each of the at least one second image, and the detail clarity of each of the at least one second image.

8. The image enhancement device according to claim 7, characterized in that: The target object includes at least one of the following objects: cheek, eye, ear, nose, eyebrow or mouth of the same person.

9. The image enhancement device according to claim 7, characterized in that: The device also includes: A display module, configured to display a first image selection interface, wherein the first image selection interface includes at least one image; The receiving module is used to receive a first image selection instruction, where the first image selection instruction indicates selecting the at least one second image from at least one image included in the first image selection interface.

10. The image enhancement device according to any one of claims 7 to 9, characterized in that: The enhanced guiding image feature of the target object is closer to the target object in the guiding image than the target object in the first image, wherein the guiding image feature includes at least one of the following image features: Dynamic range of brightness, hue, contrast, saturation, texture information, and contour information.

11. The image enhancement device according to any one of claims 7 to 9, characterized in that: The difference between the posture of the enhanced target object and the posture of the target object in the first image is within a preset range.

12. The image enhancement device according to claim 9, characterized in that: The display module is also used for: Display the camera's shooting interface; The acquisition module is specifically configured to receive a shooting operation of a user, and acquire the first image in response to the shooting operation; Or, the display module is further used for: Displaying a camera album interface, wherein the album interface includes a plurality of images; The acquisition module is specifically used to receive a third image selection instruction, where the third image selection instruction indicates selecting the first image from a plurality of images included in the album interface.

13. An electronic device, characterized in that: include: one or more processors; one or more memories; Multiple applications; and one or more programs, wherein the one or more programs are stored in the memory, and when the one or more programs are executed by the processor, the electronic device performs the steps of the image enhancement method as described in any one of claims 1 to 6.

14. A server, characterized in that: include: one or more processors; one or more memories; Multiple applications; and one or more programs, wherein the one or more programs are stored in the memory, and when the one or more programs are executed by the processor, the server performs the steps of the image enhancement method as described in any one of claims 1 to 6.

15. A computer storage medium, characterized in that The method comprises computer instructions, which, when executed on an electronic device, enable the electronic device to execute the image enhancement method as claimed in any one of claims 1 to 6.