Image generation method and device, electronic equipment and storage medium

By establishing a mapping relationship to adjust the white balance gain value of the second camera, the problem of inconsistent colors when switching cameras in multi-camera electronic devices is solved, achieving image color consistency and improving the user experience.

CN121908150APending Publication Date: 2026-04-21GUANGZHOU SHIYUAN ELECTRONICS CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGZHOU SHIYUAN ELECTRONICS CO LTD
Filing Date
2025-12-01
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Multi-camera electronic devices may produce inconsistent colors in the images they capture when switching cameras, leading to a degraded user experience.

Method used

By acquiring the white balance gain value of the first camera under different light sources, a mapping relationship is established, and the white balance gain value of the second camera is adjusted to make its color consistent with the image captured by the first camera.

Benefits of technology

This achieves color consistency in images captured by multi-camera electronic devices under different light sources, thus improving the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121908150A_ABST
    Figure CN121908150A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an image generation method and device, electronic equipment and a storage medium, a first white balance gain value of a first camera under a current light source can be obtained, and then a second white balance gain value of a second camera under the current light source is determined according to the first white balance gain value and a preset first mapping relation. And furthermore, an image shot by the second camera can be generated according to the second white balance gain value. The first mapping relationship is determined according to the plurality of first adjustment parameters of the second camera under the plurality of light sources with different color temperatures, so that the color of the image shot by the first camera when the first white balance gain value is adopted is consistent with the color of the image shot by the second camera when the second white balance gain value is adopted; therefore, the embodiment of the invention can ensure that the colors of the images shot by the first camera and the second camera are consistent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to an image generation method, apparatus, electronic device, and storage medium. Background Technology

[0002] Multi-camera electronic devices refer to electronic devices that integrate two or more cameras. By having multiple cameras work together, they can achieve richer shooting functions. Multi-camera electronic devices have been widely used in fields such as smartphones, smart homes, and security monitoring.

[0003] In multi-camera electronic devices, different cameras produce images with varying colors due to differences in hardware or software performance. Specifically, hardware performance differences can include variations in optical parameters and sensor performance. Software performance differences can stem from variations in automatic white balance algorithms.

[0004] Therefore, when using a multi-camera electronic device to capture images, switching from one camera to another can cause sudden color changes in the generated images, which can reduce the user experience.

[0005] Therefore, ensuring color consistency in images captured by multi-camera electronic devices has become a pressing technical problem that needs to be solved. Summary of the Invention

[0006] This application provides an image generation method, apparatus, electronic device, and storage medium that can ensure color consistency in images captured by a first camera and a second camera.

[0007] In a first aspect, embodiments of this application provide an image generation method applied to a multi-camera electronic device, the multi-camera electronic device including a first camera and a second camera, the method comprising: acquiring a first white balance gain value of the first camera under a current light source; determining a second white balance gain value of the second camera under the current light source based on the first white balance gain value and a preset first mapping relationship; the first mapping relationship being used to ensure that the color of an image captured by the first camera using the first white balance gain value is consistent with the color of an image captured by the second camera using the second white balance gain value; the first mapping relationship being determined based on multiple first adjustment parameters of the second camera under multiple light sources; the color temperature values ​​of the multiple light sources are all different; and generating an image captured by the second camera based on the second white balance gain value.

[0008] Optionally, before obtaining the first white balance gain value of the first camera under the current light source, the method further includes: obtaining multiple first images of the target color chart captured by the first camera under multiple light sources; the color temperature values ​​of the multiple light sources are all different; determining multiple third white balance gain values ​​of the first camera at multiple color temperatures and the average color channel value of each color channel of a first target pixel in the multiple first images based on the multiple first images; the first target pixel is the pixel corresponding to the gray-white block in the first image; obtaining multiple second images of the target color chart captured by the second camera under the multiple light sources; determining the third white balance gain value of the second camera at multiple color temperatures based on the multiple second images. The system comprises multiple fourth white balance gain values ​​and the average color channel values ​​of the second target pixels in the multiple second images; the second target pixels are the pixels corresponding to the gray-white blocks in the second images; multiple first adjustment parameters of the second camera are determined based on the average color channel values ​​of the first target pixels in the multiple first images, the average color channel values ​​of the second target pixels in the multiple second images, the multiple third white balance gain values, and the multiple fourth white balance gain values; the first adjustment parameters are used to adjust the fourth white balance gain values; and the first mapping relationship is determined based on the multiple first adjustment parameters, the multiple third white balance gain values, and the multiple fourth white balance gain values.

[0009] Optionally, acquiring multiple first images of the target color chart captured by the first camera under multiple light sources includes: adjusting multiple second adjustment parameters of the first camera to acquire multiple first images of the target color chart captured by the first camera under multiple light sources; the second adjustment parameters are used to adjust the third white balance gain value.

[0010] Optionally, the color channel values ​​of the first target pixel and the color channel values ​​of the second target pixel satisfy at least one of the following conditions: the ratio of the red channel value to the green channel value of the first target pixel is greater than a first threshold and less than a second threshold; the ratio of the blue channel value to the green channel value of the first target pixel is greater than a third threshold and less than a fourth threshold; the ratio of the red channel value to the green channel value of the second target pixel is greater than a fifth threshold and less than a sixth threshold; the ratio of the blue channel value to the green channel value of the second target pixel is greater than a seventh threshold and less than an eighth threshold; the red channel value of the first target pixel... The sum of the red channel value and the blue channel value of the first target pixel is greater than the ninth threshold and less than the tenth threshold; the sum of the red channel value and the blue channel value of the second target pixel is greater than the eleventh threshold and less than the twelfth threshold; the difference between the red channel value and the blue channel value of the first target pixel is greater than the thirteenth threshold and less than the fourteenth threshold; the difference between the red channel value and the blue channel value of the second target pixel is greater than the fifteenth threshold and less than the sixteenth threshold; the product of the red channel value and the blue channel value of the first target pixel is greater than the seventeenth threshold and less than the eighteenth threshold; the product of the red channel value and the blue channel value of the second target pixel is greater than the nineteenth threshold and less than the twentieth threshold.

[0011] Optionally, all of the light sources are LED light sources.

[0012] Optionally, the brightness values ​​of the first target pixel and the second target pixel are both within a first preset range.

