White balance adjusting method and device, electronic equipment, storage medium and product
By acquiring the spectral image of ambient light and shooting images, accurately determining the color information of the shooting scene for white balance adjustment, solving the image color casting problem caused by inaccurate color temperature restoration in traditional methods, and improving the color restoration effect of the image.
Patent Information
- Application Number
- CN202310660765.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-05
- Publication Date
- 2024-12-06
AI Technical Summary
The traditional white balance adjustment method cannot accurately restore the color temperature of the current environment, resulting in low accuracy of the obtained color temperature curve and cannot effectively solve the problem of image color casting, especially in dark or complex light scenes.
By obtaining the spectral image of the ambient light in the shooting scene, determining the color information of the shooting scene, and adjusting the white balance of the shooting images based on this information, the spectral image of the ambient light reflects the reflectivity and absorption rate of the object to different wavelengths of light, and accurately The color information is determined so as to perform white balance processing.
It improves the accuracy of image white balance processing and effectively solves the problem of image color casting, especially in dark or complex light scenes, which significantly improves the color restoration effect.
Smart Images

Figure CN119094900A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a white balance adjustment method, device, electronic device, storage medium, and product. Background Art
[0002] Automatic white balance (AWB) is one of the core technologies in image processing. It can effectively avoid color cast problems caused by temperature differences under different light sources. The traditional white balance adjustment method is to shoot white color plates at different color temperatures and perform white balance adjustment on the captured images to obtain white balance correction parameters at different color temperatures, that is, to obtain a color temperature curve. Then, the image can be white-balanced using the color temperature curve to restore the true color of the image.
[0003] However, the conventional method needs to restore the color temperature of the current environment based on the captured image, and then calculate the color temperature curve based on the restored color temperature of the current environment. Since the conventional method cannot accurately restore the color temperature of the current environment, the accuracy of the obtained color temperature curve is also low. Furthermore, the conventional method cannot effectively solve the problem of image color cast when performing white balance processing on the image. Summary of the invention
[0004] The embodiments of the present application provide a white balance adjustment method, device, electronic device, and computer-readable storage medium, which can better solve the problem of color cast in captured images.
[0005] In one aspect, a white balance adjustment method is provided, which is applied to an electronic device, and the method comprises:
[0006] Acquire a spectral image of ambient light in a shooting scene and a shot image of the shooting scene;
[0007] Determining color information of the shooting scene according to the spectral image of the ambient light;
[0008] White balance adjustment is performed on the captured image of the shooting scene according to the color information of the shooting scene.
[0009] In another aspect, a white balance adjustment device is provided, which is applied to an electronic device, and the device comprises:
[0010] An acquisition module, used to acquire a spectral image of ambient light in a shooting scene and a shot image of the shooting scene;
[0011] A color information determination module, used to determine the color information of the shooting scene according to the spectral image of the ambient light;
[0012] The white balance adjustment module is used to perform white balance adjustment on the captured image of the captured scene according to the color information of the captured scene.
[0013] On the other hand, an electronic device is provided, the electronic device comprising a spectrum acquisition device and a camera module, the spectrum acquisition device being communicatively connected to the camera module;
[0014] The spectrum acquisition device is used to obtain a spectrum image of the ambient light in the shooting scene, and send the spectrum image of the ambient light to the camera module;
[0015] The camera module is used to receive the spectral image of the ambient light and obtain the captured image of the captured scene; determine the color information of the captured scene according to the spectral image of the ambient light; and perform white balance adjustment on the captured image of the captured scene according to the color information of the captured scene.
[0016] On the other hand, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the white balance adjustment method as described above.
[0017] On the other hand, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the white balance adjustment method described above are implemented.
[0018] On the other hand, a computer program product is provided, comprising a computer program, which implements the steps of the white balance adjustment method described above when executed by a processor.
[0019] The above-mentioned white balance adjustment method, device, electronic device, storage medium, and product obtain the spectral image of the ambient light in the shooting scene and the captured image of the shooting scene, and then determine the color information of the shooting scene based on the spectral image of the ambient light. Since the spectral image of the ambient light can accurately reflect the reflectivity and absorptivity of the object to light of different wavelengths, the color information of the shooting scene can be accurately determined based on the reflectivity and absorptivity of the object to light of different wavelengths. Then, the white balance of the captured image of the shooting scene is adjusted according to the color information of the shooting scene, which can better solve the problem of color cast of the captured image. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0021] Figure 1 A diagram showing an application environment of a white balance adjustment method in an embodiment;
[0022] Figure 2 is a flow chart of a white balance adjustment method in one embodiment;
[0023] Figure 3A for Figure 2 A flowchart of a method for determining color information of a shooting scene according to a spectral image of ambient light;
[0024] Figure 3B is a schematic diagram of a spectral image of a pixel in one embodiment;
[0025] Figure 4 for Figure 2 A flowchart of a method for adjusting white balance of a captured image of a captured scene according to color information of the captured scene;
[0026] Figure 5 is a schematic diagram of color information of a shooting scene and a captured image of the shooting scene in one embodiment;
[0027] Figure 6 is a schematic structural diagram of an electronic device including a spectrum acquisition device in one embodiment;
[0028] Figure 7 A schematic diagram of the structure of a spectrum acquisition device in one embodiment;
[0029] Figure 8 A schematic diagram of the structure of a slit and a slide rail in a spectrum collection device in an embodiment;
[0030] Fig. 9 is a schematic diagram of a white balance adjustment method in an exemplary embodiment;
[0031] Fig.10 is a structural block diagram of a white balance adjustment device in one embodiment;
[0032] Fig.11 for Fig.10 The structural block diagram of the white balance adjustment module;
[0033] Fig.12 FIG. 1 is a schematic diagram of the internal structure of an electronic device in an embodiment. DETAILED DESCRIPTION
[0034] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0035] It is understood that the terms "first", "second", etc. used in the present application may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, a first focusing element may be referred to as a second focusing element, and similarly, a second focusing element may be referred to as a first focusing element without departing from the scope of the present application. Both the first focusing element and the second focusing element are focusing elements, but they are not the same focusing element.
[0036] As one of the core technologies in image processing, white balance adjustment can effectively avoid the color cast problem of images caused by temperature differences under different light sources. The traditional white balance adjustment method is to shoot white color plates at different color temperatures and perform white balance adjustment on the captured images to obtain white balance correction parameters at different color temperatures, that is, to obtain color temperature curves. In fact, when performing white balance adjustment on captured images at different color temperatures, it is only necessary to correct the R channel and the B channel to obtain Rgain (R channel gain) and Bgain (B channel gain) at different color temperatures. Then, interpolation processing is performed on Rgain (R channel gain) and Bgain (B channel gain) at different color temperatures to obtain a curve diagram of color temperature-Rgain-Bgain, that is, a color temperature curve. Then, the image can be white-balanced through the color temperature curve to restore the true color of the image.
[0037] However, the traditional method needs to restore the color temperature of the current environment based on the captured image, and then calculate the color temperature curve based on the restored color temperature of the current environment. However, since the spectral response values of the human eye and the image sensor for the three channels of RGB are not consistent, that is, it can be understood that the spectral response values of the three channels of the human eye and the image sensor are not linearly mapped, so it leads to the problem of color misalignment in the image captured by the image sensor. In dark light scenes, due to the low amount of light entering the image sensor, the color misalignment problem on the captured image will be more serious. If the color temperature curve is calculated based on the captured image with color misalignment, it is obvious that the color temperature of the current environment cannot be accurately restored. Or in complex light scenes, since the color temperature restored based on the captured image is the comprehensive color temperature of the current ambient light, it is obvious that the error of the comprehensive color temperature is greater. Since the traditional method cannot accurately restore the color temperature of the current environment, the accuracy of the obtained color temperature curve is also low. Furthermore, the use of traditional methods to perform white balance processing on the image cannot solve the problem of image color cast well.
[0038] Figure 1 FIG. 1 is a schematic diagram of an application environment of a white balance adjustment method in an embodiment. Figure 1 As shown, the application environment includes an electronic device 120, which obtains a spectral image of ambient light in a shooting scene and a shot image of the shooting scene; determines color information of the shooting scene according to the spectral image of the ambient light; and performs white balance adjustment on the shot image of the shooting scene according to the color information of the shooting scene. The electronic device 120 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart vehicle-mounted devices, smart cars, etc. The portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc.
[0039] Figure 2 FIG. 1 is a flow chart of a white balance adjustment method in an embodiment. The white balance adjustment method in this embodiment is executed in Figure 1 The electronic device in the example is used to describe. Figure 2 As shown, the white balance adjustment method includes steps 220 to 260, wherein:
[0040] Step 220 , obtaining a spectral image of the ambient light in the shooting scene and a captured image of the shooting scene.
[0041] In order to solve the problem that the traditional method of white balance processing cannot effectively solve the problem of image color cast, the electronic device in this application obtains the spectral image of the ambient light in the shooting scene while obtaining the shooting image of the shooting scene through the camera module. Here, the image format of the shooting image of the shooting scene obtained by the camera module includes a RAW image or a YUV image, and of course, this application does not limit this.
[0042] Among them, the electronic device can obtain the spectral image of the ambient light in the shooting scene through the spectral acquisition device. The shooting scene here can be a complex light scene or a non-complex light scene, which is not limited in this application. Among them, the complex light scene refers to the situation where the current shooting scene includes multiple light sources, or part of the scene in the current shooting scene presents blue light and part of the scene presents red light. Of course, this application does not limit this. Correspondingly, the non-complex light scene generally refers to the situation where there is a single light source in the current shooting scene. Here, the spectral acquisition device is also referred to as a spectral imaging device. Through the spectral acquisition device, each pixel in the shooting scene can be scanned, and the spectrum of each pixel can be collected to obtain the spectral image of the ambient light in the entire shooting scene. Of course, the spectral acquisition device can also scan each spatial line in the shooting scene, wherein each spatial line corresponds to a one-dimensional pixel array, and collects the spectrum of each spatial line, thereby obtaining the spectral image of the ambient light in the entire shooting scene.
[0043] Here, the spectral image of the ambient light in the shooting scene includes the spectral image of each pixel in the shooting scene. A spectral image is a pattern in which the dispersed monochromatic light is arranged in sequence according to the wavelength (or frequency) after the complex light is split by a dispersion system (such as a prism, grating, etc.). The full name is the optical spectrum. The visible spectrum, which accounts for the largest proportion of the spectral image, is the part of the electromagnetic spectrum visible to the human eye. The electromagnetic radiation within the wavelength range of the visible spectrum is called visible light.
[0044] Step 240: Determine color information of the shooting scene according to the spectral image of the ambient light.
[0045] After obtaining the spectral image of the ambient light in the shooting scene through the spectral acquisition device, since the spectral image of the ambient light includes the spectral image of each pixel in the shooting scene, the color information of the shooting scene can be determined based on the spectral image of the ambient light. That is, the color information of each pixel in the shooting scene can be determined based on the spectral image of each pixel in the shooting scene. Here, the color information of the pixel can also be referred to as the color information of the pixel, including the RGB information (red, green, blue), HSL information (hue, saturation, brightness), CMYK information (cyan, magenta, yellow, black), etc. of the pixel. Of course, this application does not limit this.
[0046] If the color information of the pixel refers to RGB information, optionally, the reflectivity and absorptivity of the object to light of different wavelengths can be calculated based on the spectral image of each pixel in the shooting scene to obtain the RGB information of each pixel. For example, here, the RGB information of each pixel can be inferred based on the reflectivity and absorptivity of the object to light of different wavelengths.
[0047] Similarly, if the color information of a pixel refers to CMYK information (cyan, magenta, yellow, black), then optionally, based on the spectral image of each pixel in the shooting scene, the reflectivity and absorptivity of the object to light of different wavelengths can be calculated to obtain the CMYK information of each pixel. For example, here, the CMYK information of each pixel can be inferred based on the reflectivity and absorptivity of the object to light of different wavelengths. The same is true for the case where the color information of the pixel refers to HSL information, which will not be repeated here.
[0048] Step 260: white balance adjustment is performed on the captured image of the captured scene according to the color information of the captured scene.
[0049] Here, the color information of the shooting scene can be understood as the color information of each pixel in the shooting scene. After the color information of each pixel in the shooting scene is determined based on the spectral image of each pixel in the shooting scene, the captured image of the shooting scene can be white-balanced according to the color information of the shooting scene. Optionally, the pixel value of each pixel on the captured image can be white-balanced according to the color information of the pixel.
[0050] For example, the white balance adjustment parameter of each pixel on the captured image can be calculated based on the color information of each pixel and the pixel value of the pixel on the captured image. Then, the white balance adjustment is performed on each pixel on the captured image based on the white balance adjustment parameter of each pixel. Thus, the white balance adjustment of the entire captured image is achieved.
[0051] In an embodiment of the present application, the electronic device obtains the spectral image of the ambient light in the shooting scene and the captured image of the shooting scene, and then determines the color information of the shooting scene based on the spectral image of the ambient light. Since the spectral image of the ambient light can accurately reflect the reflectivity and absorptivity of the object to light of different wavelengths, the color information of the shooting scene can be accurately determined based on the reflectivity and absorptivity of the object to light of different wavelengths. Then, the white balance of the captured image of the shooting scene is adjusted based on the color information of the shooting scene, which can better solve the problem of color cast of the captured image.
[0052] In the above embodiment, it is described that during the white balance adjustment process, the electronic device determines the color information of the shooting scene according to the spectrum image of the ambient light, and then performs white balance adjustment on the captured image of the shooting scene according to the color information of the shooting scene. Figure 3A As shown, in this embodiment, step 240, determining the color information of the shooting scene according to the spectral image of the ambient light, includes:
[0053] Step 242, obtaining tristimulus values of the human eye.
[0054] Modern optical theory believes that when a light source shines on an object, the reflected light from the surface of the object enters the human eye, and the brain processes the information, we perceive the color properties. From this, we can know that the formation of color is mainly composed of three parts, namely: light source, reflective surface, and human eye. Among them, the characteristics of the light source are described by the spectral power distribution function, the reflective surface is described by the surface spectral reflectance function, and the characteristics of the human eye are usually described by the three stimulus values of the spectrum observed by standard chromaticity. In other words, the characteristics of the human eye are usually described by the three stimulus values of the human eye.
[0055] Among them, the three stimulus values of the human eye refer to the sensitivity of the human eye to the three primary colors, for example, the sensitivity of the human eye to red, green, and blue. Optionally, the three stimulus values of the human eye obtained by the electronic device can be [R, G, B] = [x, y, z]. Here, the specific values of x, y, and z are not limited in this application. Of course, the three stimulus values of the human eye can also be a three stimulus value curve, which is not limited in this application. The three stimulus values of the human eye are different from the spectral response values of the image sensor in the camera module to the three primary colors, so the color of the captured image output by the camera module is inconsistent with the color of the image seen by the human eye, that is, the problem of color cast occurs.
[0056] For example, it can be assumed that the sensitivity of the human eye to red is 3, the sensitivity of the human eye to green is 2, and the sensitivity of the human eye to blue is 1. Of course, this application does not limit this. Then, the tristimulus values of the human eye obtained by the electronic device can be [R, G, B] = [3, 2, 1].
[0057] Step 244 , determining the color information of the shooting scene according to the spectral image of the ambient light and the tristimulus values of the human eye.
[0058] After obtaining the three stimulus values of the human eye, the electronic device can determine the color information of the shooting scene according to the spectral image of the ambient light and the three stimulus values of the human eye. Here, the spectral image of the ambient light in the shooting scene includes the spectral image of each pixel in the shooting scene. Figure 3B The figure shows a schematic diagram of a spectral image of a pixel in an embodiment. A spectral image is a pattern in which the dispersed monochromatic light is arranged in sequence according to the wavelength (or frequency) after the complex light is split by a dispersion system (such as a prism, a grating, etc.). The full name is an optical spectrum. The visible spectrum, which accounts for the largest proportion of the spectral image, is the part of the electromagnetic spectrum visible to the human eye. The electromagnetic radiation within the wavelength range of the visible spectrum is called visible light.
[0059] Optionally, for the spectral image of each pixel in the spectral image of ambient light, the color information of each pixel is calculated in combination with the tristimulus values of the human eye. Assuming that the wavelength ratio of red, green, and blue colors in a spectral image of a certain pixel is 2:3:2, then based on the wavelength ratio of red, green, and blue colors and the tristimulus values of the human eye (assuming that the tristimulus values of the human eye can be [R, G, B] = [3, 2, 1]), the comprehensive stimulation value of the spectral image of the pixel to the human eye is calculated to be 3×2+2×3+1×2=14. Then, based on the comprehensive stimulation value of the spectral image of the pixel to the human eye, the color information of the pixel can be inferred. Furthermore, based on the spectral image of each pixel in the spectral image of ambient light, combined with the tristimulus values of the human eye, the color information of each pixel in the captured scene can be accurately calculated.
[0060] If the tristimulus values of the human eye can also be a tristimulus value curve, the color information of a pixel can be obtained based on the integration of the spectral image of a certain pixel and the tristimulus value curve.
[0061] In the embodiment of the present application, since the spectral image of the ambient light can accurately reflect the reflectivity and absorptivity of an object to light of different wavelengths, and the human eye has different sensitivities to the three primary colors, the electronic device first obtains the three stimulus values of the human eye. Then, based on the spectral image of the ambient light and the three stimulus values of the human eye, the color information of the shooting scene can be determined from the perspective of the color perception of the human eye. In this way, the color information of the shooting scene can be accurately calculated from the perspective of the color perception of the human eye and the reflectivity of the object to light of different wavelengths. Finally, the white balance of the captured image of the shooting scene is adjusted according to the color information of the shooting scene, which can better solve the problem of color cast of the captured image.
[0062] In the previous embodiment, the process of accurately calculating the color information of the shooting scene from the perspective of the color perception of the human eye and the reflectivity of the object to light of different wavelengths is described. Figure 4 As shown, in this embodiment, step 260, performing white balance adjustment on the captured image of the captured scene according to the color information of the captured scene, includes:
[0063] Step 262: Calculate a first ratio between the color channel values of each pixel in the shooting scene according to the color information of the shooting scene.
[0064] After calculating the color information of each pixel in the shooting scene according to the spectral image of the ambient light and the three stimulus values of the human eye, the first ratio between the color channel values of each pixel in the shooting scene can be further calculated. Here, the color information of the pixel can also be referred to as the color information of the pixel, including the RGB information (red, green, blue), HSL information (hue, saturation, brightness), CMYK information (cyan, magenta, yellow, black), etc. of the pixel. Of course, this application does not limit this.
[0065] If the color information of each pixel in the shooting scene is RGB information, then each color channel value includes an R channel value, a G channel value, and a B channel value, then the first ratio between each color channel value (R channel value, G channel value, and B channel value) of each pixel in the shooting scene can be calculated. For example, the R channel value / G channel value and the B channel value / G channel value are calculated, where the R channel value / G channel value can also be referred to as Rgain (red gain), and the B channel value / G channel value can also be referred to as Bgain (blue gain).
[0066] If the color information of each pixel in the shooting scene is CMYK information (cyan, magenta, yellow, black), then the color channel values include C channel value, M channel value, Y channel value and K channel value. Then, the second ratio between the color channel values (C channel value, M channel value, Y channel value and K channel value) of each pixel point in the shooting scene can be calculated.
[0067] Step 264 , white balance adjustment is performed on the captured image according to a first ratio between the color channel values of each pixel point.
[0068] Since the color information of the captured scene is obtained based on the spectrum image of the ambient light and the three stimulus values of the human eye, it can accurately reflect the real color information of the captured scene from the perspective of the color perception of the human eye and the reflectivity of the object to light of different wavelengths. Therefore, based on the color information of the captured scene obtained from the spectrum image of the ambient light, after calculating the first ratio between the color channel values of each pixel in the captured scene, the captured image can be white-balanced according to the first ratio between the color channel values of each pixel. In this way, the accuracy of white-balance adjustment of the captured image can be improved.
[0069] Optionally, the second ratio between the color channel values of each pixel on the captured image is different from the first ratio between the color channel values of each pixel in the color information of the captured scene. The color information of the captured scene obtained based on the spectral image of the ambient light and the three stimulus values of the human eye can more accurately reflect the real color information of the captured scene. Then, the captured image is white-balanced based on the first ratio between the color channel values of each pixel obtained from the color information of the captured scene, and the second ratio between the color channel values of each pixel in the captured image can be adjusted to be the same as or close to the first ratio. As a result, the captured image after white balance adjustment can accurately restore colors and improve the white balance effect of the image.
[0070] In an embodiment of the present application, the electronic device calculates a first ratio between the color channel values of each pixel in the shooting scene based on the color information of the shooting scene. Then, the white balance of the captured image is adjusted based on the first ratio between the color channel values of each pixel. The color information of the shooting scene obtained based on the spectral image of the ambient light and the three stimulus values of the human eye can more accurately reflect the true color information of the shooting scene. Then, the white balance of the captured image is adjusted based on the first ratio between the color channel values of each pixel obtained from the color information of the shooting scene, and the second ratio between the color channel values of each pixel in the captured image can be adjusted to be the same as or close to the first ratio. Thereby, the captured image after the white balance adjustment can accurately restore the color and improve the white balance effect of the image.
[0071] In the previous embodiment, it is described that the electronic device calculates the first ratio between the color channel values of each pixel in the shooting scene according to the color information of the shooting scene. Then, the process of adjusting the white balance of the shot image according to the first ratio between the color channel values of each pixel is described. In this embodiment, it is further described that the white balance of the shot image is adjusted according to the first ratio between the color channel values of each pixel, including:
[0072] For each pixel in the captured image, determine a first ratio between each color channel of a target pixel that matches the pixel position from the color information of the captured scene;
[0073] Calculating white balance adjustment parameters of each color channel value of a pixel point in the captured image according to a first ratio between each color channel value of the target pixel point and a second ratio between each color channel value of the pixel point;
[0074] White balance is adjusted for each pixel in the captured image according to the white balance adjustment parameters of each color channel value of each pixel.
[0075] The color information of the captured scene obtained based on the spectral image of ambient light and the three stimulus values of the human eye can reflect the visual characteristics of the human eye. However, the resolution of the color information of the captured scene here is relatively low, for example, 8×8, or 16×16. Of course, this application does not limit this. The resolution of the captured image obtained based on the image sensor is relatively high, which can be 1024×1024, or 1024×768. Of course, this application does not limit this. Obviously, although the color information of the captured scene obtained based on the spectral image of ambient light can more accurately reflect the true color information of the captured scene, the resolution of the color information of the captured scene is relatively low.
[0076] Therefore, the white balance of the high-resolution captured image can be adjusted based on the color information of the low-resolution captured scene. Figure 5 As shown, it is a schematic diagram of the color information of a shooting scene and a captured image of the shooting scene in one embodiment. The color information of the shooting scene can also be represented in the form of an image, for example, it can be represented by the left image 520; the captured image of the shooting scene can be represented by the right image 540. Optionally, first, for each pixel in the captured image 540, a target pixel matching the pixel position is determined from the color information 520 of the shooting scene. For example, if the resolution of the color information 520 of the shooting scene is 8×8 and the resolution of the captured image 540 is higher, that is, 1024×1024, the captured image 540 can be divided into 8×8 grids. Figure 5A dotted box on the captured image 540 in the figure represents a grid in the 8×8 grid that the captured image 540 is divided into. For the pixel point a in the captured image 540 (located in the grid indicated by the diagonal lines in the figure), the target grid (x, y) = (1, 1) divided by the pixel point a is determined, and then the pixel point A (the grid indicated by the cross lines in the figure) corresponding to the target grid (x, y) is determined from the color information 520 of the captured scene as the target pixel point (A) matching the position of the pixel point a. Wherein, x represents the horizontal coordinate of the target grid in the captured scene divided into 8×8, and y represents the vertical coordinate of the target grid in the captured scene divided into 8×8. Because the resolution of the captured image 540 is greater than the resolution of the color information 520 of the captured scene, a target grid in the color information 520 of the captured scene corresponds to multiple pixel points on the captured image 540. For example, a target grid (1, 1) in the color information 520 of the captured scene corresponds to 64×64 pixel points in the dotted box (including 4 grids) on the captured image 540. Here, the present application does not limit the number of pixels on the captured image 540 corresponding to a target grid in the color information 520 of the captured scene.
[0077] Secondly, obtain a first ratio between each color channel of the target pixel (e.g., A), and then obtain a second ratio between each color channel value of the pixel (e.g., a) on the captured image 540. According to the first ratio between each color channel of the target pixel (e.g., A) and the second ratio between each color channel value of the pixel (e.g., a), calculate the white balance adjustment parameters of each color channel value of the pixel (e.g., a) in the captured image 540. For example, the first ratio may be divided by the second ratio to obtain the white balance adjustment parameters of each color channel value of the pixel (e.g., a) in the captured image 540; the first ratio may be divided by the second ratio and then multiplied by the weight to obtain the white balance adjustment parameters of each color channel value of the pixel (e.g., a) in the captured image 540. Of course, the present application does not limit this. In this way, for each pixel point in different grids in the captured image 540, different first ratios can be used to perform white balance adjustment on each pixel point in different grids in the captured image 540 based on the first ratio between each color channel of the target pixel point in the target grid on the color information 520 of the captured scene corresponding to the grid. In other words, different white balance adjustment parameters can be used to perform white balance adjustment on each pixel point in different grids in the captured image 540. Obviously, the white balance adjustment process is more refined and more accurate. It avoids using the same set of white balance adjustment parameters (including Rgain, Bgain) to perform white balance adjustment on the entire captured image 540 in dark light scenes or complex light scenes. Obviously, the same set of white balance adjustment parameters (including Rgain, Bgain) cannot take into account every color block in the captured image 540. As a result, the image after white balance adjustment still has a color cast problem.
[0078] Optionally, the first ratio between the color channels of the target pixel (e.g., A) includes a first ratio of the R channel value / G channel value of the target pixel (e.g., A) and a first ratio of the B channel value / G channel value of the target pixel (e.g., A). The second ratio between the color channel values of the pixel (e.g., a) on the captured image 540 includes a second ratio of the R channel value / G channel value of the pixel (e.g., a) and a second ratio of the B channel value / G channel value of the pixel (e.g., a).
[0079] Then, according to the first ratio between the color channels of the target pixel and the second ratio between the color channel values of the pixel, the white balance adjustment parameters of the color channel values of the pixel in the captured image 540 are calculated. The white balance adjustment parameters of the R channel value / G channel value of the pixel (e.g., a) in the captured image may be calculated according to the first ratio of the R channel value / G channel value of the target pixel (e.g., A) and the second ratio of the R channel value / G channel value of the pixel (e.g., a). The white balance adjustment parameters of the B channel value / G channel value of the pixel (e.g., a) in the captured image 540 may also be calculated according to the first ratio of the B channel value / G channel value of the target pixel (e.g., A) and the second ratio of the B channel value / G channel value of the pixel (e.g., a). Of course, the present application is not limited to this.
[0080] Finally, white balance adjustment is performed on each pixel in the captured image 540 according to the white balance adjustment parameters of each color channel value of each pixel. Optionally, white balance adjustment can be performed on the pixel (e.g., a) in the captured image 540 according to the white balance adjustment parameter (Rgain) of the R channel value / G channel value of the pixel (e.g., a) in the captured image 540. For example, the pixel value (R channel value) of the pixel (e.g., a) can be multiplied by the white balance adjustment parameter (Rgain) of the R channel value / G channel value to obtain a new pixel value (R channel value) of the pixel (e.g., a). White balance adjustment can also be performed on the pixel (e.g., a) in the captured image 540 according to the white balance adjustment parameter (Bgain) of the B channel value / G channel value of the pixel (e.g., a) in the captured image 540. For example, the pixel value (B channel value) of the pixel (e.g., a) can be multiplied by the white balance adjustment parameter (Bgain) of the B channel value / G channel value to obtain a new pixel value (B channel value) of the pixel (e.g., a).
[0081] In this way, for each pixel in the captured image 540, first, a target pixel matching the pixel position is determined from the color information 520 of the captured scene. Secondly, based on the first ratio between the color channels of the target pixel and the second ratio between the color channel values of the pixel, the white balance adjustment parameters of the color channel values of the pixel in the captured image 540 are calculated. Finally, based on the white balance adjustment parameters of the color channel values of each pixel, white balance adjustment is performed on each pixel in the captured image 540.
[0082] In the embodiment of the present application, although the color information of the shooting scene obtained based on the spectrum image of the ambient light can more accurately reflect the real color information of the shooting scene, the resolution of the color information of the shooting scene is low. Therefore, the white balance adjustment of the high-resolution shooting image can be performed based on the color information of the low-resolution shooting scene.
[0083] For each pixel in the captured image, the electronic device first determines the first ratio between the color channels of the target pixel that matches the pixel position from the color information of the captured scene. Secondly, based on the first ratio between the color channels of the target pixel and the second ratio between the color channel values of the pixel, the white balance adjustment parameters of the color channel values of the pixel in the captured image are calculated. Finally, based on the white balance adjustment parameters of the color channel values of each pixel, white balance adjustment is performed on each pixel in the captured image. Because the white balance adjustment parameters of the color channel values of the pixel in the captured image are determined based on the first ratio between the color channels of the target pixel that matches the pixel position in the captured scene, white balance adjustment is performed on each pixel in the captured image based on the white balance adjustment parameters, so that the captured image after white balance adjustment can more accurately reflect the true color information of the captured scene.
[0084] In the previous embodiment, it is described that first, for each pixel in the captured image, a first ratio between each color channel of the target pixel that matches the pixel position is determined from the color information of the captured scene. Secondly, based on the first ratio between each color channel of the target pixel and the second ratio between each color channel value of the pixel, the white balance adjustment parameters of each color channel value of the pixel in the captured image are calculated. Finally, based on the white balance adjustment parameters of each color channel value of each pixel, a process of white balance adjustment is performed on each pixel in the captured image. In this embodiment, it is further described that the electronic device includes a spectral acquisition device to obtain a spectral image of the ambient light in the captured scene, including:
[0085] The spectral image of the ambient light in the shooting scene is obtained through the spectral acquisition device.
[0086] like Figure 6 , which is a schematic diagram of an electronic device including a spectrum acquisition device in an embodiment. The electronic device 600 includes a camera module 620 and a spectrum acquisition device 640. The spectrum acquisition device 640 is also referred to as a spectrum imaging device, through which each pixel in the shooting scene can be scanned, and the spectrum of each pixel can be collected, thereby obtaining a spectrum image of the ambient light in the entire shooting scene. Of course, the spectrum acquisition device can also scan each spatial line in the shooting scene, wherein each spatial line corresponds to a one-dimensional pixel array, and collects the spectrum of each spatial line, thereby obtaining a spectrum image of the ambient light in the entire shooting scene.
[0087] Here, the spectral image of the ambient light in the shooting scene includes the spectral image of each pixel in the shooting scene. A spectral image is a pattern in which the dispersed monochromatic light is arranged in sequence according to the wavelength (or frequency) after the complex light is split by a dispersion system (such as a prism, grating, etc.). The full name is the optical spectrum. The visible spectrum, which accounts for the largest proportion of the spectral image, is the part of the electromagnetic spectrum visible to the human eye. The electromagnetic radiation within the wavelength range of the visible spectrum is called visible light.
[0088] In an embodiment of the present application, the electronic device obtains a spectral image of the ambient light in the shooting scene through a spectral acquisition device. Here, the spectral image of the ambient light in the shooting scene includes a spectral image of each pixel in the shooting scene. Thereby, the electronic device determines the color information of the shooting scene based on the spectral image of the ambient light. Since the spectral image of the ambient light can accurately reflect the reflectivity and absorptivity of an object to light of different wavelengths, the color information of the shooting scene can be accurately determined based on the reflectivity and absorptivity of the object to light of different wavelengths. Then, the white balance of the captured image of the shooting scene is adjusted according to the color information of the shooting scene, which can better solve the problem of color cast of the captured image.
[0089] In the previous embodiment, it is described that an electronic device acquires a spectral image of ambient light in a shooting scene through a spectral acquisition device. In this embodiment, it is further described that the spectral acquisition device includes a light inlet, a first focusing element, a slit, a collimating and dispersing element, a second focusing element, and an image sensor arranged in sequence; acquiring a spectral image of ambient light in a shooting scene through the spectral acquisition device includes:
[0090] The reflected light of the shooting scene entering through the light inlet is focused to the position of the slit by the first focusing element;
[0091] After the reflected light passes through the slit, the reflected light is collimated and dispersed by the collimating and dispersing elements to generate multiple colored lights;
[0092] Focusing the plurality of colored light rays onto the image sensor through a second focusing element to form a spectral image of the ambient light corresponding to the slit;
[0093] The spectral images of the ambient light corresponding to each slit are acquired by moving the slits, and the spectral images of the ambient light in the shooting scene are generated based on the spectral images of the ambient light corresponding to each slit.
[0094] like Figure 7As shown, the spectrum acquisition device includes a light inlet 702, a first focusing element 704, a slit 706, a collimating and dispersing element (including a collimating element 708 and a dispersing element 710), a second focusing element 712 and an image sensor 714, which are arranged in sequence. Among them, the light inlet 702 is used to externally receive ambient light in the shooting scene. The electronic device can obtain a spectral image of the ambient light in the shooting scene through the spectrum acquisition device. Optionally, the electronic device adopts the spectrum acquisition device, and in the first step, the reflected light of the shooting scene entering through the light inlet 702 can be focused to the position of the slit 706 through the first focusing element 704. Among them, the first focusing element 704 includes a first converging mirror, which is not limited in this application.
[0095] In the second step, after the reflected light passes through the slit 706, the reflected light is collimated and dispersed by the collimating and dispersing element 710 to generate a plurality of colored light rays. Optionally, the reflected light is collimated by the collimating element 708; and then the reflected light is dispersed by the dispersing element 710 to generate a plurality of colored light rays. The collimating element 708 may be an independent lens or a reflector, for example, the collimating element 708 includes a collimating mirror. The collimating element 708 may also be directly integrated on the dispersing element 710, such as on a concave grating. The dispersing element 710 generally includes a grating element, and the optical signal may be spatially dispersed into a plurality of light beams by wavelength by the dispersing element 710, which is not limited in the present application.
[0096] In the third step, the multiple colored light rays are focused to the image sensor 714 through the second focusing element 712 to form a spectral image of the ambient light corresponding to the slit 706. The second focusing element 712 includes a second converging mirror, and the image sensor 714 includes a charge coupled device (CCD), such as an array CCD; the image sensor 714 may also include a complementary metal oxide semiconductor (CMOS), which is not limited in the present application. The resolution of the array CCD or CMOS may be 2000×3000 or even higher, which is not limited in the present application. And the higher the resolution of the array CCD or CMOS, the more accurate the color reproduction can be in complex light scenes or dark light scenes, thereby better solving the problem of color cast in the captured image.
[0097] In the fourth step, the spectral images of the ambient light corresponding to each slit 706 are obtained by moving the slits 706, and the spectral images of the ambient light in the shooting scene are generated based on the spectral images of the ambient light corresponding to each slit 706. Figure 8The figure shows a schematic diagram of the structure of the slit and the slide rail in a spectrum acquisition device in an embodiment. The spectrum acquisition device also includes a slide rail 716, on which the slit 706 is arranged, and the slide rail 716 is used to control the movement of the slit 706 in a direction parallel to the light inlet 702. Optionally, the slit 706 is fixedly connected to the slide rail 716, and by controlling the movement of the slide rail 716, the slit 706 can be controlled to move in a direction parallel to the light inlet 702. Furthermore, by moving the slit 706, the spectral image of the ambient light corresponding to each slit 706 is obtained, and then the spectral image of the ambient light in the shooting scene is generated based on the spectral image of the ambient light corresponding to each slit 706. That is, a complete spectral image corresponding to the shooting angle of the camera module is obtained.
[0098] Among them, the optical elements used in the spectrum collection device can all transmit the visible light band of 350-780nm. Of course, this application does not limit this.
[0099] In an embodiment of the present application, the spectrum acquisition device includes a light inlet, a first focusing element, a slit, a collimating and dispersing element, a second focusing element and an image sensor arranged in sequence, and also includes a slide rail, and the slit 706 is arranged on the slide rail. Then, the electronic device focuses the reflected light of the shooting scene entering through the light inlet to the position of the slit through the first focusing element. Then, after the reflected light passes through the slit, the collimating and dispersing element performs collimation and dispersion processing on the reflected light to generate a plurality of colored light rays. Then, the second focusing element focuses the plurality of colored light rays to the image sensor to form a spectral image of the ambient light corresponding to the slit.
[0100] In this way, the electronic device can efficiently and conveniently form a spectral image of the ambient light corresponding to the slit through the light inlet, the first focusing element, the slit, the collimation and dispersion element, the second focusing element, the image sensor, the slide rail and other components sequentially arranged in the spectrum acquisition device. Finally, the slit is indirectly moved by moving the slide rail to obtain the spectral image of the ambient light corresponding to each slit, and the spectral image of the ambient light in the shooting scene is generated based on the spectral image of the ambient light corresponding to each slit.
[0101] Since the spectral image of ambient light can accurately reflect the reflectivity and absorptivity of an object to light of different wavelengths, the color information of the shooting scene can be accurately determined based on the reflectivity and absorptivity of the object to light of different wavelengths. Then, by adjusting the white balance of the captured image of the shooting scene based on the color information of the shooting scene, the accuracy of color restoration can be improved, thereby better solving the problem of color cast in the captured image.
[0102] In the previous embodiment, the specific structure of the spectrum acquisition device and the process by which the electronic device can efficiently and conveniently form a spectrum image of the ambient light corresponding to the slit through the internal components of the spectrum acquisition device are described. In this embodiment, it is further described that if the illumination intensity of the ambient light in the shooting scene is less than the preset illumination intensity threshold, the electronic device also includes a preset LED light, which is used to emit a preset light with a spectrum width greater than the preset spectrum width threshold; the spectrum image of the ambient light in the shooting scene is obtained through the spectrum acquisition device, including:
[0103] Emits preset light to the shooting scene through a preset LED light;
[0104] The spectrum acquisition device receives the light reflected by the preset light through the shooting scene, and generates a spectrum image of the ambient light in the shooting scene based on the reflected light.
[0105] Combination Figure 6 , which is a schematic diagram of an electronic device including a spectrum acquisition device in an embodiment. If the illumination intensity of the ambient light in the shooting scene is less than the preset illumination intensity threshold, that is, the shooting scene is a dark light scene, since less light enters the spectrum acquisition device in the dark light scene, then the spectrum image of the ambient light in the shooting scene cannot be accurately generated based on the less light information. Therefore, in addition to the camera module 620 and the spectrum acquisition device 640, the electronic device 600 also includes a preset LED light 660.
[0106] Among them, the preset LED lamp 660 is used to emit preset light with a spectral width greater than a preset spectral width threshold within the emission angle range, that is, it can provide a wide-spectrum light source. Obviously, the amount of light entering the spectrum collection device can be increased by presetting the LED lamp. For example, the spectral wavelength range can reach 410-760nm, which is not limited in this application. The preset spectral width threshold here can be determined based on an empirical value, for example, 300nm or 400nm, which is not limited in this application.
[0107] If the illumination intensity of the ambient light in the shooting scene is less than the preset illumination intensity threshold, that is, the shooting scene is a dark light scene, then when the electronic device obtains the spectral image of the ambient light in the shooting scene through the spectrum acquisition device 640, it includes emitting a preset light with a wide spectrum to the shooting scene through a preset LED light; then receiving the light reflected by the shooting scene through the spectrum acquisition device, and generating a spectral image of the ambient light in the shooting scene based on the reflected light. In this way, by providing a preset LED light with a wide spectrum, the amount of light entering the spectrum acquisition device can be increased, and then the spectral image of the ambient light in the shooting scene can be generated more accurately.
[0108] In the embodiment of the present application, if the illumination intensity of the ambient light in the shooting scene is less than the preset illumination intensity threshold, that is, the shooting scene is a dark light scene, the electronic device 600 includes a preset LED lamp 660 in addition to the camera module 620 and the spectrum acquisition device 640. The preset LED lamp emits a wide spectrum of preset light to the shooting scene; the spectrum acquisition device then receives the light reflected by the shooting scene from the preset light of the wide spectrum, and generates a spectrum image of the ambient light in the shooting scene based on the reflected light. In this way, by providing a preset LED lamp with a wide spectrum, the amount of light entering the spectrum acquisition device can be increased, and then, the spectrum image of the ambient light in the shooting scene can be generated more accurately.
[0109] Therefore, since the spectrum image of ambient light can accurately reflect the reflectivity and absorptivity of an object to light of different wavelengths, the color information of the shooting scene can be accurately determined based on the reflectivity and absorptivity of the object to light of different wavelengths. Then, the white balance of the captured image of the shooting scene can be adjusted based on the color information of the shooting scene, which can better solve the problem of color cast of the captured image.
[0110] In the previous embodiment, it is described that if the illumination intensity of the ambient light in the shooting scene is less than the preset illumination intensity threshold, the electronic device 600 includes a preset LED light 660 in addition to the camera module 620 and the spectrum acquisition device 640, and a process of how to generate a spectrum image of the ambient light in the shooting scene by the preset LED light. In this embodiment, an electronic device is further described, the electronic device includes a spectrum acquisition device and a camera module, and the spectrum acquisition device is communicatively connected to the camera module;
[0111] A spectrum acquisition device is used to obtain a spectrum image of the ambient light in the shooting scene and send the spectrum image of the ambient light to the camera module;
[0112] The camera module is used to receive the spectral image of the ambient light and obtain the captured image of the captured scene; determine the color information of the captured scene according to the spectral image of the ambient light; and perform white balance adjustment on the captured image of the captured scene according to the color information of the captured scene.
[0113] In an embodiment of the present application, the electronic device includes a spectrum acquisition device and a camera module, and the spectrum acquisition device is communicatively connected to the camera module. The electronic device obtains a spectrum image of ambient light in a shooting scene through the spectrum acquisition device, and sends the spectrum image of ambient light to the camera module. The electronic device then obtains a captured image of the shooting scene through the camera module, determines color information of the shooting scene based on the spectrum image of ambient light, and then performs white balance adjustment on the captured image of the shooting scene based on the color information of the shooting scene.
[0114] Since the spectrum image of ambient light can accurately reflect the reflectivity and absorptivity of an object to light of different wavelengths, the electronic device can accurately determine the color information of the shooting scene based on the reflectivity and absorptivity of the object to light of different wavelengths. Then, the electronic device can adjust the white balance of the captured image of the shooting scene based on the color information of the shooting scene, which can better solve the problem of color cast of the captured image.
[0115] In the previous embodiment, an electronic device is described, the electronic device includes a spectrum acquisition device and a camera module, and the spectrum acquisition device is communicatively connected with the camera module. In this embodiment, the electronic device further describes that the electronic device includes a preset LED light, and the preset LED light is used to emit a preset light with a spectrum width greater than a preset spectrum width threshold;
[0116] The spectrum acquisition device is also used to receive the light reflected by the preset light through the shooting scene, and generate a spectrum image of the ambient light in the shooting scene based on the reflected light.
[0117] Among them, the preset LED lamp is used to emit preset light with a spectral width greater than the preset spectral width threshold, that is, a light source that can provide a wide spectrum. Obviously, by presetting the LED lamp, the amount of light entering the spectrum collection device can be increased. For example, the spectral wavelength range can reach 410-760nm, which is not limited in this application. The preset spectral width threshold here can be determined based on an empirical value, for example, 300nm or 400nm, which is not limited in this application.
[0118] If the illumination intensity of the ambient light in the shooting scene is less than the preset illumination intensity threshold, that is, the shooting scene is a dark light scene, the electronic device can emit preset light with a wide spectrum to the shooting scene through a preset LED light, so that the amount of light entering the spectrum acquisition device can be increased through the preset LED light. Then, the electronic device can receive the light reflected by the shooting scene through the spectrum acquisition device, and generate a spectrum image of the ambient light in the shooting scene based on the reflected light. In turn, a spectrum image of the ambient light in the shooting scene can be generated more accurately.
[0119] Of course, the preset LED light is also applicable to the case where the illumination intensity of the ambient light in the shooting scene is greater than or equal to the preset illumination intensity threshold, that is, the shooting scene is a strong light scene or a normal light scene, and this application does not limit this. The electronic device can increase the amount of light entering the spectrum collection device by using the preset LED light, and thus can more accurately generate the spectrum image of the ambient light in the strong light scene or the normal light scene.
[0120] In the embodiment of the present application, if the illumination intensity of the ambient light in the shooting scene is less than the preset illumination intensity threshold, that is, the shooting scene is a dark light scene, then the electronic device can emit a preset light with a wide spectrum to the shooting scene through a preset LED lamp; then receive the preset light with a wide spectrum reflected by the shooting scene through the spectrum acquisition device, and generate a spectrum image of the ambient light in the shooting scene based on the reflected light. In this way, by providing a preset LED lamp with a wide spectrum, the amount of light entering the spectrum acquisition device can be increased, and then the spectrum image of the ambient light in the shooting scene can be generated more accurately.
[0121] In an exemplary embodiment, Fig. 9 As shown, a white balance adjustment method is provided, which is applied to an electronic device, wherein the electronic device includes a spectrum collection device, the spectrum collection device includes a light inlet, a first focusing element, a slit, a collimating and dispersing element, a second focusing element and an image sensor arranged in sequence, and also includes a slide rail, the slit is arranged on the slide rail, and the slide rail is used to control the slit to move in a direction parallel to the light inlet; the method includes:
[0122] Step 902, focusing the reflected light of the shooting scene entering through the light inlet to the position of the slit by a first focusing element;
[0123] Step 904, after the reflected light passes through the slit, the reflected light is collimated and dispersed by a collimating and dispersing element to generate a plurality of colored lights;
[0124] Step 906, focusing the plurality of colored light rays onto the image sensor through a second focusing element to form a spectral image of the ambient light corresponding to the slit;
[0125] Step 908, acquiring a spectral image of the ambient light corresponding to each slit by moving the slits, and generating a spectral image of the ambient light in the shooting scene based on the spectral image of the ambient light corresponding to each slit;
[0126] Step 910, obtaining a captured image of the captured scene through a camera module;
[0127] Step 912, obtaining the tristimulus values of the human eye; determining the color information of the shooting scene according to the spectral image of the ambient light and the tristimulus values of the human eye;
[0128] Step 914, for each pixel in the captured image, determine a first ratio between each color channel of a target pixel matching the pixel position from the color information of the captured scene;
[0129] Step 916, calculating white balance adjustment parameters of each color channel value of the pixel point in the captured image according to the first ratio between each color channel value of the target pixel point and the second ratio between each color channel value of the pixel point;
[0130] Step 918: perform white balance adjustment on each pixel in the captured image according to the white balance adjustment parameters of each color channel value of each pixel.
[0131] In the embodiment of the present application, the electronic device can efficiently and conveniently form a spectral image of the ambient light corresponding to the slit by sequentially providing the light inlet, the first focusing element, the slit, the collimating and dispersing element, the second focusing element, the image sensor, the slide rail and other components in the spectrum acquisition device. Finally, the slit is indirectly moved by moving the slide rail to obtain the spectral image of the ambient light corresponding to each slit, and the spectral image of the ambient light in the shooting scene is generated based on the spectral image of the ambient light corresponding to each slit.
[0132] Since the spectrum image of ambient light can accurately reflect the reflectivity and absorption rate of an object to light of different wavelengths, the color information of the shooting scene can be accurately determined based on the reflectivity and absorption rate of the object to light of different wavelengths. Then, the white balance of the captured image of the shooting scene can be adjusted based on the color information of the shooting scene, which can better solve the problem of color cast of the captured image.
[0133] In one embodiment, Fig.10 As shown, a white balance adjustment device 1000 is provided, which is applied to electronic equipment, and the device includes:
[0134] An acquisition module 1020 is used to acquire a spectral image of ambient light in a shooting scene and a captured image of the shooting scene;
[0135] A color information determination module 1040, configured to determine color information of a captured scene according to a spectrum image of ambient light;
[0136] The white balance adjustment module 1060 is used to perform white balance adjustment on the captured image of the captured scene according to the color information of the captured scene.
[0137] In one embodiment, the color information determination module 1040 includes:
[0138] A tristimulus value acquisition unit, used to acquire tristimulus values of human eyes;
[0139] The color information determination unit is used to determine the color information of the shooting scene according to the spectral image of the ambient light and the three stimulus values of the human eye.
[0140] In one embodiment, Fig.11 As shown, the white balance adjustment module 1060 includes:
[0141] A first ratio calculation unit 1062, configured to calculate a first ratio between color channel values of each pixel in the shooting scene according to color information of the shooting scene;
[0142] The white balance adjustment unit 1064 is used to perform white balance adjustment on the captured image according to a first ratio between the color channel values of each pixel point.
[0143] In one embodiment, the white balance adjustment unit is further used to determine, for each pixel in the captured image, a first ratio between each color channel of a target pixel that matches the pixel position from the color information of the captured scene; calculate white balance adjustment parameters of each color channel value of the pixel in the captured image based on the first ratio between each color channel of the target pixel and a second ratio between each color channel value of the pixel; and perform white balance adjustment on each pixel in the captured image based on the white balance adjustment parameters of each color channel value of each pixel.
[0144] In one embodiment, the electronic device includes a spectrum acquisition device, and the acquisition module 1020 is further used to acquire a spectrum image of the ambient light in the shooting scene through the spectrum acquisition device.
[0145] In one embodiment, the spectral acquisition device includes a light inlet, a first focusing element, a slit, a collimating and dispersing element, a second focusing element and an image sensor which are arranged in sequence; the acquisition module 1020 is also used to focus the reflected light of the shooting scene entering through the light inlet to the position of the slit through the first focusing element; after the reflected light passes through the slit, the reflected light is collimated and dispersed by the collimating and dispersing element to generate a plurality of colored light rays; the plurality of colored light rays are focused to the image sensor by the second focusing element to form a spectral image of the ambient light corresponding to the slit; the spectral image of the ambient light corresponding to each slit is acquired by moving the slit, and the spectral image of the ambient light in the shooting scene is generated based on the spectral image of the ambient light corresponding to each slit.
[0146] In one embodiment, the spectrum collection device further includes a slide rail, the slit is disposed on the slide rail, and the slide rail is used to control the movement of the slit in a direction parallel to the light inlet.
[0147] In one embodiment, if the illumination intensity of the ambient light in the shooting scene is less than a preset illumination intensity threshold, the electronic device further includes a preset LED lamp, which is used to emit preset light having a spectral width greater than a preset spectral width threshold; the acquisition module 1020 is further used to emit preset light to the shooting scene through the preset LED lamp; receive the light reflected by the shooting scene through the spectral acquisition device, and generate a spectral image of the ambient light in the shooting scene based on the reflected light.
[0148] It should be understood that, although the various steps in the above-mentioned flow chart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the above-mentioned flow chart may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0149] The division of the various modules in the above white balance adjustment device is only for illustration. In other embodiments, the white balance adjustment device may be divided into different modules as needed to complete all or part of the functions of the above white balance adjustment device.
[0150] For the specific definition of the white balance adjustment device, please refer to the definition of the white balance adjustment method above, which will not be repeated here. Each module in the above white balance adjustment device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0151] Fig.12 Schematic diagram of the internal structure of an electronic device in an embodiment. The electronic device can be any terminal device such as a mobile phone, a tablet computer, a laptop computer, a desktop computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), a car computer, a wearable device, etc. The electronic device includes a processor and a memory connected via a system bus. Among them, the processor may include one or more processing units. The processor may be a CPU (Central Processing Unit) or a DSP (Digital Signal Processing), etc. The memory may include a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The computer program can be executed by the processor to implement a white balance adjustment method provided in each of the following embodiments. The internal memory provides a cache operating environment for the operating system computer program in the non-volatile storage medium.
[0152] The implementation of each module in the white balance adjustment device provided in the embodiment of the present application can be in the form of a computer program. The computer program can be run on an electronic device. The program module constituted by the computer program can be stored in the memory of the electronic device. When the computer program is executed by the processor, the steps of the method described in the embodiment of the present application are implemented.
[0153] The embodiment of the present application further provides a computer-readable storage medium, which includes one or more non-volatile computer-readable storage media containing computer-executable instructions, and when the computer-executable instructions are executed by one or more processors, the processors execute the steps of the white balance adjustment method.
[0154] The embodiment of the present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the white balance adjustment method.
[0155] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0156] Any reference to memory, storage, database or other medium used in this application may include non-volatile and / or volatile memory. Non-volatile memory may include ROM (Read-Only Memory), PROM (Programmable Read-only Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-only Memory) or flash memory. Volatile memory may include RAM (Random Access Memory), which is used as an external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as SRAM (Static Random Access Memory), DRAM (Dynamic Random Access Memory), SDRAM (Synchronous Dynamic Random Access Memory), Double Data Rate DDRSDRAM (Double Data Rate Synchronous Dynamic Random Access memory), ESDRAM (Enhanced Synchronous Dynamic Random Access memory), SLDRAM (Sync Link Dynamic Random Access Memory), RDRAM (Rambus Dynamic Random Access Memory), and DRDRAM (Direct Rambus Dynamic Random Access Memory).
[0157] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A white balance adjustment method, characterized in that: Applied to electronic equipment, the method comprises: Acquire a spectral image of ambient light in a shooting scene and a shot image of the shooting scene; Determining color information of the shooting scene according to the spectral image of the ambient light; White balance adjustment is performed on the captured image of the shooting scene according to the color information of the shooting scene.
2. The method according to claim 1, characterized in that: The determining the color information of the shooting scene according to the spectral image of the ambient light includes: Get the tristimulus values of the human eye; The color information of the shooting scene is determined according to the spectral image of the ambient light and the tristimulus values of the human eye.
3. The method according to claim 1 or 2, characterized in that: The step of performing white balance adjustment on the captured image of the captured scene according to the color information of the captured scene comprises: Calculating a first ratio between color channel values of each pixel in the shooting scene according to the color information of the shooting scene; White balance adjustment is performed on the captured image according to a first ratio between the color channel values of the pixel points.
4. The method according to claim 3, characterized in that The white balance adjustment of the captured image according to the first ratio between the color channel values of the pixel points includes: For each pixel in the captured image, determining a first ratio between each color channel of a target pixel matching the pixel position from color information of the captured scene; Calculating a white balance adjustment parameter of each color channel value of the pixel point in the captured image according to a first ratio between each color channel of the target pixel point and a second ratio between each color channel value of the pixel point; White balance adjustment is performed on each of the pixels in the captured image according to the white balance adjustment parameters of each color channel value of each of the pixels.
5. The method according to claim 1 or 2, characterized in that: The electronic device includes a spectrum acquisition device, and the step of acquiring a spectrum image of ambient light in a shooting scene includes: The spectrum acquisition device is used to acquire a spectrum image of the ambient light in the shooting scene.
6. The method according to claim 5, characterized in that The spectrum acquisition device comprises a light inlet, a first focusing element, a slit, a collimating and dispersing element, a second focusing element and an image sensor which are arranged in sequence; the spectrum image of the ambient light in the shooting scene is obtained by the spectrum acquisition device, comprising: Focusing the reflected light of the shooting scene entering through the light inlet to the position of the slit by the first focusing element; After the reflected light passes through the slit, the reflected light is collimated and dispersed by the collimating and dispersing element to generate a plurality of colored lights; focusing the plurality of colored light rays onto the image sensor through the second focusing element to form a spectral image of the ambient light corresponding to the slit; The spectral images of the ambient light corresponding to each of the slits are acquired by moving the slits, and the spectral images of the ambient light in the shooting scene are generated based on the spectral images of the ambient light corresponding to each of the slits.
7. The method according to claim 6, characterized in that The spectrum collection device further comprises a slide rail, the slit is arranged on the slide rail, and the slide rail is used to control the slit to move in a direction parallel to the light inlet.
8. The method according to claim 5, characterized in that If the illumination intensity of the ambient light in the shooting scene is less than a preset illumination intensity threshold, the electronic device further includes a preset LED lamp, which is used to emit preset light with a spectrum width greater than a preset spectrum width threshold; the spectral image of the ambient light in the shooting scene is obtained by the spectrum acquisition device, including: emitting the preset light to the shooting scene by means of the preset LED light; The spectrum acquisition device receives the light reflected by the preset light through the shooting scene, and generates a spectrum image of the ambient light in the shooting scene based on the reflected light.
9. A white balance adjustment device, characterized in that: Applied to electronic equipment, the device comprises: An acquisition module, used to acquire a spectral image of ambient light in a shooting scene and a shot image of the shooting scene; A color information determination module, used to determine the color information of the shooting scene according to the spectral image of the ambient light; The white balance adjustment module is used to perform white balance adjustment on the captured image of the captured scene according to the color information of the captured scene.
10. An electronic device, characterized in that: The electronic device comprises a spectrum acquisition device and a camera module, and the spectrum acquisition device is communicatively connected with the camera module; The spectrum acquisition device is used to obtain a spectrum image of the ambient light in the shooting scene, and send the spectrum image of the ambient light to the camera module; The camera module is used to receive the spectral image of the ambient light and obtain the captured image of the captured scene; determine the color information of the captured scene according to the spectral image of the ambient light; and perform white balance adjustment on the captured image of the captured scene according to the color information of the captured scene.
11. The electronic device according to claim 10, characterized in that: The electronic device comprises a preset LED lamp, wherein the preset LED lamp is used to emit preset light having a spectrum width greater than a preset spectrum width threshold; The spectrum acquisition device is further used to receive the light reflected by the preset light through the shooting scene, and generate a spectrum image of the ambient light in the shooting scene based on the reflected light.
12. An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the computer program is executed by the processor, the processor is caused to perform the steps of the white balance adjustment method according to any one of claims 1 to 8.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the white balance adjustment method according to any one of claims 1 to 8 are implemented.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the white balance adjustment method according to any one of claims 1 to 8 are implemented.
Citation Information
Cited By
Snapshot method, snapshot device, glasses and computer equipment
CN120751247A
Image color calibration method and device, electronic equipment and storage medium
CN121505053A
