Image processing method and electronic device

By using a network model based on a training image set to perform deglare processing of Raw images in electronic devices, the problem of low image quality in light scenes in the existing technology is solved, and an efficient anti-glare effect under different light conditions is achieved, which is suitable for It is suitable for various types of glare and reduces the reduction of anti-glare ability caused by coating damage.

CN117135438BActive Publication Date: 2024-08-27HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310259940.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-10
Publication Date
2024-08-27
Estimated Expiration
2043-03-10

AI Technical Summary

Technical Problem

With the existing technology, images taken under specific light scenes are prone to glare problems, resulting in reduced image quality, especially in night scenes. Current anti-glare software has limited effects.

Method used

An image processing method is adopted, by obtaining the Raw images collected by the lens and inputting them into the trained network model, using the glare characteristics and glare-free characteristics of the training image set to perform glare processing to generate target display images and improve electronic equipment. Anti-glare ability. The method includes generating a display image, performing degradation processing along an inverse image signal processing path, identifying and filling glare areas, fusing the filled areas to generate an image without glare features, and adjusting brightness when necessary to improve the display effect.

Benefits of technology

It effectively improves the anti-glare ability of electronic devices in different light scenarios, is applicable to a variety of glare types, reduces the reduction in anti-glare ability due to coating damage, and improves image quality without increasing image processing overhead. Clarity and display.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117135438B
    Figure CN117135438B
Patent Text Reader

Abstract

The present application provides an image processing method and electronic device, and relates to the field of image processing. The method of the present application includes: a first network model can be used to remove glare features from the obtained Raw image, and the training images of the first network model include a first training image and a second training image, the first training image is a Raw image with at least glare features constructed based on a display image (such as an RGB image), and the second training image is a Raw image with at least no glare features constructed based on the display image. The method in the present application can eliminate different types of glare in an image, and improve the ability of an electronic device to eliminate glare features in an image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] At present, images captured by electronic devices in specific lighting scenarios (sunlight during the day, street lights at night) will produce glare problems, which reduces the quality of the captured images, for example, artifacts appear in the image, and the target in the image is not clear. In order to improve the clarity of the captured image, it is necessary to eliminate the glare problem in the image. At present, the anti-glare ability of cameras or mobile phone modules is improved by optimizing hardware structural parts and software.

[0003] However, current anti-glare software is usually limited to eliminating limited types of glare (such as eliminating light spots), and has poor effects on eliminating other types of glare, such as glare in images taken in night scenes. Summary of the invention

[0004] In order to solve the above technical problems, the present application provides an image processing method and an electronic device, so as to improve the anti-glare capability of the electronic device.

[0005] In a first aspect, the present application provides an image processing method, which is applied to an electronic device, comprising: acquiring a first Raw image captured by a lens; inputting the first Raw image into a first network model to obtain a second Raw image with glare features removed, wherein the first network model is obtained after training based on a first training image set and a second training image set, the first training image set includes multiple first training images, and the first training images are Raw images constructed based on display images and at least contain glare features; the second training image set includes multiple second training images, and the second training images are Raw images constructed based on the display images and at least have no glare features; the electronic device generates a target display image based on the second Raw image, and the target display image is used to be displayed on a display interface of the electronic device.

[0006] In this way, the first network model is obtained by training based on the first training image set and the second training image set. The first training image is a Raw image containing glare features constructed based on a display image (such as an RGB image); the second training image is a Raw image that does not contain glare features constructed based on an RGB image. The Raw image contains many image features, making the first network model obtained based on the Raw image training more accurate. At the same time, in the process of training the network, the training images are constructed based on various display images, so that the first network model obtained by training can be applied to different types of glare, rather than limited to specific types of glare (such as being able to eliminate glare in images taken at night), thereby improving the practicality of glare removal and also improving the anti-glare ability of electronic equipment, so that even if the coating of the lens is damaged, the anti-glare ability of the electronic equipment will not be sharply reduced.

[0007] According to the first aspect, before obtaining the first Raw image captured by the lens, the method further includes: shooting the same training scene at the same position to obtain at least two first basic images of the training scene, at least one of which does not contain glare features; generating a first display image based on each first basic image, the first display image being an RGB image with glare-free features; performing degradation processing on the first display image along the inverse image signal processing ISP path to obtain a second training image. In this way, the first display image is constructed based on the real image captured, so that the generated first display image is more consistent with the real scene, and the first display image is constructed based on the first basic image without glare features, thereby improving the accuracy of the second training image obtained subsequently; at the same time, the first display image is degraded along the inverse ISP path to quickly construct a Raw image of the first display image.

[0008] According to the first aspect, a first display image is generated based on each first basic image, including: obtaining a first image from at least two first basic images; identifying each first glare area in the first image; obtaining a first filling area of ​​each first glare area from each first basic image, wherein the first filling area does not contain a glare feature; and filling each first glare area in the first image based on the first filling area of ​​each first glare area to generate a first display image. In this way, each first filling area of ​​the first glare area does not contain a glare feature, and the first glare area is filled based on the first filling area, so that the first glare area of ​​the first image becomes an area without a glare feature, and an accurate display image without a glare feature is obtained.

[0009] According to the first aspect, obtaining the first filling area of ​​each first glare area from each first basic image includes: obtaining first position information of the first glare area in the first image; searching for the first area corresponding to the first position information in each first basic image; obtaining the first area without glare characteristics as the first filling area. In this way, the electronic device can quickly find the first filling area without glare characteristics corresponding to the first glare area.

[0010] According to the first aspect, each first glare area in the first image is filled according to the first filling area of ​​each first glare area to generate a first display image, including: fusing each first filling area of ​​the first glare area to generate a target filling area of ​​the first glare area; filling the corresponding target filling area in each first glare area to generate the first display image. In this way, by fusing each first filling area of ​​the first glare area, the obtained target filling area does not contain glare. At the same time, by fusing multiple first filling areas, the characteristics of the target filling area can be increased, avoiding the problem that after the target filling area fills the first glare area, the image characteristics of the filled first glare area are lost.