[0013] Optionally, the average value of each color channel of the first target pixel in the first image is determined in the following way: Detecting the brightness value of each first target pixel, filtering out a third target pixel and a fourth target pixel; the brightness value of the third target pixel is greater than a first preset value and less than a second preset value, the brightness value of the fourth target pixel is greater than a third preset value and less than the first preset value, or the brightness value of the fourth target pixel is greater than a second preset value and less than the fourth preset value; obtaining the color channel values ​​of the third target pixel and the fourth target pixel; determining the average value of each color channel of the first target pixel in the first image based on the color channel values ​​of the third target pixel and the corresponding first weighting coefficient, and the color channel values ​​of the fourth target pixel and the corresponding second weighting coefficient; wherein the first weighting coefficient is greater than the second weighting coefficient.

[0014] Secondly, embodiments of this application provide an image generation device disposed in a multi-camera electronic device, the multi-camera electronic device including a first camera and a second camera, the device comprising: an acquisition module, configured to acquire a first white balance gain value of the first camera under a current light source; a determination module, configured to determine a second white balance gain value of the second camera under the current light source based on the first white balance gain value and a preset first mapping relationship; the first mapping relationship is configured to ensure that the color of the image captured by the first camera using the first white balance gain value is consistent with the color of the image captured by the second camera using the second white balance gain value; the first mapping relationship is determined based on multiple first adjustment parameters of the second camera under multiple light sources; the color temperature values ​​of the multiple light sources are all different; and a generation module, configured to generate an image captured by the second camera based on the second white balance gain value.

[0015] Thirdly, embodiments of this application provide an electronic device, including a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the electronic device implements any of the aforementioned image generation methods.

[0016] Fourthly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements any of the aforementioned image generation methods.

[0017] This application provides an image generation method, apparatus, electronic device, and storage medium. It can acquire a first white balance gain value of a first camera under a current light source, and then determine a second white balance gain value of a second camera under the same light source based on the first white balance gain value and a preset first mapping relationship. Furthermore, it can generate an image captured by the second camera based on the second white balance gain value. Since the first mapping relationship ensures that the colors of the image captured by the first camera using the first white balance gain value are consistent with the colors of the image captured by the second camera using the second white balance gain value, this application embodiment can guarantee color consistency between the images captured by the first camera and the second camera. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1A schematic diagram of a multi-camera electronic device provided for an embodiment of this application; Figure 2 A schematic flowchart of an image generation method provided for an embodiment of this application; Figure 3 A schematic diagram of a 24-color chart provided for an embodiment of this application; Figure 4 A schematic diagram illustrating an example of a mapping curve provided for an embodiment of this application; Figure 5 Another example schematic diagram of the mapping curve provided for an embodiment of this application; Figure 6 Another schematic flowchart illustrating the image generation method provided for embodiments of this application; Figure 7 A schematic diagram of the structure of an image generation apparatus provided for an embodiment of this application; Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0020] In this article, the term "and / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent three cases: A exists alone, A and B exist simultaneously, and B exists alone. The symbol " / " in this article indicates that the related objects are in an "or" relationship; for example, A / B means A or B.

[0021] The terms "first" and "second," etc., used in the specification and claims herein are used to distinguish different objects, not to describe a specific order of objects. For example, "first response message" and "second response message," etc., are used to distinguish different response messages, not to describe a specific order of response messages.

[0022] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.

[0023] In the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more, for example, multiple processors means two or more processors, multiple elements means two or more elements, etc.

[0024] In multi-camera electronic devices, different cameras produce images with different colors due to differences in hardware performance (such as the optical parameters of the lens and the sensor parameters) or software performance (such as the automatic white balance algorithm).

[0025] Therefore, when using multi-camera electronic devices to capture images, switching from one camera to another can cause abrupt color changes in the generated images, thus degrading the user experience. This problem is particularly noticeable in scenes with mixed color temperatures and large areas of interfering colors.

[0026] In a specific application scenario, a multi-camera electronic device can be a smartphone with both a front-facing and a rear-facing camera. While recording video using the rear camera, a user can switch to the front-facing camera to continue recording. However, due to hardware and / or software differences between the rear and front cameras, the colors in the videos recorded by the two cameras will not be the same. When the user switches cameras, a sudden color change occurs on the smartphone screen, thus affecting the user experience.

[0027] In this embodiment, the white balance gain of the second camera can be pre-adjusted using a first adjustment parameter under light sources with different color temperatures, so that the color of the image captured by the second camera is consistent with that captured by the first camera when the adjusted white balance gain value is used. Then, a first mapping relationship is established based on the white balance gain value of the first camera and the adjusted white balance gain value of the second camera.

[0028] In this way, when using a multi-camera electronic device, the colors of the images captured by the first camera using the first white balance gain value and the images captured by the second camera using the second white balance gain value (i.e., the white balance gain value corresponding to the first white balance gain value in the first mapping relationship) can be consistent.

[0029] In view of this, embodiments of this application provide an image generation method, apparatus, electronic device, and storage medium that can ensure color consistency of images captured by a multi-camera electronic device.

[0030] This application provides a multi-camera electronic device, such as... Figure 1 As shown, the multi-camera electronic device 1 includes a processor 11, a first camera 12, and a second camera 13. The processor 11 can be connected to the first camera 12 and the second camera 13, respectively. For example, the processor 11 can be an image signal processor. Figure 2 As shown, the image generation method (steps S21 to S26) executed by the processor 11 is used to establish a mapping relationship (i.e., a first mapping relationship) between the white balance gain value of the first camera and the white balance gain of the second camera, which may specifically include the following steps: S21, acquire multiple first images of the target color chart captured by the first camera under multiple light sources; the color temperature values ​​of the multiple light sources are all different.

[0031] Specifically, the processor 11 can control the first camera 12 to capture images of the target color chart (e.g., a 24-color chart) under multiple light sources with different color temperatures, thereby obtaining multiple images (i.e., the first image). For information on the 24-color chart, please refer to [link to relevant documentation]. Figure 3 As shown.

[0032] First, under a light source with a color temperature of 2300K, the processor 11 can control the first camera 12 to capture an image of the 24-color chart, thus obtaining the first image of the 24-color chart. Then, with a color temperature adjustment gradient of 200K, under a light source with a color temperature of 2500K, the processor 11 can control the first camera 12 to capture an image of the 24-color chart, thus obtaining the second image of the 24-color chart. Similarly, the processor 11 can also sequentially control the first camera 12 to capture an image of the 24-color chart under light sources with color temperatures of 2700K, 2900K, and up to 7500K, thereby obtaining a total of 25 images.

