Image processing method, image processing device, storage medium and electronic device

By obtaining the image data when the auxiliary light source is not turned on and when the auxiliary light source is turned on, the image data equivalent to the auxiliary light source illumination is calculated, and the solid color area is matched to determine the target color, which solves the accuracy problem of color correction in image processing and improves the image color cast. problem.

CN114359101BActive Publication Date: 2024-09-24GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111679595.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-31
Publication Date
2024-09-24
Estimated Expiration
2041-12-31

AI Technical Summary

Technical Problem

It is difficult to accurately perform color correction in image processing with the existing technology, especially when the color temperature of the scene cannot be detected, resulting in an image color cast problem that is difficult to solve.

Method used

By obtaining the image data when the auxiliary light source is not turned on and when the auxiliary light source is turned on, the image data equivalent to that illuminated by the auxiliary light source is calculated, and the solid color area is matched with the preconfigured reference image data to determine the target color, and then carry out color analysis. Correction.

Benefits of technology

It realizes image color correction that does not rely on scene color temperature detection, improves the accuracy of color correction, is especially suitable for situations where scene color temperature cannot be accurately detected, and improves the problem of image color cast.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114359101B
    Figure CN114359101B
Patent Text Reader

Abstract

The present disclosure provides an image processing method, device, storage medium and electronic device, which relate to the field of image processing technology. The image processing method includes: obtaining first image data of a target scene taken when an auxiliary light source is not turned on, and second image data of a target scene taken when an auxiliary light source is turned on; determining third image data according to the first image data and the second image data; the third image data is image data corresponding to the target scene illuminated by only the auxiliary light source; determining the target color corresponding to the third image data by matching the image data of at least one pure color area in the third image data with a plurality of pre-configured groups of reference image data; the reference image data is image data corresponding to the reference color illuminated by only the auxiliary light source; performing color correction on the first image data or the second image data using the target color to obtain the target image data. The present disclosure improves the problem of image color cast.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image processing technology, and in particular to an image processing method, an image processing device, a computer-readable storage medium, and an electronic device. Background Art

[0002] Due to the difference between image sensors and human eyes in their perception of light, images captured by image sensors generally have a certain color cast compared to images actually seen by the human eye.

[0003] In the related art, most of the captured images are corrected by white balance to improve the color cast of the image. The premise of achieving white balance is to determine the color temperature of the shooting scene. However, in some scenes, the accurate color temperature may not be obtained, and the white balance processing cannot be performed accurately, which eventually leads to a more serious color cast in the image.

[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to those skilled in the art. Summary of the invention

[0005] The present disclosure provides an image processing method, an image processing device, a computer-readable storage medium and an electronic device, so as to improve the problem of image color cast at least to a certain extent.

[0006] According to a first aspect of the present disclosure, there is provided an image processing method, comprising: acquiring first image data of a target scene taken when an auxiliary light source is not turned on, and second image data of the target scene taken when the auxiliary light source is turned on; determining third image data according to the first image data and the second image data; the third image data is image data corresponding to the target scene illuminated by only the auxiliary light source; determining a target color corresponding to the third image data by matching image data of at least one pure color area in the third image data with a plurality of pre-configured groups of reference image data; the reference image data is image data corresponding to a reference color illuminated by only the auxiliary light source; and performing color correction on the first image data or the second image data using the target color to obtain the target image data.

[0007] According to a second aspect of the present disclosure, an image processing device is provided, comprising: an image data acquisition module, configured to acquire first image data of a target scene taken when an auxiliary light source is not turned on, and second image data of the target scene taken when the auxiliary light source is turned on; an image data separation module, configured to determine third image data based on the first image data and the second image data; the third image data is image data corresponding to the target scene being illuminated only by the auxiliary light source; a target color determination module, configured to determine a target color corresponding to the third image data by matching image data of at least one pure color area in the third image data with a plurality of pre-configured sets of reference image data; the reference image data is image data corresponding to a reference color being illuminated only by the auxiliary light source; and a color correction module, configured to perform color correction on the first image data or the second image data using the target color to obtain target image data.

[0008] According to a third aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the image processing method of the first aspect and possible implementation methods thereof are implemented.

[0009] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the image processing method of the above-mentioned first aspect and its possible implementation method by executing the executable instructions.

[0010] The technical solution disclosed in this disclosure has the following beneficial effects:

[0011] In the above image processing method, firstly, the first image data of the target scene is collected without turning on the auxiliary light source, and the second image data of the target scene is collected with turning on the auxiliary light source; then, the third image data equivalent to the target scene being illuminated only by the auxiliary light source is obtained according to the first image data and the second image data; next, the target color corresponding to the third image data is determined by matching the image data of at least one pure color area in the third image data with the reference image data equivalent to the reference color being illuminated only by the auxiliary light source; finally, the first image data or the second image data is color corrected using the target color to obtain the target image data. On the one hand, an image color correction scheme that does not rely on scene color temperature detection is provided, which is particularly suitable for situations where the scene color temperature cannot be accurately detected, such as situations where there is no gray area in the scene. On the other hand, the scheme matches the image data of the pure color area in the third image data with the reference image data, which is essentially matching the pure color part of the target scene illuminated only by the auxiliary light source with the reference color, thereby obtaining a target color that is equal to or close to the actual color of the target scene, which is conducive to improving the accuracy of color correction and improving the problem of image color cast.

[0012] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and for those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0014] Figure 1 A schematic diagram showing a system architecture in this exemplary embodiment;

[0015] Figure 2 A flowchart showing an image processing method in this exemplary embodiment is shown;

