Image processing method, electronic equipment, storage medium and chip
Through the multi-camera system, the image is processed using the white balance parameters of the face area, which solves the problem of the failure of the traditional white balance algorithm in solid color backgrounds, and improves the color accuracy and user experience of the image.
Patent Information
- Application Number
- CN202411578915.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-07
- Publication Date
- 2025-01-10
AI Technical Summary
Traditional white balance algorithms are prone to failure when shooting images containing large areas of solid color backgrounds, resulting in severe color casts in the processed image and affecting the user experience.
By using a multi-camera system in electronic devices, the white balance parameters obtained from the face area collected by one camera are used to perform white balance processing on the images collected by another camera, ensuring the accuracy of the white balance parameters, especially in the face area is non-pure color Improve the effect of white balance treatment when in the area.
It effectively reduces the color cast of the image, makes the processed image more in line with the human eye's color visual habits, improves the user experience, and improves the effect of white balance processing in the case of solid color areas.
Smart Images

Figure CN119299866A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and more specifically, to an image processing method, electronic device, storage medium and chip. Background Art
[0002] With the continuous advancement of image processing technology, electronic devices such as cameras and mobile phones used to capture images are widely used. People have higher and higher requirements for image quality (color), and the shooting scenes are becoming more and more complex. The image sensors in electronic devices will present different colors of objects under different light sources. For example, in a natural environment, the same object will present different colors under different colors of light sources, such as green leaves appear yellowish in the morning light, but blue in the evening.
[0003] In order to eliminate the influence of light sources on image sensor imaging, simulate the color constancy of the human visual system, and ensure that the white seen in any scene is truly white, it is necessary to introduce automatic white balance (AWB) technology. AWB technology is mainly used to solve the problem of image color cast under different light sources, so that the image of the scene in the image conforms to the color vision habits of the human eye. However, in traditional technologies, the images obtained after white balance processing for images collected in some scenes (such as large-area monochrome scenes or pure color scenes) (the images include large areas of pure color areas) have serious color cast problems, resulting in poor user experience. Summary of the invention
[0004] The present application provides an image processing method, an electronic device, a storage medium and a chip, so that the color cast of the processed image is smaller and more in line with the color vision habits of the human eye, thereby improving the user experience.
[0005] In a first aspect, an embodiment of the present application provides an image processing method, which is applied to an electronic device including a first camera and a second camera, and the method includes: A first original image of a first scene is captured by a first camera, wherein the first original image is an image including a face area; Obtaining a first white balance parameter according to a face region in the first original image, wherein the first white balance parameter is a parameter determined by a color temperature of a light source of a first scene obtained according to the face region; A second original image of a second scene is captured by a second camera, wherein a light source of the second scene corresponding to the second original image is the same as a light source of the first scene corresponding to the first original image; White balance processing is performed on the second original image according to the first white balance parameter to obtain a target image.
[0006] The face region in the first original image is a non-pure color region, that is, the image corresponding to the face region is not a pure color background having an area greater than that of the background. Therefore, the color temperature of the light source of the first scene obtained based on the face region can more accurately reflect the color temperature of the light source of the first scene (the color temperature of the second scene). In other words, in this case, the color temperature of the light source of the first scene obtained based on the face region in the first original image is very close to the color temperature of the real light source of the first scene.
[0007] The light source of the second scene corresponding to the second original image is the same as the light source of the first scene corresponding to the first original image. In actual applications, the same light source corresponds to the same color temperature, that is, the color temperature of the light source of the second scene is the same as the color temperature of the light source of the first scene.
[0008] In the related art, when the image captured by the camera (such as the second original image) contains a large area of pure color, such as a large area of blue or yellow, the traditional white balance algorithm will fail, causing the overall color cast of the processed image to be too serious, resulting in a poor user experience.
[0009] In the above technical solution, after the electronic device acquires the second original image through the second camera, the second original image is not subjected to white balance processing using the color temperature obtained based on the second original image, but the first white balance parameter obtained from the face area in the first original image acquired through the first camera is used to perform white balance processing on the second original image to obtain the target image. Since the face area is a non-pure color area, the first white balance parameter obtained based on the face area can more accurately reflect the color temperature of the light source of the first scene (the light source of the second scene), and the target image obtained after further processing has a smaller color cast and can conform to the color visual habits of the human eye, thereby improving the user experience. Moreover, in the case where the second original image acquired by the second camera includes a large area of pure color area, compared with performing white balance processing on the second original image using the color temperature obtained based on the second original image, this method can also improve the effect of white balance processing, so that the processed image has a smaller color cast and is more in line with the color visual habits of the human eye, thereby improving the user experience.
[0010] In a possible implementation manner, capturing a first original image of a first scene through a first camera includes: A third original image of the first scene is captured by the first camera; The third original image is subjected to image blurring processing to obtain a first original image.
[0011] Image blur processing is used to process a clear image into a more blurred image. There is no specific limitation on the image blur processing method. For example, the image blur processing can be, but is not limited to, a processing method such as a mean filter or a median filter. For example, the image blur processing method can also be an image blur processing method corresponding to a trained image blur processing model, and the image blur processing model can be trained based on an existing model training method.
[0012] The third original image can be understood as a clear image of the first scene captured by the first camera, and the first original image is a blurred image obtained by blurring the third original image. The face area in the third original image is clear, and the face area in the first original image is blurred (not clear or with poor clarity).
[0013] In the above technical solution, the electronic device does not directly obtain the white balance parameters based on the face area in the third original image (clear) captured by the first camera, but first processes the face area in the first original image (blurred) obtained by blurring the third original image to obtain the white balance parameters. Therefore, this method can better protect the user's facial privacy data to a certain extent and avoid leakage of the user's facial information.
[0014] In another possible implementation, capturing a first original image of a first scene through a first camera includes: When the auto-focus function of the first camera is turned on, the first original image is captured in a defocused manner by controlling the first camera.
[0015] It should be understood that the first camera will only turn on the autofocus function if the first camera supports the autofocus function. When the first camera turns on the autofocus function, when the first camera captures an image of the first scene including a face, the first camera can focus on the face to obtain a clearer image.
[0016] Optionally, before the electronic device executes the above steps, the electronic device may further determine whether the first camera supports an autofocus function.
[0017] In the above technical solution, the electronic device controls the first camera with the autofocus function turned on to capture the first original image in a defocused manner, so that the face area in the captured first original image is blurred (unclear). Therefore, this method can better protect the user's facial privacy data to a certain extent and avoid the leakage of the user's facial information.
[0018] In another possible implementation, performing white balance processing on the second original image according to the first white balance parameter to obtain a target image includes: In the case where the second original image includes a pure color area larger than a preset area, white balance processing is performed on the second original image according to the first white balance parameter to obtain a target image.
[0019] The second original image includes a pure color area larger than a preset area, which can be understood as a pure color background larger than the preset area in the second original image. When the second original image includes a pure color area larger than the preset area, the color temperature of the light source of the second scene obtained based on the second original image is difficult to accurately reflect the color temperature of the light source of the second scene. In other words, in this case, the color temperature of the light source of the second scene obtained based on the second original image is significantly different from the color temperature of the actual light source of the second scene.
[0020] In the above technical solution, when the second original image captured by the second camera includes a pure color area larger than a preset area, the second original image is white balanced using the first white balance parameter obtained from the face area in the first original image captured by the first camera. Since the face area is a non-pure color area, the first white balance parameter obtained based on the face area can more accurately reflect the color temperature of the light source of the first scene (the light source of the second scene), thereby improving the effect of the white balance processing, so that the processed image (target image) has less color cast and is more in line with the color vision habits of the human eye, thereby improving the user experience.
[0021] In another possible implementation, performing white balance processing on the second original image according to the first white balance parameter to obtain a target image includes: The first white balance parameter and the second white balance parameter are weighted according to the first weight and the second weight respectively to obtain a third white balance parameter, wherein the second white balance parameter is a white balance parameter obtained according to the second original image, the first weight is greater than the second weight, the first white balance gain corresponding to the third white balance parameter is the product of the first weight and the first white balance gain corresponding to the first white balance parameter, and the sum of the product of the second weight and the first white balance gain corresponding to the second white balance parameter, and the second white balance gain corresponding to the third white balance parameter is the product of the first weight and the second white balance gain corresponding to the first white balance parameter, and the sum of the product of the second weight and the second white balance gain corresponding to the second white balance parameter; White balance processing is performed on the second original image according to the third white balance parameter to obtain a target image.
[0022] Exemplarily, the first white balance parameter may be understood as a white balance gain red color (R) parameter, and the second white balance parameter may be understood as a white balance gain blue color (B) parameter.
[0023] There is no specific limitation on the value of the first weight and the value of the second weight, and it is only necessary that the value of the first weight is greater than the value of the second weight. For example, the value of the first weight and the value of the second weight can be determined according to the light source. For example, the value of the first weight can be, but not limited to, 0.75, and the value of the second weight can be, but not limited to, 0.25.
[0024] In the above technical solution, when the electronic device performs white balance processing on the second original image, it not only takes advantage of the white balance parameters (first white balance parameters) obtained based on the face area in the first original image captured by the first camera, but also utilizes the white balance parameters (second white balance parameters) obtained based on the second original image captured by the second camera, and the weight of the white balance parameters obtained by the first camera is high, and the weight of the white balance parameters of the second camera is low. In the image processing process, when the second original image captured by the second camera includes a pure color area larger than a preset area, the method can improve the effect of white balance processing, so that the color cast of the processed image is smaller and more in line with the color visual habits of the human eye, thereby improving the user experience. When the second original image captured by the second camera does not include a pure color area larger than a preset area, the method can make the color cast of the processed image smaller and more in line with the color visual habits of the human eye, thereby satisfying the user experience.
[0025] In another possible implementation, the first camera is a front camera, and the second camera is a rear camera.
[0026] In the above technical solution, the first camera is a front camera, so it is highly likely that the first original image captured by the first camera includes a face area as a non-pure color area. Afterwards, after the second original image is captured by the second camera, the first white balance parameter obtained from the face area in the first original image captured by the first camera is used to perform white balance processing on the second original image to obtain a target image. Since the face area is a non-pure color area, the first white balance parameter obtained based on the face area can more accurately reflect the color temperature of the light source of the first scene (the light source of the second scene). The target image obtained after further processing has a smaller color cast and can conform to the color visual habits of the human eye, thereby improving the user experience. Moreover, in the case where the second original image captured by the second camera includes a large area of pure color area, compared with performing white balance processing on the second original image using the color temperature obtained based on the second original image, this method can also improve the effect of white balance processing, so that the processed image has a smaller color cast and is more in line with the color visual habits of the human eye, thereby improving the user experience.
[0027] In another possible implementation, the first camera is a main camera and the second camera is a secondary camera.
[0028] In the above technical solution, the first camera can be the main camera of the electronic device, and the second camera can be the secondary camera of the electronic device. The method is applicable to a wider range of application scenarios to meet the shooting needs of users holding different electronic devices.
[0029] In another possible implementation, obtaining a first white balance parameter according to a face region in a first original image includes: Obtaining a first color temperature according to the face region in the first original image, wherein the first color temperature is the color temperature of the light source of the first scene; A first white balance parameter is obtained according to a first mapping relationship and a first color temperature, wherein the first mapping relationship includes a one-to-one correspondence between multiple color temperatures and multiple white balance parameters, the first color temperature is one of the multiple color temperatures, and the first white balance parameter is a white balance parameter corresponding to the first color temperature among the multiple white balance parameters.
[0030] In the above technical solution, the electronic device can obtain the first white balance parameter according to the first color temperature and the first mapping relationship obtained from the face area in the first original image. The implementation process is relatively simple and can improve the image processing efficiency to a certain extent.
[0031] In another possible implementation, obtaining the first color temperature according to the face region in the first original image includes: Divide the face area into a plurality of image blocks, wherein a first image block includes at least one pixel point, and the first image block is any one of the plurality of image blocks; According to the multiple image blocks, a plurality of color ratio information corresponding to the multiple image blocks is obtained, wherein the color ratio information corresponding to the first image block includes a first color ratio and a second color ratio, the first color ratio is a ratio of a red color component of all pixels in the first image block to a green color component of all pixels in the first image block, and the second color ratio is a ratio of a blue color component of all pixels in the first image block to a green color component of all pixels in the first image block; Determine one color ratio information among the multiple color ratio information as target color ratio information; A first color temperature is obtained according to the second mapping relationship and the target color ratio information, wherein the second mapping relationship includes a one-to-one correspondence between multiple color ratio information and multiple color temperatures, the target color ratio information is a color ratio information among the multiple color ratio information, and the first color temperature is a color temperature among the multiple color temperatures corresponding to the target color ratio information.
[0032] In the above technical solution, the electronic device first divides the face area in the first original image into image blocks to obtain multiple image blocks corresponding to the face area, and then obtains the target color ratio information based on the color components of the pixels of the multiple image blocks. After that, the color temperature (first color temperature) is obtained according to the mapping relationship (second mapping relationship) and the target color ratio information. The color temperature obtained based on this method can more accurately reflect the color temperature of the light source of the first scene. After that, the second original image is white-balanced based on the white balance parameter (first white balance parameter) obtained by the color temperature, so that the processed image (target image) has less color cast and is more in line with the color vision habits of the human eye, thereby improving the user experience.
[0033] In another possible implementation, the first white balance parameter includes a first white balance gain parameter and a second white balance gain parameter, and performing white balance processing on the second original image according to the first white balance parameter to obtain a target image includes: Multiplying the red color component of each pixel among all the pixels included in the second original image by the first white balance gain parameter, and multiplying the blue color component of each pixel among all the pixels included in the second original image by the second white balance gain parameter, to obtain a fourth original image; The fourth original image is encoded to obtain a target image in a preset format.
[0034] In the above technical solution, the electronic device multiplies the color component (e.g., red color component) of each pixel in the second original image by the white balance gain parameter (e.g., first white balance gain parameter) corresponding to the color component included in the first white balance parameter, thereby obtaining a fourth original image. Thereafter, the fourth original image is encoded to obtain a target image. This implementation process is relatively simple and can improve image processing efficiency to a certain extent.
[0035] In another possible implementation, the electronic device includes a photosensor provided with a normally-open alwayson sensor, and; Obtaining a first white balance parameter according to the face region in the first original image includes: Using the always-on sensor to obtain a first white balance parameter according to the face area; Performing white balance processing on the second original image according to the first white balance parameter to obtain a target image includes: The always-on sensor is used to perform white balance processing on the second original image according to the first white balance parameter to obtain a target image.
[0036] In the above technical solution, the data processed by the always-on sensor will not be stored in the file storage coefficient of the electronic device, nor will it be transmitted to other devices by the electronic device. After the always-on sensor processes the data, it will be destroyed immediately after processing. Therefore, this method can protect the user's facial privacy data to a certain extent.
[0037] In another possible implementation, the first camera and the second camera do not have a common field of view.
[0038] When the first camera and the second camera do not have a common field of view, that is, the image captured by the first camera and the image captured by the second camera do not include the same image area. In other words, when the image captured by the second camera includes a large area of pure color area, the image captured by the first camera may not include a large area of pure color area.
[0039] In a second aspect, an embodiment of the present application provides an image processing device, comprising a unit for executing any one of the image processing methods in the first aspect.
[0040] In a third aspect, an electronic device is provided, comprising a unit for executing any one of the image processing methods in the first aspect. The electronic device may be a terminal device or a chip in the terminal device. The electronic device may include an input unit and a processing unit.
[0041] When the electronic device is a terminal device, the processing unit may be a processor, and the input unit may be a communication interface; the terminal device may also include a memory, which is used to store computer program code. When the processor executes the computer program code stored in the memory, the terminal device executes any one of the image processing methods in the first aspect.
[0042] When the electronic device is a chip in a terminal device, the processing unit may be a processing unit inside the chip, and the input unit may be an output interface, a pin or a circuit, etc.; the chip may also include a memory, which may be a memory inside the chip (for example, a register, a cache, etc.) or a memory located outside the chip (for example, a read-only memory, a random access memory, etc.); the memory is used to store computer program code, and when the processor executes the computer program code stored in the memory, the chip executes any one of the image processing methods in the first aspect.
[0043] In a possible implementation, a memory is used to store computer program code; a processor executes the computer program code stored in the memory, and when the computer program code stored in the memory is executed, the processor is used to execute any one of the methods in the first aspect.
[0044] According to a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program code. When the computer program code is executed by an electronic device, the electronic device executes any one of the image processing methods according to the first aspect.
[0045] In a fifth aspect, a computer program product is provided, the computer program product comprising: a computer program code, when the computer program code is executed by an electronic device, the electronic device executes any one of the image processing methods in the first aspect.
[0046] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here.
[0047] It should be understood that the description of technical features, technical solutions, beneficial effects or similar language in this application does not imply that all features and advantages can be realized in any single embodiment. On the contrary, it is understood that the description of features or beneficial effects means that specific technical features, technical solutions or beneficial effects are included in at least one embodiment. Therefore, the description of technical features, technical solutions or beneficial effects in this specification does not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions and beneficial effects described in the present embodiment can also be combined in any appropriate manner. Those skilled in the art will understand that the embodiment can be realized without one or more specific technical features, technical solutions or beneficial effects of a specific embodiment. In other embodiments, additional technical features and beneficial effects can also be identified in specific embodiments that do not embody all embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 It is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.
[0049] Figure 2 It is a schematic diagram of a software system of an electronic device provided in an embodiment of the present application.
[0050] Figure 3 It is a schematic diagram of an application scenario provided by an embodiment of the present application.
[0051] Figure 4 It is a schematic diagram of a user interface of an electronic device to which the image processing method provided in an embodiment of the present application is applicable.
[0052] Figure 5 It is a schematic diagram of an image before and after processing captured by a rear camera provided in an embodiment of the present application.
[0053] Figure 6 It is a schematic diagram of an image processing method provided in an embodiment of the present application.
[0054] Figure 7 It is a schematic diagram of an image captured by a front camera in the image processing method provided in an embodiment of the present application.
[0055] Figure 8 It is a schematic diagram of pixel information corresponding to the face area under different color temperatures involved in the image processing method provided in the embodiment of the present application.
[0056] Fig. 9 It is a schematic diagram of an image processing method provided in an embodiment of the present application.
[0057] Fig.10 It is a schematic diagram of an image processing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0058] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0059] The terms "first", "second", "third", "fourth", etc. in the specification, claims and drawings of this application are used to distinguish different objects, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the definition of "first", "second", "third", "fourth" features may explicitly or implicitly include one or more of the features.
[0060] In the embodiments of the present application, the words "exemplarily" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a specific way.
[0061] The following is an introduction to the technical solutions provided by the embodiments of the present application.
[0062] Currently, after taking a photo, electronic devices (such as mobile phones) perform white balance processing on the image captured by the camera to make the photographed object appear in its original color and avoid the phenomenon of appearing green under fluorescent light, yellow under tungsten light, and blue in the shadow of sunlight.
[0063] The traditional white balance algorithm first needs to estimate the color temperature of the current environment based on the image captured by the camera, and then perform white balance processing on the captured image based on the estimated color temperature. However, when the captured image has a large area of solid color background, such as a large area of blue background or yellow background, the traditional white balance algorithm will fail. For example, when there is a large area of blue background in the captured image, the traditional white balance algorithm will identify the large area of blue background as a white background under high color temperature, and thus identify the color temperature of the current environment as a high color temperature environment. When performing white balance processing, the blue background will be corrected to white, and other objects in the image will also have serious color cast, such as yellowing of the face. Therefore, when there is a large area of solid color background in the image, the traditional white balance algorithm will cause the overall color cast of the processed image to be too serious, resulting in a poor user experience.
[0064] Therefore, in order to solve the above problems, the embodiments of the present application provide an image processing method, an electronic device, a storage medium and a chip. The method is applied to an electronic device including a first camera and a second camera, and includes: collecting a first original image of a first scene through the first camera, wherein the first original image is an image including a face area; obtaining a first white balance parameter according to the face area in the first original image, wherein the first white balance parameter is a parameter determined by the color temperature of the light source of the first scene obtained according to the face area; collecting a second original image of a second scene through the second camera, wherein the light source of the second scene corresponding to the second original image is the same as the light source of the first scene corresponding to the first original image; performing white balance processing on the second original image according to the first white balance parameter to obtain a target image. Based on the image processing method provided by the embodiment of the present application, after the second original image is captured by the second camera, the second original image is not subjected to white balance processing using the color temperature obtained based on the second original image, but the first white balance parameter obtained from the face area in the first original image captured by the first camera is used to perform white balance processing on the second original image to obtain the target image. Since the face area is a non-pure color area, the first white balance parameter obtained based on the face area can more accurately reflect the color temperature of the light source of the first scene (the light source of the second scene), and the target image obtained after further processing can meet the color visual habits of the human eye (that is, there is no color cast phenomenon or the color cast phenomenon can be ignored), satisfying the user experience. Moreover, in the case where the second original image captured by the second camera includes a large area of pure color area, the method can also improve the effect of white balance processing, so that the processed image is more in line with the color visual habits of the human eye, improving the user experience.
[0065] The image processing method provided in the embodiment of the present application can be applied to electronic devices. The electronic device can also be called a terminal device, a terminal, a user equipment (UE), a mobile station (MS), a mobile terminal (MT), an electronic device, etc. The electronic device can be a mobile phone, a tablet computer (Pad), a wearable device, an ultra-mobile personal computer (UMPC), a netbook, a smart TV, a wireless terminal in a smart home, etc. The mobile phone can include a folding screen mobile phone, a straight-screen mobile phone, etc. The embodiment of the present application does not limit the specific device form of the electronic device.
[0066] For example, Figure 1 Schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. Figure 1 The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. Among them, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0067] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0068] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0069] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0070] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0071] Exemplarily, in some embodiments, the processor 110 is used to: capture a first original image of a first scene through a first camera of an electronic device, wherein the first original image is an image including a face area; obtain a first white balance parameter based on the face area in the first original image, wherein the first white balance parameter is a parameter determined by the color temperature of the light source of the first scene obtained based on the face area; capture a second original image of a second scene through a second camera of the electronic device, wherein the light source of the second scene corresponding to the second original image is the same as the light source of the first scene corresponding to the first original image; and perform white balance processing on the second original image according to the first white balance parameter to obtain a target image.
[0072] In some embodiments, the processor 110 may include one or more interfaces, such as an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0073] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0074] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device 100 through the power management module 141.
[0075] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193 and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0076] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0077] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antenna. The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the electronic device 100. The wireless communication module 160 can provide solutions for wireless communications including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc. applied to the electronic device 100.
[0078] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0079] The display screen 194 is used to display the camera application interface, images, videos, etc. For example, the application interface displayed by the display screen 194 may include but is not limited to Figure 4The user interface of the mobile phone is shown. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light emitting diode or an active-matrix organic light emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is an integer greater than 1.
[0080] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0081] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise and brightness of the image. The ISP can also optimize parameters such as the exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
[0082] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is an integer greater than 1. For example, taking N equals 2 as an example, the electronic device 100 may include a front camera and a rear camera.
[0083] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0084] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in various coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0085] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0086] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created by the electronic device 100 during use (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0087] The electronic device 100 can implement audio functions, such as music playback, recording, etc., through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D and the application processor.
[0088] The pressure sensor 180A is used to sense pressure signals and convert pressure signals into electrical signals. In some embodiments, the pressure sensor 180A can be disposed on the display screen 194. When a touch operation is applied to the display screen 194, the electronic device 100 detects the touch operation intensity according to the pressure sensor 180A. Figure 4 Taking the mobile phone shown in the figure as an example, when the user Figure 4In the case where a touch operation is performed on the icon 401a of the camera application in the user interface 401 of the mobile phone shown in (1), the touch sensor in the mobile phone can detect the pressure intensity of the touch operation. The electronic device 100 can also calculate the touch position based on the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example, when a touch operation with a touch operation intensity less than a first pressure threshold acts on a short message application icon, an instruction to view a short message is executed; when a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on a short message application icon, an instruction to create a new short message is executed.
[0089] The ambient light sensor 180L is used to sense the ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
[0090] The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor 180K can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194. For example, taking the electronic device 100 as Figure 4 Taking the mobile phone shown in the figure as an example, when the user Figure 4 When a touch operation is performed on the icon 401a of the camera application in the user interface 401 shown in (1) of FIG. 1 , the touch sensor in the mobile phone can detect the touch operation. Figure 4 When the control 403a1 in the user interface 403 shown in (3) performs a touch operation, the touch sensor in the mobile phone can detect the touch operation.
[0091] It should be understood that the above Figure 1 The connection relationship between the modules shown is only a schematic illustration and does not constitute a limitation on the connection relationship between the modules of the electronic device 100. Optionally, the modules of the electronic device 100 may also adopt a combination of multiple connection modes in the above embodiments.
[0092] The hardware system of the electronic device 100 is described in detail above, and the software system of the electronic device 100 is introduced below. The software system can adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the layered architecture as an example to exemplarily describe the software system of the electronic device 100.
[0093] For example, Figure 2 is a schematic diagram of a software system of an electronic device provided in an embodiment of the present application. Figure 2 , the software system adopts a layered architecture. The layered architecture divides the software into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers, from top to bottom, namely, the application layer 210, the application framework layer 220, the Android runtime (Android Runtime) and core library layer 230, the hardware abstract layer (HAL) 240 and the kernel layer 250.
[0094] The application layer 210 may include a series of application packages. For example, the application package may include applications such as camera, gallery, chat, call, map, navigation, calendar, Bluetooth, music, video, etc.
[0095] Each of the above applications may include more specific functional modules, for example, a gallery may include a service module and a notification module. For example, a camera may include a photo taking module and an image processing module.
[0096] Each of the above applications can be used to generate application data, for example, a gallery is used to generate photo data, and a camera is used to capture images.
[0097] The application framework layer 220 provides an application programming interface (API) and a programming framework for the applications of the application layer. The application framework layer 220 includes some predefined functions.
[0098] like Figure 2 As shown, the application framework layer 220 may include a window manager, a notification manager, an activity manager, a view system, an input manager, a content provider, a resource manager, and the like.
[0099] The window manager provides window management services (WMS). WMS can be used for window management, window animation management, surface management, and as a transfer station for the input system.
[0100] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.
[0101] The activity manager can provide activity management services (AMS), which can be used to start, switch, and schedule system components (such as activities, services, content providers, and broadcast receivers) as well as manage and schedule application processes.
[0102] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images. For example, a display interface can be, but is not limited to, Figure 4 The user interface is shown.
[0103] The input manager can provide input management services (IMS), which can be used to manage system input, such as touch screen input, key input, sensor input, etc. IMS takes events from input device nodes and distributes them to appropriate windows through interaction with WMS.
[0104] Content providers are used to store and retrieve data and make it accessible to applications. This data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0105] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0106] Android Runtime includes core libraries and virtual machines. Android Runtime is responsible for scheduling and management of the Android system.
[0107] The core library consists of two parts: one part is the function that the programming language (for example, Java language) needs to call, and the other part is the Android core library.
[0108] The application layer 210 and the application framework layer 220 run in a virtual machine. The virtual machine executes the programming files (e.g., java files) of the application layer 210 and the application framework layer 220 as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0109] The core library layer 230 may include multiple functional modules, such as a surface manager, a media framework, libc, SQLite, OpenGL ES, and the like.
[0110] The surface manager is used to manage the display subsystem and provides the fusion of two-dimensional (2D) and three-dimensional (3D) layers for multiple applications.
[0111] The media framework supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc.
[0112] libc (C library) is the standard library of C language. libc is the lowest level library in the system and is implemented through Linux system calls. For example, libc can be used to connect or disconnect camera services, set camera shooting parameters, start or stop preview, take pictures, etc.
[0113] The hardware abstraction layer (HAL) 240 is an interface layer located between the operating system kernel and the upper-level software, and its purpose is to abstract the hardware. The hardware abstraction layer is an abstract interface driven by the device kernel, which is used to implement the application programming interface that provides access to the underlying device to the higher-level Java API framework. HAL contains multiple library modules, such as camera HAL (such as aperture, TOF sensor, lens or focus motor, etc.), Vendor warehouse, display, Bluetooth, audio, etc. Each library module implements an interface for a specific type of hardware component. It can be understood that the camera HAL can provide an interface for the camera FWK to access hardware components such as the camera. The Vendor warehouse can provide an interface for the media FWK to access hardware components such as the encoder. When the system framework layer API requires access to the hardware of the portable device, the Android operating system will load the library module for the hardware component.
[0114] The kernel layer 250 is the foundation of the Android operating system, and the final functions of the Android operating system are all completed through the kernel layer 250. For example, the kernel layer 250 may include Figure 2The display driver, audio driver, camera driver, and Bluetooth driver are shown. Optionally, the kernel layer 250 may also include a larger number of other drivers, for example, other drivers may be, but are not limited to, sensor drivers.
[0115] It should be noted that the application provides Figure 2 The software structure diagram of the electronic device shown is only an example and does not limit the specific module division in different layers of the Android operating system. For details, please refer to the introduction of the Android operating system software structure in conventional technology. In addition, the image processing method provided in this application can also be implemented based on other operating systems (for example, IOS or Hongmeng, etc.), and this application will not give examples one by one.
[0116] It should be noted that the execution subject of the image processing method provided in the embodiment of the present application can be the above-mentioned electronic device, or it can be a functional module and / or functional entity in the electronic device that can implement the image processing method, and the solution of the present application can be implemented by hardware and / or software, which can be determined according to actual use requirements, and the embodiment of the present application is not limited. For the sake of convenience of description below, the technical solution of the present application will be adapted to the camera application of the electronic device as an example for explanation. It can be understood that the technical solution of the present application is also applicable to other applications with image acquisition and display functions on electronic devices, not limited to camera applications.
[0117] Next, an application scenario of the image processing method provided by the embodiment of the present application is introduced in conjunction with the accompanying drawings. It should be understood that: Figure 3 The application scenarios shown are for illustration only and do not constitute any limitation on the scenarios to which the image processing method provided in the embodiments of the present application is applicable.
[0118] For example, Figure 3 is a schematic diagram of an application scenario provided by an embodiment of the present application. Figure 3 , a user holds an electronic device 100 including a front camera and a rear camera, and in a scene where the light source is sunlight 102, the user can capture an image of the scene corresponding to the field of view of the rear camera through the rear camera of the electronic device 100. At the same time, the user can also capture an image including the user's face 101 through the front camera of the electronic device 100.
[0119] It should be noted that the above Figure 3The scene shown is introduced by taking the case where the light source is sunlight, the camera that can capture the image of the user's face 101 as the front camera, and the camera that can capture the image of the scene that the user wants to capture (the scene corresponding to the field of view of the rear camera) as the rear camera as an example, but it does not constitute any limitation on the application scenario of the image processing method provided in the embodiment of the present application. Optionally, the above application scenario can also include a larger number (for example, 2 or 3) of light sources, or the above sunlight can also be replaced by other light sources (such as indoor incandescent lamps or moonlight at night, etc.). Optionally, the above electronic device 100 can also include a larger number of cameras, etc.
[0120] Below, based on the above Figure 3 Taking the illustrated scenario as an example, the user interface of a mobile phone that executes the image processing method provided in the embodiment of the present application is exemplarily described in conjunction with the accompanying drawings.
[0121] For example, see Figure 4 As shown in (1) of FIG. 1 , the user clicks on the icon 401a of the camera application in the user interface 401 to open the camera application. After that, the mobile phone will display the shooting interface of the camera application. In the shooting interface of the camera application, the mobile phone can provide the user with a variety of shooting modes to choose from, and these multiple shooting modes can include one or more of "aperture", "night scene", "portrait", "(normal) photo", "video recording" and "professional" modes.
[0122] See also Figure 4 In the user interface 402 shown in (2) of FIG. 1 , the user selects the “normal photo” mode in the shooting interface of the camera application. Accordingly, the mobile phone can detect the instruction input by the user to select the “normal photo” mode. It can be understood that the user selecting the “normal photo” mode is only an example, and the user can also select modes such as “aperture” or “portrait”. After the mobile phone detects the instruction input by the user to select the “normal photo” mode, the parameters related to the shooting mode in the mobile phone can be set based on the shooting mode selected by the user. For example, the shooting mode is set to the “normal photo” mode. The user interface 402 includes a viewfinder (also called a preview frame) 402a, a thumbnail image 402b (i.e., a thumbnail image of the last captured image) and a capture control 402c. It should be understood that before the user clicks the capture control 402c, and when the mobile phone detects that the viewfinder 402a includes a captured object, the mobile phone will also collect the original RAW data corresponding to the viewfinder 402a for indicating the captured object through the rear camera. Exemplarily, in one example, when the mobile phone detects that the scene corresponding to the captured RAW data is a scene with difficult white balance and scene color temperature estimation (difficult scenes are difficult to estimate the color temperature of the light source due to the unfixed reflectivity of the object, and it is difficult to distinguish between a pure color object and a non-pure color light source, or a pure color light source and a non-pure color object, such as a pure color scene as a difficult scene), the mobile phone can prompt the user whether to allow the user's facial image information to be collected through the front camera. Exemplarily, in another example, when the mobile phone detects that the scene corresponding to the captured RAW data is not a special scene, the mobile phone can also prompt the user whether to allow the user's facial image information to be collected through the front camera. For example, the phone can display Figure 4 The user interface 403 shown in (3) of FIG. The user interface 403 includes a pop-up window 403a, and the pop-up window 403a includes an allow control 403a1 and a disallow control. The pop-up window 403a is used to prompt the user whether to allow the front camera to collect facial images. The allow control 403a1 is used to indicate that the user agrees to use the front camera to collect facial images. The disallow control is used to indicate that the user does not agree to use the front camera to collect facial images. It should be understood that the content of the user interface 403 other than the pop-up window 403a is consistent with the content of the user interface 402, and will not be repeated here.
[0123] When the mobile phone detects that the user clicks the selection operation (eg Figure 4 In the case of the finger click operation shown by the dotted line in (3) of the figure), the mobile phone will also collect RAW data including the user's face through the front camera. That is, after the mobile phone detects that the user clicks the permission control 403a1, the mobile phone collects the RAW data corresponding to the viewfinder 402 indicating the shooting object through the rear camera, and at the same time, the mobile phone also collects RAW data of the image including the user's face through the front camera.
[0124] After that, when the user clicks Figure 4In the case of the shooting control 402c shown in (3) of the figure, the mobile phone can perform white balance processing on the RAW data collected by the rear camera based on the RAW data including the face collected by the front camera, and quickly generate a thumbnail image corresponding to this shooting instruction (a thumbnail image of the image after white balance processing is performed on the RAW data collected by the rear camera based on the RAW data including the face collected by the front camera). At the same time, the shooting interface of the camera application of the mobile phone will display the thumbnail image corresponding to this shooting instruction, for example Figure 4 The thumbnail image 404a in the user interface 404 shown in (4) is the thumbnail image corresponding to the current photo taking instruction. Afterwards, the user clicks on the thumbnail image 404a, and the mobile phone can display the Figure 4 The captured image 405 a in the user interface 405 shown in (5) of FIG. 4 is an image obtained by enlarging the thumbnail image 404 a .
[0125] It should be understood that in the above difficult scenario, after the user clicks the shooting control 402c, the image corresponding to the RAW data collected by the mobile phone through the rear camera can be Figure 5 In the image before processing shown in (1) of FIG. 1 (the image has a serious color cast phenomenon), the mobile phone can perform white balance processing on the RAW data collected by the rear camera based on the RAW data including the face collected by the front camera to obtain the captured image 405a (i.e. Figure 5 The processed image shown in (2) does not have color cast).
[0126] Next, combine Figures 6 to 9 The image processing method provided in the embodiment of the present application is introduced.
[0127] Implementation Figure 6 is a schematic diagram of an image processing method provided in an embodiment of the present application. The image processing method provided in an embodiment of the present application can be performed by an electronic device. It is understood that the electronic device can be implemented as software, or a combination of software and hardware. For example, the electronic device in the embodiment of the present application can be, but is not limited to, Figure 1 The electronic device 100 is shown. Figure 6 As shown, the image processing method provided by the embodiment of the present application includes steps S610 to S670. Steps S610 to S670 are described in detail below.
[0128] In step S610 , a camera application is run.
[0129] For example, the user can instruct the electronic device to run the camera application by clicking the icon of the "Camera" application; or, when the electronic device is in the lock screen state, the user can instruct the electronic device to run the camera application by sliding to the right on the display screen of the electronic device. Alternatively, when the electronic device is in the lock screen state, the lock screen interface includes the icon of the camera application, and the user can instruct the electronic device to run the camera application by clicking the icon of the camera application. Alternatively, when the electronic device is running other applications, the application has the permission to call the camera application; the user can instruct the electronic device to run the camera application by clicking the corresponding control.
[0130] For example, when an electronic device is running an instant messaging application, a user can instruct the electronic device to run a camera application by selecting a control of a camera function.
[0131] It should be understood that the above is an example of the operation of running a camera application; the electronic device may also run a camera application through voice instructions or other operations; this application does not impose any limitation on this. In step S620, a RAW image 1 of scene 1 is captured by the front camera, and a RAW image 2 of scene 2 is captured by the rear camera, wherein RAW image 1 includes a face area, and the light source of the shooting environment corresponding to scene 1 is the same as the light source of the shooting environment corresponding to scene 2.
[0132] In an embodiment of the present application, the electronic device may include at least two cameras, wherein the at least two cameras may include a front camera and a rear camera. It should be understood that the front camera refers to a camera used to capture images including faces, and the rear camera refers to an image used to capture scenes that the user needs to capture. The front camera and the rear camera may not have a common FOV, that is, the image captured by the front camera and the image captured by the rear camera do not include the same image area. In other words, when the image captured by the rear camera includes a large area of solid color, the image captured by the front camera may not include a large area of solid color.
[0133] For example, the preview image corresponding to the RAW image 1 captured by the front camera can be Figure 7 The preview image corresponding to the RAW image 2 captured by the rear camera may be Figure 5 From the image shown in (1) (with color cast), it can be seen that the two images do not include the same image area.
[0134] It should be noted that, in actual applications, the front camera is usually able to successfully capture an image including the user's face with a high probability, so the camera used to capture an image including a face is referred to as a front camera, but the embodiments of the present application do not constitute any limitation on this. Optionally, the camera used to capture an image including a face may also be other cameras, not limited to the front camera, and the image used to capture the scene to be captured by the user may also be other cameras, not limited to the rear camera.
[0135] In the embodiment of the present application, the RAW image (such as RAW image 1, RAW image 2 or RAW image 3) can be the raw data of the light source signal captured by the camera converted into a digital signal by a CMOS or CCD image sensor, and the raw data has not been processed by the ISP, wherein the RAW image can specifically be a Bayer image in the Bayer format, and the Bayer image is a one-dimensional image. Optionally, the RAW image can also be an image that has been processed by the ISP with a preset process (such as noise reduction process, image enhancement process, white balance process, etc.).
[0136] The light source of the shooting environment corresponding to scene 1 is the same as the light source of the shooting environment corresponding to scene 2. The light source is not specifically limited and can be determined according to the actual scene. For example, the light source can be, but is not limited to, outdoor sunlight at noon, outdoor moonlight at night, outdoor sunlight in the afternoon, a typical halogen tungsten lamp (incandescent lamp) or a fluorescent lamp, etc.
[0137] It should be understood that the color temperature corresponding to the same light source is the same, and the color temperature corresponding to different light sources may be different. For example, when the light source is a typical halogen tungsten lamp (incandescent lamp), the color temperature of the light source is 2856 Kelvin (K). For example, when the light source is a fluorescent lamp, the color temperature of the light source is 6400K. For example, when the light source is midday sunlight, the color temperature of the light source is 5000K.
[0138] For example, the light source in step S620 may be Figure 3 The sunlight 102 shown, the above scene 2 can be as follows Figure 3 The rear camera field of view shown includes the following scenes. The above scene 1 can be Figure 3 The front camera field of view shown includes the scene of the user's face 101, and Figure 3 The front and rear cameras are shown not having a common FOV.
[0139] In the embodiment of the present application, whether the front camera in the above step S620 supports the auto focus function is not specifically limited. In other words, the front camera may support the auto focus function or may not support the auto focus function.
[0140] In one example, when the front camera in the above step S620 is a camera that supports the autofocus function, when the front camera captures an image of scene 1 including a face, the front camera can focus on the face to obtain a clearer image.
[0141] In another example, when the front camera in the above step S620 is a camera that supports the autofocus function, in order to avoid leakage of the user's facial privacy data, when the front camera in the above step S620 is a camera that supports the autofocus function, the electronic device can also control the front camera to capture the image of scene 1 in a defocused manner to obtain a more blurred image. Compared with a clearer image, the more blurred image can better protect the user's facial privacy data.
[0142] In another example, when the front camera in the above step S620 is a camera that does not support the auto focus function, That is, the electronic device cannot control the front camera to capture the image of scene 1 in a defocused manner. In this case, after the front camera obtains the RAW image 1, the electronic device can also perform image blur processing on the RAW image 1 to obtain the blurred RAW image 1. The blurred RAW image 1 can better protect the user's facial privacy data. It should be understood that in this implementation, the RAW image 1 mentioned below should be replaced by the blurred RAW image 1.
[0143] In step S630 , face recognition processing is performed on the RAW image 1 to obtain a RAW image 3 , wherein the RAW image 3 only includes the face area.
[0144] The RAW image 1 at least includes a face region. Optionally, the RAW image 1 may also include other photographed objects other than the face, such as, but not limited to, buildings, trees, etc. Therefore, the purpose of the electronic device performing the above step S630 is to identify and extract the face region in the RAW image 1, and obtain a RAW image 3 including only the face region in the RAW image 1.
[0145] RAW image 3 is an image that only includes the face area, where the face area refers to the area of the human face, and the color of the human face is not a pure color area (that is, a non-pure color area, for example, the eyeballs in the face area are brown, the eyelids are white, the skin color is white or yellowish, etc.), that is, RAW image 3 can be considered as a non-pure color image.
[0146] In the embodiments of the present application, the face recognition processing method is not specifically limited. For example, it can be based on an existing face recognition method, such as a face recognition method based on geometric features or a face recognition method based on feature faces. For another example, face recognition processing can also be performed based on a trained face recognition model, which can be a neural network model.
[0147] In step S640 , the color temperature of the shooting environment corresponding to scene 1 is obtained according to RAW image 3 .
[0148] Generally, when an image includes a large area of pure color area, the color temperature deviation of the environment in which the image is taken is large when the image is estimated based on the image. In the embodiment of the present application, the electronic device performs the above step S640, that is, the color temperature of the environment in which the image is taken is estimated based only on the RAW image 3 of the user's face as a non-pure color area included in the RAW image 1 captured by the front camera, and the color temperature of the environment is more consistent with the color temperature of the real environment in which the image is taken, that is, the color temperature of the environment is more accurate.
[0149] The color temperature of the shooting environment corresponding to scene 1 is a color temperature value determined based on the RAW image 3 of the user's face as a non-pure color area. Since the face area is a non-pure color area, the color temperature of the shooting environment corresponding to scene 1 can more accurately represent the color temperature of the light source of the shooting environment in scene 1 when the front camera captures the RAW image 1, so that the color cast of the image obtained after the subsequent white balance processing based on the color temperature is small or non-existent, so that the image is more in line with the actual situation.
[0150] In the embodiment of the present application, the method of “the electronic device obtaining the color temperature of the shooting environment corresponding to the scene 1 according to the RAW image 3” is not specifically limited. Exemplarily, the electronic device obtains the color temperature of the shooting environment corresponding to the scene 1 according to the RAW image 3, which may include the following steps: the electronic device divides the RAW image 3 into multiple image blocks, wherein each image block includes multiple pixels; the electronic device determines multiple pixel information corresponding to the multiple image blocks according to the pixels included in each image block in the multiple image blocks, wherein the pixel information corresponding to each image block includes B / G (ratio of B to G) and R / G (ratio of R to G), and the B / G corresponding to each image block is equal to the ratio of the average value of the B components of all the pixels included in each image block to the average value of the G components of all the pixels included in each image block, and each image block has a pixel value of 0. The R / G corresponding to the block is equal to the ratio of the average R component of all the pixels included in each image block to the average G component of all the pixels included in each image block, R is the R component in the RGB value of the pixel, B is the B component in the RGB value of the pixel, and G is the G component in the RGB value of the pixel; the electronic device determines one pixel information among the multiple pixel information as the target pixel information according to a preset rule; the electronic device obtains the color temperature of the shooting environment corresponding to scene 1 according to the target pixel information and the mapping relationship between the pixel information and the color temperature, wherein the mapping relationship between the pixel information and the color temperature includes the mapping relationship between the target pixel information and the color temperature of the shooting environment corresponding to scene 1.
[0151] The preset rule is used to select one pixel information as target pixel information from multiple pixel information. For example, the preset rule may be to select pixel information with the largest sum of B / G and R / G. For example, the preset rule may be to select pixel information with the smallest sum of B / G and R / G.
[0152] Each of the multiple image blocks may include multiple pixel points. For example, each image block may be Figure 7 The image corresponding to the image block 701a is shown.
[0153] There is no specific limitation on whether the number of pixel points included in any two of the multiple image blocks is the same. For example, the number of pixel points included in any two of the multiple image blocks may be the same or different.
[0154] The mapping relationship between pixel information and color temperature refers to a mapping relationship between a pair of B / G and R / G and a color temperature. The mapping relationship between pixel information and color temperature can be represented by a two-dimensional coordinate system.
[0155] For example, Figure 8 (1) in the figure shows the corresponding pixel information (B / G and R / G) of the dark-skinned face area under different color temperatures corresponding to different light sources. Figure 8From Figure (1), we can see that when the light source is D50 and the corresponding color temperature is 5000K, B / G is equal to 0.4 and R / G is equal to 0.6.
[0156] For example, Figure 8 Figure (2) shows the corresponding pixel information (B / G and R / G) of the light-skinned face area under different color temperatures corresponding to different light sources. Figure 8 From Figure (2), we can see that when the light source is D50 and the corresponding color temperature is 5000K, B / G is equal to 0.4 and R / G is equal to 0.75.
[0157] For example, taking an image block including two pixel points, pixel 1 and pixel 2, and pixel 1 including R1 component, B1 component and G1 component, and pixel 2 including R2 component, B2 component and G2 component, the pixel information included in the image block includes B / G=B average / G average, R / G=R average / G average, B average=(B1+B2) / 2, G average=(G1+G2) / 2, and R average=(R1+R2) / 2.
[0158] It should be understood that the above method of obtaining the color temperature based on the RAW image 3 is only for illustration and does not constitute any limitation to the embodiments of the present application. For example, the above "the electronic device determines one pixel information among the multiple pixel information as the target pixel information according to a preset rule" can also be replaced by the following steps "the electronic device determines the average value of the multiple B / G corresponding to the multiple pixel information and the average value of the multiple R / G corresponding to the multiple pixel information as the B / G and R / G included in the target pixel information".
[0159] In step S650 , it is determined whether the RAW image 2 includes a large solid color area.
[0160] It should be understood that if it is determined that the RAW image 2 includes a large area of pure color area, it can be considered that the color cast in the RAW image 2 is relatively serious. If it is determined that the RAW image 2 does not include a large area of pure color area, it can be considered that the RAW image 2 does not have a color cast, or the color cast is very small (negligible).
[0161] The electronic device executes the above-mentioned step S650, that is, the electronic device determines whether the RAW image 2 includes a large area of pure color area. Exemplarily, it may include the following steps: the electronic device determines whether the RAW image 2 includes a pure color area; when the RAW image 2 includes a pure color area, the electronic device determines whether the area of the pure color area included in the RAW image 2 is greater than a preset area, wherein if the area of the pure color area included in the RAW image 2 is greater than or equal to the preset area, it is determined that the RAW image 2 includes a large area of pure color area; if the area of the pure color area included in the RAW image 2 is less than the preset area, it is determined that the RAW image 2 does not include a large area of pure color area.
[0162] In the embodiment of the present application, the size of the preset area is not specifically limited and can be set according to a specific scenario. The preset area can be a value predefined in the electronic device.
[0163] In the embodiment of the present application, the method of "the electronic device determining whether the RAW image 2 includes a pure color area" is not specifically limited and can be implemented using existing methods.
[0164] Exemplarily, when judging whether the RAW image 2 includes a pure color area, the RAW image 2 may be processed, and the color distribution information in the RAW image 2 may be obtained to judge whether the RAW image 2 includes a pure color area. The color distribution information refers to the distribution range of the red, green, and blue RGB values of each pixel in the image in the R / G, B / G coordinate system. R is the red channel of the pixel, B is the blue channel of the pixel, and G is the green channel of the pixel. If most of each pixel in the image is distributed in one area in the R / G, B / G coordinate system, it is judged that the RAW image 2 includes a pure color area. If the RGB value of each pixel in the image is dispersed in the R / G, B / G coordinate system, it is judged that the RAW image 2 does not include a pure color area.
[0165] Exemplarily, the electronic device may also use a trained image pure color region recognition model to recognize the RAW image 2 to determine whether the RAW image 2 includes a pure color region. The trained image recognition model may be a neural network model. The model training method for obtaining the trained image pure color region recognition model is not specifically limited, and the neural network model may be trained using an existing model training method.
[0166] In the embodiment of the present application, after the electronic device executes the above step S650, if it is determined that the RAW image 2 includes a large area of pure color area, it continues to execute step S660. If it is determined that the RAW image 2 does not include a large area of pure color area, it continues to execute step S670.
[0167] In step S660 , white balance processing is performed on the RAW image 2 according to the color temperature of the shooting environment corresponding to the scene 1 to obtain a processed image 1 .
[0168] For example, when the RAW image 2 includes a large area of pure color, the RAW image 2 may be Figure 5 The image with serious color cast shown in (1) is processed by step S660. Figure 5 After the image processing shown in Figure (1) in FIG. 1 , the image obtained as the corrected image can be Figure 5 (2) in the figure shows an image without color cast.
[0169] The electronic device executes the above-mentioned step S660, that is, the electronic device performs white balance processing on the RAW image 2 according to the color temperature of the shooting environment corresponding to the scene 1 to obtain the processed image 1. Exemplarily, the following steps may be included: the electronic device obtains a white balance gain coefficient having a mapping relationship with the color temperature of the shooting environment corresponding to the scene 1 according to the color temperature of the shooting environment corresponding to the scene 1 and a color temperature and white balance gain coefficient mapping table, wherein the white balance gain coefficient includes a coefficient of white balance gain R and a coefficient of white balance gain B; the electronic device multiplies the pixel value of the R color channel corresponding to the RAW image 2 by the coefficient of the white balance gain R, and multiplies the pixel value of the B color channel corresponding to the RAW image 2 by the coefficient of the white balance gain B to obtain the processed RAW image 2; and encodes the processed RAW image 2 to obtain the processed image 1 in a preset format.
[0170] The mapping relationship between color temperature and white balance gain coefficient is recorded in the color temperature and white balance gain coefficient mapping table. Therefore, when the color temperature of the electronic device is known, the white balance gain coefficient matching the color temperature can be successfully found based on the mapping table. It should be understood that the coefficient of the white balance gain G is usually 1, the coefficient of the white balance gain R is usually in the range of 1 to 5, and the coefficient of the white balance gain B is usually in the range of 1 to 5.
[0171] For example, when the color temperature is 5000K, the coefficient of white balance gain R is Can be 1.68, the coefficient of white balance gain B It can be 1.05.
[0172] There is no specific limitation on the preset format. For example, the preset format may be, but is not limited to, JPEG, JPG, PNG or BMP.
[0173] In step S670, white balance processing is performed on the RAW image 2 according to the color temperature of the shooting environment corresponding to the scene 2, and the processed image 2 is obtained.
[0174] The method for the electronic device to obtain the color temperature of the shooting environment corresponding to scene 2 is the same as the method for the electronic device to obtain the color temperature of the shooting environment corresponding to scene 1 mentioned above. For matters not described in detail here, please refer to the relevant description above.
[0175] The electronic device performs the above step S670, that is, when the electronic device determines that the RAW image 2 does not contain a large area of pure color area, the color temperature of the shooting environment corresponding to the scene 2 obtained by the rear camera can more accurately reflect the color temperature of the light source corresponding to the scene 2, that is, in this case, the RAW image 2 can be directly white-balanced using the ambient color temperature result obtained by the rear camera to obtain the processed image 2. It can be understood that in this implementation, the quality of the processed image obtained by white-balancing the RAW image 2 based on the color temperature of the shooting environment corresponding to the scene 2 is the same as the quality of the processed image obtained by white-balancing the RAW image 2 based on the color temperature of the shooting environment corresponding to the scene 1.
[0176] Exemplarily, the electronic device executes the above-mentioned step S670, that is, the electronic device performs white balance processing on the RAW image 2 according to the color temperature of the shooting environment corresponding to the scene 2 to obtain the processed image 2. Exemplarily, the following steps may be included: the electronic device obtains a white balance gain coefficient having a mapping relationship with the color temperature of the shooting environment corresponding to the scene 2 according to the color temperature of the shooting environment corresponding to the scene 2 and a color temperature and white balance gain coefficient mapping table, wherein the white balance gain coefficient includes a coefficient of white balance gain R and a coefficient of white balance gain B; the electronic device multiplies the pixel value of the R color channel corresponding to the RAW image 2 by the coefficient of the white balance gain R, and multiplies the pixel value of the B color channel corresponding to the RAW image 2 by the coefficient of the white balance gain B to obtain a processed RAW image 3; and encodes the processed RAW image 3 to obtain a processed image 2 in a preset format.
[0177] Optionally, when an always-on sensor is provided on the chip of the photosensitive sensor (such as CMOS or CCD) of the electronic device, the above steps S630 and S640 can be processed by the always-on sensor. Optionally, the above steps S650 to S670 can also be processed by the always-on sensor. It should be understood that the data processed by the always-on sensor will not be stored in the file storage coefficient of the electronic device, nor will it be transmitted to other devices by the electronic device. After the always-on sensor processes the data, it will be destroyed immediately after processing, which can protect the user's facial privacy data to a certain extent.
[0178] Optionally, in the case where the front camera is a camera that includes an ambient light sensor and / or a multispectral sensor, the image of scene 1 captured by the front camera can be understood as an image including one pixel, wherein the pixel value of the one pixel is the average value of the RGB parameters of all the photographed objects within the viewing angle of the front camera. For example, taking the case where the field of view of the front camera includes a face and a large tree, the image obtained after shooting with the front camera with an ambient light sensor is only one pixel, and the pixel value of the one pixel is the average value of the RGB parameters of the face and the RGB parameters of a large tree. In this implementation, since the image captured by the front camera is an image including one pixel, the image can include the user's facial privacy data to a certain extent.
[0179] It should be understood that the above Figure 6 The image processing method shown is for illustration only and does not constitute any limitation on the image processing method provided in the present application. For example, after the electronic device executes the above step S650, if it is determined that the RAW image 2 does not include a large area of pure color area, the electronic device may also execute step S660. For example, the front camera and the rear camera in the above step S620 may also be replaced by other two cameras in the electronic device.
[0180] Generally, when the RAW image 2 captured by the rear camera contains a large area of pure color area or the RAW image 2 is a pure color image, the use of the white balance algorithm will cause the color cast of the image after the white balance adjustment to be more serious. The RAW image 3 including only the user's face captured by the front camera is an image of a non-pure color area. The use of the white balance algorithm will make the image after the white balance adjustment have a smaller color cast or no color cast and more accurate. Therefore, in the embodiment of the present application, when the RAW image 2 captured by the rear camera includes a large area of pure color area, a more accurate color temperature can be obtained based on the RAW image 3 including only the face area captured by the front camera. Since the light source when the rear camera captures the RAW image 2 is exactly the same as the light source when the front camera captures the RAW image 3, the RAW image 2 of the rear camera is white-balanced based on the color temperature obtained from the RAW image 3 captured by the front camera, so that the color cast of the image after the white balance processing can be smaller or no color cast, thereby improving the user's visual experience. When the RAW image 2 captured by the rear camera does not include a large area of pure color, the RAW image 2 of the rear camera can be directly white balanced according to the color temperature obtained from the RAW image 2 captured by the rear camera. This can reduce or eliminate the color cast of the image after white balance processing, thereby improving the user's visual experience.
[0181] Implementation II Fig. 9is a schematic diagram of an image processing method provided in an embodiment of the present application. The image processing method provided in an embodiment of the present application can be performed by an electronic device. It is understood that the electronic device can be implemented as software, or a combination of software and hardware. For example, the electronic device in the embodiment of the present application can be, but is not limited to, Figure 1 The electronic device 100 is shown. Fig. 9 As shown, the image processing method provided by the embodiment of the present application includes steps S910 to S940. Steps S910 to S940 are described in detail below.
[0182] In step S910, the electronic device captures a first original image of a first scene through a first camera, wherein the first original image is an image including a face area.
[0183] The electronic device may be an electronic device including at least two cameras, wherein the at least two cameras may include a first camera and a second camera. Optionally, the electronic device may further include cameras other than the first camera and the second camera. For example, the electronic device includes three cameras, one camera is a rear main camera as the first camera, another camera is a front camera as the second camera, and another camera is a rear secondary camera.
[0184] In the embodiment of the present application, there is no specific limitation on the positions of the first camera and the second camera in the electronic device, and they can be set according to actual conditions.
[0185] In one example, the first camera may be a front camera, and the second camera may be a rear camera. The front camera refers to a camera used to capture images including faces, and the rear camera refers to an image used to capture scenes that the user needs to capture. In this scenario, the front camera as the first camera and the rear camera as the second camera do not have a common field of view (FOV). When the front camera as the first camera and the rear camera as the second camera do not have a common FOV, that is, the image captured by the front camera and the image captured by the rear camera do not include the same image area. In other words, when the image captured by the rear camera includes a large area of pure color area, the image captured by the front camera generally does not include a large area of pure color area (usually the front camera will capture the user's face as a non-pure color area).
[0186] In another example, the first camera may be a rear main camera, and the second camera may be a rear sub-camera. In this scenario, the main camera as the first camera and the sub-camera as the second camera may have a common field of view. For example, the field of view of the rear main camera as the first camera is greater than the field of view of the rear sub-camera as the second camera. For another example, the field of view of the rear main camera as the first camera is less than the field of view of the rear sub-camera as the second camera.
[0187] In the embodiment of the present application, the original image (such as the first original image, the second original image, the third original image and the fourth original image) can be the original data of the light source signal captured by the camera converted into a digital signal by a CMOS or CCD image sensor, and the original data has not been processed by the ISP, wherein the RAW image can specifically be a bayer image in the bayer format, and the bayer image is a one-dimensional image. Optionally, the RAW image can also be an image that has been processed by the ISP with a preset process (such as noise reduction process, image enhancement process, white balance process, etc.).
[0188] The first original image is an image including a face area, wherein the face area refers to an area of the face of a person, and the color of the face is not a pure color area (i.e., a non-pure color area, for example, the eyeballs in the face area are brown, the eyelids are white, the skin color is white or yellowish, etc.), that is, the image corresponding to the face area in the first original image can be considered as a non-pure color image. Optionally, the first original image may also include an area other than the face area, which is not specifically limited. Exemplarily, the first original image may also be referred to as a first preview image.
[0189] The method by which the electronic device captures the first original image of the first scene through the first camera in the above step S920 is not specifically limited.
[0190] In one example, the electronic device captures a first original image of a first scene through a first camera, which may include the following steps: the electronic device captures a third original image of the first scene through the first camera; the electronic device performs image blurring on the third original image to obtain the first original image.
[0191] The third original image (clear image) may be an original image captured by the sensor of the first camera, and the first original image is a blurred image obtained by performing image blurring on the third original image. The method for performing image blurring on the third original image to obtain the first original image is not specifically limited.
[0192] Exemplarily, in the above example, the electronic device performs image blurring processing on the third original image to obtain the first original image, which may include the following steps: the electronic device performs image blurring processing on the entire area of the third original image to obtain the first original image, wherein the entire area of the first original image is blurred.
[0193] Exemplarily, in the above example, the electronic device performs image blurring processing on the third original image to obtain the first original image, which may include the following steps: the electronic device performs image blurring processing on the face area in the third original image to obtain the first original image, wherein the face area included in the first original image is blurred, and the area other than the face area in the first original image is the same as the third original image (clear).
[0194] There is no specific limitation on the image blur processing method. For example, the image blur processing may be, but is not limited to, processing methods such as mean filtering or median filtering.
[0195] It should be noted that there is no specific limitation on whether the autofocus function of the first camera in the above example is turned on. For example, when the first camera has the autofocus function, the autofocus function of the first camera in the above example can be turned on or off. It should be understood that when the autofocus function of the first camera is turned on, when the first camera is used to capture an image of the first scene, it can focus on the face area in the first scene, so that the face image in the obtained image is clear. When the autofocus function of the first camera is turned off, when the first camera is used to capture an image of the first scene, it may not be able to focus on the face area in the first scene. At this time, the face area in the obtained image may not be very clear.
[0196] In one example, an electronic device captures a first original image of a first scene through a first camera, including: when an autofocus function of the first camera is turned on, the electronic device captures the first original image in a defocused manner by controlling the first camera.
[0197] Optionally, before the electronic device executes the above example to capture the first original image by controlling the first camera in a defocused manner, the electronic device may also execute a step of determining whether the first camera has an autofocus function turned on. It should be understood that when the first camera does not have an autofocus function, the first camera cannot have an autofocus function. When the first camera has an autofocus function, the autofocus function of the first camera may be in an on state or an off state.
[0198] In the above implementation, when the first camera is a camera that supports the autofocus function and the autofocus function of the first camera is turned on, in order to avoid leakage of the user's facial privacy data, the electronic device controls the first camera to capture an image of the first scene in a defocused manner, thereby obtaining a relatively blurred image (first original image) including the face area. Compared with a clearer image, the relatively blurred image can better protect the user's facial privacy data.
[0199] For example, a specific example of the first camera may be Figure 6 For the front camera in step S620 of the provided image processing method, a specific example of the first scene may be scene 1 in step S620, a specific example of the first original image may be RAW image 1 in step S620, a specific example of the face area in the first original image may be the face area included in RAW image 1 in step S620 or the face area included in RAW image 3 in step S630. For matters not described in detail here, please refer to the relevant description in step S620.
[0200] In step S920, the electronic device obtains a first white balance parameter according to the face region in the first original image, wherein the first white balance parameter is a parameter determined by the color temperature of the light source of the first scene obtained according to the face region.
[0201] The first white balance parameter is a parameter determined by the color temperature of the light source of the first scene obtained according to the face area in the first original image. That is, when the first original image includes a non-face area, the first white balance parameter is determined only according to the face area in the first original image, and has nothing to do with the non-face area in the first original image.
[0202] In one example, the first white balance parameter may include a first white balance gain parameter (white balance gain red color parameter) and a second white balance gain parameter (white balance gain blue color parameter).
[0203] In another example, the first white balance parameter may include a first white balance gain parameter (white balance gain red color parameter), a second white balance gain parameter (white balance gain blue color parameter) and a third white balance gain parameter (white balance gain green color parameter), wherein the value of the third white balance gain parameter is equal to 1.
[0204] For example, a specific example of the first white balance parameter may be: Figure 6The white balance gain coefficient in step S660 of the provided image processing method, a specific example of the above-mentioned first white balance gain parameter may be the coefficient of the white balance gain R in the above-mentioned step S660, a specific example of the above-mentioned second white balance gain parameter may be the coefficient of the white balance gain B in the above-mentioned step S660, and the contents not described in detail here can be referred to the relevant description in the above step S660.
[0205] In the embodiment of the present application, the implementation method of "the electronic device obtains the first white balance parameter according to the face area in the first original image" in the above step S920 is not specifically limited.
[0206] In one example, an electronic device obtains a first white balance parameter based on a face area in a first original image, illustratively, the following steps may be included: the electronic device obtains a first color temperature based on the face area in the first original image, wherein the first color temperature is the color temperature of the light source of the first scene; the electronic device obtains a first white balance parameter based on a first mapping relationship and the first color temperature, wherein the first mapping relationship includes a one-to-one correspondence between multiple color temperatures and multiple white balance parameters, the first color temperature is one of the multiple color temperatures, and the first white balance parameter is a white balance parameter among the multiple white balance parameters that corresponds to the first color temperature.
[0207] For example, a specific example of the first color temperature may be Figure 6 The color temperature of the shooting environment corresponding to scene 1 in step S660 of the provided image processing method, a specific example of the above-mentioned first mapping relationship can be the mapping relationship recorded in the color temperature and white balance gain coefficient mapping table in the above-mentioned step S660. For the contents not described in detail here, please refer to the relevant description in the above step S660.
[0208] In the above example, the electronic device obtains the first color temperature according to the face area in the first original image, exemplarily, the following steps may be included: the electronic device divides the face area into multiple image blocks, wherein the first image block includes at least one pixel, and the first image block is any one of the multiple image blocks; the electronic device obtains multiple color ratio information corresponding to the multiple image blocks according to the multiple image blocks, wherein the color ratio information corresponding to the first image block includes a first color ratio and a second color ratio, and the first color ratio is the red color component of all pixels in the first image block and the green color component of all pixels in the first image block. The electronic device determines one color ratio information among multiple color ratio information as target color ratio information; the electronic device obtains the first color temperature according to the second mapping relationship and the target color ratio information, wherein the second mapping relationship includes a one-to-one correspondence between multiple color ratio information and multiple color temperatures, the target color ratio information is one color ratio information among multiple color ratio information, and the first color temperature is a color temperature among multiple color temperatures corresponding to the target color ratio information.
[0209] There is no specific limitation on the implementation method of "the electronic device determines one color ratio information among multiple color ratio information as target color ratio information" in the above example.
[0210] For example, the electronic device may determine one of the multiple color ratio information as the target color ratio information according to a preset rule. The preset rule is used to select one of the multiple color ratio information as the target color ratio information. For example, the preset rule may be, but is not limited to, selecting the color ratio information with the maximum or minimum sum of the first color ratio and the second color ratio.
[0211] Optionally, in some implementations, the light-sensitive sensor included in the electronic device in the above step S920 is provided with a normally-on always-on sensor. Therefore, the electronic device performs the above step S920, that is, the electronic device obtains the first white balance parameter according to the face area in the first original image, which may include the following steps: using the always-on sensor to obtain the first white balance parameter according to the face area. The light-sensitive sensor included in the electronic device may be CMOS or CCD.
[0212] Optionally, before the electronic device uses the always on sensor to perform the above step S920, the electronic device may also perform the step of determining whether the light sensor of the electronic device is provided with an always on sensor. If the electronic device determines that the light sensor of the electronic device is provided with an always on sensor, the electronic device uses the always on sensor to perform the above step S920.
[0213] Optionally, the always-on sensor may further execute step S940 below, i.e., performing white balance processing on the second original image according to the first white balance parameter using the always-on sensor to obtain a target image. For details of step S940, please refer to the relevant description below and will not be repeated here.
[0214] It should be understood that the data processed by the always-on sensor will not be stored in the file storage coefficient of the electronic device, nor will it be transmitted to other devices by the electronic device. After the always-on sensor processes the data, it will be destroyed immediately after processing. Therefore, this method can protect the user's facial privacy data to a certain extent.
[0215] For example, a specific example of the first white balance parameter may be: Figure 6 The white balance gain coefficient in step S660 of the provided image processing method, a specific example of the above-mentioned first color temperature may be the color temperature of the shooting environment corresponding to the scene 1 in the above-mentioned step S660, a specific example of the above-mentioned multiple image blocks may be the multiple image blocks in the above-mentioned step S640, a specific example of the above-mentioned multiple color ratio information may be the multiple pixel information in the above-mentioned step S640, a specific example of the above-mentioned first color ratio may be R / G (the ratio of R and G) in the above-mentioned step S640, a specific example of the above-mentioned second color ratio may be B / G (the ratio of B and G) in the above-mentioned step S640, a specific example of the above-mentioned target color ratio information may be the target pixel information in the above-mentioned step S640, and a specific example of the above-mentioned second mapping relationship may be the mapping relationship between the pixel information and the color temperature in the above-mentioned step S640.
[0216] In step S930, the electronic device captures a second original image of a second scene through a second camera, wherein the light source of the second scene corresponding to the second original image is the same as the light source of the first scene corresponding to the first original image.
[0217] The electronic device collects a second original image of a second scene through a second camera. The second scene is a scene to be photographed that the user expects to photograph. The second scene is not specifically limited. Figure 3 Taking the rear camera of the mobile phone shown as an example, the second scene can be Figure 3 The scene to be captured corresponding to the field of view of the rear camera shown.
[0218] The light source of the shooting environment corresponding to the first scene is the same as the light source of the shooting environment corresponding to the second scene, and the same light source corresponds to the same color temperature, that is, the color temperature of the light source of the shooting environment corresponding to the first scene is the same as the color temperature of the light source of the shooting environment corresponding to the second scene. In the embodiment of the present application, the above-mentioned light source is not specifically limited and can be determined according to the actual scene. For example, the light source can be, but is not limited to, outdoor sunlight at noon, outdoor moonlight at night, outdoor sunlight in the afternoon, a typical halogen tungsten lamp (incandescent lamp) or a fluorescent lamp, etc.
[0219] It should be understood that there is a corresponding relationship between the light source and the color temperature, that is, when a light source is determined, the color temperature corresponding to the light source is also determined. For example, when the light source is a typical halogen tungsten lamp (incandescent lamp), the color temperature of the light source is 2856 Kelvin (K). For example, when the light source is a fluorescent lamp, the color temperature of the light source is 6400K. For example, when the light source is midday sunlight, the color temperature of the light source is 5000K.
[0220] In the embodiment of the present application, there is no specific limitation on whether the time at which the electronic device captures the first original image through the first camera and the time at which the electronic device captures the second original image through the second camera are the same.
[0221] In one example, the first camera is a front camera, the second camera is a rear camera, and the electronic device collects a first original image of a first scene through the first camera, which may include the following steps: the electronic device collects the first original image of the first scene through the first camera at a first moment. At the same time, the electronic device collects a second original image of the second scene through the second camera, which may include the following steps: the electronic device collects the second original image of the second scene through the second camera at a first moment. In this implementation, the first camera and the second camera can collect the first original image and the second original image respectively at the same time.
[0222] In another example, the first camera is a main camera, the second camera is a secondary camera, and the electronic device collects a first original image of the first scene through the first camera, which may include the following steps: the electronic device collects the first original image of the first scene through the first camera at a first moment. At the same time, the electronic device collects the second original image of the second scene through the second camera, which may include the following steps: the electronic device collects the second original image of the second scene through the second camera at a second moment, wherein the second moment is different from the first moment. The second moment may be a moment before the first moment, or the second moment may also be a moment after the first moment. In this implementation, the first camera and the second camera may collect the first original image and the second original image at different moments respectively.
[0223] For example, a specific example of the second camera in the above step S930 may be the above Figure 6 The rear camera in step S620 in the provided image processing method, a specific example of the second scene in the above step S930 may be scene 2 in the above step S620, a specific example of the second original image in the above step S930 may be RAW image 2 in the above step S620, and the contents not described in detail here can be referred to the relevant description in the above step S620.
[0224] In step S940, the electronic device performs white balance processing on the second original image according to the first white balance parameter to obtain a target image.
[0225] In the embodiment of the present application, the triggering condition for the electronic device to perform white balance processing on the second original image according to the first white balance parameter to obtain the target image is not specifically limited.
[0226] In one example, the electronic device performs white balance processing on the second original image according to the first white balance parameter to obtain a target image, which may include the following steps: when the second original image includes a pure color area larger than a preset area, the electronic device performs white balance processing on the second original image according to the first white balance parameter to obtain the target image.
[0227] In the above implementation, the condition for triggering the electronic device to execute the above step S940 is that the second original image includes a pure color area larger than the preset area. In this way, since the second original image includes a pure color area larger than the preset area, that is, the second original image has a pure color background larger than the preset area, the color temperature obtained based on the second original image cannot accurately reflect the color temperature of the second scene. Therefore, the electronic device uses the first white balance parameter obtained from the face area in the first original image captured by the first camera to perform white balance processing on the second original image. Since the face area is a non-pure color area, that is, the first white balance parameter obtained based on the face area can more accurately reflect the color temperature of the light source of the first scene (the light source of the second scene), thereby improving the effect of white balance processing, making the processed image (target image) more in line with the color vision habits of the human eye, and improving user experience.
[0228] In another example, the electronic device performs white balance processing on the second original image according to the first white balance parameter to obtain a target image, which may include the following steps: when the second original image includes a pure color area less than or equal to a preset area, the electronic device performs white balance processing on the second original image according to the first white balance parameter to obtain the target image.
[0229] It should be understood that when the second original image includes a pure color area less than or equal to the preset area, that is, when there is no pure color background larger than the preset area in the second original image, the color temperature obtained based on the second original image can accurately reflect the color temperature of the light source of the second scene. In other words, the image obtained by performing white balance processing on the second original image based on the white balance parameters obtained from the second original image is the same as the target image obtained by performing white balance processing on the second original image based on the white balance parameters obtained from the first original image.
[0230] In the above implementation, the condition for triggering the electronic device to execute the above step S940 is that the second original image includes a pure color area less than or equal to a preset area, that is, when the second original image does not have a pure color background larger than the preset area, the electronic device may also perform white balance processing on the second original image through the first white balance parameter obtained from the face area in the first original image captured by the first camera. Since the face area is a non-pure color area, the first white balance parameter obtained based on the face area can more accurately reflect the color temperature of the light source of the first scene (the light source of the second scene), so that the processed image (target image) is more in line with the color vision habits of the human eye and meets the user experience.
[0231] In the embodiment of the present application, the method for the electronic device to execute the above step S940 is not specifically limited.
[0232] In one example, the electronic device performs white balance processing on the second original image according to the first white balance parameter to obtain a target image. Exemplarily, the following steps may be included: the electronic device performs white balance processing on the second original image only according to the first white balance parameter to obtain the target image.
[0233] Exemplarily, in the above example, the first white balance parameter includes a first white balance gain parameter and a second white balance gain parameter, and the electronic device performs white balance processing on the second original image only according to the first white balance parameter to obtain a target image, which may include the following steps: the electronic device multiplies the red color component of each pixel among all the pixels included in the second original image by the first white balance gain parameter, and multiplies the blue color component of each pixel among all the pixels included in the second original image by the second white balance gain parameter to obtain a fourth original image; the electronic device encodes the fourth original image to obtain a target image in a preset format.
[0234] The preset format may be a format pre-defined by a user in the electronic device, and there is no specific limitation on the preset format. For example, the target image in the preset format may be, but is not limited to, a Joint Photographic Experts Group (JEPG) image, a JPG image, a portable network graphic (PNG) or a bitmap (BMP), etc.
[0235] In another example, the electronic device performs white balance processing on the second original image according to the first white balance parameter to obtain a target image, which may illustratively include the following steps: the electronic device weights the first white balance parameter and the second white balance parameter according to the first weight and the second weight respectively to obtain a third white balance parameter, wherein the second white balance parameter is a white balance parameter obtained according to the second original image, the first weight is greater than the second weight, the first white balance gain corresponding to the third white balance parameter is the product of the first weight and the first white balance gain corresponding to the first white balance parameter, and the sum of the product results of the first white balance gain corresponding to the second weight and the second white balance parameter, and the second white balance gain corresponding to the third white balance parameter is the product of the first weight and the second white balance gain corresponding to the first white balance parameter, and the sum of the product results of the second white balance gain corresponding to the second weight and the second white balance parameter; the electronic device performs white balance processing on the second original image according to the third white balance parameter to obtain the target image.
[0236] The first weight is greater than the second weight, and the values of the first weight and the second weight are not specifically limited. For example, in some implementations, the value of the first weight and the value of the second weight can be determined according to the color temperature of the light source and the illuminance of the light source. Specifically, when the light source is low illuminance and low color temperature, the value of the first weight is larger. When the light source is high illuminance and high color temperature, the value of the first weight is larger. For example, the value of the first weight can be but is not limited to 0.75, and the value of the second weight can be but is not limited to 0.25.
[0237] In the above example, the method in which the electronic device performs white balance processing on the second original image according to the third white balance parameter to obtain the target image is similar to the method in which the electronic device performs white balance processing on the second original image according to the first white balance parameter to obtain the target image in the above step S940, and will not be described in detail here.
[0238] For example, the first white balance gain R1 corresponding to the first white balance parameter is equal to 0.5, the second white balance gain B1 corresponding to the first white balance parameter is equal to 0.6, the first white balance gain R2 corresponding to the second white balance parameter is equal to 0.58, the second white balance gain B2 corresponding to the second white balance parameter is equal to 0.63, the first weight value is 0.75, and the second weight value is 0.25. The first white balance gain R3 corresponding to the third white balance parameter is , the second white balance gain B3 corresponding to the third white balance parameter is .
[0239] In the above implementation, when the electronic device performs white balance processing on the second original image, it not only benefits the white balance parameters (first white balance parameters) obtained by the front camera, but also utilizes the white balance parameters (second white balance parameters) obtained by the rear camera, and the weight of the white balance parameters obtained by the front camera is high, and the weight of the white balance parameters of the rear camera is low. In the image processing process, when the second original image collected by the second camera includes a pure color area larger than a preset area, the method is conducive to improving the effect of white balance processing, so that the color cast of the processed image is smaller and more in line with the color visual habits of the human eye, thereby improving the user experience. When the second original image collected by the second camera does not include a pure color area larger than a preset area, the method makes the color cast of the processed image smaller and more in line with the color visual habits of the human eye, thereby satisfying the user experience.
[0240] Exemplarily, in the above example, the electronic device performs white balance processing on the second original image according to the first white balance parameter to obtain a target image, which may include the following steps: the electronic device multiplies the red color component of each pixel among all the pixels included in the second original image by the first white balance gain parameter corresponding to the third white balance parameter, and multiplies the blue color component of each pixel among all the pixels included in the second original image by the second white balance gain parameter corresponding to the third white balance parameter to obtain a fourth original image; the electronic device encodes the fourth original image to obtain a target image in a preset format.
[0241] It should be understood that the above Fig. 9 The image processing method shown is for illustration only and does not constitute any limitation to the image processing method provided in this application.
[0242] In the embodiment of the present application, after the second original image is captured by the second camera, the second original image is not subjected to white balance processing using the color temperature obtained based on the second original image, but the first white balance parameter obtained from the face area in the first original image captured by the first camera is used to perform white balance processing on the second original image to obtain the target image. Since the face area is a non-pure color area, the first white balance parameter obtained based on the face area can more accurately reflect the color temperature of the light source of the first scene (the light source of the second scene), and the target image obtained after further processing has a smaller color cast and can conform to the color visual habits of the human eye, thereby improving the user experience. Moreover, in the case where the second original image captured by the second camera includes a large area of pure color area, compared with performing white balance processing on the second original image using the color temperature obtained based on the second original image, this method can also improve the effect of white balance processing, so that the processed image has a smaller color cast and is more in line with the color visual habits of the human eye, thereby improving the user experience.
[0243] Combination of the above Figures 1 to 9 , describes in detail the application scenario and image processing method of the image processing method of the embodiment of the present application, and will now combine Fig.10 It should be understood that the image processing device in the embodiment of the present application can execute various image processing methods in the aforementioned embodiment of the present application, that is, the specific working process of the following various products can refer to the corresponding process in the aforementioned method embodiment.
[0244] Fig.10 is a schematic diagram of an image processing device provided in an embodiment of the present application. For example, Fig.10 The image processing apparatus 1000 shown includes a processing unit 1010. The function of the processing unit 1010 will be described below.
[0245] The processing unit 1010 is used for: A first original image of a first scene is captured by a first camera, wherein the first original image is an image including a face area; Obtaining a first white balance parameter according to a face region in the first original image, wherein the first white balance parameter is a parameter determined by a color temperature of a light source of a first scene obtained according to the face region; A second original image of a second scene is captured by a second camera, wherein a light source of the second scene corresponding to the second original image is the same as a light source of the first scene corresponding to the first original image; White balance processing is performed on the second original image according to the first white balance parameter to obtain a target image.
[0246] In a possible implementation, the processing unit 1010 is further configured to: A third original image of the first scene is collected by the first camera; and image blurring is performed on the third original image to obtain a first original image.
[0247] In another possible implementation, the processing unit 1010 is further configured to: when the autofocus function of the first camera is turned on, capture the first original image in a defocused manner by controlling the first camera.
[0248] In another possible implementation, the processing unit 1010 is further configured to: In the case where the second original image includes a pure color area larger than a preset area, white balance processing is performed on the second original image according to the first white balance parameter to obtain a target image.
[0249] In another possible implementation, the processing unit 1010 is further configured to: The first white balance parameter and the second white balance parameter are weighted according to the first weight and the second weight respectively to obtain a third white balance parameter, wherein the second white balance parameter is a white balance parameter obtained according to the second original image, the first weight is greater than the second weight, the first white balance gain corresponding to the third white balance parameter is the product of the first weight and the first white balance gain corresponding to the first white balance parameter, and the sum of the product of the second weight and the first white balance gain corresponding to the second white balance parameter, and the second white balance gain corresponding to the third white balance parameter is the product of the first weight and the second white balance gain corresponding to the first white balance parameter, and the sum of the product of the second weight and the second white balance gain corresponding to the second white balance parameter; White balance processing is performed on the second original image according to the third white balance parameter to obtain a target image.
[0250] In another possible implementation, the first camera is a front camera, and the second camera is a rear camera.
[0251] In another possible implementation, the first camera is a main camera and the second camera is a secondary camera.
[0252] In another possible implementation, the processing unit 1010 is further configured to: Obtaining a first color temperature according to the face region in the first original image, wherein the first color temperature is the color temperature of the light source of the first scene; A first white balance parameter is obtained according to a first mapping relationship and a first color temperature, wherein the first mapping relationship includes a one-to-one correspondence between multiple color temperatures and multiple white balance parameters, the first color temperature is one of the multiple color temperatures, and the first white balance parameter is a white balance parameter corresponding to the first color temperature among the multiple white balance parameters.
[0253] In another possible implementation, the processing unit 1010 is further configured to: Divide the face area into a plurality of image blocks, wherein a first image block includes at least one pixel point, and the first image block is any one of the plurality of image blocks; According to the multiple image blocks, a plurality of color ratio information corresponding to the multiple image blocks is obtained, wherein the color ratio information corresponding to the first image block includes a first color ratio and a second color ratio, the first color ratio is a ratio of a red color component of all pixels in the first image block to a green color component of all pixels in the first image block, and the second color ratio is a ratio of a blue color component of all pixels in the first image block to a green color component of all pixels in the first image block; Determine one color ratio information among the multiple color ratio information as target color ratio information; A first color temperature is obtained according to the second mapping relationship and the target color ratio information, wherein the second mapping relationship includes a one-to-one correspondence between multiple color ratio information and multiple color temperatures, the target color ratio information is a color ratio information among the multiple color ratio information, and the first color temperature is a color temperature among the multiple color temperatures corresponding to the target color ratio information.
[0254] In another possible implementation, the first white balance parameter includes a first white balance gain parameter and a second white balance gain parameter, and the processing unit 1010 is further configured to: Multiplying the red color component of each pixel among all the pixels included in the second original image by the first white balance gain parameter, and multiplying the blue color component of each pixel among all the pixels included in the second original image by the second white balance gain parameter, to obtain a fourth original image; The fourth original image is encoded to obtain a target image in a preset format.
[0255] In another possible implementation, the electronic device includes a photosensor provided with a normally-open alwayson sensor, and the processing unit 1010 is further configured to: Using the always-on sensor to obtain a first white balance parameter according to the face area; The always-on sensor is used to perform white balance processing on the second original image according to the first white balance parameter to obtain a target image.
[0256] In another possible implementation, the first camera and the second camera do not have a common field of view.
[0257] It should be noted that the above-mentioned image processing device 1000 is embodied in the form of a functional unit. The term "unit" here can be implemented in the form of software and / or hardware, and is not specifically limited to this.
[0258] For example, a "unit" may be a software program, a hardware circuit, or a combination of the two that implements the above functions. The hardware circuit may include an application specific integrated circuit (ASIC), an electronic circuit, a processor (such as a shared processor, a dedicated processor, or a group processor, etc.) and a memory for executing one or more software or firmware programs, a combined logic circuit, and / or other suitable components that support the described functions.
[0259] Therefore, the units of each example described in the embodiments of the present application can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.
[0260] The present application also provides a computer program product, which, when executed by a processor, implements the image processing method described in any method embodiment of the present application.
[0261] The computer program product may be stored in a memory, for example, a program, which is finally converted into an executable target file that can be executed by a processor after preprocessing, compiling, assembling and linking.
[0262] The present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a computer, the image processing method described in any method embodiment of the present application is implemented. The computer program can be a high-level language program or an executable target program.
[0263] The present application also provides a chip, which is applied to an electronic device. The chip includes one or more processors, and the processor is used to call computer instructions so that the electronic device implements the image processing method described in any method embodiment of the present application when executing.
[0264] In this application, "at least one" means one or more, and "plurality" means two or more. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0265] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0266] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0267] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0268] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic; for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0269] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0270] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0271] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. An image processing method, characterized in that: Applied to an electronic device including a first camera and a second camera, the method includes: A first original image of a first scene is captured by the first camera, wherein the first original image is an image including a face area; Obtaining a first white balance parameter according to the face region in the first original image, wherein the first white balance parameter is a parameter determined by the color temperature of the light source of the first scene obtained according to the face region; A second original image of a second scene is captured by the second camera, wherein a light source of the second scene corresponding to the second original image is the same as a light source of the first scene corresponding to the first original image; White balance processing is performed on the second original image according to the first white balance parameter to obtain a target image.
2. The method according to claim 1, characterized in that The first original image of the first scene collected by the first camera includes: A third original image of the first scene is captured by the first camera; Perform image blurring processing on the third original image to obtain the first original image.
3. The method according to claim 1, characterized in that The first original image of the first scene collected by the first camera includes: When the auto-focus function of the first camera is turned on, the first original image is captured in a defocused manner by controlling the first camera.
4. The method according to any one of claims 1 to 3, characterized in that: The step of performing white balance processing on the second original image according to the first white balance parameter to obtain a target image includes: In the case where the second original image includes a pure color area larger than a preset area, white balance processing is performed on the second original image according to the first white balance parameter to obtain the target image.
5. The method according to any one of claims 1 to 3, characterized in that: The step of performing white balance processing on the second original image according to the first white balance parameter to obtain a target image includes: The first white balance parameter and the second white balance parameter are weighted according to a first weight and a second weight respectively to obtain a third white balance parameter, wherein the second white balance parameter is a white balance parameter obtained according to the second original image, the first weight is greater than the second weight, a first white balance gain corresponding to the third white balance parameter is a product of the first weight and the first white balance gain corresponding to the first white balance parameter, and a sum of a product of the second weight and the first white balance gain corresponding to the second white balance parameter, and a second white balance gain corresponding to the third white balance parameter is a product of the first weight and the second white balance gain corresponding to the first white balance parameter, and a sum of a product of the second weight and the second white balance gain corresponding to the second white balance parameter; White balance processing is performed on the second original image according to the third white balance parameter to obtain the target image.
6. The method according to any one of claims 1 to 3, characterized in that: The first camera is a front camera, and the second camera is a rear camera.
7. The method according to any one of claims 1 to 3, characterized in that: The obtaining a first white balance parameter according to the face area in the first original image includes: Obtaining a first color temperature according to the face region in the first original image, wherein the first color temperature is the color temperature of the light source of the first scene; The first white balance parameter is obtained according to a first mapping relationship and the first color temperature, wherein the first mapping relationship includes a one-to-one correspondence between multiple color temperatures and multiple white balance parameters, the first color temperature is one of the multiple color temperatures, and the first white balance parameter is a white balance parameter among the multiple white balance parameters corresponding to the first color temperature.
8. The method according to claim 7, characterized in that The obtaining a first color temperature according to the face area in the first original image includes: Dividing the face region into a plurality of image blocks, wherein a first image block includes at least one pixel point, and the first image block is any one of the plurality of image blocks; According to the multiple image blocks, a plurality of color ratio information corresponding to the multiple image blocks is obtained, wherein the color ratio information corresponding to the first image block includes a first color ratio and a second color ratio, the first color ratio is a ratio of a red color component of all pixels in the first image block to a green color component of all pixels in the first image block, and the second color ratio is a ratio of a blue color component of all pixels in the first image block to a green color component of all pixels in the first image block; Determine one color ratio information among the plurality of color ratio information as target color ratio information; The first color temperature is obtained according to a second mapping relationship and the target color ratio information, wherein the second mapping relationship includes a one-to-one correspondence between multiple color ratio information and multiple color temperatures, the target color ratio information is one color ratio information among the multiple color ratio information, and the first color temperature is a color temperature among the multiple color temperatures corresponding to the target color ratio information.
9. The method according to any one of claims 1 to 3, characterized in that: The first white balance parameter includes a first white balance gain parameter and a second white balance gain parameter, and performing white balance processing on the second original image according to the first white balance parameter to obtain a target image includes: Multiplying the red color component of each pixel among all the pixels included in the second original image by the first white balance gain parameter, and multiplying the blue color component of each pixel among all the pixels included in the second original image by the second white balance gain parameter, to obtain a fourth original image; The fourth original image is encoded to obtain the target image in a preset format.
10. The method according to any one of claims 1 to 3, characterized in that: The electronic device includes a light-sensitive sensor provided with a normally-open always-on sensor, and; The obtaining a first white balance parameter according to the face area in the first original image includes: Using the always on sensor to obtain the first white balance parameter according to the face area; The step of performing white balance processing on the second original image according to the first white balance parameter to obtain a target image includes: The always-on sensor is used to perform white balance processing on the second original image according to the first white balance parameter to obtain the target image.
11. The method according to any one of claims 1 to 3, characterized in that: The first camera and the second camera do not have a common field of view.
12. An electronic device, characterized in that: It comprises one or more processors and one or more memories; wherein, the one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer programs, and when the one or more processors execute the computer programs, the electronic device executes the method as described in any one of claims 1 to 11.
13. A chip system, the chip system is applied to electronic equipment, the chip system comprises one or more processors, characterized in that: The processor is used to call computer instructions so that the electronic device executes the method according to any one of claims 1 to 11.
14. A computer-readable storage medium comprising a computer program, characterized in that: When the computer program is executed on an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 11.
15. A computer program product, characterized in that When the computer program product is executed on an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Double-camera picture pick-up system and white balance adjustment method and device thereof
CN103402102A
Mobile terminal, and white balance adjustment method
CN106713887A
Automatic white balance processing method and device, and computer storage medium
CN109151428A
Image processing method and device and electronic equipment
CN113573037A
Image adjusting method and device
CN114125302A
Cited By
Million-pixel camera control method based on multifunctional fusion
CN120935465A
A megapixel camera control method based on multi-functional fusion
CN120935465B