[0033] It should be noted that the above description is for illustrative purposes only, and users can adjust the color temperature of the light source according to their actual needs.

[0034] S22, based on the multiple first images, determine multiple third white balance gain values ​​of the first camera at multiple color temperatures and the average value of each color channel of the first target pixel in the multiple first images; the first target pixel is the pixel corresponding to the gray-white block in the first image.

[0035] In this step, the processor 11 can determine the white balance gain value (i.e., the third white balance gain value) of the first camera 12 at each different color temperature based on multiple first images at multiple color temperatures and an automatic white balance algorithm. Specifically, the white balance gain value includes the white balance gain value of the red channel and the white balance gain value of the blue channel.

[0036] Specifically, following the previous example, processor 11 can use an automatic white balance algorithm (such as a grayscale algorithm) to calculate the red channel gain value Rgain1 and the blue channel gain value Bgain1 of the first camera 12 at a color temperature of 2300K, based on image X1 captured by the first camera 12 at 2300K color temperature. Similarly, processor 11 can use an automatic white balance algorithm to calculate the red channel gain value Rgain2 and the blue channel gain value Bgain2 of the first camera 12 at 2500K color temperature, based on image X2 captured by the first camera 12 at 7500K color temperature. And so on, processor 11 can use an automatic white balance algorithm to calculate the red channel gain value Rgain27 and the blue channel gain value Bgain27 of the first camera 12 at 7500K color temperature, based on image X27 captured by the first camera 12 at 7500K color temperature.

[0037] In this step, the processor 11 can also determine the average red channel, average green channel, and average blue channel values ​​of a first target pixel in multiple first images based on the first images at multiple color temperatures. The first target pixel is a gray-white block in the first image (color blocks 19 to 23, see...). Figure 3 The corresponding pixel.

[0038] Continuing with the previous example, under a light source with a color temperature of 2300K, the image captured by the first camera 12 from the 24-color chart is image X1. After obtaining image X1, the processor 11 can determine the red channel intensity values ​​of multiple pixels corresponding to the gray-white blocks in image X1 (i.e., the first target pixels). Then, it can calculate the average of the multiple red channel intensity values, i.e., the red channel mean R1. Similarly, the processor 11 can calculate the green channel mean G1 and the blue channel mean B1.

[0039] Similarly, under a 2500K color temperature light source, the image captured by the first camera 12 from the 24-color chart is image X2. The processor 11 can calculate the average value R2 of the red channel, the average value G2 of the green channel, and the average value B2 of the blue channel for the pixels corresponding to the gray-white blocks in image X2. By analogy, under a 7500K color temperature light source, the image captured by the first camera 12 from the 24-color chart is image X27. The processor 11 can calculate the average value R27 of the red channel, the average value G27 of the green channel, and the average value B27 of the blue channel for the multiple pixels corresponding to the gray-white blocks in image X27.

[0040] S23, acquire multiple second images of the target color chart captured by the second camera under multiple light sources.

[0041] In this step, the processor 11 can control the second camera 13 to capture the target color chart under the light source of each of the aforementioned color temperatures (the same light source as in step S21), thereby obtaining multiple images (i.e., the second image).

[0042] The specific implementation method of the processor 11 controlling the second camera 13 to capture the target color chart at different color temperatures is the same as the specific implementation method of the processor 11 controlling the first camera 12 to capture the target color chart at different color temperatures. For details, please refer to the description in the aforementioned step S21.

[0043] S24, based on the multiple second images, determine multiple fourth white balance gain values ​​of the second camera at multiple color temperatures and the average value of each color channel of the second target pixel in the multiple second images; the second target pixel is the pixel corresponding to the gray-white block in the second image.

[0044] In this step, the processor 11 can determine the white balance gain value (i.e., the fourth white balance gain value) of the second camera 13 at different color temperatures based on the second image at multiple color temperatures and an automatic white balance algorithm. Specifically, the fourth white balance gain value includes the white balance gain value of the red channel and the white balance gain value of the blue channel.

[0045] Specifically, following the previous example, processor 11 can use an automatic white balance algorithm (such as a grayscale algorithm) to calculate the red channel gain value Rgain1SE and the blue channel gain value Bgain1SE of the second camera 13 at a color temperature of 2300K, based on image Y1 captured by the second camera 13 at 2300K color temperature. Similarly, processor 11 can use an automatic white balance algorithm to calculate the red channel gain value Rgain2 and the blue channel gain value Bgain2 of the second camera 13 at a color temperature of 2500K, based on image Y2 captured by the second camera 13 at 7500K color temperature. And so on, processor 11 can use an automatic white balance algorithm to calculate the red channel gain value Rgain27SE and the blue channel gain value Bgain27SE of the second camera 13 at 7500K color temperature, based on image Y27 captured by the second camera 13 at 7500K color temperature.

[0046] In this step, the processor 11 can also determine the average red channel, average green channel, and average blue channel values ​​of the second target pixels in the multiple second images based on the second images at multiple color temperatures. The second target pixels are the pixels corresponding to the gray-white blocks in the second images.

[0047] Continuing with the previous example, under a light source with a color temperature of 2300K, the image captured by the second camera 13 of the 24-color chart is image Y1. After obtaining image Y1, the processor 11 can determine the gray-white patches (color patches 19 to 23, see...) within image Y1. Figure 3 The processor 11 can calculate the red channel intensity values ​​of multiple pixels (i.e., the second target pixel), and then calculate the average of the multiple red channel intensity values, which is the red channel mean R1SE. Similarly, the processor 11 can calculate the green channel mean G1SE and the blue channel mean B1SE.

[0048] Similarly, under a 2500K color temperature light source, the image captured by the second camera 13 from the 24-color chart is image Y2. The processor 11 can calculate the average red channel value R2SE, the average green channel value G2SE, and the average blue channel value B2SE of the pixels corresponding to the gray-white blocks in image Y2. By analogy, the processor 11 can calculate the average red channel value R27SE, the average green channel value G27SE, and the average blue channel value B27SE of the second target pixel at a 7500K color temperature.

[0049] S25, based on the average color channel values ​​of the first target pixels in the multiple first images, the average color channel values ​​of the second target pixels in the multiple second images, the multiple third white balance gain values, and the multiple fourth white balance gain values, determine multiple first adjustment parameters of the second camera; the first adjustment parameters are used to adjust the fourth white balance gain values.