[0016] Figure 3 A schematic diagram showing a method of acquiring reference image data in this exemplary embodiment is shown;

[0017] Figure 4 A sub-flow chart for determining a target color in this exemplary embodiment is shown;

[0018] Figure 5 A schematic diagram showing determination of third pure color sub-image data in this exemplary embodiment;

[0019] Figure 6A flow chart of color correction in this exemplary embodiment is shown;

[0020] Figure 7 A schematic flowchart showing an image processing method in this exemplary embodiment;

[0021] Figure 8 A schematic diagram showing the structure of an image processing device in this exemplary embodiment is shown;

[0022] Fig. 9 A schematic structural diagram of an electronic device in this exemplary embodiment is shown. DETAILED DESCRIPTION

[0023] Exemplary embodiments of the present disclosure will now be described with reference to the accompanying drawings. However, the exemplary embodiments can be implemented in various forms and should not be construed as being limited to the examples set forth herein. These embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concept of the exemplary embodiments will be fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, the known technical solutions are not shown or described in detail to avoid obscuring the various aspects of the present disclosure.

[0024] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0025] In the related art, the general process of white balance processing is: find the white or gray area in the shooting scene; count the colors of the white or gray area to determine the color temperature of the shooting scene; obtain the correction parameters under the color temperature according to the color temperature curve; perform color correction based on the correction parameters to complete the white balance processing. However, in some scenes, it may be difficult to find the gray area (including the white area), such as red or yellow pure color scenes, which makes it impossible to accurately determine the color temperature of the scene, and it is impossible to achieve white balance, that is, it is impossible to solve the problem of image color cast.

[0026] In view of the above problems, the exemplary embodiment of the present disclosure first provides an image processing method. Figure 1 The system architecture and application scenarios of the operating environment of this exemplary embodiment are exemplarily described.

[0027] Figure 1 A schematic diagram of a system architecture is shown, and the system architecture 100 may include an image acquisition device 110, an auxiliary light source 120, a target scene 130, and a computing device 140. Among them, the image acquisition device 110 is used to capture an image of the target scene 130, and it can be a camera or other terminal device with a shooting function, such as a smart phone, a tablet computer, a wearable device, a drone, etc. In general, the image acquisition device 110 may include an image sensor, which is used to sense light signals and realize digital imaging by quantizing the light signals into digital signals. The auxiliary light source 120 refers to a light source other than a natural light source, which is used to provide auxiliary lighting during shooting, such as a lamp. In one embodiment, the auxiliary light source 120 can be set in the image acquisition device 110, such as a flash of the image acquisition device 110. The target scene 130 refers to a real scene as a shooting target, and may include people and objects in the scene. The computing device 140 can be used for image processing, such as a terminal computer or a server providing image processing services. The image acquisition device 110 and the computing device 140 can be connected through a wired or wireless communication link to perform data interaction.

[0028] In one embodiment, the image acquisition device 110 may send the first image data and the second image data captured of the target scene to the computing device 120. The computing device 120 obtains the target image data by executing the above image processing method, and may return the result to the image acquisition device 110 for display. Therefore, the computing device 120 may be the executor of the above image processing method.

[0029] In one implementation, after capturing and obtaining the first image data and the second image data, the image acquisition device 110 may obtain the target image data by executing the above image processing method. Therefore, the image acquisition device 110 may also be the execution subject of the above image processing method.

[0030] Combine the following Figure 2 The image processing method in this exemplary embodiment is described. Figure 2 An exemplary process of the image processing method is shown, which may include:

[0031] Step S210, acquiring first image data of the target scene taken when the auxiliary light source is not turned on, and second image data of the target scene taken when the auxiliary light source is turned on;

[0032] Step S220, determining third image data according to the first image data and the second image data; the third image data is image data corresponding to the target scene being illuminated by only the auxiliary light source;

[0033] Step S230, determining a target color corresponding to the third image data by matching image data of at least one pure color area in the third image data with a plurality of pre-configured groups of reference image data; the reference image data is image data corresponding to the reference color illuminated only by the auxiliary light source;

[0034] Step S240: performing color correction on the first image data or the second image data using the target color to obtain target image data.

[0035] In the above image processing method, firstly, the first image data of the target scene is collected without turning on the auxiliary light source, and the second image data of the target scene is collected with turning on the auxiliary light source; then, the third image data equivalent to the target scene being illuminated only by the auxiliary light source is obtained according to the first image data and the second image data; next, the target color corresponding to the third image data is determined by matching the image data of at least one pure color area in the third image data with the reference image data equivalent to the reference color being illuminated only by the auxiliary light source; finally, the first image data or the second image data is color corrected using the target color to obtain the target image data. On the one hand, an image color correction scheme that does not rely on scene color temperature detection is provided, which is particularly suitable for situations where the scene color temperature cannot be accurately detected, such as situations where there is no gray area in the scene. On the other hand, the scheme matches the image data of the pure color area in the third image data with the reference image data, which is essentially matching the pure color part of the target scene illuminated only by the auxiliary light source with the reference color, thereby obtaining a target color that is equal to or close to the actual color of the target scene, which is conducive to improving the accuracy of color correction and improving the problem of image color cast.

[0036] Below Figure 2 Each step in the procedure is described in detail.

[0037] In step S210, first image data of the target scene captured when the auxiliary light source is not turned on, and second image data of the target scene captured when the auxiliary light source is turned on are acquired.

[0038] There is a natural light source in the target scene. When the auxiliary light source is not turned on, the target scene is illuminated only by the natural light source. In this case, the target scene is photographed to obtain first image data; when the auxiliary light source is turned on, the target scene is illuminated by both the natural light source and the auxiliary light source. In this case, the target scene is photographed to obtain second image data.

