A white balance control method and device, electronic equipment and storage medium
By acquiring the color values of objects in an image and determining the proportion of monochrome, the use of automatic white balance is suppressed, thus solving the problem of color abrupt changes caused by large areas of monochrome objects and improving the image display effect.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUNAN GOKE MICROELECTRONICS CO LTD
- Filing Date
- 2023-09-27
- Publication Date
- 2026-08-04
AI Technical Summary
When a person wearing a large amount of red or blue clothing enters the frame during filming, it causes a sudden change in color in the image, affecting the visual experience.
By obtaining the color value of the area where the object is located in the image, it is determined whether the preset monochrome ratio condition is met. If it is met, the automatic white balance mechanism is suppressed from using the color value of that area, thereby reducing the impact of large monochrome objects on the image white balance.
It effectively reduces the impact of large monochrome objects in the image on the automatic white balance mechanism, improves the color abruptness problem in the image, and enhances the display effect.
Smart Images

Figure CN117336618B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing, and in particular to a white balance control method, apparatus, electronic device, and storage medium. Background Technology
[0002] In filming scenarios, it's common to encounter situations where a person wearing large areas of red or blue clothing enters the frame, causing a sudden color shift in the entire image. This is especially true in high color temperature scenes where someone wearing a large area of red passes by, or in low color temperature scenes where someone wearing a large area of blue passes by. In these cases, the entire image will abruptly shift to a bluish or reddish tint. Such video effects typically severely impact visual perception, as the human eye can quickly detect the sudden color change, resulting in an unnatural appearance. Summary of the Invention
[0003] The purpose of this invention is to provide a white balance control method, device, electronic device, and storage medium that can reduce the influence of large-area monochrome objects in an image on adjusting the image white balance, thereby helping to reduce color abrupt changes in the image.
[0004] To solve the above-mentioned technical problems, the present invention provides a white balance control method, comprising:
[0005] Get the color value of the region where an object is located in an image;
[0006] When the color value meets the preset monochrome ratio condition, the use of color values in the area by the automatic white balance mechanism is suppressed.
[0007] Optionally, after obtaining the color value of the region where the object is located in the image, the method further includes:
[0008] Determine a first ratio between the first color mean in the region and the mean of all colors in the region, and determine a second ratio between the second color mean in the region and the mean of all colors in the region;
[0009] When it is determined that the first ratio is greater than the first color threshold and the second ratio is less than the second color threshold, or when it is determined that the first ratio is less than the first color threshold and the second ratio is greater than the second color threshold, the color values in the image are determined to meet the preset monochrome ratio condition.
[0010] Optionally, before suppressing the use of color values in the region by the automatic white balance mechanism, the method further includes:
[0011] Obtain the current number of consecutive image frames, wherein the color values of the regions where the objects are located in the consecutive image frames all satisfy a preset monochrome percentage condition, and the consecutive image frames include the image;
[0012] If the number of consecutive image frames reaches a certain threshold, the following step is performed: suppress the use of color values in the region by the automatic white balance mechanism;
[0013] If the number of consecutive image frames does not reach a certain threshold, the color value of the region where the object is located in the next frame of the image is obtained.
[0014] Optionally, before obtaining the color value of the region where the object is located in the image, the method further includes:
[0015] The image is input into the object detection API interface to obtain the location and size information of the region where the object is located in the image, which is returned by the object detection API interface.
[0016] The region is determined in the image based on the location information and the size information.
[0017] Optionally, the location information includes the starting coordinates of the region;
[0018] Determining the region in the image based on the location information and the size information includes:
[0019] The termination coordinates of the region in the image are determined based on the starting coordinates and the size information;
[0020] The region is determined based on the starting coordinates and the ending coordinates.
[0021] Optionally, the suppression of the automatic white balance mechanism's use of color values in the region includes:
[0022] Lower the white balance weight of the region.
[0023] Optionally, lowering the white balance weight of the region includes:
[0024] Adjust the white balance weight of the region to 0.
[0025] The present invention also provides a white balance control device, comprising:
[0026] The information acquisition module is used to acquire the color values of the region where an object is located in the image;
[0027] The white balance control module is used to suppress the use of color values in the area by the automatic white balance mechanism when the color value meets the preset monochrome ratio condition.
[0028] The present invention also provides an electronic device, comprising:
[0029] Memory, used to store computer programs;
[0030] A processor is used to implement the white balance control method as described above when executing the computer program.
[0031] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the white balance control method described above.
[0032] The present invention provides a white balance control method, comprising: acquiring the color value of the region where an object is located in an image; and when the color value meets a preset monochrome ratio condition, suppressing the use of the color value in the region by the automatic white balance mechanism.
[0033] As can be seen, the present invention first obtains the color value of the region where the object is located in the image. Then, the present invention determines whether the color value meets a preset monochrome percentage condition. If both conditions are met, it can be determined that the object is a color value that causes significant interference with white balance adjustment. Therefore, the present invention further suppresses the use of color values in this region by the automatic white balance mechanism, thereby reducing the impact of large areas of monochrome in the image on the automatic white balance mechanism's adjustment of image white balance. The present invention can also provide a white balance control device, an electronic device, and a computer-readable storage medium, which have the above-mentioned beneficial effects. Attached Figure Description
[0034] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0035] Figure 1 A flowchart of a white balance control method provided in an embodiment of the present invention;
[0036] Figure 2 This is a schematic diagram illustrating the adjustment of white balance weights according to an embodiment of the present invention;
[0037] Figure 3 A flowchart of another white balance control method provided in an embodiment of the present invention;
[0038] Figure 4 This is a structural block diagram of a white balance control device provided in an embodiment of the present invention. Detailed Implementation
[0039] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0040] In filming scenarios, it's common to encounter people wearing large areas of red or blue clothing entering the frame, especially in high color temperature scenes where someone wearing a large area of red passes by, or in low color temperature scenes where someone wearing a large area of blue passes by. This causes a sudden color shift in the entire image, resulting in a bluish or reddish tint. Such color changes typically significantly impact visual perception, as the human eye can quickly detect the abrupt color change, creating an unnatural effect.
[0041] In view of this, the present invention can provide a white balance control scheme that can automatically suppress the use of color values in the area where the object in the image is located when the preset monochrome ratio condition is met. This can reduce the impact of large monochrome objects in the image on the image white balance, thereby improving the abrupt changes in the image and enhancing the display effect.
[0042] It should be noted that the embodiments of the present invention are not limited to specific hardware devices for implementing this method. They can be set according to actual application needs. For example, they can be personal computers connected to shooting devices, mobile devices (such as mobile phones, tablets), cameras, etc., or they can be chips or image processing devices including chips.
[0043] Please refer to Figure 1 , Figure 1 A flowchart of a white balance control method provided in an embodiment of the present invention, the method may include:
[0044] S101. Obtain the color value of the region where the object is located in the image.
[0045] To avoid the white balance abrupt changes that large-area monochrome objects can easily cause in images, this embodiment first needs to determine whether there are monochrome objects occupying a large area of the image. To this end, this embodiment needs to obtain the region information of the area where the object is located in the image, where the region information includes color values, in order to determine whether the object is a large-area monochrome object based on these color values.
[0046] In some examples, the above area information may also include the area size, which can be combined with the color value to determine whether the object is a large monochrome object.
[0047] It should be noted that this embodiment does not limit the specific color value, but is related to the color mode (color space) of the image. For example, when the color mode of the image is RGB, the color value can be the average value of a single color corresponding to the red, green, and blue channels of all pixels in the region, as well as the average value of all colors corresponding to all channels of all pixels in the region; when the color mode of the image is YUV, the color value can be the average value of luminance (average Y value) and average value of chromaticity (average U value and average V value) of all pixels in the region.
[0048] Furthermore, this embodiment does not limit the specific type of the object mentioned above; for example, it can be a human body object, a vehicle object, a building object, etc. It is understood that to obtain the above-mentioned region information, it is also necessary to determine the region corresponding to the object in the image. This embodiment does not limit the shape of the region; for example, it can be a rectangle or other polygons.
[0049] This embodiment is not limited to the method used to determine the region corresponding to each object in the image. Generally, an object detection model corresponding to each object category can be used for detection. For example, for human objects, a human object detection model can be used to perform human object detection in the image. This model can determine the location of the human object in the image and generate a detection box that can surround the human object based on the location. Thus, the region corresponding to the detection box can be determined as the human region where the human object is located in the image.
[0050] Other types of objects can be detected in a similar manner. This embodiment does not limit the specific object detection model; relevant technologies for object detection algorithms related to object type can be referenced. For example, for human body objects, relevant technologies for human body object detection algorithms can be referenced.
[0051] Furthermore, each object detection model can be configured with an API (Application Programming Interface). In this embodiment, the API can be invoked, and an image can be passed into it, allowing the model to perform object detection within the image. This yields the location information (coordinates of a location on the detection box in the image, such as the coordinates of the top-left corner of the detection box) and size information (length and width of the detection box) returned by the object detection API. Based on this location and size information, this embodiment can then mark the object's detection box in the image, thereby obtaining the region where the object is located.
[0052] Based on this, before obtaining the color value of the region where the object is located in the image, the following can be included:
[0053] Step 11: Input the image into the object detection API interface to obtain the location and size information of the region where the object is located in the image returned by the object detection API interface.
[0054] Step 12: Determine the region in the image based on the location and size information.
[0055] Furthermore, for a rectangular region, the starting coordinates of the region in the image can be determined first based on the location information (such as the coordinates of the upper left corner of the region). For example, the location information can directly include the starting coordinates of the region. Then, the ending coordinates of the region in the image can be determined based on the starting coordinates and the size information (such as the coordinates of the lower right corner of the region). For example, the ending coordinates can be obtained by adding the corresponding coordinate direction-related dimensions to the starting coordinates. Finally, the region can be determined in the image based on the starting coordinates and the ending coordinates.
[0056] Based on this, determining regions in an image according to location and size information can include:
[0057] Step 22: Determine the ending coordinates of the region in the image based on the starting coordinates and size information;
[0058] Step 23: Determine the region based on the starting and ending coordinates.
[0059] In these examples, by combining the coordinate position with the size of the area, the location can be quickly identified, providing a basic target for white balance control.
[0060] Please continue reading. Figure 1 Following S102, it may also include:
[0061] S102. Determine whether the color value meets the preset monochrome percentage condition; if the color value meets the preset monochrome percentage condition, proceed to step S103.
[0062] It should be noted that meeting the preset monochrome ratio condition means that a certain monochrome ratio in the area where the object is located has a large ratio, which may have a significant impact on the overall color change of the image and affect the automatic white balance control. Conversely, it means that the color value of the area where the object is located does not have an impact on the overall image and is unlikely to cause a sudden change. In this case, the detection can be stopped, or the next frame image relative to the current image can be obtained and the object and the area information of the object in the next frame image can be detected.
[0063] In other examples, the overall area of the region where the object is located can also be identified. If the overall area is greater than a preset area threshold and the color value in the region meets the preset monochrome ratio condition, S103 is executed.
[0064] Furthermore, this embodiment does not limit the specific preset monochrome ratio condition. When the image is in RGB color mode, the preset monochrome ratio condition is related to the color value distribution of each pixel in the red, green, and blue channels in that region.
[0065] Since white balance shift is related to the color value distribution of any two channels, such as the color value distribution of each pixel in the red and blue channels, this embodiment can set the above-mentioned preset monochrome ratio condition according to the color value distribution of each pixel in any two channels in the region.
[0066] For example, the preset monochrome ratio condition can be: when it is determined that the first ratio is greater than the first color threshold and the second ratio is less than the second color threshold, or when it is determined that the first ratio is less than the first color threshold and the second ratio is greater than the second color threshold, the color values in the image are determined to meet the preset monochrome ratio condition.
[0067] The first ratio is the ratio between the first color mean in the region and the mean of all colors in the region, and the second ratio is the ratio between the second color mean in the region and the mean of all colors in the region.
[0068] When the image's color mode is YUV, considering the conversion relationship between YUV and RGB color modes, the preset monochrome percentage condition corresponding to the YUV color mode can also be set based on the above idea.
[0069] By using the settings of the above embodiments, it is possible to quickly identify whether there is a large monochrome area in the image by using the proportion of each color value in the region, and by understanding the nature of the problem, it is possible to accurately distinguish whether it may cause a sudden change in the image.
[0070] Based on this, after obtaining the color value of the region where the object is located in the image, the following can be included:
[0071] Step 31: Determine the first ratio between the first color mean in the region and the total color mean in the region, and determine the second ratio between the second color mean in the region and the total color mean in the region;
[0072] Step 32: When it is determined that the first ratio is greater than the first color threshold and the second ratio is less than the second color threshold, or when it is determined that the first ratio is less than the first color threshold and the second ratio is greater than the second color threshold, the color values in the image are determined to meet the preset monochrome ratio condition.
[0073] For example, if the first color mean is the red mean and the second color mean is the blue mean, then the above-mentioned preset monochrome ratio condition is: determining the first ratio between the red mean in the region and the mean of all colors in the region, and determining the second ratio between the blue mean in the region and the mean of all colors in the region.
[0074] If it is determined that the first ratio is greater than the first color threshold and the second ratio is less than the second color threshold, then the area is reddish and meets the condition of a large area of red proportion.
[0075] Alternatively, if the first ratio is less than the first color threshold and the second ratio is greater than the second color threshold, then the area is bluish and meets the condition of a large area of blue proportion.
[0076] If the area where the above-mentioned object is located meets the condition of a large area of blue or a large area of red, it can be determined that the color value in the image meets the preset monochrome ratio condition.
[0077] It should be noted that this embodiment does not limit the specific values of the first preset color threshold and the second preset color threshold, and can be set according to actual application requirements.
[0078] Furthermore, it is worth noting that when the area information includes the area area, the judgment actions on whether the area area meets the preset area conditions and whether the color value meets the preset monochrome ratio conditions can be performed simultaneously or sequentially. For example, the judgment action on whether the area area meets the preset area conditions can be performed first, and then the judgment action on whether the color value meets the preset monochrome ratio conditions can be performed. The choice can be made according to the actual needs.
[0079] S103. Suppress the use of color values in the area by the automatic white balance mechanism.
[0080] For easier understanding, please refer to Figure 2 , Figure 2 This is a schematic diagram illustrating an adjustment of white balance weights according to an embodiment of the present invention. In an automatic white balance mechanism, an image can generally be divided into several white balance weight regions, for example, in Figure 2 In this system, the image can be completely divided into 12 regions. Each region has a corresponding white balance weight, which describes the importance of color at different locations within the image, allowing for better correction of color deviations when adjusting the white balance.
[0081] For example, when calculating the total rgain (red channel gain) and bgain (blue channel gain), the R (red value), G (green value), and B (blue value) values for each region can be multiplied by their corresponding weights to obtain the gain. In other words, the white balance weight directly affects the degree to which the color values in the white balance weight region influence white balance adjustment. The higher the white balance weight, the greater the influence of the color values in that region on white balance adjustment; conversely, the lower the white balance weight, the less influence the color values in that region on white balance adjustment.
[0082] To avoid the influence of large-area monochrome objects on image white balance adjustment, this embodiment will actively reduce the white balance weight of the area where the object is located, thereby reducing the influence of color values in the area on white balance adjustment.
[0083] For example, in Figure 2 In this embodiment, the human body region is located in white balance weight regions 1, 2, 5, 6, 9, and 10. Therefore, this embodiment can actively reduce the white balance weight of white balance weight regions 1, 2, 5, 6, 9, and 10 to reduce the influence of the color value brought by the human body region on the image white balance adjustment.
[0084] It should be noted that this embodiment does not limit the adjustment method of white balance weight. For example, it can be adjusted linearly according to the average value of red channel pixels and the average value of blue channel pixels corresponding to the image, or it can be adjusted to a fixed value. It can be set according to the actual application requirements.
[0085] Based on this, suppressing the use of color values in a region by the automatic white balance mechanism can include:
[0086] Step 41: Lower the white balance weight of the area where the object is located.
[0087] That is, in multiple white balance weight regions corresponding to the image, the white balance weight of each white balance weight region mapped to the object is reduced; the multiple white balance weight regions corresponding to the image completely cover the image.
[0088] In some examples, the white balance weight of areas with more pronounced color abrupt changes in the region containing the object can decrease more significantly, while the white balance weight of areas with relatively less pronounced color abrupt changes can decrease slightly less.
[0089] For example Figure 2 If a person is wearing a bright red top and light red pants, and the color values meet the preset monochrome ratio conditions, the white balance weight of the area corresponding to the top will be reduced more, while the white balance weight of the area corresponding to the pants will be reduced relatively less.
[0090] To achieve the best suppression effect, the white balance weight of the area can be adjusted to 0. That is, the white balance weight corresponding to each white balance weight area mapped to the object can be adjusted to 0, so that the white balance mechanism does not refer to the color values in these white balance weight areas at all, thereby maximizing the suppression effect.
[0091] Furthermore, to avoid interference from rapid changes in image content (such as the sudden appearance or disappearance of large areas of monochrome objects), white balance adjustment can be performed only when a preset number of times the preset monochrome ratio condition is met.
[0092] In other words, it can be further confirmed whether the previous one or several images adjacent to this image also meet the preset monochrome ratio condition. If, including this image, there are a preset number (i.e., a number threshold) of consecutive images that meet the preset monochrome ratio condition, it can be determined that a large area of monochrome objects remaining in the image will affect the automatic white balance mechanism, and the step of suppressing the use of color values in the object area by the automatic white balance mechanism can be started.
[0093] Based on this, before suppressing the use of color values in a region by the automatic white balance mechanism, it may also include:
[0094] Obtain the current number of consecutive image frames, wherein the color values of the regions where the objects are located in the consecutive image frames all satisfy a preset monochrome percentage condition, and the consecutive image frames include the image;
[0095] If the number of consecutive image frames reaches a certain threshold, the following step is performed: suppress the use of color values in the region by the automatic white balance mechanism;
[0096] If the number of consecutive image frames does not reach a certain threshold, the color value of the region where the object is located in the next frame of the image is obtained.
[0097] It should be noted that this embodiment does not limit the specific preset value, and can be set according to actual application needs, for example, it can be 3.
[0098] Based on the above embodiments, the present invention can first obtain the color value of the region where the object is located in the image. Subsequently, the present invention can determine whether the color value meets the preset monochrome ratio condition. If it does, it can be determined that the object brings a lot of interference to the white balance adjustment of the image. Therefore, the present invention can further suppress the use of color values in this region by the automatic white balance mechanism, thereby reducing the influence of large areas of monochrome in the image on the automatic white balance mechanism's adjustment of the image white balance.
[0099] The white balance control method described above is illustrated below using another flowchart. Please refer to it. Figure 3 , Figure 3 A flowchart illustrating another white balance control method provided in an embodiment of the present invention. This method mainly comprises two parts:
[0100] 1. Quantification of parameters in color transition regions:
[0101] Locating color-change areas translates to locating human-shaped regions in practical applications. So how do we obtain the coordinates of these human-shaped regions? This involves the application of backend AI interfaces. In practice, calling the relevant human-shaped region API allows for relatively accurate acquisition of the region's starting coordinates. Adding the corresponding width and height reveals the region's ending coordinates. The position of the human-shaped region is then mapped to the AWB (Auto White Balance) weighted area.
[0102] Furthermore, after the AWB (Auto White Balance) of a scene has stabilized, if a large area of a monochrome human figure enters the scene, the AWB will adjust accordingly. To prevent this adjustment, the AWB weight corresponding to the human figure area should be set to 0, thus preventing this area from participating in AWB adjustments. Furthermore, to avoid interference from sudden changes in image content (such as the sudden appearance or rapid disappearance of a large monochrome object) on white balance adjustments, it's possible to further determine if the number of times the current image and adjacent images consecutively meet the preset monochrome percentage condition has reached a preset value. Only when this number is confirmed to meet the preset value is it determined that a large monochrome object has remained in the image for an extended period, and the step of suppressing the use of color values in the object area by the automatic white balance mechanism initiated.
[0103] 2. Quantification of color in the humanoid area:
[0104] AWB (Auto-Width Booster) adjustments will not be performed when the human-shaped area is a large area of blue or red. However, the AWB adjustment function will only take effect when the human-shaped area is another color. So how can the color of the human-shaped area be detected in real time? This requires statistical analysis of the GlobalR (average pixel value of the red channel), GlobalG (average pixel value of the green channel), GlobalB (average pixel value of the blue channel), and GlobalAll (average pixel value of all channels). When GlobalR / GlobalAll is greater than the threshold Mr and GlobalB / GlobalAll is less than the threshold Mb, it is considered a large area of red; when GlobalR / GlobalAll is less than the threshold Mr and GlobalB / GlobalAll is greater than the threshold Mb, it is considered a large area of blue. This is how the color of the human-shaped area can be determined.
[0105] The white balance control device, electronic device, and computer-readable storage medium provided in the embodiments of the present invention are described below. The white balance control device, electronic device, and computer-readable storage medium described below can be referred to in correspondence with the white balance control method described above.
[0106] Please refer to Figure 4 , Figure 4This is a structural block diagram of a white balance control device provided in an embodiment of the present invention. The device may include:
[0107] Information acquisition module 401 is used to acquire the color value of the region where the object is located in the image;
[0108] The white balance control module 402 is used to suppress the use of color values in the area by the automatic white balance mechanism when the color value meets the preset monochrome ratio condition.
[0109] Optionally, the device may further include:
[0110] The ratio calculation module is used to determine a first ratio between the first color mean in the region and the mean of all colors in the region, and to determine a second ratio between the second color mean in the region and the mean of all colors in the region.
[0111] The monochrome determination module is used to determine that the color values in the image meet the preset monochrome ratio condition when it is determined that the first ratio is greater than the first color threshold and the second ratio is less than the second color threshold, or when it is determined that the first ratio is less than the first color threshold and the second ratio is greater than the second color threshold.
[0112] Optionally, the device may further include:
[0113] The adjacent image judgment module is used to obtain the current number of consecutive image frames, wherein the color values of the area where the object is located in the consecutive image frames all meet the preset monochrome ratio condition, and the consecutive image frames include the image; when the number of consecutive image frames reaches a quantity threshold, the white balance control module 402 is triggered to suppress the use of color values in the area by the automatic white balance mechanism; when the number of consecutive image frames does not reach the quantity threshold, the information acquisition module 401 is triggered to obtain the color values of the area where the object is located in the next frame image relative to the image.
[0114] Optionally, the device may further include:
[0115] The object detection module is used to input an image into the object detection API interface and obtain the location and size information of the region where the object is located in the image returned by the object detection API interface.
[0116] The region determination module is used to determine regions in an image based on location and size information.
[0117] Optionally, the location information includes the starting coordinates of the region in the image;
[0118] The region determination module may include:
[0119] The termination coordinate determination submodule is used to determine the termination coordinates of the region in the image based on the starting coordinates and size information.
[0120] The region determination submodule is used to determine the region based on the starting and ending coordinates.
[0121] Optionally, the white balance control module 402 is specifically used for:
[0122] Lower the white balance weight of the region.
[0123] Optionally, the white balance control module 402 is specifically used for:
[0124] Adjust the white balance weight of the region to 0.
[0125] This application also provides an electronic device, including:
[0126] Memory, used to store computer programs;
[0127] A processor is used to implement the steps of the data writing method described above when executing a computer program.
[0128] Since the embodiments of the electronic device part correspond to the embodiments of the white balance control method part, please refer to the description of the embodiments of the white balance control method part for the embodiments of the electronic device part, and will not be repeated here.
[0129] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the white balance control method of any of the above embodiments.
[0130] Since the embodiments of the computer-readable storage medium portion correspond to the embodiments of the white balance control method portion, please refer to the description of the embodiments of the white balance control method portion for the embodiments of the computer-readable storage medium portion, which will not be repeated here.
[0131] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0132] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0133] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0134] The foregoing has provided a detailed description of the white balance control method, apparatus, electronic device, and storage medium provided by this invention. Specific examples have been used to illustrate the principles and implementation methods of this invention. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and core ideas of this invention. It should be noted that those skilled in the art can make various improvements and modifications to this invention without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this invention.
Claims
1. A white balance control method, characterized in that, include: Get the color value of the region where an object is located in an image; When the color value meets the preset monochrome ratio condition, the use of color values in the area by the automatic white balance mechanism is suppressed; After obtaining the color value of the region where the object is located in the image, the process further includes: Determine a first ratio between the first color mean in the region and the mean of all colors in the region, and determine a second ratio between the second color mean in the region and the mean of all colors in the region; When it is determined that the first ratio is greater than the first color threshold and the second ratio is less than the second color threshold, or when it is determined that the first ratio is less than the first color threshold and the second ratio is greater than the second color threshold, the color values in the image are determined to meet the preset monochrome ratio condition.
2. The white balance control method according to claim 1, characterized in that, Before suppressing the use of color values in the region by the automatic white balance mechanism, the following are also included: Obtain the current number of consecutive image frames, wherein the color values of the regions where the objects are located in the consecutive image frames all satisfy a preset monochrome percentage condition, and the consecutive image frames include the image; If the number of consecutive image frames reaches a certain threshold, the following step is performed: suppress the use of color values in the region by the automatic white balance mechanism; If the number of consecutive image frames does not reach a certain threshold, the color value of the region where the object is located in the next frame of the image is obtained.
3. The white balance control method according to claim 1, characterized in that, Before obtaining the color values of the region where the object is located in the image, the process also includes: The image is input into the object detection API interface to obtain the location and size information of the region where the object is located in the image, which is returned by the object detection API interface. The region is determined in the image based on the location information and the size information.
4. The white balance control method according to claim 3, characterized in that, The location information includes the starting coordinates of the region; Determining the region in the image based on the location information and the size information includes: The termination coordinates of the region in the image are determined based on the starting coordinates and the size information; The region is determined based on the starting coordinates and the ending coordinates.
5. The white balance control method according to any one of claims 1 to 4, characterized in that, The suppression of the automatic white balance mechanism's use of color values in the region includes: Lower the white balance weight of the region.
6. The white balance control method according to claim 5, characterized in that, The reduction of the white balance weight in the region includes: Adjust the white balance weight of the region to 0.
7. A white balance control device, characterized in that, include: The information acquisition module is used to acquire the color values of the region where an object is located in the image; The white balance control module is used to suppress the use of color values in the area by the automatic white balance mechanism when the color value meets the preset monochrome ratio condition; A ratio calculation module is used to determine a first ratio between the first color mean in the region and the mean of all colors in the region, and to determine a second ratio between the second color mean in the region and the mean of all colors in the region; The monochrome determination module is used to determine that the color values in the image meet the preset monochrome ratio condition when it is determined that the first ratio is greater than the first color threshold and the second ratio is less than the second color threshold, or when it is determined that the first ratio is less than the first color threshold and the second ratio is greater than the second color threshold.
8. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the white balance control method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the white balance control method as described in any one of claims 1 to 6.