[0050] In this step, the value of the first adjustment parameter of the second camera 13 is typically different for different color temperatures. Continuing with the previous example, under a 2300K color temperature light source, the first adjustment parameter can be used to adjust the fourth white balance gain value of the second camera 13, so that the colors of the image captured by the second camera 13 using the adjusted fourth white balance gain value are consistent with the colors of the image captured by the first camera 12 using the third white balance gain value. The function of the first adjustment parameter is the same for other color temperature values, and will not be detailed here. A corresponding first adjustment parameter exists for each color temperature light source.

[0051] The first adjustment parameters include red channel gain adjustment parameters and blue channel gain adjustment parameters. The red channel gain adjustment parameters are used to adjust the red channel gain value of the second camera 13, and the blue channel gain adjustment parameters are used to adjust the blue channel gain value of the second camera 13.

[0052] The following section will explain in detail how to calculate the first adjustment parameter for each color temperature.

[0053] First, the processor 11 can use the third white balance gain value from step S22 to correct the aforementioned red channel mean and blue channel mean. Specifically, following the previous example, at a color temperature of 2300K, the red channel white balance gain value in the third white balance gain value is Rgain1, and the red channel mean of the pixels corresponding to the gray-white blocks in image X1 is R1. Multiplying Rgain1 and R1 yields the corrected red channel mean value R1M.

[0054] Similarly, at a color temperature of 2300K, the blue channel white balance gain value in the third white balance gain value is Bgain1, and the blue channel mean value of the pixels corresponding to the gray-white blocks in image Y1 is B1. Multiplying Bgain1 and B1 will yield the corrected blue channel mean value B1M.

[0055] Then, the processor 11 can determine the red-green difference value a1 and the yellow-blue difference value b1 of the LAB color space based on the corrected red channel mean R1M, the corrected blue channel mean B1M, and the green channel mean G1.

[0056] It should be noted that the red-green difference component ranges from approximately [-128, 127]. Positive values ​​indicate a red tint, negative values ​​indicate a green tint, and the larger the absolute value, the more vibrant the color. The yellow-blue difference component also ranges from approximately [-128, 127]. Positive values ​​indicate a yellow tint, negative values ​​indicate a blue tint, and the larger the absolute value, the higher the color saturation.

[0057] Next, the processor 11 can use the fourth white balance gain value from step S24 to correct the red channel mean and blue channel mean of the pixels in the gray-white block in the second image. Specifically, following the previous example, at a color temperature of 2300K, the red channel white balance gain value in the fourth white balance gain value is Rgain1SE, and the red channel mean of the pixels corresponding to the gray-white block in image Y1 is R1SE. By multiplying Rgain1SE, R1SE, and the adjustment parameter Radjust1 of the red channel white balance gain value, the corrected red channel mean value R1MSE can be obtained.

[0058] Similarly, at a color temperature of 2300K, the blue channel white balance gain value in the fourth white balance gain value is Bgain1SE, and the blue channel mean value of the pixels corresponding to the gray-white blocks in image Y1 is B1SE. Multiplying Bgain1SE, B1SE, and the adjustment parameter Badjust1 for the blue channel white balance gain value yields the corrected blue channel mean value B1MSE. The adjustment parameter Radjust1 for the red channel white balance gain value and the adjustment parameter Badjust1 for the blue channel white balance gain value are the first adjustment parameters at a color temperature of 2300K.

[0059] Then, the processor 11 can determine the red-green difference value a2 and the yellow-blue difference value b2 of the LAB color space based on the corrected red channel mean R1MSE, the corrected blue channel mean B1MSE, and the green channel mean.

[0060] In the formula [(a1-a2) 2 +(b1-b2) 2 ] 1 / 2 middle, Used to characterize the color difference between image X1 and image Y1, when When the value is 0, the colors of image X1 and image Y1 are identical. Therefore, by setting... When the value is equal to 0, the adjustment parameter Radjust1 for the white balance gain of the red channel and the adjustment parameter Badjust1 for the white balance gain of the blue channel can be calculated.

[0061] Similarly, processor 11 can also use the same method to determine the adjustment parameter Radjust2 for the red channel white balance gain value and the adjustment parameter Badjust2 for the blue channel white balance gain value of the second camera 13 at a color temperature of 2500K. By analogy, processor 11 can also use the same method to determine the adjustment parameter Radjust27 for the red channel white balance gain value and the adjustment parameter Badjust27 for the blue channel white balance gain value of the second camera 13 at a color temperature of 7500K.

[0062] S26, determine the first mapping relationship based on the plurality of first adjustment parameters, the plurality of third white balance gain values ​​and the plurality of fourth white balance gain values.

[0063] In this step, following the previous example, at a color temperature of 2300K, the processor 11 can multiply the red channel white balance gain adjustment parameter Radjust1 in the first adjustment parameters with the red channel white balance gain value Rgain1SE of the second camera 13 to calculate the adjusted red channel white balance gain value Rgain1MSE. Next, the processor 11 can use the red channel white balance gain value Rgain1 of the first camera 12 as the horizontal axis value and the adjusted red channel white balance gain value Rgain1MSE of the second camera 13 as the vertical axis value to determine the corresponding coordinate point C1 in the coordinate system.

[0064] Similarly, at a color temperature of 2500K, the processor 11 can multiply the red channel white balance gain adjustment parameter Radjust2 in the first adjustment parameter with the red channel white balance gain value Rgain2SE of the second camera 13 to calculate the adjusted red channel white balance gain value Rgain2MSE. Next, the processor 11 can use the red channel white balance gain value Rgain2 of the first camera 12 as the horizontal axis value and the adjusted red channel white balance gain value Rgain2MSE of the second camera 13 as the vertical axis value to determine the corresponding coordinate point C2 in the coordinate system.

[0065] Similarly, at a color temperature of 7500K, the processor 11 can multiply the red channel white balance gain adjustment parameter Radjust27 in the first adjustment parameter with the red channel white balance gain value Rgain27SE of the second camera 13 to calculate the adjusted red channel white balance gain value Rgain27MSE. Next, the processor 11 can use the red channel white balance gain value Rgain27 of the first camera 12 as the horizontal axis value and the adjusted red channel white balance gain value Rgain27MSE of the second camera 13 as the vertical axis value to determine the corresponding coordinate point C27 in the coordinate system.