[0039] In one embodiment, the auxiliary light source may be a flash of an image acquisition device. When the user controls the image acquisition device to take a photo, if the user wishes to capture an image without the flash, such as when the user manually turns off the flash, or when the image acquisition device determines in the automatic flash mode that the flash does not need to be turned on based on the sensed ambient light intensity, then the first image data is captured without the flash, and before or after the first image data is captured, the flash is forced to be turned on to capture the second image data. If the user wishes to capture an image with the flash on, such as when the user manually turns on the flash, or when the image acquisition device determines in the automatic flash mode that the flash needs to be turned on based on the sensed ambient light intensity, then the second image data is captured with the flash on, and before or after the second image data is captured, the flash is forced to be turned off to capture the first image data, and the preview image data captured before the second image data is captured (the flash is usually turned off by default during preview) may also be used as the first image data.

[0040] The first image data and the second image data may be sensing data of an image sensor for a light signal, and the present disclosure does not limit its content. For example, the first image data may include light intensity data or pixel data of the first image, and the second image data may include light intensity data or pixel data of the second image.

[0041] The light intensity data may be quantitative data of the intensity of the light signal sensed by the image sensor. Exemplarily, the image sensor may generate a responsive electrical signal when sensing the light signal, and the electrical signal may be converted into quantitative data and output to obtain the light intensity data. Alternatively, the brightness data of the first image may be used as the light intensity data, such as the first image data may include the brightness data of each pixel in the first image, and the second image data may include the brightness data of each pixel in the second image.

[0042] Pixel data may be quantitative data that corresponds an optical signal to a specific channel, such as the values ​​of R, G, and B channels. A Bayer filter is usually provided in an image sensor, so that light is filtered into monochromatic light after passing through the Bayer filter, and then enters each pixel of the image sensor. The image sensor may output RAW data, in which each pixel has only the value of the monochromatic channel. The RAW data may be further processed by demosaicing, etc., to obtain displayable data (displayable data is a name relative to RAW data, indicating that the data is the image data that users usually see), in which each pixel includes the values ​​of the three channels of R, G, and B, and the displayable data may be encoded and stored as an image file in a computer, such as JPEG (Joint Photographic Experts Group), PNG (Portable Network Graphics), BMP (Bitmap), and other image format files, and these image format files are equivalent to displayable data in this article. In one embodiment, the first image data may include the RAW data of the first image, and the second image data may include the RAW data of the second image. In one embodiment, the first image data may include presentable data of the first image, and the second image data may include presentable data of the second image.

[0043] Continue to refer Figure 2 In step S220, third image data is determined according to the first image data and the second image data; the third image data is image data corresponding to the target scene being illuminated by only the auxiliary light source.

[0044] The third image data is not actually captured image data, but is obtained by calculating the first image data and the second image data, and is equivalent to image data actually captured when the target scene is illuminated only by an auxiliary light source.

[0045] The natural light source and the auxiliary light source have an uncorrelated relationship, so the second image data can be regarded as the superposition result of the natural light source alone lighting and the auxiliary light source alone lighting. In step S220, the third image data can be obtained by calculating the difference data between the second image data and the first image data.

[0046] In one embodiment, the first image data and the second image data may be converted into frequency domain signals, the first image data corresponding to the first image signal, which is a signal of a natural light source reflected by a target scene (or refracted, reflection and refraction are not specifically distinguished in this article, and are both regarded as the convolution effect of the target scene on light), and the second image data corresponding to the second image signal, which is a superposition of the signals of the natural light source and the auxiliary light source reflected by the target scene. Thus, the first image signal is separated from the second image signal, and the remaining is a signal of the auxiliary light source reflected by the target scene, which is recorded as a third image signal. The third image data may be obtained based on the third image signal, for example, by converting the third image signal to the image spatial domain (the spatial domain information when the first image data or the second image data is converted into a frequency domain signal may be used) to obtain the third image data, or by converting the third image signal into a digital form to obtain the third image data.

[0047] In one implementation, since the information collected by the image sensor is the convolution of the light source and the object (ie, the target scene), the following relationship can be obtained:

[0048]

[0049] Wherein, λ represents the wavelength of light. I1 and I2 represent the first image data and the second image data respectively. S1 represents the spectrum of the natural light source, S1(λ) represents the light intensity corresponding to the wavelength λ in the natural light source, S2 represents the auxiliary light source, S2(λ) represents the light intensity corresponding to the wavelength λ in the auxiliary light source, ρ represents the reflectivity of the target scene to the light, and * is the convolution operation symbol.

[0050] From formula (1), we can know that the first image data is the convolution of the natural light source and the target scene, and the second image data is the convolution of the natural light source and the target scene, and the linear superposition of the convolution of the auxiliary light source and the target scene. Therefore, the following relationship can be obtained:

[0051] I3(λ)=I2(λ)-I1(λ)=S2(λ)*ρ(λ) (2)

[0052] Wherein, I3 represents the third image data. It can be known from formula (2) that the third image data is obtained by subtracting the second image data from the first image data.

[0053] It should be understood that in the above formulas (1) and (2), to be precise, I1, I2, and I3 are the light intensity data of the first image, the light intensity data of the second image, and the light intensity data of the third image, respectively. Since the light intensity data and the pixel data have a mapping relationship, I1, I2, and I3 can also be used as the pixel data of the first image, the pixel data of the second image, and the pixel data of the third image (it can be regarded as that the mapping relationship from light intensity to pixel is omitted in formulas (1) and (2)).