[0011] According to the first aspect, a first display image is generated based on each first basic image, including: fusing each first basic image to obtain a first fused image; identifying a second glare area in the first fused image; obtaining a second filling area matching the second glare area from each first basic image based on the second glare area of ​​the first fused image, wherein the second filling area does not contain glare features; fusing the second glare area in the first fused image with each obtained second filling area to generate the first display image. In this way, the first basic images are first fused to balance the features in the first fused image and weaken the glare features; and the second glare area in the first fused image is eliminated to make the obtained first display image more accurate.

[0012] According to the first aspect, before performing the operation of fusing the images, the method further comprises: performing stack registration on each image, thereby improving the accuracy of subsequent fusion.

[0013] According to the first aspect, after fusing each first filling area of ​​the first glare area to generate a target filling area of ​​the first glare area, the method further includes: adjusting the brightness of each target filling area according to the brightness of the first glare area. In this way, the brightness of the target filling area is adjusted so that there is no conflict between the brightness of the target filling area and the first image, thereby improving the overall display effect of the first display image obtained subsequently.

[0014] According to the first aspect, before the second glare area in the first fused image is fused with each second filling area to generate the first display image, the method further includes: adjusting the brightness of each second filling area according to the brightness of the second glare area. In this way, the problem of inconsistent brightness of the first display image obtained subsequently can be avoided.

[0015] According to the first aspect, before acquiring the first Raw image, the method further includes: generating a second display image based on each first basic image, the second display image at least including a glare feature; performing degradation processing on the second display image along the reverse ISP path to obtain a first training image. In this way, this method can quickly acquire an accurate first training image.

[0016] According to the first aspect, generating the second display image according to each first basic image includes: fusing each first basic image to generate the second display image. In this way, the accuracy of the second display image can be improved by fusing.

[0017] According to the first aspect, the first network model is also used to perform a second image processing on the first feature of the first Raw image so that the processed first Raw image meets a preset condition, and the first feature includes any one of the following: noise, image blur higher than a first threshold, high dynamic range, and image white balance does not meet a first standard. In this way, the first network model simultaneously implements glare removal and processing of the first feature, which can reduce the overhead in the ISP path.

[0018] According to the first aspect, the image of the first training image also contains the first feature; the second training image does not contain the first feature; before obtaining the first Raw image, the method further includes: according to the third training image set and the fourth training image set, the CNN network training model is used for training to obtain the first training model, the first training model is used for performing the second image processing on the input image, the third training image set includes a plurality of third training images, the third training image is a Raw image containing the first feature; the fourth training set includes a plurality of fourth training images, the fourth training image is the Raw image of the third training image after the second image processing; according to the first training image set and the second training image set, the first training model is trained to obtain the first network model. In this way, the first network model can avoid the problem of weakening the second image processing function of the electronic device after two-stage training.

[0019] According to the first aspect, the image of the first training image also contains the first feature; the second training image does not contain the first feature; before acquiring the first Raw image captured by the lens, the method further includes: training with a CNN network training model based on the first training image set and the second training image set to obtain a first network model. In this way, the first network model is obtained directly based on the first training image set and the second training image set, which can reduce the time for network model training.

[0020] According to the first aspect, after obtaining the second training image, the method further includes: cropping the second training image multiple times, and adding the multiple images obtained after cropping to the second training image set; the cropping method includes regular cropping or random cropping. In this way, the number of images used for training can be quickly increased.

[0021] In a second aspect, the present application provides an electronic device comprising: a memory and a processor, wherein the memory is coupled to the processor; the memory stores program instructions, and when the program instructions are executed by the processor, the electronic device executes the image processing method corresponding to the first aspect and any one of the implementation methods of the first aspect.

[0022] The second aspect and any implementation of the second aspect correspond to the first aspect and any implementation of the first aspect respectively. The technical effects corresponding to the second aspect and any implementation of the second aspect can refer to the technical effects corresponding to the above-mentioned first aspect and any implementation of the first aspect, which will not be repeated here.

[0023] In a third aspect, the present application provides a computer-readable medium for storing a computer program. When the computer program is run on an electronic device, the electronic device executes the image processing method corresponding to the above-mentioned first aspect and any one of the implementation methods of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0025] Figure 1 is a schematic diagram of an image containing glare features exemplarily shown;

[0026] Figure 2 is a schematic diagram of the structure of an electronic device shown exemplarily;

[0027] Figure 3is a schematic diagram of a software structure of an electronic device shown as an example;

[0028] Figure 4 is a flowchart showing an exemplary image processing;

[0029] Figure 5 is a processing flow chart of an ISP shown as an example;

[0030] Figure 6 is a flowchart of an exemplary training first network model;

[0031] Figure 7 A schematic diagram showing a plurality of first basic images taken continuously by an electronic device of the same building as an example;

[0032] Figure 8 A schematic diagram of generating a first display image for an exemplarily illustrated electronic device;

[0033] Fig. 9 A schematic diagram showing an exemplary electronic device fusing multiple first basic images;

[0034] Fig.10 A schematic diagram of generating a first display image for an exemplarily illustrated electronic device;

[0035] Fig.11 The flowchart of generating a Raw image with no glare characteristics is shown as an example;

[0036] Fig.12 is a flowchart for generating a Raw image containing glare features as an example;

[0037] Fig.13 is a schematic diagram of an exemplary training first network model;

[0038] Fig.14 Another ISP path schematic diagram is shown as an example;

[0039] Fig.15 It is a schematic diagram exemplarily showing an image obtained by using the image processing method of the present application. DETAILED DESCRIPTION

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

[0041] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.

[0042] The terms "first" and "second" in the description and claims of the embodiments of the present application are used to distinguish different objects rather than to describe a specific order of objects. For example, a first target object and a second target object are used to distinguish different target objects rather than to describe a specific order of target objects.

[0043] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0044] In the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" refers to two or more than two. For example, multiple processing units refer to two or more processing units; multiple systems refer to two or more systems.

[0045] Before describing the technical solution of the embodiment of the present application, the application scenario of the embodiment of the present application is first described in conjunction with the accompanying drawings. User A can use the camera function in the mobile phone to take pictures of a building with a luminous sign at night, and obtain the following Figure 1 The image shown. The "Coffee" sign in the image emits strong light, resulting in glare characteristics 10 on the "Coffee" in the captured image.