[0066] Based on the 27 coordinate points C1, C2, up to C27, connecting adjacent coordinate points yields a mapping curve (i.e., mapping curve E). For more information on mapping curve E, please refer to [link to documentation / reference]. Figure 4 .

[0067] In this step, following the previous example, at a color temperature of 2300K, the processor 11 can multiply the blue channel white balance gain value adjustment parameter Badjust1 in the first adjustment parameters with the blue channel white balance gain value Bgain1SE of the second camera 13 to calculate the adjusted blue channel white balance gain value Bgain1MSE. Next, the processor 11 can use the blue channel white balance gain value Bgain1 of the first camera 12 as the horizontal axis value and the adjusted blue channel white balance gain value Bgain1MSE of the second camera 13 as the vertical axis value to determine the corresponding coordinate point D1 in the coordinate system.

[0068] Similarly, at a color temperature of 2500K, the processor 11 can multiply the blue channel white balance gain value adjustment parameter Badjust2 in the first adjustment parameter with the blue channel white balance gain value Bgain2SE of the second camera 13 to calculate the adjusted blue channel white balance gain value Bgain2MSE. Next, the processor 11 can use the blue channel white balance gain value Bgain2 of the first camera 12 as the horizontal axis value and the adjusted blue channel white balance gain value Bgain2MSE of the second camera 13 as the vertical axis value to determine the corresponding coordinate point D2 in the coordinate system.

[0069] Similarly, at a color temperature of 7500K, the processor 11 can multiply the blue channel white balance gain adjustment parameter Badjust27 in the first adjustment parameter with the blue channel white balance gain value Bgain27SE of the second camera 13 to calculate the adjusted blue channel white balance gain value Bgain27MSE. Next, the processor 11 can use the blue channel white balance gain value Bgain27 of the first camera 12 as the horizontal axis value and the adjusted blue channel white balance gain value Bgain27MSE of the second camera 13 as the vertical axis value to determine the corresponding coordinate point D27 in the coordinate system.

[0070] Based on the 27 coordinate points D1, D2, up to D27, connecting adjacent coordinate points yields a mapping curve (i.e., mapping curve F). For more information on mapping curve F, please refer to [link to documentation / reference]. Figure 5 The mapping curves E and F are collectively referred to as the first mapping relationship.

[0071] Because in the first mapping relationship, at color temperatures of 2300K, 2500K, and up to 7500K, the white balance gain values ​​of the first camera 12 and the second camera 13 corresponding to the corresponding coordinate points in the first mapping relationship can ensure that the images captured by the first camera 12 and the second camera 13 have consistent colors. By extension, the white balance gain values ​​of the first camera 12 and the second camera 13 corresponding to any coordinate point in the first mapping relationship can ensure that the images captured by the first camera 12 and the second camera 13 have consistent colors.

[0072] It should be noted that the method of selecting color temperature values ​​in this application is merely an illustrative description. The more color temperature values ​​selected, the more accurate the first mapping curve, and the higher the color consistency between the image captured by the first camera 12 and the image captured by the second camera 13.

[0073] The above describes the correspondence between the white balance gain value of the first camera 12 and the white balance gain value of the second camera 13, specifically the correspondence between the red channel white balance gain value of the first camera 12 and the red channel white balance gain value of the second camera 13, as well as the correspondence between the blue channel white balance gain value of the first camera 12 and the blue channel white balance gain value of the second camera 13.

[0074] The image generation method (steps S27 to S29) executed by the processor 11 is further used to determine the white balance gain value of the second camera based on the aforementioned first mapping relationship, such as... Figure 6 As shown, the specific steps include: S27, Obtain the first white balance gain value of the first camera under the current light source.

[0075] In this step, the processor 11 can obtain the first white balance gain value of the first camera 12 under the current light source according to the automatic white balance algorithm. For example, the color temperature value of the current light source is 3000K.

[0076] S28, determine the second white balance gain value of the second camera under the current light source based on the first white balance gain value and the preset first mapping relationship.

[0077] In this step, the processor 11 can determine the second white balance gain value of the second camera 13 under the current light source based on the first white balance gain and the aforementioned first mapping relationship. Referring to the preceding text, the first mapping relationship is determined based on multiple first adjustment parameters of the second camera 13 under multiple light sources with different color temperatures, ensuring that the colors of the image captured by the first camera 12 using the first white balance gain value are consistent with the colors of the image captured by the second camera 13 using the second white balance gain value.

[0078] Specifically, the processor 11 can determine the red channel balance white gain value of the second camera 13 based on the red channel balance white gain value in the first white balance gain and the aforementioned mapping curve E. Then, it can determine the blue channel balance white gain value of the second camera 13 based on the blue channel balance white gain value in the first white balance gain and the aforementioned mapping curve F. The red channel balance white gain value and the blue channel balance white gain value of the second camera 13 are collectively referred to as the second white balance gain value.

[0079] S29, generate an image captured by the second camera based on the second white balance gain value.

[0080] In this step, the processor 11 can generate the image captured by the second camera 13 based on the second white balance gain value and the RGB values ​​of each pixel in the image captured by the second camera 13. According to the characteristics of the first mapping relationship, the colors of the image captured by the first camera 12 using the first white balance gain value are consistent with the colors of the image captured by the second camera 13 using the second white balance gain value.

[0081] This application provides an image generation method that obtains a first white balance gain value of a first camera under a current light source, and then determines a second white balance gain value of a second camera under the same light source based on the first white balance gain value and a preset first mapping relationship. Furthermore, an image captured by the second camera can be generated based on the second white balance gain value. Since the first mapping relationship is determined based on multiple first adjustment parameters of the second camera under multiple light sources with different color temperatures, and ensures that the colors of the image captured by the first camera using the first white balance gain value are consistent with the colors of the image captured by the second camera using the second white balance gain value, this application embodiment can guarantee that the colors of the images captured by the first camera and the second camera are consistent.

[0082] In some embodiments of this application, during step S21, in order to ensure that the multiple first images captured by the first camera 12 under multiple light sources of the target color chart conform to the user's personal color preferences, the values ​​of the corresponding second adjustment parameters can be adjusted to change the third white balance gain value, thereby changing the color of the first image. Specifically, the second adjustment parameters may include a red channel gain value adjustment parameter and a blue channel gain value adjustment parameter. The red channel gain value adjustment parameter can change the red channel gain value, and the blue channel gain value adjustment parameter can change the blue channel gain value, thereby changing the color of the first image.