[0054] Continue to refer Figure 2 In step S230, the target color corresponding to the third image data is determined by matching the image data of at least one pure color area in the third image data with a plurality of pre-configured sets of reference image data; the reference image data is image data corresponding to the reference color illuminated only by an auxiliary light source.

[0055] The reference color is used as a reference in color correction and can be any color. The present disclosure does not limit the number of reference colors. In one embodiment, several reference colors can be determined in each color system, or multiple reference colors evenly distributed in the color space can be determined, so that a similar reference color can be found for any color.

[0056] For ease of matching, the reference image data and the third image data may be of the same type. For example, the third image data is light intensity data, and the reference image data is also light intensity data; the third image data is pixel data, and the reference image data is also pixel data. In this exemplary embodiment, image data of different reference colors illuminated only by an auxiliary light source may be acquired in advance to obtain a set of reference image data corresponding to each reference color. The auxiliary light source is the same as the auxiliary light source in step S210.

[0057] Figure 3 A schematic diagram of configuring reference image data is shown. The reference color card refers to a pure color card of the reference color, and the flash is an auxiliary light source. The reference image data is obtained by shooting the image data of the reference color card when only the auxiliary light source is used for illumination by the camera. The reference image data can be matched one by one with the reference color to form a related database.

[0058] The present disclosure does not limit the method for obtaining reference image data. For example, the reference color card can be placed in an environment without natural light source (such as a dark room), and the auxiliary light source can be turned on. At this time, only the auxiliary light source provides lighting, and the reference color card is photographed to obtain reference image data. Alternatively, the same method as steps S210 and S220 is adopted, and the reference color card is photographed respectively when the auxiliary light source is not turned on and when the auxiliary light source is turned on, and the value of the natural light source part is excluded by calculating the differential data to obtain the reference image data.

[0059] The third image data is image data corresponding to the target scene illuminated only by the auxiliary light source, and the reference image data is image data corresponding to the reference color illuminated only by the auxiliary light source. Matching the image data of the pure color area in the third image data with the reference image data is essentially matching the pure color part of the target scene illuminated only by the auxiliary light source with the reference color, thereby determining one or more reference colors closest to the pure color part in the target scene, and further determining the target color based on these reference colors. The target color can be regarded as the actual color of the target scene.

[0060] When the third image data includes only one color, that is, the third image data is a pure color image, the entire third image data may be used as image data of a pure color area to be matched with the reference image data.

[0061] When the third image data includes multiple colors, for example, there are multiple colors in the target scene, the first image data and the second image data both include multiple colors, and the third image data obtained after processing also includes multiple colors. Image data of at least one pure color area can be determined in the third image data and matched with the reference image data.

[0062] In one implementation, a region with the same value, that is, a pure color region, may be determined in the third image data, and image data of the pure color region may be extracted and matched with the reference image data.

[0063] In one embodiment, image data of a pure color area may be determined in the third image data according to at least one of the first image data and the second image data.

[0064] For easy distinction, the pure color area in the first image data is recorded as the first pure color area, the pure color area in the second image data is recorded as the second pure color area, and the pure color area in the third image data is recorded as the third pure color area.

[0065] Figure 4 Two exemplary ways of determining the image data of the third pure color area are shown:

[0066] Mode 1: The image processing method may further include the following steps:

[0067] Determine position information of a pure color area according to at least one of the first image data and the second image data;

[0068] Based on the position information of the pure color area, image data of the pure color area is determined in the third image data.

[0069] refer to Figure 4As shown, a first pure color region is determined in the first image data, or a second pure color region is determined in the second image data, and the region at the same position corresponding to the first pure color region or the second pure color region in the third image data is the third pure color region. Thus, after obtaining the third image data, image data of the third pure color region is segmented from the third image data according to the position information of the first pure color region or the second pure color region.

[0070] In one embodiment, if there is a pure color area in the first image data, the area at the same position in the second image data is usually also a pure color area, and the area at the same position in the processed third image data is also a pure color area. Thus, the first pure color area can be determined in the first image data, and its position information in the first image data can be obtained. Based on the position information, the corresponding pure color area can be determined in both the second image data and the third image data, and the image data of the pure color area can be extracted in the third image data, that is, the image data of the third pure color area.

[0071] In one embodiment, if there is a pure color area in the second image data, the area at the same position in the first image data is usually also a pure color area, and the area at the same position in the processed third image data is also a pure color area. Thus, the second pure color area can be determined in the second image data, and its position information in the second image data can be obtained. Based on the position information, the corresponding pure color area can be determined in both the first image data and the third image data, and the image data of the pure color area can be extracted in the third image data, that is, the image data of the third pure color area.

[0072] Since the auxiliary light source may be uneven in illumination, the pure color area in the first image data is not a pure color area in the second image data, or the pure color area in the second image data is not a pure color area in the first image data. Based on this, in one embodiment, the first pure color area can be determined in the first image data, and its position information in the first image data can be obtained, and it is detected whether the area at the same position in the second image data is also a pure color area; if so, it is determined that the area at the same position in the third image data is a pure color area, and the image data of the pure color area is extracted based on the position information, that is, the image data of the third pure color area; if not, it is determined that the area at the same position in the third image data is not a pure color area.

[0073] Method 2: The third image as a whole may be a pure color area, that is, the third image data is the image data of the third pure color area. The above-mentioned determining the third image data based on the first image data and the second image data includes:

[0074] Determine image data of a first pure color area in the first image data, and determine image data of a second pure color area corresponding to the first pure color area in the second image data;

