A video automatic white balance method and device, computer equipment and medium
By comprehensively evaluating decision factors such as brightness changes, motion detection, and color temperature changes, a decision score is generated, and the fusion weights are adaptively adjusted. This solves the color deviation and flickering problems of video white balance methods when the scene changes, and achieves a dynamic balance between accuracy and stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN TVT DIGITAL TECH CO LTD
- Filing Date
- 2026-03-20
- Publication Date
- 2026-06-09
Smart Images

Figure CN122179673A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a video automatic white balance method, apparatus, computer equipment, and medium. Background Technology
[0002] Automatic white balance (AWB) is a core component of the image signal processing pipeline. Its purpose is to eliminate color casts caused by varying light source color temperatures, ensuring that neutral colors appear neutral under different lighting conditions, thus simulating the color constancy of human vision. Traditional automatic white balance algorithms are mainly divided into methods based on statistical prior assumptions and learning-based methods. These methods have achieved good results in static image processing, but they have significant limitations when applied to video stream processing: Firstly, traditional methods are sensitive to scene changes; when large areas of monochromatic objects appear in the video scene or when lighting conditions change abruptly, color deviations are easily generated. Secondly, traditional methods lack temporal stability; because each frame is processed independently, the white balance parameters may fluctuate unnecessarily between frames, causing color flickering in the video and severely affecting the visual experience.
[0003] To address the aforementioned issues, existing video white balance methods attempt to smooth inter-frame white balance parameter variations by fixing parameters or using simple weighted averaging. However, these methods lack adaptability: if the smoothing intensity is too high, it cannot respond quickly when significant scene changes occur, leading to color correction delays and temporary color distortion; if the smoothing intensity is too low, it cannot effectively suppress inter-frame fluctuations, and color flickering remains. Therefore, maintaining temporal stability of video colors while ensuring white balance accuracy has become a pressing technical challenge in this field. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings of the prior art and provide a video automatic white balance method, apparatus, computer equipment and medium.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: In a first aspect, the present invention provides a video automatic white balance method, comprising: Read the image partition statistics of the current frame, which includes the average values of the red, green, and blue channels of each sub-block; Based on image partition statistics, the red channel gain and blue channel gain are calculated and used as candidate white balance parameters. A comprehensive evaluation of multiple decision factors that characterize the temporal changes of a video from different dimensions is used to generate a decision score that represents the degree of scene change. The decision factors include brightness change factor, motion detection factor, and color temperature change confidence factor. The fusion weights are adaptively adjusted based on the decision scores. The candidate white balance parameters are fused with the historical white balance parameters of the previous frame using fusion weights to obtain the final white balance parameters of the current frame.
[0006] Furthermore, the brightness change factor is determined based on the brightness difference of multiple consecutive frames; the color temperature change confidence factor is determined based on the degree of deviation between the color temperature estimate of the current frame and the color temperature statistics of historical frames; and the motion detection factor is determined based on the inter-frame change rate of the color statistics of image partitions. The brightness variation factor is determined based on the brightness differences across multiple consecutive frames, including: The brightness value of the current frame is normalized to obtain the normalized brightness. Calculate the cumulative difference in normalized luminance between consecutive frames; The brightness variation factor is determined based on the ratio of the cumulative difference to the number of frames involved in the calculation; The color temperature change confidence factor is determined based on the degree of deviation between the color temperature estimate of the current frame and the color temperature statistics of historical frames, including: Estimate the color temperature value of the current frame; Statistically analyze the color temperature values of historical frames to obtain the historical color temperature mean and standard deviation; Calculate the difference between the estimated color temperature of the current frame and the historical average color temperature, and divide the difference by the historical standard deviation of the color temperature to obtain the confidence factor of the color temperature change. The motion detection factor is determined based on the inter-frame change rate of color statistics values of image partitions, including: Divide the image of the current frame into multiple sub-blocks and obtain the color statistics value of each sub-block; Calculate the average rate of change of color statistics values of all sub-blocks between the current frame and the previous frame; The motion detection factor is determined based on the mean of the average rate of change over multiple consecutive frames.
[0007] Furthermore, the comprehensive evaluation of multiple decision factors characterizing the temporal changes of the video from different dimensions generates a decision score representing the degree of scene change. These decision factors include a brightness change factor, a motion detection factor, and a color temperature change confidence factor, including: Assign weight coefficients to each decision factor; The decision score is obtained by weighting and summing each decision factor with its corresponding weight coefficient.
[0008] Furthermore, it also includes; The decision score is compared with a preset trigger threshold; When the decision score exceeds the trigger threshold, it is determined that a valid change has occurred in the scenario, and a transition cycle is initiated. When the decision score does not exceed the trigger threshold, but the number of frames since the last determination of a valid change in the scene reaches the preset minimum trigger interval, a valid change in the scene is forcibly determined, and a transition cycle is initiated.
[0009] Furthermore, the adaptive adjustment of the fusion weights based on the decision scores includes: Obtain a preset number of transition frames, wherein the number of transition frames is defined as the maximum duration of the transition period; Get the current cumulative frame count during the transition period; The fusion weight of the current frame is determined based on the decision score, the number of transition frames, and the cumulative number of frames.
[0010] Further, determining the fusion weight of the current frame based on the decision score, the number of transition frames, and the cumulative number of frames includes: The decision score is multiplied by a scaling factor, which is the smaller of 1 and the quotient obtained by dividing the current cumulative frame number by the transition frame number, to obtain the fusion weight.
[0011] Furthermore, the step of fusing the candidate white balance parameters with the historical white balance parameters of the previous frame using fusion weights to obtain the final white balance parameters of the current frame includes: Use the fusion weights as the weights for the candidate white balance parameters; Subtract the fusion weight from 1 as the weight of the historical white balance parameter; The candidate white balance parameters and historical white balance parameters are weighted and summed to obtain the final white balance parameters for the current frame.
[0012] Secondly, the present invention also provides a video automatic white balance device, comprising: The reading unit is used to read the image partition statistics of the current frame, which includes the average values of the red, green, and blue channels of each sub-block; The calculation unit is used to calculate the red channel gain and blue channel gain based on image partition statistics, as candidate white balance parameters; The evaluation unit is used to comprehensively evaluate multiple decision factors that characterize the temporal changes of the video from different dimensions, and generate a decision score that represents the degree of scene change. The decision factors include brightness change factor, motion detection factor and color temperature change confidence factor. An adjustment unit is used to adaptively adjust the fusion weights based on the decision scores; The fusion unit is used to fuse the candidate white balance parameters with the historical white balance parameters of the previous frame using fusion weights to obtain the final white balance parameters of the current frame.
[0013] Thirdly, the present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement a video automatic white balance method as described above.
[0014] Fourthly, the present invention also provides a computer-readable storage medium storing a computer program, the computer program including program instructions, which, when executed by a processor, cause the processor to perform a video automatic white balance method as described above.
[0015] The advantages of this invention compared to existing technologies are as follows: By comprehensively evaluating decision factors across multiple dimensions, such as brightness changes, motion detection, and color temperature changes, a decision score is generated that accurately reflects the degree of scene change. Based on this score, the fusion weights are adaptively adjusted to smoothly fuse candidate white balance parameters with historical white balance parameters. This design accurately identifies effective scene changes, avoiding misjudgments caused by minor disturbances or large areas of monochromatic objects, thus improving the accuracy of white balance correction. Simultaneously, through adaptive temporal smoothing control, the fusion weights are dynamically adjusted according to the degree of scene change, maintaining color consistency and suppressing flicker when the scene is stable, and responding quickly and reducing color lag when the scene changes, achieving a dynamic balance between accuracy and stability.
[0016] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other objectives, features and advantages of the present invention more obvious and understandable, preferred embodiments are described in detail below. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 A flowchart of a video automatic white balance method provided in a specific embodiment of the present invention; Figure 2 A schematic block diagram of a video automatic white balance device provided for a specific embodiment of the present invention; Figure 3 This is a schematic block diagram of a computer device provided for a specific embodiment of the present invention. Detailed Implementation
[0019] The technical solution of the present invention will be clearly and completely described below with reference to specific embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. 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.
[0020] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0021] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0022] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0023] The advantages of this invention compared to existing technologies are as follows: By comprehensively evaluating decision factors across multiple dimensions, such as brightness changes, motion detection, and color temperature changes, a decision score is generated that accurately reflects the degree of scene change. Based on this score, the fusion weights are adaptively adjusted to smoothly fuse candidate white balance parameters with historical white balance parameters. This design accurately identifies effective scene changes, avoiding misjudgments caused by minor disturbances or large areas of monochromatic objects, thus improving the accuracy of white balance correction. Simultaneously, through adaptive temporal smoothing control, the fusion weights are dynamically adjusted according to the degree of scene change, maintaining color consistency and suppressing flicker when the scene is stable, and responding quickly and reducing color lag when the scene changes, achieving a dynamic balance between accuracy and stability.
[0024] like Figure 1 As shown, this embodiment of the invention provides a video automatic white balance method, including the following steps: S10-S50.
[0025] S10. Read the image partition statistics of the current frame. The image partition statistics include the average values of the red, green and blue channels of each sub-block.
[0026] During video stream processing, ISP hardware typically includes a white balance partitioning statistics module. This module divides each frame of the image into M×N rectangular sub-blocks (e.g., 16×16, 32×32, etc.) and calculates the average pixel values of the red (R), green (G), and blue (B) channels for all pixels within each sub-block. This statistical information serves as the basic input data for subsequent white balance algorithms. This step directly reads this partitioning statistics, i.e., the average R, average G, and average B values for each sub-block, from the ISP's registers or memory.
[0027] S20. Based on the image partition statistics, the gain of the red channel and the gain of the blue channel are calculated and used as candidate white balance parameters.
[0028] The read partition statistics are input into the static image white balance algorithm to calculate the red channel gain R_gain and blue channel gain B_gain for the current frame. Typically, the green channel gain is fixed at 1, or adjusted based on green as a baseline. The calculation formula can be expressed as: Rgain=AWB(Ri,Gi,Bi); Bgain=AWB(Ri,Gi,Bi); Where AWB represents the selected static white balance algorithm, and Ri, Gi, and Bi are the channel averages of each sub-block. The resulting (Rgain, Bgain) is the candidate white balance parameter for the current frame, denoted as... .
[0029] S30. Comprehensively evaluate multiple decision factors that characterize the temporal changes of the video from different dimensions, and generate a decision score that represents the degree of scene change. The decision factors include brightness change factor, motion detection factor, and color temperature change confidence factor.
[0030] In this embodiment, the brightness variation factor reflects the degree of change in overall illumination intensity between consecutive frames, and the brightness variation factor is determined based on the brightness differences of multiple consecutive frames.
[0031] Specifically, the method for determining the brightness variation factor based on the brightness differences of multiple consecutive frames includes: normalizing the brightness value of the current frame to obtain normalized brightness; calculating the cumulative difference between the normalized brightness of multiple consecutive frames; and determining the brightness variation factor based on the ratio of the cumulative difference to the number of frames involved in the calculation. The specific calculation process is as follows: First, the luminance value of the current frame is normalized. The luminance value Y can be calculated from RGB statistics, for example, Y=(R+2G+B) / 4, or directly obtained from the luminance component of the ISP. The normalized luminance luma=Y / (BitDepth-B), where BitDepth is the pixel bit depth (e.g., 8-bit, 10-bit) and B is the black level value. Then, the cumulative difference in normalized luminance between consecutive T frames (e.g., T=5) is calculated: ; ; in, B represents the luminance bit depth, B represents the black level value, and Y represents the luminance of the current frame. The normalized brightness of the current frame. This is the normalized brightness of the previous calculated frame.
[0032] Calculate the brightness change rate compared to the previous T frames, i.e., the average brightness change rate per frame, to obtain the brightness change factor factor_Δ, which is calculated as follows: .
[0033] In this embodiment, the motion detection factor is used to capture spatial distribution changes in image content, effectively distinguishing between object motion and light source changes in a scene. The motion detection factor is determined based on the inter-frame change rate of color statistics values for image partitions.
[0034] Specifically, the method for determining the motion detection factor based on the inter-frame change rate of color statistics values of image partitions includes: dividing the current frame image into multiple sub-blocks and obtaining the color statistics value of each sub-block; calculating the average change rate of color statistics values of all sub-blocks between the current frame and the previous frame; and determining the motion detection factor based on the mean of the average change rates of multiple consecutive frames. The specific calculation process is as follows: First, based on the RGB mean of each sub-block, a statistical feature value is calculated for each sub-block, which approximately represents the brightness or grayscale level of the sub-block. Then, the average value μ of all sub-blocks in the current frame is calculated, and the difference Δμ between this average and the previous frame is calculated. The motion detection factor is obtained by averaging Δμ over multiple consecutive frames. The calculation formula is: ; in, , , For white balance statistics, This represents the total number of white balance zones. In this embodiment, the luminance bit depth and the pixel bit depth are the same.
[0035] Then calculate the average change rate of T frames as the inter-frame change rate. The calculation method is as follows: .
[0036] In this embodiment, the color temperature change confidence factor is used to evaluate the stability of the light source's color temperature. The color temperature change confidence factor is determined based on the degree of deviation between the estimated color temperature of the current frame and the statistical color temperature values of historical frames.
[0037] Specifically, the confidence factor for color temperature change is determined based on the degree of deviation between the estimated color temperature of the current frame and the statistical color temperature values of historical frames. The specific methods include: estimating the color temperature value of the current frame; statistically analyzing the color temperature values of historical frames to obtain the historical color temperature mean and standard deviation; calculating the difference between the estimated color temperature of the current frame and the historical color temperature mean, and dividing the difference by the historical color temperature standard deviation to obtain the confidence factor for color temperature change. The specific calculation process is as follows: The historical color temperature mean and standard deviation of the previous T-1 frames are calculated as follows: ; ; in, Let i be the color temperature value of the i-th frame. The historical average color temperature. This represents the historical color temperature standard deviation.
[0038] Then, the current frame is compared with the normalized average color temperature of historical frames as a confidence factor for color temperature change. The calculation method is as follows: .
[0039] Finally, the brightness change factor, motion detection factor, and color temperature change confidence factor are used for evaluation. When the score of the multi-factor evaluation exceeds the preset threshold or reaches the minimum trigger interval, it is determined that the white balance parameters need to be reapplied to the image.
[0040] Specifically, the brightness change factor, motion detection factor, and color temperature change confidence factor are assigned weight coefficients α, β, and γ, respectively, where γ = 1 - α - β, and then weighted and summed to obtain the decision score. The specific calculation formula is as follows: ; In some embodiments, the automatic white balance method for video further includes: comparing a decision score with a preset trigger threshold; when the decision score exceeds the trigger threshold, determining that a valid scene change has occurred and initiating a transition period; when the decision score does not exceed the trigger threshold but the number of frames since the last determination that a valid scene change has occurred reaches a preset minimum trigger interval, forcibly determining that a valid scene change has occurred and initiating a transition period.
[0041] Specifically, the decision score (Score) is compared with a preset trigger threshold (η). If the score > η, a valid scene change is determined, and a transition period is immediately initiated. Furthermore, to prevent parameter stagnation due to prolonged periods without triggering, a minimum trigger interval (L) is set; if L frames have elapsed since the last trigger, a transition period is forcibly initiated even if the score does not exceed η. The transition period has a preset maximum duration (γ) (e.g., 10 frames).
[0042] The specific calculation formula is as follows: ; in, , The adjustment factor is no greater than 1. The trigger threshold is adjustable.
[0043] S40. Adaptively adjust the fusion weights based on the decision scores.
[0044] In some embodiments, step 40 specifically includes: obtaining a preset number of transition frames, wherein the number of transition frames is defined as the maximum duration of the transition period; obtaining the current cumulative number of frames within the transition period; and determining the fusion weight of the current frame based on the decision score, the number of transition frames, and the cumulative number of frames.
[0045] The fusion weight λ of the current frame is determined according to the following formula: ; Where Score represents the multi-factor score. To smooth the frame count, a maximum length for the smoothing phase is defined, where k is the current frame counter, representing the accumulated frame count since the transition began, incrementing frame by frame until it reaches a certain value. No further additions will be made.
[0046] The meaning of this formula is: in the initial stage of the transition, λ is limited by k / γ, and gradually approaches the Score as k increases; when k reaches γ, λ stabilizes at the Score. This ensures both the smoothness of the transition and that the final fusion weight matches the degree of scene change.
[0047] S50. The candidate white balance parameters are fused with the historical white balance parameters of the previous frame using the fusion weight to obtain the final white balance parameters of the current frame.
[0048] In some embodiments, step S50 specifically includes: using the fusion weight as the weight of the candidate white balance parameter; subtracting the fusion weight from 1 as the weight of the historical white balance parameter; and performing a weighted summation of the candidate white balance parameter and the historical white balance parameter to obtain the final white balance parameter of the current frame.
[0049] In this embodiment, the current frame is represented by the time index t, and the video AWB gain is updated as follows: .
[0050] Let the historical white balance parameters applied in the previous frame be: The final white balance parameters of the current frame Calculated by the following formula: ; in, λ represents the candidate white balance parameters for the current frame, and λ represents the fusion weight for the current frame.
[0051] The final white balance parameters obtained ( This is applied to each pixel of the current frame, for example, by multiplying the R value of each pixel by... B value multiplied by The G value remains unchanged (or is multiplied by 1) to complete white balance correction. The corrected image frame is then output to subsequent processing modules (such as noise reduction, sharpening, etc.) or directly displayed / encoded.
[0052] In summary, by comprehensively evaluating decision factors across multiple dimensions, including brightness changes, motion detection, and color temperature changes, a decision score is generated that accurately reflects the degree of scene change. Based on this score, the fusion weights are adaptively adjusted to smoothly fuse candidate white balance parameters with historical white balance parameters. This design accurately identifies effective scene changes, avoiding misjudgments caused by minor disturbances or large areas of monochromatic objects, thus improving the accuracy of white balance correction. Simultaneously, through adaptive temporal smoothing control, the fusion weights are dynamically adjusted according to the degree of scene change, maintaining color consistency and suppressing flicker when the scene is stable, while responding quickly and reducing color lag when the scene changes, achieving a dynamic balance between accuracy and stability.
[0053] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0054] This invention also provides a video automatic white balance device, which is used to perform the steps in any of the embodiments of the foregoing video automatic white balance method. Specifically, please refer to... Figure 2 , Figure 2 A schematic block diagram of an automatic video white balance device 100 provided in an embodiment of this application is shown. The automatic video white balance device 100 specifically includes: The reading unit 110 is used to read the image partition statistics of the current frame, which includes the mean values of the red, green, and blue channels of each sub-block; the calculation unit 120 is used to calculate the red channel gain and blue channel gain based on the image partition statistics, as candidate white balance parameters; the evaluation unit 130 is used to comprehensively evaluate multiple decision factors that characterize the temporal changes of the video from different dimensions, and generate a decision score that represents the degree of scene change, which includes a brightness change factor, a motion detection factor, and a color temperature change confidence factor; the adjustment unit 140 is used to adaptively adjust the fusion weights according to the decision scores; the fusion unit 150 is used to fuse the candidate white balance parameters with the historical white balance parameters of the previous frame using the fusion weights to obtain the final white balance parameters of the current frame.
[0055] The brightness variation factor is determined based on the brightness difference of multiple consecutive frames; the color temperature variation confidence factor is determined based on the deviation between the color temperature estimate of the current frame and the color temperature statistics of historical frames; and the motion detection factor is determined based on the inter-frame change rate of the color statistics of image partitions. The brightness variation factor is determined based on the brightness difference of multiple consecutive frames, including: normalizing the brightness value of the current frame to obtain normalized brightness; calculating the cumulative difference between the normalized brightness of multiple consecutive frames; and determining the brightness variation factor based on the ratio of the cumulative difference to the number of frames involved in the calculation. The color temperature change confidence factor is determined based on the degree of deviation between the estimated color temperature value of the current frame and the statistical color temperature value of historical frames, including: estimating the color temperature value of the current frame; statistically analyzing the color temperature values of historical frames to obtain the historical color temperature mean and historical color temperature standard deviation; calculating the difference between the estimated color temperature of the current frame and the historical color temperature mean, and dividing the difference by the historical color temperature standard deviation to obtain the color temperature change confidence factor. The motion detection factor is determined based on the inter-frame change rate of color statistics values of image partitions, including: dividing the image of the current frame into multiple sub-blocks and obtaining the color statistics value of each sub-block; calculating the average change rate of color statistics values of all sub-blocks between the current frame and the previous frame; and determining the motion detection factor based on the mean of the average change rates of multiple consecutive frames.
[0056] In some embodiments, the evaluation unit 130 is specifically applied to: assigning weight coefficients to each decision factor; and weighting and summing each decision factor with its corresponding weight coefficient to obtain the decision score.
[0057] In some embodiments, the video automatic white balance device 100 is further specifically applied to: comparing the decision score with a preset trigger threshold; when the decision score exceeds the trigger threshold, determining that a valid scene change has occurred and initiating a transition period; when the decision score does not exceed the trigger threshold but the number of frames since the last determination that a valid scene change has occurred reaches a preset minimum trigger interval, forcibly determining that a valid scene change has occurred and initiating a transition period.
[0058] In some embodiments, the adjustment unit 140 is specifically applied to: comparing the decision score with a preset trigger threshold; when the decision score exceeds the trigger threshold, determining that the scene has undergone a valid change and initiating a transition period; when the decision score does not exceed the trigger threshold but the number of frames since the last determination that the scene has undergone a valid change reaches a preset minimum trigger interval, forcibly determining that the scene has undergone a valid change and initiating a transition period.
[0059] In some embodiments, the adjustment unit 140 is further specifically applied to: multiplying the decision score by a scaling factor, wherein the scaling factor is the smaller of 1 and the quotient obtained by dividing the current cumulative frame number by the transition frame number, to obtain the fusion weight.
[0060] In some embodiments, the fusion unit 150 is specifically used to: use the fusion weight as the weight of the candidate white balance parameter; subtract the fusion weight from 1 as the weight of the historical white balance parameter; and perform a weighted summation of the candidate white balance parameter and the historical white balance parameter to obtain the final white balance parameter of the current frame.
[0061] It should be noted that those skilled in the art can clearly understand that the specific implementation process of the above-mentioned automatic white balance device 100 and each unit can be referred to the corresponding description in the foregoing method embodiments. For the sake of convenience and brevity, it will not be repeated here.
[0062] The aforementioned automatic white balance device for video can be implemented as a computer program, which can, for example... Figure 3 It runs on the computer device shown.
[0063] Please see Figure 3 , Figure 3 This is a schematic block diagram of a computer device provided in an embodiment of this application. The computer device 700 can be a server, wherein the server can be a standalone server or a server cluster composed of multiple servers.
[0064] like Figure 3 As shown, the computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the video automatic white balance method steps described above.
[0065] The computer device 700 includes a processor 720, a memory, and a network interface 750 connected via a system bus 710, wherein the memory may include a non-volatile storage medium 730 and internal memory 740.
[0066] The non-volatile storage medium 730 may store an operating system 731 and a computer program 732. When the computer program 732 is executed, it causes the processor 720 to perform a video automatic white balance method.
[0067] The processor 720 provides computing and control capabilities to support the operation of the entire computer device 700.
[0068] The internal memory 740 provides an environment for the operation of the computer program 732 in the non-volatile storage medium 730. When the computer program 732 is executed by the processor 720, the processor 720 can perform a video automatic white balance method.
[0069] This network interface 750 is used for network communication, such as sending assigned tasks. Those skilled in the art will understand that... Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device 700 to which the present application is applied. The specific computer device 700 may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements. The processor 720 is used to run program code stored in memory to implement the automatic white balance method for video.
[0070] Those skilled in the art will understand that Figure 3 The embodiments of the computer device shown do not constitute a limitation on the specific configuration of the computer device. In other embodiments, the computer device may include more or fewer components than illustrated, or combine certain components, or have different component arrangements. For example, in some embodiments, the computer device may include only memory and a processor. In such embodiments, the structure and function of the memory and processor are different from those shown. Figure 3 The embodiments shown are consistent and will not be described again here.
[0071] It should be understood that, in the embodiments of this application, the processor 720 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0072] In another embodiment of the present invention, a computer-readable storage medium is provided. This computer-readable storage medium may be a non-volatile computer-readable storage medium. The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the video automatic white balance method disclosed in the embodiments of the present invention.
[0073] Those skilled in the art will readily understand that, for the sake of convenience and brevity, the specific working processes of the devices, apparatuses, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. Those skilled in the art will 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 composition and steps of each example have been generally described in terms of function 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 implementation should not be considered beyond the scope of this invention.
[0074] In the embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Units with the same function may be grouped into one unit. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, or may be electrical, mechanical, or other forms of connection.
[0075] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of the present invention, depending on actual needs.
[0076] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0077] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks.
[0078] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A video automatic white balance method, characterized in that, include: Read the image partition statistics of the current frame, which includes the average values of the red, green, and blue channels of each sub-block; Based on image partition statistics, the red channel gain and blue channel gain are calculated and used as candidate white balance parameters. A comprehensive evaluation of multiple decision factors that characterize the temporal changes of a video from different dimensions is used to generate a decision score that represents the degree of scene change. The decision factors include brightness change factor, motion detection factor, and color temperature change confidence factor. The fusion weights are adaptively adjusted based on the decision scores. The candidate white balance parameters are fused with the historical white balance parameters of the previous frame using fusion weights to obtain the final white balance parameters of the current frame.
2. The automatic white balance method for video according to claim 1, characterized in that, The brightness variation factor is determined based on the brightness difference of multiple consecutive frames; the color temperature variation confidence factor is determined based on the deviation between the estimated color temperature of the current frame and the statistical color temperature of historical frames; the motion detection factor is determined based on the inter-frame change rate of the color statistics of image partitions. The brightness variation factor is determined based on the brightness differences across multiple consecutive frames, including: The brightness value of the current frame is normalized to obtain the normalized brightness. Calculate the cumulative difference in normalized luminance between consecutive frames; The brightness variation factor is determined based on the ratio of the cumulative difference to the number of frames involved in the calculation; The color temperature change confidence factor is determined based on the degree of deviation between the color temperature estimate of the current frame and the color temperature statistics of historical frames, including: Estimate the color temperature value of the current frame; Statistically analyze the color temperature values of historical frames to obtain the historical color temperature mean and standard deviation; Calculate the difference between the estimated color temperature of the current frame and the historical average color temperature, and divide the difference by the historical standard deviation of the color temperature to obtain the confidence factor of the color temperature change. The motion detection factor is determined based on the inter-frame change rate of color statistics values of image partitions, including: Divide the image of the current frame into multiple sub-blocks and obtain the color statistics value of each sub-block; Calculate the average rate of change of color statistics values of all sub-blocks between the current frame and the previous frame; The motion detection factor is determined based on the mean of the average rate of change over multiple consecutive frames.
3. The automatic white balance method for video according to claim 2, characterized in that, The process comprehensively evaluates multiple decision factors that characterize the temporal changes of the video from different dimensions, generating a decision score that represents the degree of scene change. These decision factors include a brightness change factor, a motion detection factor, and a color temperature change confidence factor, among others. Assign weight coefficients to each decision factor; The decision score is obtained by weighting and summing each decision factor with its corresponding weight coefficient.
4. The automatic white balance method for video according to claim 3, characterized in that, Also includes; The decision score is compared with a preset trigger threshold; When the decision score exceeds the trigger threshold, it is determined that a valid change has occurred in the scenario, and a transition cycle is initiated. When the decision score does not exceed the trigger threshold, but the number of frames since the last valid change in the scene reaches the preset minimum trigger interval, the scene is forced to change, and a transition cycle is started.
5. The automatic white balance method for video according to claim 4, characterized in that, The adaptive adjustment of fusion weights based on decision scores includes: Obtain a preset number of transition frames, wherein the number of transition frames is defined as the maximum duration of the transition period; Get the current cumulative frame count during the transition period; The fusion weight of the current frame is determined based on the decision score, the number of transition frames, and the cumulative number of frames.
6. The automatic white balance method for video according to claim 5, characterized in that, The step of determining the fusion weight of the current frame based on the decision score, the number of transition frames, and the cumulative number of frames includes: The decision score is multiplied by a scaling factor, which is the smaller of 1 and the quotient obtained by dividing the current cumulative frame number by the transition frame number, to obtain the fusion weight.
7. The automatic white balance method for video according to claim 6, characterized in that, The process of fusing candidate white balance parameters with historical white balance parameters from the previous frame using fusion weights to obtain the final white balance parameters for the current frame includes: Use the fusion weights as the weights for the candidate white balance parameters; Subtract the fusion weight from 1 as the weight of the historical white balance parameter; The candidate white balance parameters and historical white balance parameters are weighted and summed to obtain the final white balance parameters for the current frame.
8. A video automatic white balance device, characterized in that, include: The reading unit is used to read the image partition statistics of the current frame, which includes the average values of the red, green, and blue channels of each sub-block; The calculation unit is used to calculate the red channel gain and blue channel gain based on image partition statistics, as candidate white balance parameters; The evaluation unit is used to comprehensively evaluate multiple decision factors that characterize the temporal changes of the video from different dimensions, and generate a decision score that represents the degree of scene change. The decision factors include brightness change factor, motion detection factor and color temperature change confidence factor. An adjustment unit is used to adaptively adjust the fusion weights based on the decision scores; The fusion unit is used to fuse the candidate white balance parameters with the historical white balance parameters of the previous frame using fusion weights to obtain the final white balance parameters of the current frame.
9. A computer device, characterized in that, The device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements a video automatic white balance method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, the computer program including program instructions, which, when executed by a processor, cause the processor to perform a video automatic white balance method as described in any one of claims 1 to 7.