[0046] Dazzle refers to a visual condition that causes visual discomfort and reduced visibility of objects due to inappropriate brightness distribution in the field of vision or extreme brightness contrast in space or time. Usually, glare is caused by high-intensity light sources causing multiple reflective surfaces to interfere with each other. The essence of the glare problem is the superposition of light caused by the refraction of light in the lens. The glare in the image appears as light spots of different shapes and colors at different locations. The presence of glare characteristics in the image will cause the image to appear hazy and foggy, reduce contrast, and cause problems such as overexposure of the image.

[0047] In order to solve the glare problem, the hardware of the shooting equipment can be improved, such as adding a reflective coating (i.e., coating) to the lens of the shooting equipment. Both the coating technology and the coating material will affect the anti-glare performance of the shooting equipment. When the dust layer in the lens increases or the coating is damaged, the anti-glare ability of the shooting equipment will be sharply reduced.

[0048] In some embodiments, software improvements can be made to the shooting device. For example, a two-stage method is used, and the two-stage method is to first identify a specific halo, and then repair the area where the specific halo is located. The two-stage method can only eliminate limited types of flares in the image, and it is easy to misidentify local bright areas as flares. For another example, a multiple-image fusion method is used to remove glare from the image, and a glare spread function (GSF) superposition deconvolution method is used to remove glare from the image. Both the multiple-image fusion method and the GSF superposition deconvolution method can only remove limited types (such as one or two) of glare.

[0049] In an embodiment of the present application, a method for image processing is proposed, which can be applied to an electronic device, wherein the electronic device can obtain a first Raw image, input the first Raw image into a first network model, and perform de-glare processing on the first Raw image by the first network model to obtain a second Raw image. The electronic device can perform image signal processing according to the second Raw image to obtain a target display image.

[0050] The first network model is obtained after training based on the first training image set and the second training image set. The first training image set includes multiple first training images (such as 100, 200, 300, 500 or more), and the first training image is a Raw image with at least glare characteristics constructed based on the display image. The second training image set includes multiple second training images (100, 200, 300, 500 or more), and the second training image is a Raw image with at least no glare characteristics constructed based on the display image. The display image is an image that can be displayed on a display screen by an electronic device, such as an RGB (format) image or a YUV format image. In this example, the display image takes an RGB image as an example. In this example, the second training image is a Raw image with no glare characteristics. Since the Raw image contains many image features, it can avoid the loss of features during image processing, thereby enhancing the accuracy of network training. In addition, since the network training is based on images containing glare features and corresponding images without glare features constructed based on RGB images, rather than being limited to one or several types of glare, the first network model can eliminate different types of glare in the Raw image, improve the anti-glare ability of electronic equipment, and increase the use scenarios of electronic equipment.

[0051] Figure 2 This is a schematic diagram of the structure of an electronic device 100 shown in an embodiment of the present application. It should be understood that: Figure 2The electronic device 100 shown is only one example of an electronic device, and the electronic device 100 may have more or fewer components than shown in the drawings, may combine two or more components, or may have a different configuration of components. Figure 2 The various components shown in the EMBODIMENTS 2000 may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.

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

[0053] Figure 3 It is a software structure block diagram of the electronic device 100 according to an embodiment of the present application.

[0054] The layered architecture of the electronic device 100 divides the software into several layers, each with 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 three layers, from top to bottom, namely, the application layer, the application framework layer, and the kernel layer. It is understandable that Figure 3 The layers in the software structure and the components contained in each layer do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer layers than shown in the figure, and each layer may include more or fewer components, which is not limited in the present application.

[0055] like Figure 3As shown, the application layer can include a series of application packages. The application packages can include image processing applications, cameras, gallery, calendar, short messages, calls, navigation, Bluetooth and other applications. The application framework layer provides application programming interfaces (APIs) and programming frameworks for applications in the application layer. The application framework layer includes some predefined functions.

[0056] The image processing application may perform first image processing on the first Raw image captured by the electronic device to remove glare features in the Raw image; the image processing application may obtain a display image based on the Raw image from which the glare features have been removed, and the display image may be an RGB image. Optionally, the first Raw image may be acquired by a lens of the electronic device. Optionally, the image processing application may also process the input RGB image to obtain a first Raw image corresponding to the RGB image.

[0057] Figure 3 As shown, the application framework layer may include a window manager, a resource manager, a content provider, a view system, a phone manager, a notification manager, and the like.

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

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

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

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

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

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

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

[0065] Understandably, Figure 3 The layers in the software structure shown and the components included in each layer do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer layers than shown, and each layer may include more or fewer components, which is not limited in the present application.

[0066] Figure 4 The following is a flowchart showing an exemplary method of image processing. The image processing method may be performed by an electronic device, which may be a device with a display screen, such as a mobile phone, a tablet computer, a camera, etc. The image processing process may include the following steps:

[0067] Step 401: The electronic device acquires a first Raw image.

[0068] Specifically, a Raw image is the original data that an image sensor (such as CMOS or CCD) converts into a digital signal by capturing a light source signal. A Raw image is a lossless image that contains physical information such as the light intensity and color of an object. After an electronic device acquires a Raw image, it needs to perform image signal processing ("ISP") on the Raw image to obtain an image that the electronic device can display, such as an RGB image (i.e., an image in RGB format) or a YUV image (i.e., an image in YUV format).

[0069] Figure 5 FIG. 1 is a flowchart of an ISP shown as an example. Figure 5As shown, the electronic device sequentially performs Defect Pixel Correction (“DPC”), Black Level Correction (“BLC”), Lens Shading Correction (“LSC”), Noise Reduction (“NR”), Auto White Balance (“AWB”), Bayer Color Interpolation (Bayer DeMosica), Color Correction Matrix (“CCM”), and Gamma Correction (Gamma) on the Raw image.

[0070] AWB: Estimate the gain values ​​of the red channel and the blue channel through empirical distribution.

[0071] DeMosaic: Demosaicing based on bilinear interpolation.

[0072] CCM: Color correction solves the problem that the color filter of the camera sensor does not match the spectrum of sRGB. Usually the camera has a fixed CCM value.

[0073] Gamma is an exponential curve, which can be expressed as follows:

[0074]

[0075] The value range of x is 0 to 1.

[0076] The process of the electronic device performing ISP processing on the Raw image can refer to the existing ISP processing flow, which will not be described in detail here.