[0075] The image data of the third pure color area is determined according to the image data of the first pure color area and the image data of the second pure color area.

[0076] refer to Figure 4 As shown, the image data of the first pure color area is segmented from the first image data, and the image data of the second pure color area is segmented from the second image data, and the first pure color area corresponds to the second pure color area. Then, the image data of the third pure color area is obtained by performing calculations such as differential calculations based on the image data of the first pure color area and the image data of the second pure color area, that is, the image data of the third pure color area can be directly obtained without processing the complete image data, and the image data of the third pure color area can be used as the third image data.

[0077] The present disclosure does not limit the number of third pure color regions. In one embodiment, a pure color region with an area greater than a preset area threshold in the third image data may be extracted to obtain image data of the pure color region for matching. In one embodiment, a pure color region with the largest area in the third image data may also be extracted to obtain image data of the pure color region for matching.

[0078] In this exemplary embodiment, by matching the image data of the third pure color area with the reference image data, a target color that is closer to the actual color of the third pure color area is determined. The target color may be a reference color or a color obtained by blending multiple reference colors. For example, if image data of k1 third pure color areas are determined in the third image data, and the image data of the k1 third pure color areas include k2 colors (the colors are colors in the third image data, k2≤k1), then corresponding k2 target colors may be obtained.

[0079] In one embodiment, reference Figure 5 As shown, the above-mentioned determination of the target color corresponding to the third image data by matching the third image data with a plurality of pre-configured groups of reference image data may include the following steps S510 and S520:

[0080] Step S510, matching the image data of at least one pure color area in the third image data with the reference image data, and determining at least one set of reference image data that matches the image data of the pure color area and at least one reference color corresponding to the at least one set of reference image data;

[0081] Step S520: determining a target color corresponding to the third image data according to a matching degree between the image data of the pure color area and the at least one set of reference image data, and the at least one reference color.

[0082] The present disclosure does not limit the specific method for calculating the matching degree. For example, the matching degree can be determined based on the Euclidean distance between the image data of the third pure color area and the reference image data. The larger the Euclidean distance, the smaller the matching degree. For example, (1-normalized Euclidean distance) can be used as the matching degree. The matching degree can also be determined based on the relative difference between the image data of the third pure color area and the reference image data, as shown in the following formula:

[0083]

[0084] Wherein, Iref represents reference image data, I3' represents image data of the third pure color area, and Sim represents the matching degree.

[0085] In one implementation, the matching degree between the image data of the third pure color area and each set of reference image data may be calculated.

[0086] In one implementation, reference image data that is significantly different from the third image data may be excluded, and only the matching degree between the third image data and the remaining reference image data may be calculated, thereby reducing the amount of calculation. For example, the color system in which the third image data is located may be determined, and reference image data corresponding to the reference color in the color system may be selected, and the matching degree between the third image data and these reference image data may be calculated.

[0087] After obtaining the degree of match between the image data of the third pure color area and the multiple groups of reference image data, one or more groups of reference image data with the highest degree of match can be selected as reference image data that matches the image data of the third pure color area. Exemplarily, a fixed number of reference image data can be selected in descending order of degree of match, and the fixed number can be determined based on experience or actual conditions. Alternatively, reference image data with a degree of match higher than a preset degree of match threshold can be selected. Furthermore, at least one reference color corresponding to the above at least one group of reference image data can be obtained, and these reference colors are reference colors that are relatively close to the pure color part of the target scene.

[0088] If only one set of reference image data matching the image data of the third pure color area and its corresponding reference color are obtained, the reference color can be used as the target color; if multiple sets of matching reference image data and their corresponding reference colors are obtained, these reference colors can be merged to obtain the target color.

[0089] In one embodiment, the at least one reference color may be weightedly fused according to the matching degree between the image data of the third pure color area and the at least one set of reference image data to obtain the target color. The reference image data with a higher matching degree has a greater weight of the corresponding reference color. Thus, the target color is closer to the actual color of the target scene.

[0090] Continue to refer Figure 2 In step S240, the first image data or the second image data is color corrected using the target color to obtain the target image data.

[0091] After the target color is determined, color correction is used to correct the first image data or the second image data to the target color. For example, when the first image data is a pure color image, the first image data can be corrected as a whole to the target color to obtain the target image data.

[0092] In one implementation, it can be determined whether to perform color correction on the first image data or on the second image data according to the flash setting during shooting. Exemplarily, if the flash is set to be off during shooting, indicating that it is desired to shoot an image without the flash, the first image data can be color corrected to obtain the target image data; if the flash is set to be on during shooting, indicating that it is desired to shoot an image with the flash on, the second image data can be color corrected to obtain the target image data.

[0093] In one embodiment, reference Figure 6 As shown, the above-mentioned color correction of the first image data or the second image data using the target color to obtain the target image data may include the following steps S610 and S620:

[0094] Step S610, obtaining a reference color corresponding to a pure color area in the third image data in the first image data or the second image data, and determining a correction parameter according to the target color and the reference color;

[0095] Step S620: Perform color correction on the first image data or the second image data using the correction parameters to obtain target image data.

[0096] The reference color is a color that corresponds to the target color. Color correction is used to correct the reference color to the target color. For example, the reference color can be the main color in the first image data or the color of the first pure color area.

[0097] The correction parameters can be mapping parameters from the reference color to the target color. For example, if the reference color of the first image data is (R1, G1, B1) and the target color is (R2, G2, B2), the correction parameters Rgain = R2 / R1, Ggain = G2 / G1, and Bgain = B2 / B1 can be obtained. Then, the first image data is fully color corrected using the correction parameters to obtain the target image data.

