Image processing method, device, storage medium and terminal
By combining environmental information and image information to determine the image scene, obtain color gamut offset information and adjust the coordinates of image pixel points, calculate the white balance gain, which solves the problem of insufficient accuracy of image white balance adjustment in the prior art, and achieves the following High accuracy.
Patent Information
- Application Number
- CN202210052035.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-17
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2042-01-17
AI Technical Summary
The prior art lacks accuracy when performing image white balance adjustment, especially when dealing with large-area solid colors or obfuscated color scenes.
By combining the environment information of the current environment and the image information of the target image collected by the camera, the image scene corresponding to the target image is determined, the color gamut offset information of the image scene is obtained, and the coordinates of the pixel points in the preset color gamut are adjusted based on this, and the calculation is performed. Adjust the whitening balance gain.
The accuracy of image white balance adjustment is improved, ensuring the accuracy of image scene recognition, and thus calculating a more accurate white balance gain.
Smart Images

Figure CN114339094B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image processing method, device, storage medium and terminal. Background Art
[0002] White balance (Auto White Balance, AWB for short) means making the image captured by the sensor close to the real picture seen by the human eye at different color temperatures. In other words, AWB can make the images of white objects taken at different color temperatures also appear white. In daily use, the camera of a mobile phone can be set to automatic white balance, which can meet the user's shooting needs in most cases. Using automatic white balance technology, the camera can automatically estimate the ambient color light and remove the influence of the light source on the image sensor, so that the camera can have the same color constancy as the human visual system. Summary of the invention
[0003] The embodiments of the present application provide an image processing method, device, computer storage medium and terminal, which can improve the accuracy of white balance adjustment of images. The technical solution is as follows:
[0004] In a first aspect, an embodiment of the present application provides an image processing method, the method comprising:
[0005] Determine at least one image scene corresponding to the target image based on environmental information of the current environment and image information of the target image captured by the camera under the current environment;
[0006] Acquire color gamut offset information corresponding to the image scene, and adjust the coordinates of the pixel points in the target image in the preset color gamut based on the color gamut offset information to obtain the target coordinates of the pixel points in the target image in the preset color gamut;
[0007] A white balance gain corresponding to the target image is obtained based on target coordinates of pixels in the target image in a preset color gamut, and white balance adjustment is performed on the target image based on the white balance gain.
[0008] In a second aspect, an embodiment of the present application provides an image processing device, the device comprising:
[0009] A scene determination module, configured to determine at least one image scene corresponding to the target image based on environmental information of the current environment and image information of the target image captured by the camera under the current environment;
[0010] A coordinate calculation module, used to obtain color gamut offset information corresponding to the image scene, and adjust the coordinates of the pixel points in the target image in the preset color gamut based on the color gamut offset information to obtain the target coordinates of the pixel points in the target image in the preset color gamut;
[0011] The gain calculation module is used to obtain the white balance gain corresponding to the target image based on the target coordinates of the pixel points in the target image in a preset color domain, and to perform white balance adjustment on the target image based on the white balance gain.
[0012] In a third aspect, an embodiment of the present application provides a computer storage medium, wherein the computer storage medium has a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the above-mentioned method steps.
[0013] In a fourth aspect, an embodiment of the present application provides a terminal, which may include: a memory and a processor; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the memory and executing the above-mentioned method steps.
[0014] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:
[0015] When the scheme of the embodiment of the present application is executed, based on the environmental information of the current environment and the image information of the target image captured by the camera under the current environment, at least one image scene corresponding to the target image is determined, the color gamut offset information corresponding to the image scene is obtained, and the coordinates of the pixel points in the target image in the preset color gamut are adjusted based on the color gamut offset information to obtain the target coordinates of the pixel points in the target image in the preset color gamut, the white balance gain corresponding to the target image is obtained based on the target coordinates of the pixel points in the target image in the preset color gamut, and the white balance adjustment of the target image is performed based on the white balance gain. The present application determines the image scene corresponding to the target image through the environmental information and the image information of the target image, which can ensure the accuracy of image scene recognition, and then, according to the predefined offset information, the coordinates of the pixel points corresponding to the determined image scene in the preset color gamut are offset, and further, the white balance gain of the target image can be calculated. Therefore, the white balance gain calculated by the above method is more accurate, which can improve the accuracy of white balance adjustment of the image. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the embodiments of the present invention 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 invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0017] Figure 1 It is a flowchart of an image processing method provided in an embodiment of the present application;
[0018] Figure 2 is a coordinate diagram of a preset color gamut provided in an embodiment of the present application;
[0019] Figure 3 It is a flowchart of an image processing method provided in an embodiment of the present application;
[0020] Figure 4 is a schematic diagram of a coordinate area provided in an embodiment of the present application;
[0021] Figure 5 is a schematic diagram of a target image provided in an embodiment of the present application;
[0022] Figure 6 It is a flowchart of a method for calculating mean coordinates provided in an embodiment of the present application;
[0023] Figure 7 is a structural schematic diagram of an image processing device provided in an embodiment of the present application;
[0024] Figure 8 It is a structural diagram of a terminal provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] In order to make the purpose, features, and advantages of the embodiments of the present application more obvious and understandable, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only 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 those skilled in the art without creative work are within the scope of protection of this application.
[0026] In the description of the present application, it should be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In the description of the present application, it should be noted that, unless otherwise clearly specified and limited, "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood in specific circumstances. In addition, in the description of the present application, unless otherwise specified, "multiple" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B, which can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are an "or" relationship.
[0027] In the related art, in the white balance solution, most solutions calculate the white balance gain or adjust the white balance gain based on image data, light source classification, color temperature value collected by color temperature sensor and other data. The white balance results obtained by these solutions are not accurate enough, especially when dealing with large areas of pure color scenes or mixed color scenes, the white balance results obtained are even more inaccurate.
[0028] The present application is described in detail below with reference to specific embodiments.
[0029] In the following method embodiments, for the sake of convenience, only the execution subject of each step is introduced and described as the terminal.
[0030] See also Figure 1 , is a flow chart of an image processing method provided in an embodiment of the present application. Figure 1 As shown, the method of the embodiment of the present application may include the following steps:
[0031] S101 , determining at least one image scene corresponding to a target image based on environmental information of a current environment and image information of a target image captured by a camera under the current environment.
[0032] It can be understood that environmental information can include two types of environmental information. One type of environmental information can be light source information, which can include natural light sources and artificial light sources. Natural light sources mainly refer to visible light that exists in nature, such as sunlight, fire, lightning flashes, etc. Artificial light sources mainly refer to light generated by artificially designed and manufactured instruments and equipment, such as light of various colors emitted by fluorescent lamps of various colors. The other type of environmental information can be spatial information, which mainly refers to indoor or outdoor.
[0033] The image information may be color information. The color information refers to the colors contained in the target image. The target image may contain only one color or may contain multiple colors.
[0034] The image scene can be obtained by combining the environment information and the image information. A target image has only one unique environment information, and a target image may have one or more image information.
[0035] According to some embodiments, when determining the environmental information of the environment, and the image information of the target image collected under the current environment, the environmental information and the image information can be combined to obtain an image scene or multiple image scenes corresponding to the target image. When the image information in a target image is one, that is, the target image contains only one color, an image scene corresponding to the target image can be obtained from the color and the environmental information. When the image information in a target image is multiple, that is, the target image contains multiple colors, each color can be combined with the environmental information to obtain an image scene. For example, the environmental information of the current environment is: outdoor, sunlight, under this environmental information, the image information of the target image is: green, blue, then the target image corresponds to two image scenes, one image scene can be: outdoor, sun, green, and the other image scene can be: outdoor, sunlight, blue.
[0036] Optionally, the image scene can also be obtained by the detection results of the environmental information, image information, and artificial intelligence (AI) algorithm. The detection results of the AI algorithm can be a description of an object with color information, such as the results of the AI algorithm are blue sky, green plants, white walls, gray desktops, etc. The color information in the target image can be determined by the image information, and the color information can usually be determined by the RGB value of the pixel point. Common objects can be determined based on the color information. The colors of common objects are basically fixed. On the basis of the environmental information and image information, plus the detection results of the AI algorithm, a more accurate image scene can be obtained. For example, when the environmental information is outdoor and sunlight, and the image information is blue, the common objects corresponding to blue are sky, sea water, etc. At this time, the result of the AI algorithm detection is the sky, then the image scene in the target image can be determined to be outdoor, sunlight, and blue sky. Therefore, the image scene of the target image is determined by the environmental information, image information, and the detection results of the AI algorithm, which can improve the accuracy of image scene recognition.
[0037] S102, obtaining color gamut offset information corresponding to the image scene, and adjusting the coordinates of the pixel points in the target image in the preset color gamut based on the color gamut offset information to obtain the target coordinates of the pixel points in the target image in the preset color gamut.
[0038] It can be understood that the preset color gamut refers to a coordinate space formed by r / g as the X axis and b / g as the Y axis. r represents the value of R in the RGB color mode, g represents the value of G in the RGB color mode, and b represents the value of B in the RGB color mode.
[0039] The color gamut offset information refers to coordinate offset information in a preset color gamut.
[0040] In some embodiments, a correspondence table between image scenes and color gamut offset information can be predefined. After the image scene corresponding to the target image is determined, the color gamut offset information corresponding to the image scene can be found from the correspondence table. Furthermore, the image information of the known target image is equal to the RGB values of all pixels in the known target image. Then, the coordinates of each pixel in the preset color gamut can be calculated based on the RGB values. Since the image scene of the target image is known, the pixel corresponding to the image scene and the coordinates of the pixel in the preset color gamut can be determined. Furthermore, the coordinate offset information of all pixels in the target image in the preset color gamut can be determined, and the coordinates of each pixel can be adjusted according to the coordinate offset information corresponding to each pixel, so as to obtain the target coordinates of all pixels in the target image. For example, see Figure 2The coordinate diagram of the preset color gamut is shown. In the preset color gamut, if the initial coordinates of a pixel point in the target image are (0.65, 0.1), that is, the coordinates before the offset marked in the figure, the offset information corresponding to the pixel point is: the horizontal coordinate decreases by 0.05 and the vertical coordinate increases by 0.1, then the target coordinates of the pixel point can be obtained as (0.6, 0.2), that is, the coordinates after the offset marked in the figure.
[0041] S103, obtaining a white balance gain corresponding to the target image based on target coordinates of pixels in the target image in a preset color gamut, and performing white balance adjustment on the target image based on the white balance gain.
[0042] It can be understood that the white balance gain may be the gain of three channels of RGB, ie, red gain, green gain and blue gain.
[0043] In some embodiments, after determining the target coordinates of all pixels in the target image in a preset color gamut, the mean coordinates of all coordinates in the target coordinates can be calculated, the horizontal coordinate in the mean coordinates is (mean of r) / (mean of g), the vertical coordinate in the mean coordinates is (mean of b) / (mean of g), the reciprocal of the horizontal coordinate can be used as the red gain, that is, the red gain is (mean of g) / (mean of r), the reciprocal of the vertical coordinate can be used as the blue gain, that is, the blue gain is (mean of g) / (mean of b), and the green gain can be set to 1. Further, after calculating the red gain, green gain, and blue gain corresponding to the target image, the original R value of the red channel in the target image can be multiplied by the red gain, the original G value of the green channel can be multiplied by the green gain, and the original B value of the blue channel can be multiplied by the blue gain, so as to achieve white balance adjustment of the target image.
[0044] It should be noted that the mean coordinates can be arithmetic mean coordinates or weighted mean coordinates. Considering the simplification of the calculation amount, the arithmetic mean coordinates can be calculated as the mean coordinates. Considering the improvement of the accuracy of the gain calculation, different preset weights can be set for different image scenes, and each image scene corresponds to a part of the pixel points. In this way, the preset weights corresponding to all the coordinates in the target coordinates can be determined, and the weighted mean coordinates of all the coordinates in the target coordinates can be calculated according to the preset weights, and the weighted mean coordinates are used as the mean coordinates.
[0045] When the scheme of the embodiment of the present application is executed, based on the environmental information of the current environment and the image information of the target image captured by the camera under the current environment, at least one image scene corresponding to the target image is determined, the color gamut offset information corresponding to the image scene is obtained, and the coordinates of the pixel points in the target image in the preset color gamut are adjusted based on the color gamut offset information to obtain the target coordinates of the pixel points in the target image in the preset color gamut, the white balance gain corresponding to the target image is obtained based on the target coordinates of the pixel points in the target image in the preset color gamut, and the white balance adjustment of the target image is performed based on the white balance gain. The present application determines the image scene corresponding to the target image through the environmental information and the image information of the target image, which can ensure the accuracy of image scene recognition, and then, according to the predefined offset information, the coordinates of the pixel points corresponding to the determined image scene in the preset color gamut are offset, and further, the white balance gain of the target image can be calculated. Therefore, the white balance gain calculated by the above method is more accurate, which can improve the accuracy of white balance adjustment of the image.
[0046] See also Figure 3 , is a flow chart of an image processing method provided in an embodiment of the present application. Figure 3 As shown, the method of the embodiment of the present application may include the following steps:
[0047] S301, obtaining ambient brightness information of the current environment.
[0048] It can be understood that the ambient brightness information refers to the value of the ambient brightness.
[0049] In some embodiments, the value of the ambient brightness can be obtained by automatic exposure technology. Under different light sources, the value of the ambient brightness is different.
[0050] S302: Acquire spectrum information, current information, and color temperature information collected by the multi-spectral sensor in the current environment.
[0051] It is understandable that the multi-spectral sensor can be a spectral sensor with multiple spectral channels, and the spectral range covered by the multi-spectral sensor can include visible light spectrum and infrared spectrum. The visible light spectrum refers to the optical spectrum information composed of various colors of red light, orange light, yellow light, green light, cyan light, blue light or purple light, and the infrared spectrum refers to the optical spectrum information of the infrared band. The multi-spectral sensor can output data of more than a dozen or even dozens of spectral channels, and each spectral channel corresponds to a wavelength range (band).
[0052] Spectral information refers to data of several spectral channels output by a multispectral sensor.
[0053] The current information refers to the strength of the AC frequency and the strength of the DC frequency.
[0054] Color temperature information refers to the correlated color temperature (CCT).
[0055] In some embodiments, data of multiple spectral channels collected by the multi-spectral sensor in the current environment, the intensity of the AC frequency, the intensity of the DC frequency, and the correlated color temperature may be directly acquired.
[0056] S303, calculating a first ratio between the channel value of the infrared band and the sum of the channel values of the entire band based on the spectral information, and calculating a second ratio between the AC frequency intensity and the DC frequency intensity based on the current information.
[0057] It is understandable that the channel value of the infrared band refers to the value of the spectral channel of the infrared band. The sum of the channel values of the entire band refers to the sum of the values of the spectral channels of all bands in the spectral channel data output by the multi-spectral sensor.
[0058] In some embodiments, the ratio between the channel value of the infrared band and the sum of the channel values of the full band can be calculated, and for the convenience of description, this ratio can be called the first ratio. The ratio between the AC frequency intensity and the DC frequency intensity in the current information can also be calculated, and for the convenience of description, this ratio can be called the second ratio.
[0059] S304: Determine environmental information of the current environment based on the environmental brightness information, the first ratio, the second ratio, and the color temperature information.
[0060] It can be understood that the environmental information may include two kinds of environmental information. One kind of environmental information may be light source information. The light source information may include natural light sources and artificial light sources. Natural light sources may be sunlight, lightning, etc., and artificial light sources may include red light, blue light, white light, etc.; the other kind of environmental information may be space information. Space information mainly refers to indoor or outdoor. Then the environmental information may be natural light source + indoor, natural light source + outdoor, artificial light source + indoor, and artificial light source + outdoor. The environmental information in the real scene may be obtained by combining the above two kinds of information. One piece of environmental information may correspond to a brightness range (brightness refers to the environmental brightness information), an infrared intensity range (infrared intensity refers to the first ratio), an AC intensity range (AC intensity refers to the second ratio), and a color temperature range (color temperature refers to CCT). For example, see the brightness range, infrared intensity range, AC intensity range, and color temperature range corresponding to a certain environmental information shown in Table 1.
[0061] Table 1
[0062]
[0063] In some implementations, the terminal may store a plurality of tables as shown in Table 1, each table corresponding to one piece of environmental information, and when four attributes correspond to one table at the same time, the environmental information corresponding to the table may be used as the environmental information of the current environment. When the four attributes correspond to at least two tables, the environmental information corresponding to the table with the most hit values may be used as the environmental information of the current environment, or the values of the four attributes may be re-acquired and then the environmental information may be re-determined.
[0064] S305 , obtaining coordinates of pixel points of a target image captured by the camera in the current environment in a preset color gamut, and determining a coordinate area of the target image in the preset color gamut based on the coordinates.
[0065] It can be understood that the preset color gamut refers to a coordinate space formed by r / g as the X axis and b / g as the Y axis. r represents the value of R in the RGB color mode, g represents the value of G in the RGB color mode, and b represents the value of B in the RGB color mode.
[0066] The coordinate area may include the coordinates of one pixel or multiple pixels.
[0067] In some embodiments, for the target image captured by the camera in the current environment, it is easy to obtain the RGB values of the pixels in the target image. For each pixel, r / g and b / g can be calculated from its corresponding RGB value. Further, the coordinates of the pixel in the preset color gamut can be determined as (r / g, b / g). Further, the coordinate area of the distribution of all pixels in the preset color gamut can be determined. For example, see Figure 4 A schematic diagram of the coordinate area shown, Figure 4 The coordinate system may include region 1, region 2 and region 3, where region 1, region 2 and region 3 are all called coordinate regions. Some pixels may be concentrated in region 1, some pixels may be concentrated in region 2, and some pixels may be concentrated in region 3.
[0068] S306: Determine image information of the target image based on the color of the coordinate area.
[0069] It can be understood that the image information refers to color information, and the image information may include monochrome information and mixed color information. The monochrome information indicates that there is only one color in the target image, and the mixed color information indicates that the target image has multiple colors.
[0070] In some embodiments, a coordinate area represents a color. When the pixel points in the target image are concentrated in a coordinate area in a preset color gamut, the color of the coordinate area can be used as the image information of the target image; when the pixel points in the target image are concentrated in multiple coordinate areas in the preset color gamut, the colors of these coordinates can all be used as the image information of the target image.
[0071] S307: When the image information is monochrome information, determine the image scene corresponding to the target image based on the environmental information of the current environment and the color corresponding to the monochrome information.
[0072] It can be understood that, based on the aforementioned environmental information of the current environment and the image information of the target image collected under the current environment, the image scene corresponding to the target image can be obtained by combining the environmental information and the image information. When the image information is monochrome information, the image scene of the target image can be obtained by combining the environmental information and the color corresponding to the monochrome information. For example, if the environmental information is: sunlight + indoors, and the color corresponding to the monochrome information is: yellow, the image scene corresponding to the target image obtained by combining the two is: sunlight + indoors + yellow.
[0073] S308, obtaining color gamut offset information corresponding to the image scene, and offsetting the coordinates of the pixel points in the target image in the preset color gamut based on the color gamut offset information to obtain the target coordinates of the pixel points in the target image in the preset color gamut.
[0074] It can be understood that the color gamut offset information refers to coordinate offset information in a preset color gamut.
[0075] In some embodiments, a correspondence table between different image scenes and different color gamut offset information can be predefined. When an image scene corresponding to the target image is determined, the color gamut offset information corresponding to the image scene can be obtained from the correspondence table. Furthermore, the coordinates of the pixel points in the target image in the preset color gamut can be offset according to the color gamut offset information, and then the target coordinates of the pixel points in the target image in the preset color gamut can be obtained. For example, using the example in S307, the image scene corresponding to the target image is: sunlight + indoor + yellow, and the color gamut offset information corresponding to the image scene is: the horizontal coordinate is offset to the right by 0.1 and the vertical coordinate is offset upward by 0.15, then the coordinates of the pixel points in the target image in the preset color gamut can be offset according to the color gamut offset information, and the target coordinates of the pixel points in the target image in the preset color gamut can be obtained after each coordinate is offset.
[0076] S309: When the image information is mixed color information, each color in the mixed color information is combined with the environmental information of the current environment to obtain multiple image scenes.
[0077] It can be understood that, based on the aforementioned environmental information of the current environment and the image information of the target image collected under the current environment, the image scene corresponding to the target image can be obtained by combining the environmental information and the image information. When the image information is mixed color information, the environmental information and each color in the mixed color information can be combined to obtain the image scene of the target image. For example, the environmental information is: sunlight + outdoor, and each color in the mixed color information is: red, green, blue, and purple. The two are combined to obtain multiple image scenes corresponding to the target image, which are: sunlight + outdoor + red; sunlight + outdoor + green; sunlight + outdoor + blue; sunlight + outdoor + purple.
[0078] S310, obtaining color gamut shift information corresponding to each of the image scenes, and obtaining a block image corresponding to each of the image scenes in the target image.
[0079] It can be understood that the color gamut offset information refers to the coordinate offset information in a preset color gamut.
[0080] In some embodiments, a correspondence table between different image scenes and different color gamut offset information can be predefined. When the image scene is determined, the color gamut offset information corresponding to the image scene can be obtained from the correspondence table. If the coordinates of the image scene in the preset color gamut are known, it is easy to determine the pixel points corresponding to the image scene. Then, the target image can be divided into different block images according to the image scene, and each block image corresponds to an image scene. For example, see Figure 5 The schematic diagram of the target image shown is an image collected outdoors under sunlight. There are objects 1, 2 and 3 in the target image. Object 1 is a green object, object 2 is a red object and object 3 is a purple object. The image scene corresponding to object 1 is sunlight + outdoor + green, the image scene corresponding to object 2 is sunlight + outdoor + red, and the image scene corresponding to object 3 is sunlight + outdoor + purple. Then, the target can be divided into multiple block images according to the three image scenes. The target image can be divided into block image 1, block image 2 and block image 3 according to the solid lines shown in the figure. Block image 1 only includes object 1, block image 2 only includes object 2, and block image 3 only includes object 3.
[0081] S311, based on each of the color gamut offset information, offset the coordinates of the pixel points of each of the block images in the preset color gamut, to obtain the target coordinates of the pixel points in the target image in the preset color gamut.
[0082] In some embodiments, the color gamut offset information corresponding to the image scene is known, and the block image corresponding to the image scene is known. The coordinates of the pixel points in the block image in the preset color gamut can be offset according to the color gamut offset information corresponding to the block image, and then the target coordinates of all the pixel points in the target image in the preset color gamut can be obtained. For example, the original coordinates of a pixel point in the preset color gamut are (r / g, b / g), and the corresponding color gamut offset information is: the value of the reduced horizontal coordinate is x, and the value of the reduced vertical coordinate is y, and the target of the pixel point after the offset can be obtained as (r / gx, b / gy).
[0083] S312, calculating the arithmetic mean coordinates of the pixel points in the target image between the target coordinates in the preset color gamut.
[0084] In some embodiments, for the case where the target image corresponds to an image scene, that is, corresponding to the embodiments described in S307 and S308, the arithmetic mean coordinates between the target coordinates of all pixels in the target image can be calculated, that is, the arithmetic mean of the horizontal coordinates in the target coordinates of all pixels can be calculated, and the arithmetic mean of the vertical coordinates in the target coordinates of all pixels can be calculated, and then the arithmetic mean of the horizontal coordinates can be used as the horizontal coordinate in the arithmetic mean coordinates, and the arithmetic mean of the vertical coordinates can be used as the vertical coordinate in the arithmetic mean coordinates.
[0085] In some embodiments, for the case where the target image corresponds to multiple image scenes, that is, corresponding to the embodiments described in S310 and S311, it can be known from S311 that after the coordinates of the pixel points of each block image in the preset color gamut are offset, the target coordinates of the pixel points in each block image in the preset color gamut can be obtained, and because the block images constitute the target image, the target coordinates of the pixel points in the target image in the preset color gamut can be obtained, and then the arithmetic mean coordinates between the target coordinates of all the pixel points contained in all the block images can be calculated. Specifically, the arithmetic mean of the horizontal coordinates in the target coordinates of all the pixel points contained in all the block images can be calculated, and the arithmetic mean of the horizontal coordinates can be used as the horizontal coordinate in the arithmetic mean coordinates, and the arithmetic mean of the vertical coordinates in the target coordinates of all the pixel points contained in all the block images can be calculated, and the arithmetic mean of the vertical coordinates can be used as the vertical coordinate in the arithmetic mean coordinates.
[0086] S313, using the reciprocal of the horizontal coordinate in the arithmetic mean coordinate as the red gain in the white balance gain corresponding to the target image, using the reciprocal of the vertical coordinate in the arithmetic mean coordinate as the blue gain in the white balance gain corresponding to the target image, and using a preset value as the green gain in the white balance gain corresponding to the target image.
[0087] In some embodiments, after the arithmetic mean coordinates are determined, the reciprocal of the abscissa in the arithmetic mean coordinates can be used as the red gain in the white balance gain, and the reciprocal of the ordinate in the arithmetic mean coordinates can be used as the blue gain in the white balance gain. The green gain can also be set to 1. For example, if the arithmetic mean coordinates are (r0 / g0, b0 / g0), the red gain can be g0 / r0, and the blue gain can be g0 / b0.
[0088] S314: Perform white balance adjustment on the target image based on the white balance gain.
[0089] In some embodiments, after determining the red gain, green gain and blue gain corresponding to the target image, the R value of the original red channel in the target image can be multiplied by the red gain, the G value of the original green channel can be multiplied by the green gain, and the B value of the original blue channel can be multiplied by the blue gain to achieve white balance adjustment of the target image.
[0090] When the scheme of the embodiment of the present application is executed, first, the ambient brightness information of the current environment is obtained, as well as the spectrum information, current information and color temperature information collected by the multi-spectral sensor in the current environment, and the brightness range of the ambient brightness information, the value range of the infrared intensity obtained from the spectrum information, the value range of the AC intensity obtained from the current information and the color temperature range of the color temperature information are determined. Then, the ambient information of the current environment is jointly determined according to the above value ranges, which can ensure accurate recognition of the ambient information; then, based on the coordinates of the pixel points of the target image collected by the camera in the current environment in the preset color gamut, the image information corresponding to the target image is determined according to the distribution of the coordinates in the preset color gamut; then, at least one image scene corresponding to the target image is jointly determined by the ambient information and the image information, which can ensure accurate recognition of the image scene; then, according to the offset information corresponding to the image scene, the coordinates of the pixel points are adjusted in the preset color gamut to obtain the target coordinates; finally, the arithmetic mean coordinates between the target coordinates can be directly calculated, and then the white balance gain can be obtained from the arithmetic mean coordinates to complete the white balance adjustment of the target image, which can simplify the calculation amount on the basis of improving the accuracy of the white balance adjustment of the image.
[0091] Optionally, when the target image corresponds to multiple image scenes, Figure 3 Replace S312-S313 in Figure 6 S611-S613 in the equation, we get Figure 6 A flow chart of a method for calculating mean coordinates is shown in FIG. Figure 6 As shown, calculating the mean coordinates may include the following steps:
[0092] S611, obtaining a preset weight corresponding to each of the image scenes, and determining the scene coordinates of the pixel points of each of the block images in the target coordinates.
[0093] S612: Calculate weighted mean coordinates of each of the scene coordinates based on each of the preset weights.
[0094] S613, using the reciprocal of the horizontal coordinate in the weighted mean coordinate as the red gain in the white balance gain corresponding to the target image, using the reciprocal of the vertical coordinate in the weighted mean coordinate as the blue gain in the white balance gain corresponding to the target image, and using a preset value as the green gain in the white balance gain corresponding to the target image.
[0095] S611-S613 are explained below.
[0096] In some embodiments, preset weights corresponding to different image scenes can be pre-set. After the scene coordinates of the pixel points of each block image are determined in the target coordinates, the weighted mean calculation can be performed on each scene coordinate according to the preset weights, that is, the weighted mean calculation can be performed on the horizontal coordinates in each scene coordinate according to the preset weights, and then the horizontal coordinate in the weighted mean coordinate can be obtained. The weighted mean calculation can be performed on the vertical coordinates in each scene coordinate according to the preset weights, and then the vertical coordinate in the weighted mean coordinate can be obtained. Further, the inverse of the horizontal coordinate in the weighted mean coordinate can be used as the red gain, and the inverse of the vertical coordinate in the weighted mean coordinate can be used as the blue gain. The green gain can also be set to 1. For example, the weighted mean coordinates are (r1 / g1, b1 / g1), the red gain can be g1 / r1, and the blue gain can be g1 / b1.
[0097] Optionally, when the target image corresponds to an image scene, Figure 6 The method for calculating the mean coordinates shown, that is, after executing S307 and S308, the following operations may also be performed: obtaining the preset weight corresponding to the image scene; calculating the weighted mean coordinates of the pixel points in the target image between the target coordinates in the preset color range according to the preset weight; using the reciprocal of the horizontal coordinate in the weighted mean coordinate as the red gain in the white balance gain corresponding to the target image, using the reciprocal of the vertical coordinate in the weighted mean coordinate as the blue gain in the white balance gain corresponding to the target image, and using the preset value as the green gain in the white balance gain corresponding to the target image.
[0098] The above operation is explained below: Specifically, since the target image corresponds to only one image scene, the preset weight corresponding to the image scene can be obtained, and the preset weight can be: 1 / total number of pixels, wherein the total number of pixels can be the total number of all pixels in the target image, and then the preset weights of all pixels in the target image are equal. Further, the horizontal coordinates of all pixels in the target image can be weighted averaged according to the preset weights to obtain the horizontal coordinates in the weighted mean coordinates, and the vertical coordinates of all pixels in the target image can be weighted averaged according to the preset weights to obtain the vertical coordinates in the weighted mean coordinates. Further, the inverse of the horizontal coordinate in the weighted mean coordinates can be used as the red gain, the inverse of the vertical coordinate in the weighted mean coordinates can be used as the blue gain, and the green gain can be set to 1. For example, the weighted mean coordinates are (r2 / g2, b2 / g2), the red gain can be g2 / r2, the blue gain can be g2 / b2, and the green gain is 1.
[0099] In an embodiment of the present application, based on the above scheme, the weighted mean coordinates between the target coordinates can be calculated, and then the white balance gain can be obtained from the weighted mean coordinates to complete the white balance adjustment of the target image. The accuracy of the white balance gain can be further guaranteed on the basis of improving the accuracy of the white balance adjustment of the image.
[0100] See also Figure 7 , is a schematic diagram of the structure of an image processing device provided in an embodiment of the present application. The image processing device 700 can be implemented as all or part of the terminal through software, hardware, or a combination of both. The device 700 includes:
[0101] A scene determination module 710, configured to determine at least one image scene corresponding to a target image based on environmental information of a current environment and image information of a target image captured by a camera under the current environment;
[0102] A coordinate calculation module 720 is used to obtain color gamut offset information corresponding to the image scene, and adjust the coordinates of the pixel points in the target image in the preset color gamut based on the color gamut offset information to obtain the target coordinates of the pixel points in the target image in the preset color gamut;
[0103] The gain calculation module 730 is used to obtain a white balance gain corresponding to the target image based on target coordinates of pixels in the target image in a preset color gamut, and to perform white balance adjustment on the target image based on the white balance gain.
[0104] Optionally, the device 700 further includes:
[0105] An environmental information determination module is used to obtain environmental brightness information of a current environment and data collected by a multispectral sensor in the current environment, and determine environmental information of the current environment based on the environmental brightness information and the data;
[0106] The image information determination module is used to obtain the coordinates of the pixel points of the target image captured by the camera in the current environment in a preset color gamut, and determine the image information of the target image based on the coordinates.
[0107] Optionally, the environment information determination module includes:
[0108] A first environment determination unit, used to obtain ambient brightness information of the current environment;
[0109] A second environment determination unit, used to obtain spectrum information, current information and color temperature information collected by the multi-spectral sensor in the current environment;
[0110] A third environment determination unit, configured to calculate a first ratio between a channel value of an infrared band and a sum of channel values of a full band based on the spectral information;
[0111] a fourth environment determination unit, configured to calculate a second ratio between the AC frequency intensity and the DC frequency intensity based on the current information;
[0112] A fifth environment determination unit is used to determine the environment information of the current environment based on the environment brightness information, the first ratio, the second ratio and the color temperature information.
[0113] Optionally, the image information determination module includes:
[0114] A first information unit is used to obtain coordinates of pixel points of a target image captured by the camera in the current environment in a preset color gamut, and determine a coordinate area of the target image in the preset color gamut based on the coordinates;
[0115] The second information unit is used to determine the image information of the target image based on the color of the coordinate area.
[0116] Optionally, the scene determination module 710 includes:
[0117] A first scene determination unit, configured to determine, when the image information is monochrome information, an image scene corresponding to the target image based on environmental information of the current environment and a color corresponding to the monochrome information;
[0118] or,
[0119] The second scene determination unit is used to combine each color in the mixed color information with the environmental information of the current environment to obtain multiple image scenes when the image information is mixed color information.
[0120] Optionally, the coordinate calculation module 720 includes:
[0121] A first calculation unit is used to obtain color gamut offset information corresponding to an image scene when the target image corresponds to an image scene; offset the coordinates of the pixel points in the target image in a preset area based on the color gamut offset information to obtain the target coordinates of the pixel points in the target image in a preset color gamut;
[0122] or,
[0123] The second calculation unit is used to obtain color gamut offset information corresponding to each image scene when the target image corresponds to at least two image scenes, and to obtain block images corresponding to each image scene in the target image; based on each color gamut offset information, the coordinates of the pixel points of each block image in the preset color gamut are offset respectively to obtain the target coordinates of the pixel points in the target image in the preset color gamut.
[0124] Optionally, the gain calculation module 730 includes:
[0125] A first gain calculation unit, used to calculate the arithmetic mean coordinates of the pixel points in the target image between the target coordinates in the preset color domain;
[0126] The second gain calculation unit is used to use the reciprocal of the horizontal coordinate in the arithmetic mean coordinate as the red gain in the white balance gain corresponding to the target image, to use the reciprocal of the vertical coordinate in the arithmetic mean coordinate as the blue gain in the white balance gain corresponding to the target image, and to use a preset value as the green gain in the white balance gain corresponding to the target image.
[0127] Optionally, the gain calculation module 730 includes:
[0128] A third gain calculation unit, used to obtain a preset weight corresponding to each of the image scenes;
[0129] a fourth gain calculation unit, configured to determine in the target image the block images corresponding to the image scenes, and to determine in the target coordinates the scene coordinates of the pixel points of the block images;
[0130] A fifth gain calculation unit, configured to calculate a weighted mean coordinate of each of the scene coordinates based on each of the preset weights;
[0131] a sixth gain calculation unit, configured to use the inverse of the horizontal coordinate in the weighted mean coordinate as the red gain in the white balance gain corresponding to the target image, use the inverse of the vertical coordinate in the weighted mean coordinate as the blue gain in the white balance gain corresponding to the target image, and use a preset value as the green gain in the white balance gain corresponding to the target image.
[0132] Please refer to Figure 8 , Figure 8 A schematic diagram of the structure of a terminal provided in an embodiment of the present application. Figure 8 As shown, the terminal 1300 may include: at least one processor 1301 , at least one network interface 1304 , a user interface 1303 , a memory 1305 , a display screen component 1306 , and at least one communication bus 1302 .
[0133] The communication bus 1302 is used to realize the connection and communication between these components.
[0134] The user interface 1303 may include a display screen (Display) and a camera (Camera), and the optional user interface 1303 may also include a standard wired interface and a wireless interface.
[0135] The network interface 1304 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).
[0136] Among them, the processor 1301 may include one or more processing cores. The processor 1301 uses various interfaces and lines to connect various parts in the entire terminal 1300, and executes various functions and processes data of the terminal 1300 by running or executing instructions, programs, code sets or instruction sets stored in the memory 1305, and calling data stored in the memory 1305. Optionally, the processor 1301 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 1301 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 1301, and it can be implemented separately through a chip.
[0137] Among them, the memory 1305 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 1305 includes a non-transitory computer-readable storage medium. The memory 1305 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 1305 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 1305 may also be optionally at least one storage device located away from the aforementioned processor 1301. As Figure 8 As shown, the memory 1305 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a program of an image processing method.
[0138] exist Figure 8In the terminal 1300 shown, the user interface 1303 is mainly used to provide an input interface for the user and obtain the data input by the user; and the processor 1301 can be used to call the program of the image processing method stored in the memory 1305, and specifically perform the following operations:
[0139] Determine at least one image scene corresponding to the target image based on environmental information of the current environment and image information of the target image captured by the camera under the current environment;
[0140] Acquire color gamut offset information corresponding to the image scene, and adjust the coordinates of the pixel points in the target image in the preset color gamut based on the color gamut offset information to obtain the target coordinates of the pixel points in the target image in the preset color gamut;
[0141] A white balance gain corresponding to the target image is obtained based on target coordinates of pixels in the target image in a preset color gamut, and white balance adjustment is performed on the target image based on the white balance gain.
[0142] In one embodiment, before executing the step of determining at least one image scene corresponding to the target image based on the environmental information of the current environment and the image information of the target image captured by the camera under the current environment, the processor 1301 further performs the following operations:
[0143] Acquire ambient brightness information of a current environment and data collected by a multispectral sensor in the current environment, and determine ambient information of the current environment based on the ambient brightness information and the data;
[0144] The coordinates of the pixel points of the target image captured by the camera in the current environment in a preset color gamut are obtained, and the image information of the target image is determined based on the coordinates.
[0145] In one embodiment, when the processor 1301 executes the step of obtaining the ambient brightness information of the current environment and the data collected by the multispectral sensor in the current environment, and determining the ambient information of the current environment based on the ambient brightness information and the data, the processor 1301 specifically performs the following operations:
[0146] Get the ambient brightness information of the current environment;
[0147] Acquire spectrum information, current information and color temperature information collected by the multi-spectral sensor under the current environment;
[0148] Calculate a first ratio between the channel value of the infrared band and the sum of the channel values of the entire band based on the spectral information;
[0149] Calculating a second ratio between the AC frequency intensity and the DC frequency intensity based on the current information;
[0150] The environmental information of the current environment is determined based on the environmental brightness information, the first ratio, the second ratio, and the color temperature information.
[0151] In one embodiment, when the processor 1301 executes the step of acquiring the coordinates of the pixel points of the target image captured by the camera in the current environment in the preset color gamut and determining the image information of the target image based on the coordinates, the following operations are specifically performed:
[0152] Acquire coordinates of pixel points of a target image captured by a camera in the current environment in a preset color gamut, and determine a coordinate area of the target image in the preset color gamut based on the coordinates;
[0153] Image information of the target image is determined based on the color of the coordinate area.
[0154] In one embodiment, when the processor 1301 executes the step of determining at least one image scene corresponding to the target image based on the environmental information of the current environment and the image information of the target image captured by the camera under the current environment, the processor 1301 specifically performs the following operations:
[0155] When the image information is monochrome information, determining the image scene corresponding to the target image based on the environmental information of the current environment and the color corresponding to the monochrome information;
[0156] or,
[0157] When the image information is mixed color information, each color in the mixed color information is combined with the environmental information of the current environment to obtain multiple image scenes.
[0158] In one embodiment, when the processor 1301 executes the steps of obtaining the color gamut offset information corresponding to each of the image scenes, and adjusting the coordinates of the pixel points in the target image in the preset color gamut based on each of the color gamut offset information to obtain the target coordinates of the pixel points in the target image in the preset color gamut, the processor 1301 specifically performs the following operations:
[0159] When the target image corresponds to an image scene, obtaining color gamut offset information corresponding to the image scene;
[0160] Based on the color gamut offset information, the coordinates of the pixel points in the target image in the preset area are offset to obtain the target coordinates of the pixel points in the target image in the preset color gamut;
[0161] or,
[0162] When the target image corresponds to at least two image scenes, obtaining color gamut offset information corresponding to each of the image scenes, and obtaining a block image corresponding to each of the image scenes in the target image;
[0163] Based on each of the color gamut offset information, the coordinates of the pixel points of each of the block images in the preset color gamut are offset respectively to obtain the target coordinates of the pixel points in the target image in the preset color gamut.
[0164] In one embodiment, when the processor 1301 executes the step of obtaining the white balance gain corresponding to the target image based on the target coordinates of the pixel points in the target image in the preset color gamut, the following operations are specifically performed:
[0165] Calculating the arithmetic mean coordinates of the pixel points in the target image between the target coordinates in the preset color gamut;
[0166] The inverse of the abscissa in the arithmetic mean coordinate is used as the red gain in the white balance gain corresponding to the target image;
[0167] The reciprocal of the ordinate in the arithmetic mean coordinate is used as the blue gain in the white balance gain corresponding to the target image;
[0168] The preset value is used as the green gain in the white balance gain corresponding to the target image.
[0169] In one embodiment, when the processor 1301 executes the step of obtaining the white balance gain corresponding to the target image based on the target coordinates of the pixel points in the target image in the preset color gamut, the following operations are specifically performed:
[0170] Obtaining preset weights corresponding to each of the image scenes;
[0171] Determining the block images corresponding to the image scenes in the target image, and determining the scene coordinates of the pixel points of each block image in the target coordinates;
[0172] Calculate the weighted mean coordinates of each of the scene coordinates based on each of the preset weights;
[0173] The inverse of the abscissa in the weighted mean coordinate is used as the red gain in the white balance gain corresponding to the target image;
[0174] The inverse of the ordinate in the weighted mean coordinate is used as the blue gain in the white balance gain corresponding to the target image;
[0175] The preset value is used as the green gain in the white balance gain corresponding to the target image.
[0176] In addition, those skilled in the art will appreciate that the structure of the terminal 1300 shown in the above figures does not limit the terminal 1300, and the user terminal may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. For example, the terminal 1300 also includes components such as a radio frequency circuit, an audio circuit, a WiFi component, a power supply, and a Bluetooth component, which will not be described in detail here.
[0177] An embodiment of the present application further provides a computer-readable storage medium, which stores at least one instruction, and the at least one instruction is used to be executed by a processor to implement the image processing method described in the above embodiments.
[0178] An embodiment of the present application further provides a computer program product, which stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the image processing method described in the above embodiments.
[0179] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented with hardware, software, firmware or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein the communication media include any medium that is convenient for transmitting a computer program from one place to another. The storage medium can be any available medium that a general or special-purpose computer can access. The above is only an optional embodiment of the present application, and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. An image processing method, characterized in that: The method comprises: Acquire ambient brightness information of a current environment and data collected by a multispectral sensor in the current environment, and determine ambient information of the current environment based on the ambient brightness information and the data; Acquire coordinates of pixel points of a target image captured by a camera in the current environment in a preset color gamut, and determine image information of the target image based on the coordinates; The step of acquiring ambient brightness information of a current environment and data collected by a multispectral sensor in the current environment, and determining ambient information of the current environment based on the ambient brightness information and the data, includes: Get the ambient brightness information of the current environment; Acquire spectrum information, current information and color temperature information collected by the multi-spectral sensor under the current environment; Calculate a first ratio between the channel value of the infrared band and the sum of the channel values of the entire band based on the spectral information; Calculating a second ratio between the AC frequency intensity and the DC frequency intensity based on the current information; Determine the environmental information of the current environment based on the environmental brightness information, the first ratio, the second ratio, and the color temperature information; Determine at least one image scene corresponding to the target image based on environmental information of the current environment and image information of the target image captured by the camera under the current environment; Acquire color gamut offset information corresponding to the image scene, and adjust the coordinates of the pixel points in the target image in the preset color gamut based on the color gamut offset information to obtain the target coordinates of the pixel points in the target image in the preset color gamut, wherein the color gamut offset information is the coordinate offset information in the preset color gamut; A white balance gain corresponding to the target image is obtained based on target coordinates of pixels in the target image in a preset color gamut, and white balance adjustment is performed on the target image based on the white balance gain.
2. The method according to claim 1, characterized in that: The acquiring coordinates of pixel points of a target image captured by a camera in the current environment in a preset color gamut, and determining image information of the target image based on the coordinates, includes: Acquire coordinates of pixel points of a target image captured by a camera in the current environment in a preset color gamut, and determine a coordinate area of the target image in the preset color gamut based on the coordinates; Image information of the target image is determined based on the color of the coordinate area.
3. The method according to claim 1 or 2, characterized in that: The determining at least one image scene corresponding to the target image based on the environmental information of the current environment and the image information of the target image captured by the camera under the current environment includes: When the image information is monochrome information, determining the image scene corresponding to the target image based on the environmental information of the current environment and the color corresponding to the monochrome information; or, When the image information is mixed color information, each color in the mixed color information is combined with the environmental information of the current environment to obtain multiple image scenes.
4. The method according to claim 1 or 2, characterized in that: The acquiring the color gamut offset information corresponding to the image scene, and adjusting the coordinates of the pixel points in the target image in the preset color gamut based on the color gamut offset information to obtain the target coordinates of the pixel points in the target image in the preset color gamut, includes: When the target image corresponds to an image scene, obtaining color gamut offset information corresponding to the image scene; Based on the color gamut offset information, the coordinates of the pixel points in the target image in the preset area are offset to obtain the target coordinates of the pixel points in the target image in the preset color gamut; or, When the target image corresponds to at least two image scenes, obtaining color gamut offset information corresponding to each of the image scenes, and obtaining a block image corresponding to each of the image scenes in the target image; Based on each of the color gamut offset information, the coordinates of the pixel points of each of the block images in the preset color gamut are offset respectively to obtain the target coordinates of the pixel points in the target image in the preset color gamut.
5. The method according to claim 1 or 2, characterized in that: The obtaining the white balance gain corresponding to the target image based on the target coordinates of the pixel points in the target image in the preset color gamut includes: Calculating the arithmetic mean coordinates of the pixel points in the target image between the target coordinates in the preset color gamut; The inverse of the abscissa in the arithmetic mean coordinate is used as the red gain in the white balance gain corresponding to the target image; The reciprocal of the ordinate in the arithmetic mean coordinate is used as the blue gain in the white balance gain corresponding to the target image; The preset value is used as the green gain in the white balance gain corresponding to the target image.
6. The method according to claim 1 or 2, characterized in that: The obtaining the white balance gain corresponding to the target image based on the target coordinates of the pixel points in the target image in the preset color gamut includes: Obtaining preset weights corresponding to each of the image scenes; Determining the block images corresponding to the image scenes in the target image, and determining the scene coordinates of the pixel points of each block image in the target coordinates; Calculate the weighted mean coordinates of each of the scene coordinates based on each of the preset weights; The inverse of the abscissa in the weighted mean coordinate is used as the red gain in the white balance gain corresponding to the target image; The inverse of the ordinate in the weighted mean coordinate is used as the blue gain in the white balance gain corresponding to the target image; The preset value is used as the green gain in the white balance gain corresponding to the target image.
7. An image processing device, characterized in that: The device comprises: An environment determination module, used to obtain ambient brightness information of a current environment and data collected by a multispectral sensor in the current environment, and determine ambient information of the current environment based on the ambient brightness information and the data; An image determination module, used to obtain coordinates of pixel points of a target image captured by a camera under the current environment in a preset color gamut, and determine image information of the target image based on the coordinates; The environment determination module is further used to obtain the ambient brightness information of the current environment; obtain the spectrum information, current information and color temperature information collected by the multi-spectral sensor in the current environment; calculate the first ratio between the channel value of the infrared band and the sum of the channel values of the full band based on the spectrum information; calculate the second ratio between the AC frequency intensity and the DC frequency intensity based on the current information; determine the ambient information of the current environment based on the ambient brightness information, the first ratio, the second ratio and the color temperature information; A scene determination module, configured to determine at least one image scene corresponding to the target image based on environmental information of the current environment and image information of the target image captured by the camera under the current environment; A coordinate calculation module, used to obtain color gamut offset information corresponding to the image scene, and adjust the coordinates of the pixel points in the target image in the preset color gamut based on the color gamut offset information to obtain the target coordinates of the pixel points in the target image in the preset color gamut; The gain calculation module is used to obtain the white balance gain corresponding to the target image based on the target coordinates of the pixel points in the target image in a preset color domain, and to perform white balance adjustment on the target image based on the white balance gain.
8. A computer storage medium, characterized in that The computer storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the method steps according to any one of claims 1 to 6.
9. A terminal, characterized in that: include: A processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the method steps as claimed in any one of claims 1 to 6.
Citation Information
Patent Citations
White balance adjusting method, device, camera and medium
CN109151426A