[0083] Continuing with the previous example, at a color temperature of 2300K, a satisfactory color effect can be achieved by adjusting the red channel gain value (Raj1) and the blue channel gain value (Baj1). In this case, the red channel white balance gain value in the third white balance gain setting is adjusted to the product of Rgain1 and the adjustment parameter Raj1. Similarly, the blue channel white balance gain value in the third white balance gain setting is adjusted to the product of Bgain1 and the adjustment parameter Baj1.

[0084] Similarly, at a color temperature of 2500K, satisfactory color effects can be achieved by adjusting the gain values ​​of the red channel (Raj2) and the blue channel (Baj2). In this case, the red channel white balance gain value in the third white balance gain setting is adjusted to the product of Rgain2 and the adjustment parameter Raj2. Similarly, the blue channel white balance gain value in the third white balance gain setting is adjusted to the product of Bgain2 and the adjustment parameter Baj2.

[0085] Similarly, at a color temperature of 7500K, the user can achieve a satisfactory color effect by adjusting the red channel gain value (Raj27) and the blue channel gain value (Baj27). At this point, the red channel white balance gain value in the third white balance gain setting is adjusted to the product of the aforementioned Rgain27 and the adjustment parameter Raj27. Similarly, the blue channel white balance gain value in the third white balance gain setting is adjusted to the product of the aforementioned Bgain27 and the adjustment parameter Baj27.

[0086] In this way, users can change the value of the second adjustment parameter under various color temperature light sources, so that multiple first images of the target color chart captured by the first camera 12 under various color temperature light sources can match the user's personal color preferences. The first mapping relationship established by this method ensures that the images captured by the first camera 12 and the images captured by the second camera 13 not only have consistent colors, but also meet the user's personal color preferences.

[0087] In the foregoing embodiments, the first target pixels are all pixels corresponding to the gray-white blocks in the first image. To further improve the accuracy of the first mapping relationship, the first target pixels and the second target pixels can be filtered. Specifically, it can be checked whether the color channel values ​​of each first target pixel meet preset conditions, thereby filtering out the first target pixels that meet the preset conditions. Similarly, it can also be checked whether the color channel values ​​of each second target pixel meet preset conditions, thereby filtering out the second target pixels that meet the preset conditions.

[0088] For example, the color temperature sampling points are 2300K, 2800K, 3700K, 4700K, 6500K, and 7500K. At color temperatures of 2300K, 2800K, 3700K, 4700K, 6500K, and 7500K, the ratios of the blue channel value to the green channel value of the first target pixel are 32, 40, 55, 67, 81, and 93, respectively, with minimum and maximum values ​​of 32 and 93. The ratios of the red channel value to the green channel value of the first target pixel are 143, 118, 88, 73, 58, and 49, with minimum and maximum values ​​of 49 and 143, respectively. Using 47 (minimum 49 multiplied by 0.95 equals 47) as the first threshold and 150 (maximum 143 multiplied by 1.05 equals 150) as the second threshold, and then using values ​​greater than the first threshold and less than the second threshold as filtering conditions, the first target pixel can be filtered.

[0089] Similarly, 30 (minimum value 32 multiplied by 0.95 equals 30) can be used as the third threshold, and 98 (maximum value 93 multiplied by 1.05 equals 98) can be used as the fourth threshold. Then, the values ​​greater than the third threshold and less than the fourth threshold can be used as filters to filter the first target pixel.

[0090] Similarly, the filtering conditions for the second target pixel can be determined in the same way, and the second target pixel can be filtered according to these conditions. These filtering conditions can be that the ratio of the red channel value to the green channel value of the second target pixel is greater than the fifth threshold and less than the sixth threshold, and the ratio of the blue channel value to the green channel value of the second target pixel is greater than the seventh threshold and less than the eighth threshold. The methods for determining the fifth, sixth, seventh, and eighth thresholds can be found in the preceding description.

[0091] The pixels selected using the above method can avoid extreme color interference and improve the accuracy of the first mapping relationship, thereby improving the color consistency between the images captured by the first camera 12 and the images captured by the second camera 13.

[0092] Similarly, the filtering condition for the first target pixel can also be that the sum of the red channel value and the blue channel value of the first target pixel is greater than a ninth threshold and less than a tenth threshold. For example, the ninth and tenth thresholds can be determined based on the aforementioned minimum value of 49 and maximum value of 143. The filtering condition for the second target pixel can also be that the sum of the red channel value and the blue channel value of the second target pixel is greater than an eleventh threshold and less than a twelfth threshold. For example, the eleventh and twelfth thresholds can be determined based on the aforementioned minimum value of 32 and maximum value of 95.

[0093] The pixels selected using the above method can also avoid extreme color interference and improve the accuracy of the first mapping relationship, thereby improving the color consistency between the images captured by the first camera 12 and the images captured by the second camera 13.

[0094] Similarly, the filtering condition for the first target pixel can also be that the difference between the red channel value and the blue channel value of the first target pixel is greater than a thirteenth threshold and less than a fourteenth threshold. For example, the thirteenth and fourteenth thresholds can be determined based on the aforementioned minimum value of 49 and maximum value of 143. The filtering condition for the second target pixel can also be that the difference between the red channel value and the blue channel value of the second target pixel is greater than a fifteenth threshold and less than a sixteenth threshold. For example, the fifteenth and sixteenth thresholds can be determined based on the aforementioned minimum value of 32 and maximum value of 95.

[0095] The pixels selected using the above method can also avoid extreme color interference and improve the accuracy of the first mapping relationship, thereby improving the color consistency between the images captured by the first camera 12 and the images captured by the second camera 13.

[0096] Similarly, the filtering condition for the first target pixel can also be that the product of the red channel value and the blue channel value of the first target pixel is greater than the seventeenth threshold and less than the eighteenth threshold. For example, the seventeenth and eighteenth thresholds can be determined based on the aforementioned minimum value of 49 and maximum value of 143. The filtering condition for the second target pixel can also be that the product of the red channel value and the blue channel value of the second target pixel is greater than the nineteenth threshold and less than the twentieth threshold. For example, the nineteenth and twentieth thresholds can be determined based on the aforementioned minimum value of 32 and maximum value of 95.

[0097] The pixels selected using the above method can also avoid extreme color interference and improve the accuracy of the first mapping relationship, thereby improving the color consistency between the images captured by the first camera 12 and the images captured by the second camera 13.