[0098] It should be understood that since there may be color differences between the first image data and the second image data, the pure color area in the third image data corresponds to different reference colors in the first image data and the second image data, and different correction parameters can be obtained thereby, that is, the correction parameters of the first image data may be different from the correction parameters of the second image data.

[0099] In one embodiment, the target scene may be a pure color scene, such as the sky, green leaves, a pure color wall, etc., then the first image data, the second image data, and the third image data are all pure color images, the first image data, the second image data, and the third image data are all one color, and all correspond to the target color, then the color of the first image data is the reference color. When color correction is performed on the first image data, the reference color can be corrected to complete the correction of the entire image.

[0100] In one implementation, the target scene may be a non-pure color scene, and the first image data and the second image data are not pure color images, and the color of the image data of the third pure color area corresponding to the position area in the first image data or the second image data may be used as the reference color of the first image data or the second image data. Figure 4 As shown in , the color (R1, G1, B1) of the first pure color area in the first image data can be used as the reference color of the first image data. After the correction parameter is calculated according to the reference color, the correction parameter can be used to perform color correction for all colors in the first image data.

[0101] In one embodiment, after acquiring the first image data, the image processing method may further include the following steps:

[0102] determining a distribution feature within at least one first image channel based on the first image data;

[0103] It is determined whether the first image data is a pure color image according to the above distribution characteristics.

[0104] The first image channel refers to a channel in the first image. The at least one first image channel may be any one or more of the R, G, and B channels of the first image data. Of course, the first image data may also be in other color modes (such as HSL, etc.), and the at least one first image channel may be a channel in other color modes.

[0105] For pure color images, the values ​​in any channel should be consistent. However, considering the influence of the environment, sensor errors, equipment fluctuations and other factors, even if the target scene is a pure color scene, the captured first image data may also contain non-pure color information (such as noise). This exemplary embodiment determines whether the first image data is a pure color image based on the distribution characteristics in the first image channel.

[0106] In one implementation, the mode of image data (such as light intensity data or pixel data) in a single channel can be counted, and points whose values ​​are not equal to the mode are determined as abnormal points. Then, the number or position of the abnormal points and other information are counted. If the number of abnormal points is large (such as greater than a preset abnormal point number threshold), or the distribution of abnormal points is too concentrated (such as there is at least one area, and the proportion of abnormal points in the area is greater than a preset abnormal point proportion threshold), it is determined that the first image data is not a pure color image. Otherwise, it is determined that the first image data is a pure color image.

[0107] In one embodiment, the above distribution feature may include the degree of discreteness of the image data in a single channel, and the degree of discreteness may be quantitatively represented by indicators such as variance, standard deviation, and relative deviation. If the degree of discreteness in a single channel is greater than a preset discrete threshold, it is determined that the first image data is not a pure color image, and if the degree of discreteness in a single channel is less than a preset discrete threshold, it is determined that the first image data is a pure color image. The discrete threshold may be set based on experience or actual conditions, such as 1%.

[0108] In one embodiment, the at least one first image channel may include all first image channels, such as three channels of R, G, and B. When determining whether the first image data is a pure color image, it may be determined whether the distribution characteristics of each first image channel meet the requirements. For example, when the discreteness of the image data in the R, G, and B channels is less than a preset discrete threshold, the first image data is determined to be a pure color image.

[0109] In one embodiment, in response to determining that the first image data is a pure color image according to the above distribution characteristics, step S220 is performed. That is, when the first image data is a pure color image, the processing of steps S220 to S240 is performed to achieve color correction.

[0110] In one embodiment, the image processing method may further include the following steps:

[0111] In response to determining that the first image data is not a pure color image according to the distribution characteristics, a scene color temperature corresponding to the first image data is determined, and white balance processing is performed on the first image data according to the scene color temperature.

[0112] That is to say, for non-pure color images, white balance processing can be performed by determining the scene color temperature to achieve color correction. Among them, a gray image block can be determined in the first image data, and the scene color temperature can be determined from this, and then the correction parameters corresponding to the scene color temperature (such as Rgain, Bgain) are called to perform white balance processing. After the first image data is white balanced, it can be output as a final image.

[0113] The above describes how to determine whether the first image data is a pure color image based on the distribution characteristics in the channels of the first image data, and whether to adopt the processing method of steps S220 to S240 or the white balance processing method.

[0114] In one implementation, similar processing may also be performed on the second image data. Specifically, after acquiring the second image data, the image processing method may further include the following steps:

[0115] determining a distribution feature within at least one second image channel based on the second image data;

[0116] It is determined whether the second image data is a pure color image according to the above distribution characteristics.

[0117] The second image channel refers to a channel in the second image, which is different from the first image channel. The second image data is judged whether it is a pure color image according to the distribution characteristics in the second image channel. For the specific judgment process, please refer to the embodiment of the first image data.

[0118] In one embodiment, in response to determining that the second image data is a pure color image according to the above distribution characteristics, step S220 is performed. That is, when the second image data is a pure color image, the processing of steps S220 to S240 is performed to achieve color correction.

[0119] In one embodiment, the image processing method may further include the following steps:

[0120] In response to determining that the second image data is not a pure color image according to the distribution characteristics, a scene color temperature corresponding to the second image data is determined, and white balance processing is performed on the second image data according to the scene color temperature.

[0121] After the second image data is processed with white balance, it can be output as a final image.

[0122] Figure 7 The schematic flow of the image processing method is shown, including:

[0123] Step S710, shooting first image data without turning on the flash, and shooting second image data with turning on the flash;