[0077] In some embodiments, after the image sensor in the electronic device captures the Raw image, the Raw image can be obtained as the first Raw image. Optionally, the electronic device can also obtain an RGB image input by the user, or can obtain an RGB image from other devices. For example, mobile phone A downloads an RGB image from a server, and mobile phone A can also obtain an RGB image transmitted from mobile phone B. After obtaining the RGB image, the electronic device can perform degradation processing on the RGB image along the inverse image signal processing ISP path to obtain a Raw image corresponding to the RGB image, and use the obtained Raw as the first Raw image.

[0078] In this example, the electronic device can be described by taking a mobile phone as an example.

[0079] Step 402: The electronic device inputs the first Raw image into the first network model to obtain a second Raw image with glare removed.

[0080] In some embodiments, the electronic device is provided with a first network model, and the first network model can be used to perform a first image processing on an input Raw image, and the first image processing is used to remove glare features in the image.

[0081] Optionally, the first network model can also perform a second image processing on the input image, and the second image processing is used to eliminate the first feature in the input image. The first feature includes any one of the following: noise, image blur higher than a first threshold, high dynamic range (High-Dynamic Range, "HDR"), and image white balance does not meet the first standard. Among them, the first threshold can be set according to the actual application, for example, the first threshold is 50%. Optionally, the electronic device can pre-store the first standard of white balance for different scenes. For example, in the scene of gaze, the first standard includes: white balance is 5000K; in the scene of gaze light, the first standard includes: white balance is 4000K.

[0082] When the first feature is noise, the second image processing is used to remove the noise feature in the image; when the first feature is that the blurriness of the image is higher than the first threshold, the second image processing is used to increase the clarity of the image. When the first feature is high dynamic range, the second image processing is used to compress the high dynamic range image and convert it into a low dynamic range (LowDynamic Range, "LDR") image. When the first feature is that the white balance of the image does not meet the first standard, the second image processing is used to adjust the white balance of the image to the first standard.

[0083] In this example, the first feature is noise as an example for explanation, that is, the second image processing is used to remove noise in the image.