[0098] It should be noted that the above multiple filtering conditions can be used to filter the first target pixel and the second target pixel in order to improve the color consistency of the image captured by the first camera 12 and the image captured by the second camera 13.

[0099] In some embodiments of this application, the first target pixels can be filtered based on their brightness values, and the second target pixels can be filtered based on their brightness values. The brightness value of each pixel can be calculated using its RGB value and the CIE standard luminance equation.

[0100] Specifically, the brightness values ​​of both the first and second target pixels are within a first preset range. This first preset range can be a neutral brightness range, for example, a range greater than 10 and less than 240. By filtering the first and second target pixels in this way, some overly dark or overly bright pixels can be removed, avoiding the impact of dark noise and overexposure in highlights on the accuracy of the first mapping relationship.

[0101] In some embodiments of this application, the average value of each color channel of the first target pixel in the first image is determined by detecting the brightness value of each first target pixel and filtering out the third and fourth target pixels. Specifically, the brightness value of the third target pixel is greater than a first preset value and less than a second preset value, and the brightness value of the fourth target pixel is greater than the third preset value and less than the first preset value, or the brightness value of the fourth target pixel is greater than the second preset value and less than the fourth preset value. For example, the first preset value is 50, the second preset value is 200, the third preset value is 0, and the fourth preset value is 255. Therefore, the third target pixel is a pixel with neutral brightness (i.e., moderate brightness, neither too bright nor too dark). The fourth target pixel is a pixel that is either too bright or too dark.

[0102] Then, the color channel values ​​of the third target pixel and the fourth target pixel can be obtained. Based on the color channel values ​​of the third target pixel and their corresponding first weighting coefficients, and the color channel values ​​of the fourth target pixel and their corresponding second weighting coefficients, the average value of each color channel of the first target pixel in the first image can be determined. The first weighting coefficient is greater than the second weighting coefficient. For example, the first weighting coefficient is 2, and the second weighting coefficient is 1.

[0103] By using this method, when calculating the average value of each color channel of the first target pixel, pixels with neutral brightness are given a higher weight coefficient, which can reduce the impact of overly dark and overly bright pixels on the accuracy of the first mapping relationship, improve the accuracy of the first mapping relationship, and thus improve the color consistency of the image captured by the first camera 12 and the image captured by the second camera 13.

[0104] In addition, the average value of each color channel of the second target pixel in the second image can be determined in the same way as the above method to improve the accuracy of the first mapping relationship, thereby improving the color consistency of the image captured by the first camera 12 and the image captured by the second camera 13.

[0105] In one implementation, the first image can be divided into several pixel blocks, each pixel block including multiple pixels. For example, if the first image contains 2 million pixels, it can be divided into 65 rows and 65 columns, resulting in 4225 pixel blocks. Then, the pixel blocks corresponding to the grayscale blocks (i.e., target pixel blocks) can be selected. When selecting target pixel blocks by brightness, the selection can be based on the average brightness of each target pixel block to obtain the selected target pixel blocks. The average brightness of each target pixel block can be determined by the brightness of each pixel within that target pixel block. In this way, when assigning weight coefficients, weight coefficients can be directly assigned to each selected target pixel block. Then, based on the color channel values ​​of each selected target pixel block and the corresponding weight coefficients, the average value of each color channel of the first target pixel is determined. Compared to the aforementioned implementation method of assigning weight coefficients to the third and fourth target pixels, this implementation method can significantly reduce the computational load and improve computational efficiency.

[0106] In one specific implementation, all light sources can be light-emitting diodes (LEDs). More specifically, multiple light sources with different color temperatures can be generated by adjusting the color temperature of color-temperature adjustable light-emitting diodes (LEDs). With the increasing prevalence of LED light source applications, using LEDs to establish the first mapping relationship in this embodiment better adapts to various current application scenarios and improves the accuracy of the first mapping relationship in this embodiment. Therefore, it can improve the color consistency of the images captured by the first camera 12 and the second camera 13.

[0107] In one specific implementation, when establishing the first mapping relationship, the aforementioned multiple light sources can simultaneously include high color temperature light sources, medium color temperature light sources, and low color temperature light sources, thereby improving the accuracy of the first mapping relationship.

[0108] It is understandable that the sequence numbers of the steps in the above example do not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not impose any limitations on the implementation process of this example. Furthermore, in some possible implementations, the steps in the above example can be selectively executed according to the actual situation; they can be partially executed or fully executed, without any restrictions here.

[0109] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.

[0110] Figure 7 This is a schematic diagram of an image generation device provided in an embodiment of this application. The image generation device can be disposed in a multi-camera electronic device, which includes a first camera and a second camera. The device includes: an acquisition module for acquiring a first white balance gain value of the first camera under a current light source; a determination module for determining a second white balance gain value of the second camera under the same light source based on the first white balance gain value and a preset first mapping relationship; the first mapping relationship is used to ensure that the color of the image captured by the first camera using the first white balance gain value is consistent with the color of the image captured by the second camera using the second white balance gain value; the first mapping relationship is determined based on multiple first adjustment parameters of the second camera under multiple light sources; the color temperature values ​​of the multiple light sources are all different; and a generation module for generating an image captured by the second camera based on the second white balance gain value.

[0111] This application provides an image generation apparatus that can acquire a first white balance gain value of a first camera under a current light source, and then determine a second white balance gain value of a second camera under the same light source based on the first white balance gain value and a preset first mapping relationship. Furthermore, an image captured by the second camera can be generated based on the second white balance gain value. Since the first mapping relationship is determined based on multiple first adjustment parameters of the second camera under multiple light sources with different color temperatures, and can ensure that the colors of the image captured by the first camera using the first white balance gain value are consistent with the colors of the image captured by the second camera using the second white balance gain value, this application embodiment can guarantee color consistency between the images captured by the first camera and the second camera.

[0112] The image generation apparatus provided in this application embodiment can execute the actions of the processor 11 in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described again here.

[0113] like Figure 8As shown, this application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, it can implement the webpage display method described above. For details, please refer to the description of the foregoing embodiments. Specifically, this electronic device may be the multi-camera electronic device 1 described above.