[0124] Step S720, determining whether the first image data is a pure color image, if so, continuing to execute steps S730 to S750, if not, continuing to execute step S760;

[0125] Step S730, subtracting the second image data from the first image data to obtain third image data;

[0126] Step S740, matching the image data of the pure color area in the third image data with the reference image data to determine the target color;

[0127] Step S750, color correction is performed on the first image data using the target color, and the image can be output after the correction;

[0128] Step S760: perform white balance processing on the first image data, and output the image after the processing.

[0129] The exemplary embodiment of the present disclosure also provides an image processing device. Figure 8 As shown, the image processing device 800 may include:

[0130] The image data acquisition module 810 is configured to acquire first image data of the target scene when the auxiliary light source is not turned on, and second image data of the target scene when the auxiliary light source is turned on;

[0131] The image data separation module 820 is configured to determine third image data according to the first image data and the second image data; the third image data is image data corresponding to the target scene being illuminated by only the auxiliary light source;

[0132] The target color determination module 830 is configured to determine the target color corresponding to the third image data by matching the image data of at least one pure color area in the third image data with a plurality of pre-configured sets of reference image data; the reference image data is image data corresponding to the reference color illuminated by only the auxiliary light source;

[0133] The color correction module 840 is configured to perform color correction on the first image data or the second image data using a target color to obtain target image data.

[0134] In one implementation, the image data separation module 820 is further configured to:

[0135] After acquiring the first image data, determining a distribution feature within at least one first image channel according to the first image data;

[0136] In response to determining that the first image data is a pure color image according to the distribution characteristics, determining the third image data according to the first image data and the second image data is performed.

[0137] In one implementation, the color correction module 840 is further configured to:

[0138] In response to determining that the first image data is not a pure color image according to the distribution characteristics, a scene color temperature corresponding to the first image data is determined, and white balance processing is performed on the first image data according to the scene color temperature.

[0139] In one implementation, the target color determination module 830 is further configured to:

[0140] Determine position information of a pure color area according to at least one of the first image data and the second image data;

[0141] Based on the position information of the pure color area, image data of the pure color area is determined in the third image data.

[0142] In one implementation, the third image data is image data of a third pure color area; the above-mentioned determining the third image data according to the first image data and the second image data includes:

[0143] Determine image data of a first pure color area in the first image data, and determine image data of a second pure color area corresponding to the first pure color area in the second image data;

[0144] Determine image data of a third pure color area according to the image data of the first pure color area and the image data of the second pure color area;

[0145] The method of determining the target color corresponding to the third image data by matching the image data of at least one pure color area in the third image data with a plurality of pre-configured groups of reference image data includes:

[0146] By matching the image data of the third pure color area with the reference image data, the target color corresponding to the image data of the third pure color area is determined.

[0147] In one embodiment, the method of determining the target color corresponding to the third image data by matching the third image data with a plurality of pre-configured groups of reference image data includes:

[0148] Matching the image data of at least one pure color area in the third image data with the reference image data, and determining at least one set of reference image data matching the image data of the pure color area and at least one reference color corresponding to the at least one set of reference image data;

[0149] A target color corresponding to the third image data is determined according to a matching degree between the image data of the pure color area and at least one set of reference image data, and at least one reference color.

[0150] In one embodiment, the color correction of the first image data or the second image data using the target color to obtain the target image data includes:

[0151] Acquire a reference color corresponding to a pure color area in the third image data in the first image data or the second image data, and determine a correction parameter according to the target color and the reference color;

[0152] Color correction is performed on the first image data or the second image data using the correction parameters to obtain target image data.

[0153] The specific details of each part of the above-mentioned device have been described in detail in the implementation method of the method part. The undisclosed details can be found in the implementation method of the method part, so they will not be repeated here.

[0154] The exemplary embodiments of the present disclosure also provide a computer-readable storage medium, which can be implemented in the form of a program product, which includes a program code, and when the program product is run on an electronic device, the program code is used to cause the electronic device to perform the steps described in the above "Exemplary Method" section of this specification according to various exemplary embodiments of the present disclosure. In an optional embodiment, the program product can be implemented as a portable compact disk read-only memory (CD-ROM) and includes program code, and can be run on an electronic device, such as a personal computer. However, the program product of the present disclosure is not limited to this, and in this document, the readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, device or device.

[0155] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0156] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0157] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

[0158] Program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0159] The exemplary embodiment of the present disclosure further provides an electronic device, which may be, for example, the image acquisition device 110 or the computing device 140 described above. The electronic device may include a processor and a memory. The memory stores executable instructions of the processor, such as program code. The processor executes the image processing method of the exemplary embodiment by executing the executable instructions, such as program code. Figure 2 method steps.

[0160] Below Fig. 9 The mobile terminal 900 in FIG. 1 is taken as an example to exemplify the structure of the electronic device. It should be understood by those skilled in the art that, in addition to the components specifically used for mobile purposes, Fig. 9 The construction in can also be applied to fixed type equipment.

[0161] like Fig. 9As shown, the mobile terminal 900 may specifically include: a processor 901, a memory 902, a bus 903, a mobile communication module 904, an antenna 1, a wireless communication module 905, an antenna 2, a display screen 906, a camera module 907, an audio module 908, a power module 909 and a sensor module 910.

[0162] The processor 901 may include one or more processing units, for example, the processor 901 may include an AP (Application Processor), a modem processor, a GPU (Graphics Processing Unit), an ISP (Image Signal Processor), a controller, an encoder, a decoder, a DSP (Digital Signal Processor), a baseband processor and / or an NPU (Neural-Network Processing Unit), etc. The image processing method in this exemplary embodiment may be performed by one or more of the AP, the GPU, and the DSP.