[0084] In this example, the first network model can remove glare features and noise from the input image. Figure 6 FIG. 4 is a flowchart of an exemplary training of the first network model. Figure 6 As shown, the electronic device can obtain a reference image (Ground Truth), which can be an RGB image obtained by taking a single-lens reflex camera (i.e. Figure 6 The reference RGB image in FIG. 1 is a reference RGB image of a scene in FIG. 1 , or an image obtained by shooting a real scene in other ways. The reference RGB image has glare characteristics and no noise characteristics.

[0085] The electronic device can perform fallback processing on the reference RGB image along the reverse ISP path. Figure 5 The processing of the ISP channel is the opposite. Figure 6As shown, the sub-device performs reverse dynamic range compression (ToneMapping) and reverse Gamma processing on the reference RGB image in sequence, and converts the image from RGB format to Bayer format (i.e. Figure 6 The RGB2Bayer process in ) is used to obtain the Raw image. The fallback process of other ISPs, such as the inverse process of DeMosaic, can directly sample the method and ignore the other two color values.

[0086] The inverse Gamma curve can be expressed in the form of formula (2):

[0087] F -1 (y) = y 2.5 Formula (2);

[0088] The value range of y is 0 to 1.

[0089] Perform reverse white balance processing on the Raw image after inverse gamma processing. Since the current denoising algorithm is applied to the Raw domain, the denoising function is implemented through an AI network in the Raw domain. There are two main types of noise in the Raw domain, namely shot noise and read noise. Shot noise generally satisfies Poisson distribution, and read noise generally satisfies Gaussian distribution. Therefore, noise fallback (i.e. Figure 6 The added noise in the image can be expressed as the superposition of Poisson noise and Gaussian noise. Assume that the pixel values ​​of the Raw image satisfy the following distribution:

[0090]

[0091] Among them, the parameter λ read ,λ shot Determined by the digital gain and analog gain of the sensor, for a given digital gain gd and analog gain g a , with a fixed sensor readout circuit variance σ 2 , we can get the following relationship:

[0092]

[0093] λ shot =g d g a Formula (5);

[0094] Digital gain and analog gain are generally determined by ISO and exposure parameters.

[0095] In this example, the parameter λ read ,λ shot Satisfies the following distribution form:

[0096]

[0097]

[0098] In this example, the electronic device can perform noise addition processing on the Raw image that has undergone the reverse white balance processing to obtain a Raw image with noise characteristics and glare characteristics, which is recorded as Raw_1.

[0099] The electronic device inputs the constructed Raw image with noise characteristics and glare characteristics (i.e., Raw_1) into the first network model 601, and the first network model 601 performs the first image processing (i.e., removing the glare characteristics) and the second image processing (i.e., removing the noise characteristics in the Raw_1 image) on the Raw_1 image to obtain a Raw image without noise characteristics and glare characteristics, which is recorded as Raw_2. After the electronic device obtains the Raw_2 image, it can process the Raw_2 image according to the current ISP path, i.e., Figure 6 As shown, the electronic device performs AWB processing, Bayer Demosica processing, CCM processing and Gamma processing on the Raw_2 image in sequence to obtain an RGB image without glare and noise features.

[0100] Should Figure 6 In the process of training the first network model, the input reference image needs to be degraded along the inverse ISP path to obtain a Raw image containing noise features and glare features. The Raw image containing noise features and glare features is input into the first network model, so that a Raw image without glare features and noise can be output; after the Raw image is processed by the ISP path, a noise-free and glare-free RGB image can be obtained.

[0101] In this example, you can pre-train Figure 6 The first network model shown. The input data for training the first network model may be a plurality of first training images and second training images, the first training image being a Raw image containing glare features and noise features, and the second training image being a Raw image containing neither glare features nor noise features. In order to ensure the accuracy of the trained first network model, the first training image and the second training image are constructed using real RGB images.

[0102] Combine the following Figures 7-8 The display image without glare characteristics and noise characteristics generated based on the real display image in this example is specifically described.

[0103] The electronic device can continuously shoot the same training scene at the same position at the same shooting angle to obtain at least two first basic images of the training scene. Optionally, the electronic device can shoot multiple first basic images of the same scene at the same angle with an interval of 1EV per image, where 1EV is the unit of exposure value. For example, the shutter time of the first first basic image is 1 / 10 second, the shutter time of the second is 1 / 20 second, the shutter time of the third is 1 / 40 second, and the shutter time of the fourth is 1 / 100 second. The aperture values ​​of the four first basic images can be fixed to: f / 2.4, and ISO (International Standards Organization, sensitivity) is fixed to 2500. Alternatively, the SLR can adopt an automatic continuous shooting mode to shoot 9 or 3 consecutive images. It can be understood that the more first basic images there are, the better the effect of the display image with glare-free and noise-free features constructed based on the first basic images.

[0104] The ISO or shutter values ​​of each first image may be different or partially the same. The sensitivity and shutter set in the camera will affect the amount of light entering the lens. In this example, the exposure value can be used to characterize the exposure during shooting (i.e., the light entering the lens). The exposure value (EV) is used to characterize all camera aperture-shutter combinations that can give the same exposure. For example, an exposure value of 0 corresponds to a combination of an exposure time of 1 second and an aperture of f / 1.0 or its equivalent. The smaller the exposure value of the image, the less light enters the lens, and the brightness of the generated image is low. At this time, the light has little effect on the lens and is less likely to produce glare.

[0105] For example, if Figure 7 As shown, at night, the electronic device can continuously shoot the building at the same position (such as a position B meters away from the building) using the same shooting angle, and the exposure value of each first basic image shot is different, wherein the building's logo "Coffee" glows at night. That is, 8 images are shot in sequence from time t1 to time t8, and the exposure value gradually increases, such as the exposure value of image 701 is -6EV, the exposure value of image 702 is -5EV, the exposure value of image 703 is -4EV, and the exposure value of image 704 is -1EV; the exposure value of image 705 is 2EV, the exposure value of image 706 is 3EV, the exposure value of image 707 is 4EV, and the exposure value of image 708 is 5EV.

[0106] In some embodiments, when the electronic device acquires multiple first basic images, one of the multiple first basic images may be selected as the first image. Optionally, the electronic device pre-sets a selection condition, such as the selection condition may be that the brightness exceeds a first brightness threshold and is less than a second brightness threshold and / or the clarity of the image is greater than a first clarity threshold. Figure 7 As shown, the electronic device detects that the brightness of image 708 exceeds the first brightness threshold and is less than the second brightness threshold, and detects that the clarity of image 708 is greater than the first clarity threshold, then determines that image 708 is the first image.

[0107] Optionally, when there are multiple first basic images that meet the selection condition, the image with the highest definition may be selected as the first image, or one of the first basic images that meet the selection condition may be randomly selected as the first image.

[0108] Optionally, the electronic device may also receive a selection instruction input by the user to obtain the first image from the multiple first basic images. For example, after obtaining the multiple first basic images, the electronic device displays each first basic image; in response to the selection operation input by the user, the image selected by the user is obtained as the first image.

[0109] Optionally, when the electronic device detects that there is no image satisfying the selection condition among multiple first basic images, each first basic image is displayed, and the user is prompted to select an image as the first image; in response to the user's selection operation, the first basic image selected by the user is obtained as the first image.

[0110] After the electronic device determines the first image, it identifies each first glare area in the first image. The electronic device may use a preset glare recognition model for recognition, and the glare recognition model may be a model obtained based on deep learning. Optionally, the electronic device may also identify each first glare area in the first image in response to a recognition operation of the user. Optionally, the engineer may add an identifier of the glare area in the first image in advance, and the electronic device may identify the first glare area in the first image based on the identifier of the glare area marked by the engineer.

[0111] There may be multiple first glare areas in the first image, such as Figure 7 As shown, a glare area 7081 and a glare area 7082 are marked in the image 708 (the glare area 7081 and the glare area 7082 are both first glare areas), and other glare areas in the image 708 are not shown here.

[0112] When the electronic device determines each first glare area in the first image, the first filling area of ​​each first glare area can be obtained from each first basic image. Optionally, the process of the electronic device obtaining the first filling area of ​​a first glare area is as follows: obtaining the first position information of the first glare area in the first image; searching for the first area corresponding to the first position information in each first basic image; obtaining the first area without glare features as the first filling area. That is, the position of the first filling area in the first basic image is the same as the position of the first glare area in the first image, and the first filling area does not have glare features and is an area without glare features.

[0113] Continue to refer to Figure 7 , the electronic device can obtain the position information A of the glare area 7081 in the image 708, obtain the first area where the position A is located in the image 701, detect that the first area does not have the glare feature, and use the first area as the first first filling area of ​​the glare area 7081. Similarly, the electronic device can find the second first filling area of ​​the glare area 7081 in the image 702, and obtain the first filling area of ​​the glare area 7081 from the images 703 to 707 in sequence. Since there is a glare feature in the first area corresponding to the glare area 7081 in the images 706 and 707, it is determined that there is no first filling area corresponding to the glare area 7081 in the images 706 and 707, that is, the glare area 7081 can have 5 corresponding first filling areas.

[0114] The electronic device may fuse all the first filling areas of the first glare area to generate a target filling area of ​​the first glare area, and fill the first glare area in the first image with the target filling area of ​​the first glare area. Optionally, the fusion weight of each first filling area may be determined according to the brightness of the first glare area. For example, when the brightness difference between the first glare area and the first filling area in image 705 is detected to be the smallest, it may be determined that the fusion weight corresponding to image 705 is the largest; when the brightness difference between the first glare area and the first filling area in image 701 is detected to be the largest, it may be determined that the fusion weight corresponding to image 701 is the smallest. Optionally, when the brightness difference between the first glare area and the first filling area in image 705 is detected to be the smallest, it may be determined that the fusion weight corresponding to image 705 is the smallest; when the brightness difference between the first glare area and the first filling area in image 701 is detected to be the largest, it may be determined that the fusion weight corresponding to image 701 is the largest. Optionally, the fusion weight of each first filling area may also be determined in a mean value manner, that is, the fusion weight of each first filling area is the same.

[0115] Combine the following Figure 8 The process of determining the first display image is described in detail.

[0116] Figure 8 , each first filling area in the glare area 7081 and each first filling area in the glare area 7082 are shown. The first filling areas of the glare area 7081 are respectively: area 8011 to area 8015; the first filling areas of the glare area 7082 are respectively: area 8021 to area 8026. In this example, the first filling areas are fused with the same weights. The electronic device can fuse areas 8011 to 8015 according to their corresponding weights to generate a target filling area A of the glare area 7081. The target filling area A is filled with the glare area 7081 of the first image.

[0117] Similarly, by fusing each first filling area of ​​the glare area 7082 with the same weight, the electronic device can fuse areas 8021 to 8026 according to their corresponding weights to generate a target filling area B of the glare area 7082. The target filling area B fills the glare area 7082 of the first image.

[0118] The other first glare areas in the first image are filled in the same manner as the glare areas 7081 and 7082 to generate the following: Figure 8 The first displayed image 809 in .

[0119] Optionally, the electronic device may adjust the brightness of area 8091 in the first display image 809 (ie, the brightness of the target filling area) according to the brightness in the first image. The electronic device uses the image 810 after the brightness adjustment as the first display image.

[0120] Optionally, the electronic device may first perform stack registration on the eight first basic images, so as to obtain an area matching the first glare area from the first basic images as the first filling area of ​​the first glare area.

[0121] Optionally, the electronic device may perform stack registration on each first basic image before determining the first glare area, so as to improve the accuracy of subsequent fusion of each filling area. Optionally, stack registration may also be performed before fusion.

[0122] In this example, images with different exposure values ​​are obtained by continuously shooting the same scene. When the exposure value is low, less light enters the camera lens, so the shooting is less affected by glare. For example, the exposure value of image 701 is the smallest, and there is no glare feature in the image. The exposure value of image 708 is the largest, and the area occupied by the glare feature in image 708 is the largest. The electronic device obtains an image that meets the selection conditions, determines the first glare area from the image, and can obtain a first filling area matching the first glare area from other first basic images. The first filling area includes a non-glare area. The electronic device fuses the non-glare area to completely eliminate the glare feature in the first glare area.

[0123] In another example, after capturing multiple first basic images, the electronic device may stack-register all the first basic images, fuse the stack-registered first basic images, and obtain a first fused image. The electronic device identifies a second glare area in the first fused image; based on the second glare area in the first fused image, obtains a second filling area matching the second glare area from at least two first basic images; and fuses each of the obtained second filling areas with the second glare area in the first fused image to generate a first display image.

[0124] For example, if Fig. 9 As shown, the electronic device obtains 8 first basic images (i.e., images 901 to 908). The electronic device can stack the 8 first basic images, fuse the 8 first basic images after stack registration, and obtain a fused image (i.e., image 909). Optionally, the fusion can be proportional, that is, the fusion weight of each first basic image is the same. Optionally, the electronic device can also determine the fusion weight of each first basic image based on the exposure value. For example, the fusion weight of the first basic image with a high exposure value is greater than the fusion weight of the first basic image with a low exposure value. Optionally, the electronic device can also use HDR technology to fuse the 8 first basic images to obtain a first fused image.

[0125] The electronic device can identify each second glare area in the image 909. The process of the electronic device identifying the second glare area is similar to Figure 7 The description is similar to that in , and will not be repeated here.

[0126] The electronic device searches for a second filling area matching each second glare area in each first basic image according to the position of each second glare area in the image 909. Figure 7 The description in is similar, that is, obtaining the second position information of the second glare area in the first fused image; searching for the second area corresponding to the second position information in each first basic image; and obtaining the second area without glare features as the second filling area.

[0127] Fig. 9 The image 909 in FIG. 1 shows two first glare areas, namely glare area 9091 and glare area 9092, and the other glare areas are not shown. Fig. 9 Shown in.

[0128] Fig.10 , each first filling area in the glare area 9091 and each first filling area in the glare area 9092 are shown. The second filling areas of the glare area 9091 are respectively: area 1011, area 1021 ... area 1051; the second filling areas of the glare area 9092 are respectively: area 1012, area 1022 ... area 1062. Optionally, since the brightness of the detected area 1051 is the smallest difference from the brightness of the second glare area 9091 in the first fused image, the weight W35 can be set to the maximum, and the weights from large to small are W35, W34, W33, W32 and W31.

[0129] Similarly, the electronic device detects that the brightness of area 1062 is minimally different from the brightness of the second glare area 9092 in the first fused image, and the weight W46 can be set to the maximum. The weights from large to small are W46, W45, W44, W43, W42 and W41.

[0130] Similarly, the electronic device can obtain the weight of each second filling area of ​​other second glare areas, which will not be described in detail here.

[0131] In the first fused image (i.e. Fig.10 The second glare area 9091 in 1009) is fused according to the fusion weight of each second filling area of ​​the second glare area 9091, the second glare area 9092 in the first fused image is fused according to the fusion weight of each second filling area of ​​the second glare area 9092, and each second filling area of ​​other second glare areas is fused according to their respective fusion weights, so as to generate the first display image. That is to say, during this fusion operation, different areas of the electronic device are fused according to the fusion weights of their respective filling areas. For example, Fig.10 In the example, the fill areas 1011 to 1051 are merged according to their respective weights, and the fill areas 1012 to 1062 are merged according to their respective weights, to generate the first display image 1010 .

[0132] After the electronic device acquires the first display image, the first display image can be degraded along the reverse ISP path to generate a Raw image without glare characteristics and noise characteristics. The process of the degradation process can be as follows: Fig.11As shown, the RGB image without glare and noise features is sequentially processed through inverse ToneMapping, inverse Gamma, RGB2Bayer, and inverse WB to obtain a Raw image without glare and noise features. The electronic device can use the Raw image without glare and noise features as the second training image.

[0133] The electronic device can obtain an RGB image containing glare features taken by a camera. Since the current camera has removed the noise in the image during ISP processing, the electronic device can add noise to the RGB image. For example, Figure 6 As shown, after the RGB image containing glare features is processed by inverse ToneMapping, inverse Gamma, RGB2Bayer, and inverse WB in sequence, noise is added to the Raw image after the WB processing to generate a Raw image containing glare features and noise features, and the Raw image containing glare features and noise features is added to the first training image set.

[0134] Optionally, if the RGB image captured by the camera contains glare features and noise features, degradation processing can be directly performed along the reverse ISP path to obtain a Raw image containing glare features. Fig.12 As shown, image A is an RGB image containing glare features and noise features. The electronic device sequentially performs inverse tone mapping, inverse gamma, RGB2bayer, and inverse WB processing on image A to obtain a Raw image containing glare features and noise features.

[0135] It can be understood that each first training image has a corresponding second training image, and the second training image is a Raw image without glare features and noise features. In other words, the first training image and the second training image appear in pairs.

[0136] Optionally, the electronic device can crop the constructed Raw image without glare features and noise features, and add the cropped Raw image to the second training image set. The cropping method can be random cropping or cropping according to a preset size or shape. The electronic device can also crop the Raw images with glare features and noise features to obtain more first training images. For example, there are 300 pairs of constructed Raw images with glare features and noise features and corresponding Raw images without glare features and noise features. After random cropping, the training data can be increased to 2000 pairs, of which 90% can be used for training, 5% for verification, and 5% for testing.

[0137] In some embodiments, when the electronic device acquires the first training image set and the second training image set, the electronic device can obtain the first network model according to the first training image set and the second training image training. The first network model can adopt a CNN network training model. A plurality of first training images are input into the CNN network model, and the encoder of the training network downsamples the first training image to obtain image features in the first training image; the decoder in the training network classifies (i.e., decodes) the first training image according to the image features to obtain a Raw image without noise features and glare features. Among them, after each round of network training, the network parameters in the CNN network model are adjusted according to the gap between the second training image and the training result of this round until the CNN network model converges to obtain the first network model. Optionally, the loss function in the first network model can adopt L1 Loss (L1 norm loss). Optionally, the loss function can also include L1Loss, Percpion Loss (perceptual loss function) and L2 Loss (L2 norm loss). Among them, L1 Loss can be used to determine the difference of the whole image, and L2 Loss can be used to determine the difference of the glare area.

[0138] In this example, the network training is that the network input can use 4 channels to adapt to the arrangement of each pixel of the Raw image (that is, the pixels are arranged in the form of RGGB). For example, an image with glare and noise features is input with 512*512*4 channels, and the encoder can use a Gaussian function with a variance of 1 to downsample to 512*512.

[0139] In some embodiments, the electronic device may also first train to obtain a first training model, where the first training model is used to eliminate noise features in the input Raw image. The electronic device then trains based on the first training image set, the second training image set, and the first training model to obtain a first network model. Fig.13 The network training process is described in detail.

[0140] Fig.13Schematic diagram of a training first network model is shown as an example. The electronic device can obtain a third training image set and a fourth training image set, and the third image training set includes multiple third training images (such as 100, 200, 300, etc.), and the third training image is a Raw image with noise characteristics. The fourth image training set includes multiple fourth training images (such as 100, 200, 300, etc.), and the fourth training image is a Raw image without noise characteristics. The electronic device can set a preset initial model based on the CNN network model. The third training image is input into the initial model, and the third training image is subjected to feature extraction by the encoder and classification by the decoder to obtain an image with noise features removed. After each network training, the training network continuously updates the network parameters through the gap between the fourth image training image and the training result of this time until the network converges to obtain the first training model. Optionally, the loss function in the first network model can adopt L1Loss.

[0141] When training the first training model, the learning rate of the network can be set to 10 -4 , hyperparameters β1=0.9, β2=0.999, ε=10 -7 .

[0142] Continue to refer to Figure 7 , the first training model is used as the initial model of the second stage in the network training, that is, at the beginning of the second stage of training, the network parameters of the first training model remain unchanged, and the learning rate gradient is reduced. The electronic device inputs the first training image into the first training model, and the first training image passes through the encoder and the decoder to obtain an image without noise features and glare features. After each round of training in the second stage, the electronic device adjusts the network parameters in the first training model according to the difference between the second training image and the result of the current round of training until the network converges. The loss function in the training process may include L1 Loss, Percpion Loss and L2 Loss. Among them, L1 Loss is used to determine the difference of the entire image, and L2 Loss is used to determine the difference of the glare area.

[0143] Optionally, in the process of training the first network model based on the first training model, the parameters of the last two layers of the convolutional layers in the first training model can be adjusted to increase the speed of network convergence and improve the training speed.

[0144] The electronic device stores the first network model. Optionally, the electronic device may also periodically update the first network model.

[0145] After the electronic device acquires the first Raw image, the first Raw image can be input into the first network model to obtain a second Raw image with glare features eliminated. Optionally, if the first network model also has the function of eliminating the first feature, such as in this example, the first network model has the function of eliminating noise, then the first Raw image is input into the first network model to obtain a second Raw image with no glare features and no noise features. In other words, the denoising module in the current ISP channel can be replaced with the first network model in the present application, and the first network model performs denoising and glare removal on the image at the same time. This method does not add additional modules in the ISP channel, thereby reducing the performance and power consumption of the ISP channel.

[0146] Step 403: The electronic device generates a target display image according to the second Raw image.

[0147] Specifically, the electronic device performs ISP processing on the second Raw image according to the second Raw image.

[0148] Optionally, the first network model can be set at the position of the denoising function module of the ISP path, and after acquiring the second Raw image, continue to process along the ISP path, for example, Figure 6 As shown, after the second Raw image is generated, the second Raw image is subjected to AWB, Bayer Demosaic, CCM processing and Gamma processing to generate a display image without noise and glare.

[0149] In this example, the electronic device also photographs a building with a "Coffee" sign, and the output image is as follows: Fig.15 As shown, the Fig.15 The images in the image are free of glare characteristics.

[0150] In this example, the first network model is obtained by training based on the first training image set and the second training image set. The first training image is a Raw image containing glare features constructed based on an RGB image; the second training image is a Raw image without glare features constructed based on an RGB image. The Raw image contains many features, so that the first network model obtained by training based on the Raw image is more accurate. At the same time, the second training image is constructed based on the RGB image, so that the second training image is more accurate. In addition, the first network model can simultaneously realize denoising and glare removal, so that there is no need to add an additional model to the ISP channel, which improves the image processing speed and reduces the cost of image processing when the glare removal function is added. At the same time, in the process of training the network, the training images are constructed based on various display images, so that the first network model obtained by training can be applied to different types of glare, not limited to specific types of glare, and improves the practicality of glare removal. However, the current AI algorithm is located in the YUV domain, which increases the performance and power consumption of the ISP channel and cannot utilize more image feature information in the Raw domain, resulting in problems such as unnatural glare removal and artifacts when AI removes glare. Compared with the current AI algorithm, this example uses a first display image with glare-free features constructed based on the RGB domain, so the second training image constructed based on the first display image is accurate. Since the second training image is a Raw image, more image feature information is retained, so that the first network model trained based on the second training image can eliminate different types of glare, and the elimination is natural without artifacts and other problems.

[0151] In some embodiments, the first network model may be a separate module. For example, the electronic device may perform a glare removal function on the image after the denoising process. Fig.14 As shown, de-glare processing is performed after denoising in the ISP path.

[0152] Specifically, the electronic device can be pre-trained to obtain a first network model, wherein the first training image of the first network model is a Raw image containing glare features, and the second training image is a Raw image not containing glare features. The electronic device obtains a preset initial model. The first training image is input into the initial model for training. When this round of training is completed, the network parameters of the model are adjusted according to the gap between the training result and the second training image until the network converges to obtain the first network model.

[0153] In this method, the first network model does not need to add a denoising function and the training speed is fast.

[0154] It is understandable that, in order to realize the above functions, the electronic device includes hardware and / or software modules corresponding to the execution of each function. In combination with the algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in combination with the embodiments, but such implementation should not be considered to be beyond the scope of the present application.

[0155] This embodiment also provides a computer storage medium, in which computer instructions are stored. When the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the image processing method in the above-mentioned embodiment. The storage medium includes: a U disk, a mobile hard disk, a read only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0156] This embodiment further provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the above-mentioned related steps to implement the image processing method in the above-mentioned embodiment.

[0157] Among them, the electronic device, computer storage medium, computer program product or chip provided in this embodiment is used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above and will not be repeated here.

[0158] Any content of each embodiment of the present application, as well as any content of the same embodiment, can be freely combined. Any combination of the above content is within the scope of the present application.

[0159] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A method for image processing, characterized in that: Used in electronic equipment, including: Get the first Raw image; Inputting the first Raw image into a first network model to obtain a second Raw image with glare features removed, wherein the first network model is obtained after training based on a first training image set and a second training image set, wherein the first training image set includes a plurality of first training images, which are Raw images at least containing glare features and constructed based on display images; and the second training image set includes a plurality of second training images, which are Raw images at least having no glare features and constructed based on the display images; The electronic device generates a target display image according to the second Raw image, and the target display image is used to be displayed on a display interface of the electronic device; Before acquiring the first Raw image captured by the lens, the method further includes: Shooting the same training scene at the same position to obtain at least two first basic images of the training scene, at least one of the first basic images does not contain glare features; Generate a first display image according to each first basic image, wherein the first display image is an RGB image having a glare-free feature; Performing degradation processing on the first display image along an inverse image signal processing (ISP) path to obtain the second training image; The generating of the first display image according to each first basic image includes: acquiring the first image from the at least two first basic images; identifying each first glare area in the first image; acquiring the first filling area of ​​each first glare area from each first basic image, wherein the first filling area does not contain glare features; fusing each first filling area of ​​the first glare area to generate a target filling area of ​​the first glare area; filling the corresponding target filling area in each first glare area to generate the first display image; Alternatively, each of the first basic images is fused to obtain a first fused image; a second glare area in the first fused image is identified; based on the second glare area in the first fused image, a second filling area matching the second glare area is obtained from at least two first basic images, wherein the second filling area does not contain glare features; each of the second filling areas obtained is fused with the second glare area in the first fused image to generate the first display image.

2. The method according to claim 1, characterized in that Acquiring a first filling area of ​​each first glare area from each of the first basic images, comprising: Acquire first position information of the first glare area in the first image; searching for a first area corresponding to the first position information in each of the first basic images; A first area without glare features is obtained as a first filling area.

3. The method according to claim 1, characterized in that Before performing the operation of fusing the images, the method further includes: Stack registration was performed for each image.

4. The method according to claim 1, characterized in that: After fusing each first filling area of ​​the first glare area to generate a target filling area of ​​the first glare area, the method further includes: The brightness of each of the target filling areas is adjusted according to the brightness of the first glare area.

5. The method according to claim 1, characterized in that Before generating the first display image by fusing each of the second filling regions acquired by fusing the second glare region in the first fused image, the method further includes: The brightness of each of the second filling areas is adjusted according to the brightness of the second glare area.

6. The method according to claim 1, characterized in that Before acquiring the first Raw image, the method further includes: generating a second display image according to each first basic image, wherein the second display image at least includes a glare feature; The second display image is degraded along the inverse ISP path to obtain a first training image.

7. The method according to claim 6, characterized in that Generating a second display image according to each first basic image, including: Each first basic image is fused to generate the second display image.

8. The method according to claim 7, characterized in that The first network model is also used to perform a second image processing on a first feature of the first Raw image so that the processed first Raw image meets a preset condition, and the first feature includes any one of the following: noise, image blur higher than a first threshold, high dynamic range, and image white balance does not meet a first standard.

9. The method according to claim 8, characterized in that The image of the first training image also includes a first feature; The second training image does not contain the first feature; Before acquiring the first Raw image, the method further includes: According to the third training image set and the fourth training image set, a CNN network training model is used for training to obtain a first training model, wherein the first training model is used to perform the second image processing on the input image, wherein the third training image set includes a plurality of third training images, and the third training images are Raw images containing the first feature; and the fourth training image set includes a plurality of fourth training images, and the fourth training images are Raw images of the third training images after the second image processing; The first training model is trained according to the first training image set and the second training image set to obtain the first network model.

10. The method according to claim 8, characterized in that The image of the first training image also includes a first feature; The second training image does not contain the first feature; Before acquiring the first Raw image captured by the lens, the method further includes: According to the first training image set and the second training image set, a CNN network training model is used for training to obtain the first network model.

11. The method according to claim 1, characterized in that: After obtaining the second training image, the method further includes: The second training image is cropped multiple times, and the multiple images obtained after cropping are added to the second training image set; the cropping method includes regular cropping or random cropping.

12. An electronic device, characterized in that: include: a memory and a processor, the memory being coupled to the processor; The memory stores program instructions, and when the program instructions are executed by the processor, the electronic device executes the image processing method described in any one of claims 1-11.

13. A computer-readable storage medium comprising a computer program, characterized in that: When the computer program is executed on an electronic device, the electronic device is enabled to execute the image processing method according to any one of claims 1 to 11.