[0114] Specifically, at the hardware level, the electronic device may include a processor, an internal bus, and memory. The memory may include main memory and non-volatile memory. The processor reads the corresponding computer program from the non-volatile memory into main memory and then executes it. Those skilled in the art will understand that... Figure 8 The structure shown is for illustrative purposes only and does not limit the structure of the electronic device described above. For example, the electronic device may also include components that are larger than... Figure 8 The components shown may include more or fewer components, such as other processing hardware like a GPU (Graphics Processing Unit) or external communication ports. Of course, this application does not exclude other implementation methods besides software implementations, such as logic devices or a combination of hardware and software.

[0115] In this embodiment, the processor may include a central processing unit (CPU) or a graphics processing unit (GPU), and may also include other microcontrollers, logic gates, integrated circuits, or appropriate combinations thereof with logic processing capabilities. The memory described in this embodiment can be a storage device for storing information. In digital systems, a device capable of storing binary data can be a memory; in integrated circuits, a circuit without physical form but with storage function can also be a memory, such as RAM or FIFO; in a system, a storage device with physical form can also be called a memory. In implementation, this memory can also be implemented using a cloud storage method; the specific implementation method is not limited in this specification.

[0116] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the image generation method implemented by the processor 11 as described above.

[0117] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0118] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. An image generation method, characterized in that, Applied to a multi-camera electronic device, the multi-camera electronic device including a first camera and a second camera, the method includes: Obtain the first white balance gain value of the first camera under the current light source; Based on the first white balance gain value and a preset first mapping relationship, a second white balance gain value for the second camera under the current light source is determined; the first mapping relationship is used to ensure that the color of the image captured by the first camera using the first white balance gain value is consistent with the color of the image captured by the second camera using the second white balance gain value; the first mapping relationship is determined based on multiple first adjustment parameters of the second camera under multiple light sources; the color temperature values ​​of the multiple light sources are all different; The image captured by the second camera is generated based on the second white balance gain value.

2. The method according to claim 1, characterized in that, Before obtaining the first white balance gain value of the first camera under the current light source, the method further includes: The first camera captures multiple first images of the target color chart under multiple light sources; the color temperature values ​​of the multiple light sources are all different. Based on multiple first images, determine multiple third white balance gain values ​​of the first camera at multiple color temperatures and the average value of each color channel of the first target pixel in the multiple first images; the first target pixel is the pixel corresponding to the gray-white block in the first image. Acquire multiple second images of the target color chart captured by the second camera under multiple light sources; Based on multiple second images, determine multiple fourth white balance gain values ​​of the second camera at multiple color temperatures and the average value of each color channel of the second target pixel in the multiple second images; the second target pixel is the pixel corresponding to the gray-white block in the second image. Based on the average color channel values ​​of the first target pixels in the multiple first images, the average color channel values ​​of the second target pixels in the multiple second images, the multiple third white balance gain values, and the multiple fourth white balance gain values, a plurality of first adjustment parameters of the second camera are determined; the first adjustment parameters are used to adjust the fourth white balance gain values. The first mapping relationship is determined based on a plurality of the first adjustment parameters, a plurality of the third white balance gain values, and a plurality of the fourth white balance gain values.

3. The method according to claim 2, characterized in that, The step of acquiring multiple first images of the target color chart captured by the first camera under multiple light sources includes: Adjusting multiple second adjustment parameters of the first camera, multiple first images of the target color chart captured by the first camera under multiple light sources are obtained; the second adjustment parameters are used to adjust the third white balance gain value.

4. The method according to claim 2, characterized in that, The color channel values ​​of the first target pixel and the color channel values ​​of the second target pixel satisfy at least one of the following conditions: The ratio of the red channel value to the green channel value of the first target pixel is greater than a first threshold and less than a second threshold; the ratio of the blue channel value to the green channel value of the first target pixel is greater than a third threshold and less than a fourth threshold; the ratio of the red channel value to the green channel value of the second target pixel is greater than a fifth threshold and less than a sixth threshold; and the ratio of the blue channel value to the green channel value of the second target pixel is greater than a seventh threshold and less than an eighth threshold. The sum of the red channel value and the blue channel value of the first target pixel is greater than the ninth threshold and less than the tenth threshold; the sum of the red channel value and the blue channel value of the second target pixel is greater than the eleventh threshold and less than the twelfth threshold. The difference between the red channel value and the blue channel value of the first target pixel is greater than the thirteenth threshold and less than the fourteenth threshold; the difference between the red channel value and the blue channel value of the second target pixel is greater than the fifteenth threshold and less than the sixteenth threshold. The product of the red channel value and the blue channel value of the first target pixel is greater than the seventeenth threshold and less than the eighteenth threshold, and the product of the red channel value and the blue channel value of the second target pixel is greater than the nineteenth threshold and less than the twentieth threshold.

5. The method according to claim 2, characterized in that, All of the light sources are LED light sources.

6. The method according to claim 2, characterized in that, The brightness values ​​of the first target pixel and the second target pixel are both within a first preset range.

7. The method according to claim 2, characterized in that, The average value of each color channel of the first target pixel in the first image is determined in the following way: The brightness values ​​of each of the first target pixels are detected, and the third target pixel and the fourth target pixel are selected; the brightness value of the third target pixel is greater than a first preset value and less than a second preset value, the brightness value of the fourth target pixel is greater than a third preset value and less than a first preset value, or the brightness value of the fourth target pixel is greater than a second preset value and less than a fourth preset value. Obtain the color channel values ​​of the third target pixel and the color channel values ​​of the fourth target pixel; Based on the color channel values ​​of the third target pixel and the corresponding first weighting coefficient, and the color channel values ​​of the fourth target pixel and the corresponding second weighting coefficient, the average value of each color channel of the first target pixel in the first image is determined. Wherein, the first weighting coefficient is greater than the second weighting coefficient.

8. An image generation apparatus, characterized in that, The device is disposed in a multi-camera electronic device, the multi-camera electronic device including a first camera and a second camera, and the device includes: The acquisition module is used to acquire the first white balance gain value of the first camera under the current light source; The determining module is configured to determine a second white balance gain value of the second camera under the current light source based on the first white balance gain value and a preset first mapping relationship; the first mapping relationship is configured to ensure that the color of the image captured by the first camera using the first white balance gain value is consistent with the color of the image captured by the second camera using the second white balance gain value; the first mapping relationship is determined based on multiple first adjustment parameters of the second camera under multiple light sources; the color temperature values ​​of the multiple light sources are all different; The generation module is used to generate an image captured by the second camera based on the second white balance gain value.

9. An electronic device comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it causes the electronic device to implement the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 7.