[0163] The encoder can encode (i.e. compress) an image or video to reduce the data size for easy storage or transmission. The decoder can decode (i.e. decompress) the encoded data of an image or video to restore the image or video data. For example, after obtaining the target image data, the target image data can be encoded into a specific format by the encoder for storage.

[0164] The processor 901 may be connected to the memory 902 or other components via a bus 903 .

[0165] The memory 902 may be used to store computer executable program codes, which may include instructions. The processor 901 executes various functional applications and data processing of the mobile terminal 900 by running the instructions stored in the memory 902. The memory 902 may also store application data, such as images, videos, and other files.

[0166] The communication function of the mobile terminal 900 can be implemented by the mobile communication module 904, antenna 1, wireless communication module 905, antenna 2, modulation and demodulation processor and baseband processor. Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. The mobile communication module 904 can provide 3G, 4G, 5G and other mobile communication solutions applied to the mobile terminal 900. The wireless communication module 905 can provide wireless communication solutions such as wireless LAN, Bluetooth, near field communication, etc. applied to the mobile terminal 900.

[0167] The display screen 906 is used to implement display functions, such as displaying user interfaces, images, videos, etc.

[0168] The camera module 907 is used to implement a shooting function, and may include an image sensor, a flash, etc. In this exemplary embodiment, the camera module 907 is used to shoot the first image data and the second image data.

[0169] The audio module 908 is used to implement audio functions, such as playing audio, collecting voice, etc. The power module 909 is used to implement power management functions, such as charging the battery, powering the device, monitoring the battery status, etc. The sensor module 910 may include one or more sensors to implement specific sensing detection functions.

[0170] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the exemplary embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.

[0171] It will be appreciated by those skilled in the art that various aspects of the present disclosure may be implemented as a system, method or program product. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or an implementation combining hardware and software aspects, which may be collectively referred to herein as a "circuit", "module" or "system". Those skilled in the art will readily think of other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any variations, uses or adaptive changes of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and implementation are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.

[0172] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. An image processing method, characterized in that: include: Acquire first image data of a target scene taken when the auxiliary light source is not turned on, and second image data of the target scene taken when the auxiliary light source is turned on; Determine third image data according to the first image data and the second image data; the third image data is image data corresponding to the target scene being illuminated by only the auxiliary light source; Determine a target color corresponding to the third image data by matching image data of at least one pure color area in the third image data with a plurality of pre-configured groups of reference image data; The reference image data is image data corresponding to illumination of a reference color by the auxiliary light source only; The first image data or the second image data is color corrected using the target color to obtain target image data.

2. The method according to claim 1, characterized in that After acquiring the first image data, the method further includes: determining a distribution feature within at least one first image channel based on the first image data; In response to determining that the first image data is a pure color image according to the distribution characteristics, determining third image data according to the first image data and the second image data is performed.

3. The method according to claim 2, characterized in that The method further comprises: In response to determining that the first image data is not a pure color image according to the distribution characteristics, a scene color temperature corresponding to the first image data is determined, and white balance processing is performed on the first image data according to the scene color temperature.

4. The method according to claim 1, characterized in that: The method further comprises: determining position information of the pure color area according to at least one of the first image data and the second image data; Based on the position information of the pure color area, image data of the pure color area is determined in the third image data.

5. The method according to claim 1, wherein the third image data is image data of a third pure color area; and determining the third image data according to the first image data and the second image data comprises: Determine image data of a first pure color area in the first image data, and determine image data of a second pure color area corresponding to the first pure color area in the second image data; Determine the image data of the third pure color area according to the image data of the first pure color area and the image data of the second pure color area; The determining the target color corresponding to the third image data by matching the image data of at least one pure color area in the third image data with a plurality of pre-configured groups of reference image data comprises: The target color corresponding to the image data of the third pure color area is determined by matching the image data of the third pure color area with the reference image data.

6. The method according to claim 1, characterized in that The determining the target color corresponding to the third image data by matching the image data of at least one pure color area in the third image data with a plurality of pre-configured groups of reference image data comprises: Matching the image data of at least one pure color area in the third image data with the reference image data, and determining at least one group of reference image data matching the image data of the pure color area and at least one reference color corresponding to the at least one group of reference image data; A target color corresponding to the third image data is determined according to a matching degree between the image data of the pure color area and the at least one set of reference image data, and the at least one reference color.

7. The method according to claim 1, characterized in that The step of performing color correction on the first image data or the second image data by using the target color to obtain the target image data includes: Acquire a reference color corresponding to a pure color area in the third image data in the first image data or the second image data, and determine a correction parameter according to the target color and the reference color; The first image data or the second image data is color corrected using the correction parameters to obtain the target image data.

8. An image processing device, characterized in that: include: An image data acquisition module is configured to acquire first image data of a target scene taken when the auxiliary light source is not turned on, and second image data of the target scene taken when the auxiliary light source is turned on; an image data separation module, configured to determine third image data according to the first image data and the second image data, wherein the third image data is image data corresponding to the target scene being illuminated by only the auxiliary light source; a target color determination module, configured to determine a target color corresponding to the third image data by matching image data of at least one pure color area in the third image data with a plurality of pre-configured groups of reference image data; The reference image data is image data corresponding to the illumination of the reference color by the auxiliary light source only; The color correction module is configured to perform color correction on the first image data or the second image data using the target color to obtain target image data.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

10. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 7 by executing the executable instructions.