CN109462745B - White balance processing method and mobile terminal - Google Patents
White balance processing method and mobile terminal Download PDFInfo
- Publication number
- CN109462745B CN109462745B CN201811643403.2A CN201811643403A CN109462745B CN 109462745 B CN109462745 B CN 109462745B CN 201811643403 A CN201811643403 A CN 201811643403A CN 109462745 B CN109462745 B CN 109462745B
- Authority
- CN
- China
- Prior art keywords
- picture
- white balance
- pixel
- balance gain
- coefficient
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N9/00—Details of colour television systems
- H04N9/64—Circuits for processing colour signals
- H04N9/73—Colour balance circuits, e.g. white balance circuits or colour temperature control
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/80—Camera processing pipelines; Components thereof
- H04N23/84—Camera processing pipelines; Components thereof for processing colour signals
- H04N23/88—Camera processing pipelines; Components thereof for processing colour signals for colour balance, e.g. white-balance circuits or colour temperature control
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Color Television Image Signal Generators (AREA)
- Processing Of Color Television Signals (AREA)
Abstract
The embodiment of the invention provides a white balance processing method and a mobile terminal, wherein the method comprises the following steps: acquiring picture pixel-by-pixel information of a target image, shooting physical parameters and a first white balance gain coefficient of n frames before the target image; determining a second white balance gain coefficient and an updating reference coefficient based on the picture pixel-by-pixel information and the shooting physical parameter; under the condition that the second white balance gain coefficient needs to be updated, updating the second white balance gain coefficient by adopting the updating reference coefficient; performing white balance processing on the target image by adopting the updated second white balance gain coefficient; wherein the target image is a current frame image; n is a positive integer greater than or equal to 1. By applying the embodiment of the invention, the picture jitter caused by overlarge white balance coefficient change of the target image can be avoided, and the picture quality is stabilized.
Description
Technical Field
The embodiment of the invention relates to the technical field of communication, in particular to a white balance processing method and a mobile terminal.
Background
With the development of information technology, mobile terminals have more and more functions, such as a camera function. At present, although the self-photographing technology using a camera is common and mature in the existing mobile terminal, with the continuous upgrade of the camera configuration, the ISP (Image Signal Processing) technology is rapidly developed, and the picture quality of the Image photographed by the mobile terminal is also continuously requested to be higher.
The color of the object under different light sources is different, which is determined by the different color temperature of the light sources, and the reflection spectrum of the object has a certain deviation from the real color. For example, a white object appears yellowish-orange under low color temperature illumination of indoor tungsten light, and a scene photographed under such illumination conditions is yellowish, and if it is illuminated with high color temperature in the sky blue, it appears bluish. In order to make a mobile terminal having an imaging function such as a camera have a visual adjustment capability similar to that of human eyes, the colors of the acquired images are kept consistent under different lighting conditions, and the processing of the acquired images is called white balance.
The current AWB (Automatic white balance) technology based on picture color components can stably restore the colors of a shooting scene. However, AWB techniques based on picture color components have deficiencies. For example, when the camera of the mobile terminal is displaced to cause a picture change, but the ambient color temperature is not actually changed, the AWB algorithm may calculate an ambient color temperature different from that before the displacement from the change of the picture, so that the AWB result is inaccurate, and the picture quality stability of the image is reduced.
Disclosure of Invention
The embodiment of the invention provides a white balance processing method and a mobile terminal, which aim to solve the problem of unstable image quality caused by inaccurate white balance calculation result.
In order to solve the technical problem, the invention is realized as follows:
in a first aspect, a white balance processing method is provided, which is applied to a mobile terminal, and includes:
acquiring picture pixel-by-pixel information of a target image, shooting physical parameters and a first white balance gain coefficient of n frames before the target image;
determining a second white balance gain coefficient and an updating reference coefficient based on the picture pixel-by-pixel information and the shooting physical parameter;
under the condition that the second white balance gain coefficient needs to be updated, updating the second white balance gain coefficient by adopting the updating reference coefficient;
performing white balance processing on the target image by adopting the updated second white balance gain coefficient;
wherein the target image is a current frame image; n is a positive integer greater than or equal to 1.
In a second aspect, an embodiment of the present invention provides a white balance processing method, which is applied to a mobile terminal, and the method includes:
acquiring first picture pixel-by-pixel information of a target image, second picture pixel-by-pixel information of the first n frames of the target image and a first white balance gain coefficient of the first n frames; n is a positive integer greater than or equal to 1;
determining a second white balance gain coefficient and determining an update reference coefficient based on the first picture pixel-by-pixel information and the second picture pixel-by-pixel information;
under the condition that the second white balance gain coefficient needs to be updated, updating the second white balance gain coefficient by adopting the updating reference coefficient;
performing white balance processing on the target image by adopting the updated second white balance gain coefficient;
and the target image is a current frame image.
In a third aspect, an embodiment of the present invention provides a mobile terminal, where the mobile terminal includes:
the first data acquisition module is used for acquiring picture pixel-by-pixel information of a target image, shooting physical parameters and a first white balance gain coefficient of n frames before the target image;
the first data determining module is used for determining a second white balance gain coefficient and an updating reference coefficient based on the picture pixel-by-pixel point information and the shooting physical parameter;
a first updating module, configured to update the second white balance gain coefficient by using the update reference coefficient when the second white balance gain coefficient needs to be updated;
the first white balance processing module is used for carrying out white balance processing on the target image by adopting the updated second white balance gain coefficient;
wherein the target image is a current frame image; n is a positive integer greater than or equal to 1.
In a fourth aspect, an embodiment of the present invention provides a mobile terminal, where the mobile terminal includes:
the second data acquisition module is used for acquiring pixel point-by-pixel point information of a first picture of a target image, pixel point-by-pixel point information of a second picture of the previous n frames of the target image and a first white balance gain coefficient of the previous n frames; n is a positive integer greater than or equal to 1;
the second data determination module is used for determining a second white balance gain coefficient and determining an updating reference coefficient based on the first picture pixel-by-pixel information and the second picture pixel-by-pixel information;
a second updating module, configured to update the second white balance gain coefficient by using the updated reference coefficient when the second white balance gain coefficient needs to be updated;
the second white balance processing module is used for carrying out white balance processing on the target image by adopting the updated second white balance gain coefficient;
and the target image is a current frame image.
In a fifth aspect, an embodiment of the present invention provides a mobile terminal, including a processor, a memory, and a computer program stored on the memory and executable on the processor, where the computer program, when executed by the processor, implements the steps of the white balance processing method.
In a sixth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the white balance processing method as described above.
The embodiment of the invention determines the updating reference coefficient according to the shooting physical parameters of the target image when shooting the target image, calculates the second white balance gain coefficient according to the picture pixel-by-pixel information of the target image, adopts the updating reference coefficient to update the second white balance gain coefficient when the second white balance gain coefficient needs to be updated, and finally adopts the updated second white balance gain coefficient to carry out white balance processing on the target image, and the embodiment of the invention enables the white balance gain coefficient for processing the white balance of the target image to be in a more stable state by setting the updating reference coefficient, so that the stable white balance gain coefficient can be obtained under the condition that the picture is changed due to the displacement of the lens of the mobile terminal and the ambient color temperature is not changed by applying the embodiment of the invention, and the picture is prevented from shaking due to the overlarge change of the white balance coefficient of the target image, and stabilizing the picture quality.
Drawings
FIG. 1 is a flow chart of steps of an embodiment of a white balance processing method according to the present invention;
FIG. 2 is a schematic illustration of an acceleration of an embodiment of the present invention;
FIG. 3 is a schematic illustration of one rotation angle of an embodiment of the present invention;
FIG. 4 is a flowchart illustrating steps of a white balance processing method according to another embodiment of the present invention;
fig. 5 is a block diagram of a mobile terminal according to an embodiment of the present invention;
fig. 6 is a block diagram of another embodiment of a mobile terminal according to an embodiment of the present invention;
fig. 7 is a schematic diagram of a hardware structure of a mobile terminal according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, a flowchart illustrating steps of an embodiment of a white balance processing method according to an embodiment of the present invention is shown, where the white balance processing method is applied to a mobile terminal, and specifically may include the following steps:
In a specific implementation, the embodiments of the present invention may be applied to a mobile terminal, for example, a mobile phone, a tablet computer, a personal digital assistant, a wearable device (such as a bracelet, glasses, a watch, and the like), and the like. The target image is a current frame image (current frame) currently shot by the mobile terminal.
The picture pixel-by-pixel information is the pixel information of all pixels on the picture of the current frame. The picture pixel-by-pixel information can be obtained by taking values at m (0-i) pixels, the value of m is determined according to conditions and requirements, and m and i are positive integers.
The shooting physical parameters are related physical parameters when the current frame is shot, and include, but are not limited to, acceleration, rotation angle, and focus distance. Acceleration can be acquired through an acceleration sensor, and the acceleration sensor can acquire the acceleration on the x, y and z axes of the mobile terminalSpeed Ax、Ay、Az. Referring to fig. 2, x and y axes are located on a plane on which a screen of the mobile terminal is located, and a z axis is perpendicular to the screen of the mobile terminal. The rotation angle can be acquired through a gyroscope, and the gyroscope can acquire the rotation angle A of the mobile terminal in the three-dimensional spacexz、Axy、AyzReference may be made in particular to fig. 3. The focusing distance is also called an object distance H and refers to the distance from a shooting object to the optical center of a lens of the mobile terminal lens.
n is a positive integer greater than or equal to 1, and in the embodiment of the present invention, a first white balance Gain coefficient, i.e., AWB Gain, of a previous n frames before the target image is also obtained, but of course, only the AWB Gain of the previous 1 frame may be obtained in practical application.
And 102, determining a second white balance gain coefficient and an updating reference coefficient based on the picture pixel-by-pixel information and the shooting physical parameters.
In the embodiment of the present invention, the second white balance gain coefficient is determined based on the picture-by-pixel point information, and the update reference coefficient is determined based on the shooting physical parameter.
In a preferred embodiment of the present invention, the step 102 may include the following sub-steps:
and a substep S11 of determining a continuous variation of the picture using the shooting physical parameter.
The embodiment of the invention can calculate the continuous variable quantity of the picture according to the acquired shooting physical parameters, and the continuous variable quantity of the picture can reflect the change condition of the picture. In one embodiment, the sub-step S11 may include the following sub-steps:
calculating the translation amount of the picture by adopting the acceleration;
calculating the frame offset by adopting the rotation angle;
and calculating the continuous variable quantity of the picture by adopting the translation quantity and the offset quantity.
In a specific implementation, the picture translation amount is related to the acceleration of the mobile terminal lens in a three-dimensional space, the picture offset amount is related to the rotation angle of the mobile terminal lens in the three-dimensional space, and the picture continuous variation can be further calculated according to the picture translation amount and the picture offset amount.
In a preferred embodiment of the present invention, the calculating the frame shift amount by using the acceleration may include:
setting the translation amount as a preset numerical value under the condition that the focusing distance is greater than or equal to a preset distance;
and under the condition that the focusing distance is smaller than a preset distance, calculating the picture translation amount by adopting the acceleration.
If the focusing distance H is considered, when H is greater than a certain distance threshold, it is considered that the translation of the mobile terminal has no influence on the picture translation amount, the picture translation amount T may be set to a preset value, for example, T is 0; when H is less than a certain distance threshold,wherein A isx、Ay、AzAcceleration in each direction, Wx、Wy、WzAre the directional weights.
In another preferred embodiment of the present invention, the acceleration includes a z-axis acceleration perpendicular to the mobile terminal, and an x-axis acceleration and a y-axis acceleration parallel to the mobile terminal, and the calculating the picture shift amount using the acceleration may include the sub-steps of:
under the condition that the focusing distance is larger than or equal to a preset distance, calculating the image translation amount by adopting the x-axis acceleration and the y-axis acceleration;
and under the condition that the focusing distance is smaller than a preset distance, calculating the picture translation amount by adopting the x-axis acceleration, the y-axis acceleration and the z-axis acceleration.
Considering the focus distance H, when H is greater than a certain distance threshold, the movement of the lens in the z-axis direction does not substantially affect the change of the screen, and therefore the movement in the z-axis direction can be consideredWhen H is less than a certain distance threshold,wherein A isx、Ay、AzAcceleration in each direction, Wx、Wy、WzAre the directional weights.
In a preferred embodiment of the present invention, the calculating the picture shift amount using the rotation angle may include the sub-steps of:
and calculating the picture offset by adopting the rotation angle.
If the focusing distance H is not considered, the offset R can be directly calculated by adopting the rotating angle,wherein A isxz、Axy、AyzFor angles of rotation in all directions of three-dimensional space, Wxy、Wxz、WyzAre the directional weights.
In another preferred embodiment of the present invention, said calculating the picture shift amount by using the rotation angle may include the following sub-steps:
under the condition that the focusing distance is larger than or equal to a preset distance, calculating the image offset by adopting the rotation angle;
and setting the picture offset as a preset numerical value under the condition that the focusing distance is smaller than a preset distance.
If the focus distance H is considered, when H is smaller than a certain distance threshold, it may be considered that the mobile terminal is currently moving at a macro, and the actual offset of the picture is not large, at this time, the offset R is set to a preset value, for example, R is 0; when H is equal to or greater than a distance threshold,wherein A isxz、Axy、AyzFor angles of rotation in all directions of three-dimensional space, Wxy、Wxz、WyzAre the directional weights.
The inventionAfter T and R are calculated, the embodiment can calculate the picture variation C, C ═ W from the two datar*R+WtT, wherein, WrIs the weight of the offset R, WtIs the weight of the translation T.
Further, after the picture variation C calculated by weighting T and R is recorded, the picture continuity variation Cn, that is, Cn ═ Σ Ci, can be obtained after C of several consecutive frames is recorded.
And a substep S12 of calculating a second white balance gain coefficient of the target image by using the picture pixel-by-pixel information.
In the embodiment of the invention, the white balance Gain value (AWB Gain) of the current frame can be calculated according to the picture pixel-by-pixel information of the current frame.
In a preferred embodiment of the present invention, the sub-step S12 may include the following sub-steps:
dividing the current frame into at least one picture block;
extracting picture statistical information from the picture pixel-by-pixel point information; the picture statistical information comprises an R component mean value, a G component mean value and a B component mean value of each picture block;
calculating the ratio of the G component mean value to the R component mean value as a first coefficient;
calculating the ratio of the G component mean value to the B component mean value as a second coefficient;
and taking the first coefficient and the second coefficient as a second white balance gain coefficient of the current frame.
In the embodiment of the present invention, the current frame is divided into a plurality of picture blocks, for example, the current frame may be divided into M × N blocks, where M and N are positive integers, and then the R component mean, the G component mean, and the B component mean of each picture block are counted to obtain the picture statistical information of the picture block.
In practical applications, the AWB Gain is calculated, which is generally based on the gray world theory: in any image, when there is enough color change, the average value of R, G, B components of the image tends to be balanced (i.e. three values of RGB are equal, that is, the image should be a black-white-gray type color), according to the gray world theory, the result of averaging R/G, B/G in the image statistics of the current frame should be 1, if the result is not 1, the color temperature of the ambient light source is affected, so that the color of the image can be restored by multiplying the image R, B channel by G/R, G/B only for the effect of the color temperature of the ambient light source. That is, in the embodiment of the present invention, the ratio of the G component mean value to the R component mean value is used as the first coefficient (G/R), and the ratio of the G component mean value to the B component mean value is used as the second coefficient (G/B), where the first coefficient and the second coefficient are the AWB Gain of the current frame.
In a preferred embodiment of the present invention, after the extracting the picture statistical information from the picture pixel-by-pixel information, the method may further include the following steps:
screening out a priori white picture block from the picture block of the current frame;
and acquiring the R component mean value, the G component mean value and the B component mean value of the prior white picture block.
However, the gray world theory is not always true, for example, when there is a relatively large color block in the environment, so the embodiment of the present invention may implement the gray world theory on the basis of a prior white picture block (prior white region) of the current frame, the prior white region is a region defined by adopting a point where a white object is defined in an R/G, B/G coordinate space under light sources of different color temperatures and defining the region on the basis of the point, and after determining the prior white region of the current frame, the AWB Gain may be calculated according to the gray world theory on the basis of an R component mean value, a G component mean value, and a B component mean value in the prior white region.
And a substep S13 of determining an updated reference coefficient according to the continuous variation of the picture.
In a specific implementation, the picture continuous variation can reflect the variation of the picture, so that the embodiment of the present invention can determine an updated reference coefficient according to the picture continuous variation, and the updated reference coefficient is used for adjusting the variation amplitude of the white balance gain coefficient of the current frame.
In a preferred embodiment of the present invention, the sub-step S13 may include the following sub-steps:
setting the updating reference coefficient as a first preset updating reference coefficient under the condition that the continuous variation of the picture is greater than or equal to a preset threshold value;
setting the updating reference coefficient as a second preset updating reference coefficient under the condition that the continuous variation of the picture is smaller than a preset threshold value; the second preset updating reference coefficient is larger than the first preset updating reference coefficient.
And if Cn is larger than a certain threshold value, the picture variation is considered to be larger, the AWB Gain is large in probability at the moment, the AWB fluctuation caused by the color change of the scene object is caused, and a smaller updating reference coefficient is set to update the AWB Gain at the moment. Otherwise, a larger updating reference coefficient is set to update the AWB Gain.
If the camera of the mobile terminal is at a stable color temperature, continuously moving the picture can cause the AWB Gain obtained by calculation to fluctuate near the true value, detecting the picture variation to obtain an updated reference coefficient, and adjusting the AWB Gain of the current frame by the updated reference coefficient so as to inhibit the fluctuation; if the real color temperature changes, the correct AWB Gain can be switched to quickly under the condition that the picture variation is not large, and the correct AWB Gain can be switched to gradually under the condition that the picture variation is large.
And 103, under the condition that the second white balance gain coefficient needs to be updated, updating the second white balance gain coefficient by adopting the updating reference coefficient.
In a specific implementation process, whether the second white balance Gain coefficient, i.e., the AWB Gain of the current frame, needs to be updated may be determined according to the first white balance Gain coefficient and the second white balance Gain coefficient. Specifically, it may be determined whether the second white balance gain coefficient needs to be updated by:
calculating a difference between the first white balance gain factor and the second white balance gain factor;
determining that the second white balance gain coefficient needs to be updated in the case that the difference between the first white balance gain coefficient and the second white balance gain coefficient is greater than or equal to a preset difference;
determining that the second white balance gain factor does not need to be updated in a case where a difference between the first white balance gain factor and the second white balance gain factor is smaller than a preset difference.
And if the difference value between the AWB Gain of the current frame and the AWB Gain of the previous frame or the previous nth frame is larger than a certain difference value, updating the AWB Gain of the current frame.
If the difference value between the AWB Gain of the current frame and the AWB Gain of the previous frame or the previous nth frame is smaller than a certain difference value, the AWB Gain of the current frame does not need to be updated.
104, performing white balance processing on the target image by adopting the updated second white balance gain coefficient; and the target image is a current frame image.
And when the fact that the AWB Gain of the current frame needs to be updated is determined, combining the updating reference coefficient and the AWB Gain of the current frame to calculate a new AWB Gain of the current frame, and performing white balance processing on the current frame by adopting the AWB Gain of the current frame. Wherein the AWB Gain recalculated every other frame or frames is close to the update reference coefficient (step).
In a preferred embodiment of the present invention, the method may further comprise the steps of:
and under the condition that the second white balance gain coefficient is not required to be updated, carrying out white balance processing on the target image by adopting the second white balance gain coefficient.
And when the fact that the AWB Gain of the current frame does not need to be updated is determined, the AWB Gain of the current frame is directly adopted to carry out white balance processing on the current frame.
The embodiment of the invention determines the updating reference coefficient according to the shooting physical parameters of the target image when shooting the target image, calculates the second white balance gain coefficient according to the picture pixel-by-pixel information of the target image, adopts the updating reference coefficient to update the second white balance gain coefficient when the second white balance gain coefficient needs to be updated, and finally adopts the updated second white balance gain coefficient to carry out white balance processing on the target image, and the embodiment of the invention enables the white balance gain coefficient for processing the white balance of the target image to be in a more stable state by setting the updating reference coefficient, so that the stable white balance gain coefficient can be obtained under the condition that the picture is changed due to the displacement of the lens of the mobile terminal and the ambient color temperature is not changed by applying the embodiment of the invention, and the picture is prevented from shaking due to the overlarge change of the white balance coefficient of the target image, and stabilizing the picture quality.
Referring to fig. 4, a flowchart illustrating steps of another embodiment of a white balance processing method according to an embodiment of the present invention is shown, where the white balance processing method is applied to a mobile terminal, and specifically includes the following steps:
step 201, obtaining pixel point-by-pixel point information of a first picture of a target image, pixel point-by-pixel point information of a second picture of the first n frames of the target image, and a first white balance gain coefficient of the first n frames.
n is a positive integer greater than or equal to 1. In the embodiment of the invention, when the mobile terminal shoots the current frame (target image), the pixel point information of a first picture of the current frame is acquired one by one, the pixel point information of a second picture corresponding to the previous n frames respectively is acquired one by one, and in addition, the first white balance gain coefficients corresponding to the previous n frames respectively are also included. It should be noted that, in the embodiment of the present invention, pixel-by-pixel information and a first white balance gain coefficient of a second picture of a previous n frames may be obtained, pixel-by-pixel information and a first white balance gain coefficient of a second picture of a certain frame of the previous n frames may also be obtained, and corresponding data may be obtained according to actual needs, which is not limited in this embodiment of the present invention.
Step 202, based on the first picture pixel-by-pixel information and the second picture pixel-by-pixel information, determining a second white balance gain coefficient and determining an update reference coefficient.
In the embodiment of the invention, the second white balance gain coefficient is determined based on the first picture pixel-by-pixel information, and the updating reference coefficient is determined based on the first picture pixel-by-pixel information and the second picture pixel-by-pixel information.
In a preferred embodiment of the present invention, the step 202 may include the following sub-steps:
sub-step S21, segmenting the target image into at least one first picture block and segmenting the first n frames into at least one second picture block.
In a specific implementation process, the whole current frame and the previous n frames of the picture can be divided into W × H regions (picture blocks), wherein W, H is a positive integer, and the value is determined according to conditions or requirements.
And a substep S22 of screening out the motion picture blocks from the first picture blocks according to the first picture pixel-by-pixel information of each first picture block and the second picture pixel-by-pixel information of each second picture block.
In the embodiment of the invention, the motion picture block can be screened from the first picture block of the current frame according to the picture pixel-by-pixel information respectively corresponding to the picture block of the current frame and the picture block of the previous n frames. The motion picture blocks are the current frame picture areas with large picture changes.
In a preferred embodiment of the present invention, the first picture-by-pixel point information and the second picture-by-pixel point information have pixel point information of each pixel point, and the sub-step S22 may include the following sub-steps:
carrying out difference processing on the pixel point information of the first picture block and the pixel point information of the second picture block at the same position to obtain a difference component;
taking a corresponding pixel point in the first picture block as a moving pixel point under the condition that the difference component exceeds a first preset threshold value;
respectively counting the number of the motion pixel points in each first picture block;
and under the condition that the number of the motion pixel points exceeds a second preset threshold value, taking the first picture block as a motion picture block.
The current frame and the previous n frames are divided into a plurality of picture blocks, and the R component mean value, the G component mean value and the B component mean value of each picture block of the current frame and the previous n frames are respectively counted to obtain picture statistical information.
In one embodiment, a frame difference method is used for each picture block to determine whether the picture block is a moving picture block, specifically, difference processing is performed on picture statistical information of each picture block of a current frame and a previous n frames at the same position to obtain a difference between pixel points, and a moving picture block in the current frame is extracted by thresholding, that is, when the difference between the pixel points in the picture block exceeds a certain motion threshold value, the picture block is considered to be a moving pixel point, and when the number of the moving pixel points in the picture block is greater than a certain number threshold value, the picture block is considered to be a moving picture block; otherwise, if the condition is not met, the moving picture is not the moving picture.
In another preferred embodiment of the present invention, the first picture pixel-by-pixel information and the second picture pixel-by-pixel information have pixel information of each pixel, and the sub-step S22 may include the following sub-steps:
counting pixel point information of the second picture block at the same position, and calculating average pixel point information;
carrying out difference processing on the pixel point information of the first picture block at the same position and the average pixel point information to obtain a difference component;
taking a corresponding pixel point in the first picture block as a moving pixel point under the condition that the difference component exceeds a third preset threshold value;
respectively counting the number of the motion pixel points in each first picture block;
and under the condition that the number of the motion pixel points exceeds a fourth preset threshold value, taking the first picture block as a motion picture block.
In another embodiment, a background subtraction method is adopted for each picture block to judge whether the picture block is a motion picture block, specifically, average pixel point information m is obtained at the same position according to picture statistical information of each picture block of previous n frames (averaging pixel points at the same position of the previous n frames), difference between pixel points is obtained by subtracting m from picture statistical information of the picture block of a current frame, when the difference is greater than a certain motion threshold value, the picture block is considered to be a motion pixel point, then the number n of the motion pixel points in each picture block is counted, and if the n is greater than the certain number threshold value, the picture block is considered to be the motion picture block and the number of the motion picture block is counted; otherwise, if the condition is not met, the moving picture is not the moving picture.
And a substep S23 of counting the number of the motion picture blocks in the target image.
And after the motion picture face blocks are screened from the current frame, counting the number of the motion picture face blocks.
And a substep S24 of calculating a second white balance gain coefficient of the target image by using the first picture pixel-by-pixel information.
In the embodiment of the invention, the white balance Gain value (AWB Gain) of the current frame can be calculated according to the picture pixel-by-pixel information of the current frame.
In a preferred embodiment of the present invention, the sub-step S24 may include the following sub-steps:
extracting picture statistical information from the first picture pixel-by-pixel information; the picture statistical information comprises an R component mean value, a G component mean value and a B component mean value of each first picture block;
calculating the ratio of the G component mean value to the R component mean value as a first coefficient;
calculating the ratio of the G component mean value to the B component mean value as a second coefficient;
and taking the first coefficient and the second coefficient as a second white balance gain coefficient of the current frame.
In the embodiment of the present invention, the current frame is divided into a plurality of picture blocks, for example, the current frame may be divided into M × N blocks, where M and N are positive integers, and then the R component mean, the G component mean, and the B component mean of each picture block are counted.
In practical applications, the AWB Gain is calculated, which is generally based on the gray world theory: in any image, when there is enough color change, the average value of R, G, B components of the image tends to be balanced (i.e. three values of RGB are equal, that is, the image should be a black-white-gray type color), according to the gray world theory, the result of averaging R/G, B/G in the image statistics of the current frame should be 1, if the result is not 1, the color temperature of the ambient light source is affected, so that the color of the image can be restored by multiplying the image R, B channel by G/R, G/B only for the effect of the color temperature of the ambient light source. That is, in the embodiment of the present invention, the ratio of the G component mean value to the R component mean value is used as the first coefficient (G/R), and the ratio of the G component mean value to the B component mean value is used as the second coefficient (G/B), where the first coefficient and the second coefficient are the AWB Gain of the current frame.
In a preferred embodiment of the present invention, after the extracting the picture statistical information from the first picture pixel-by-pixel information, the method further includes:
screening out a prior white picture block from the first picture block of the current frame;
and acquiring the R component mean value, the G component mean value and the B component mean value of the prior white picture block.
However, the gray world theory is not always true, for example, when there is a relatively large color block in the environment, so the embodiment of the present invention may implement the gray world theory on the basis of a prior white picture block (prior white region) of the current frame, the prior white region is a region defined by adopting a point where a white object is defined in an R/G, B/G coordinate space under light sources of different color temperatures and defining the region on the basis of the point, and after determining the prior white region of the current frame, the AWB Gain may be calculated according to the gray world theory on the basis of an R component mean value, a G component mean value, and a B component mean value in the prior white region.
And a substep S25 of determining an updated reference coefficient based on the number.
In a specific implementation, the number (C) of the motion picture blocks may reflect a change condition of a picture, and the more the motion picture blocks, the larger the picture change amount is described, and the less the motion picture blocks, the smaller the picture change amount is described.
In a preferred embodiment of the present invention, the sub-step S25 may include the following sub-steps:
setting the update reference coefficient to a first preset update reference coefficient if the number is greater than or equal to a fifth preset threshold;
setting the update reference coefficient to a second preset update reference coefficient when the number is smaller than a sixth preset threshold;
wherein the second preset updating reference coefficient is larger than the first preset updating reference coefficient. And if C is larger than a certain threshold value, the picture variation is considered to be too large, the AWB Gain is large in probability at the moment, the AWB fluctuation caused by the color change of the scene object is caused, and a smaller updating reference coefficient is set to update the AWB Gain at the moment. Otherwise, a larger updating reference coefficient is set to update the AWB Gain.
If the camera of the mobile terminal is at a stable color temperature, continuously moving the picture can cause the calculated AWB color temperature to fluctuate near the true value, and detecting the number of the motion picture surface blocks can determine the picture variation, then obtaining an updated reference coefficient based on the picture variation, and adjusting the AWB Gain of the current frame by updating the reference coefficient so as to inhibit the fluctuation; if the real color temperature changes, the correct AWB Gain can be switched to quickly under the condition that the picture variation is not large, and the correct AWB Gain can be switched to gradually under the condition that the picture variation is large.
And 203, updating the second white balance gain coefficient by adopting the updating reference coefficient under the condition that the second white balance gain coefficient needs to be updated.
In a specific implementation process, whether the second white balance Gain coefficient, i.e., the AWB Gain of the current frame, needs to be updated may be determined according to the first white balance Gain coefficient and the second white balance Gain coefficient.
In a preferred embodiment of the present invention, the step 207 may include the following sub-steps:
calculating a difference between the first white balance gain factor and the second white balance gain factor;
determining that the second white balance gain coefficient needs to be updated in the case that the difference between the first white balance gain coefficient and the second white balance gain coefficient is greater than or equal to a preset difference;
determining that the second white balance gain factor does not need to be updated in a case where a difference between the first white balance gain factor and the second white balance gain factor is smaller than a preset difference.
And if the difference value between the AWB Gain of the current frame and the AWB Gain of the previous frame or the previous nth frame is larger than a certain difference value, updating the AWB Gain of the current frame.
If the difference value between the AWB Gain of the current frame and the AWB Gain of the previous frame or the previous nth frame is smaller than a certain difference value, the AWB Gain of the current frame does not need to be updated.
And 204, performing white balance processing on the target image by using the updated second white balance gain coefficient.
And when the fact that the AWB Gain of the current frame needs to be updated is determined, combining the updating reference coefficient and the AWB Gain of the current frame to calculate a new AWB Gain of the current frame, and performing white balance processing on the current frame by adopting the AWB Gain of the current frame. Wherein the AWB Gain recalculated every other frame or frames is close to the update reference coefficient (step).
In a preferred embodiment of the present invention, the method may further comprise the steps of:
and under the condition that the second white balance gain coefficient is not required to be updated, carrying out white balance processing on the target image by adopting the second white balance gain coefficient.
And when the fact that the AWB Gain of the current frame does not need to be updated is determined, the AWB Gain of the current frame is directly adopted to carry out white balance processing on the current frame.
The implementation of the invention determines the picture variation by identifying the variation between the pictures of the current frame and the previous n frames, compared with the previous embodiment, the method does not need to acquire the physical shooting parameters of the current frame, and the accuracy of the obtained picture variation is higher, thereby being more beneficial to stabilizing the AWB Gain.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the illustrated order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
Referring to fig. 5, which shows a block diagram of a mobile terminal according to an embodiment of the present invention, the mobile terminal 300 may specifically include the following modules:
the first data acquisition module 301 is configured to acquire picture pixel-by-pixel information of a target image, shooting physical parameters, and a first white balance gain coefficient of n frames before the target image;
a first data determining module 302, configured to determine a second white balance gain coefficient and an update reference coefficient based on the picture pixel-by-pixel information and the shooting physical parameter;
a first updating module 303, configured to update the second white balance gain coefficient by using the update reference coefficient if the second white balance gain coefficient needs to be updated;
a first white balance processing module 304, configured to perform white balance processing on the target image by using the updated second white balance gain coefficient;
wherein the target image is a current frame image; n is a positive integer greater than or equal to 1.
In a preferred embodiment of the present invention, the first data determining module 302 may include:
determining continuous variable quantity of the picture by adopting the shooting physical parameters;
calculating a second white balance gain coefficient of the target image by adopting the picture pixel-by-pixel information;
and determining an updating reference coefficient according to the continuous variation of the picture.
In a preferred embodiment of the present invention, the shooting physical parameters include acceleration, rotation angle; the determining the continuous variation of the picture by using the shooting physical parameters comprises:
calculating the translation amount of the picture by adopting the acceleration;
calculating the frame offset by adopting the rotation angle;
and calculating the continuous variable quantity of the picture by adopting the translation quantity and the offset quantity.
In a preferred embodiment of the present invention, the photographing physical parameter further includes a focus distance;
the calculating the picture translation amount by adopting the acceleration comprises the following steps:
setting the translation amount as a preset numerical value under the condition that the focusing distance is greater than or equal to a preset distance;
and under the condition that the focusing distance is smaller than a preset distance, calculating the picture translation amount by adopting the acceleration.
In a preferred embodiment of the present invention, the photographing physical parameter further includes a focus distance; the acceleration comprises a z-axis acceleration perpendicular to the mobile terminal and an x-axis acceleration and a y-axis acceleration parallel to the mobile terminal;
the calculating the picture translation amount by adopting the acceleration comprises the following steps:
under the condition that the focusing distance is larger than or equal to a preset distance, calculating the image translation amount by adopting the x-axis acceleration and the y-axis acceleration;
and under the condition that the focusing distance is smaller than a preset distance, calculating the picture translation amount by adopting the x-axis acceleration, the y-axis acceleration and the z-axis acceleration.
In a preferred embodiment of the present invention, the calculating the picture shift amount by using the rotation angle includes:
and calculating the picture offset by adopting the rotation angle.
In a preferred embodiment of the present invention, the photographing physical parameter further includes a focus distance;
the calculating the picture offset by adopting the rotation angle comprises the following steps:
under the condition that the focusing distance is larger than or equal to a preset distance, calculating the image offset by adopting the rotation angle;
and setting the picture offset as a preset numerical value under the condition that the focusing distance is smaller than a preset distance.
In a preferred embodiment of the present invention, the mobile terminal further includes:
calculating a difference between the first white balance gain factor and the second white balance gain factor;
determining that the second white balance gain coefficient needs to be updated in the case that the difference between the first white balance gain coefficient and the second white balance gain coefficient is greater than or equal to a preset difference;
determining that the second white balance gain factor does not need to be updated in a case where a difference between the first white balance gain factor and the second white balance gain factor is smaller than a preset difference.
In a preferred embodiment of the present invention, the mobile terminal further includes:
and under the condition that the second white balance gain coefficient is not required to be updated, carrying out white balance processing on the target image by adopting the second white balance gain coefficient.
In a preferred embodiment of the present invention, the determining an updated reference coefficient according to the picture continuous variation includes:
setting the updating reference coefficient as a first preset updating reference coefficient under the condition that the continuous variation of the picture is greater than or equal to a preset threshold value;
setting the updating reference coefficient as a second preset updating reference coefficient under the condition that the continuous variation of the picture is smaller than a preset threshold value;
wherein the second preset updating reference coefficient is larger than the first preset updating reference coefficient.
Referring to fig. 6, which shows a block diagram of another embodiment of the mobile terminal according to the embodiment of the present invention, the mobile terminal 400 may specifically include the following modules:
a second data obtaining module 401, configured to obtain pixel-by-pixel information of a first picture of a target image, pixel-by-pixel information of a second picture of n previous frames of the target image, and a first white balance gain coefficient of the n previous frames; n is a positive integer greater than or equal to 1;
a second data determining module 402, configured to determine a second white balance gain coefficient and determine an update reference coefficient based on the first picture-by-pixel information and the second picture-by-pixel information;
a second updating module 403, configured to update the second white balance gain coefficient by using the updated reference coefficient if the second white balance gain coefficient needs to be updated;
a second white balance processing module 404, configured to perform white balance processing on the target image by using the updated second white balance gain coefficient; and the target image is a current frame image.
In a preferred embodiment of the present invention, the second data determining module 402 comprises:
dividing the target image into at least one first picture block, and dividing the first n frames into at least one second picture block;
screening out the moving picture blocks from the first picture blocks according to the first picture pixel-by-pixel information of each first picture block and the second picture pixel-by-pixel information of each second picture block;
counting the number of the motion picture surface blocks in the target image;
calculating a second white balance gain coefficient of the target image by adopting the pixel point-by-pixel point information of the first picture;
and determining an updated reference coefficient according to the number.
In a preferred embodiment of the present invention, the first picture-by-pixel information and the second picture-by-pixel information have pixel information of each pixel;
the screening out the moving picture blocks from the first picture blocks according to the first picture pixel-by-pixel information of each first picture block and the second picture pixel-by-pixel information of each second picture block comprises the following steps:
carrying out difference processing on the pixel point information of the first picture block and the pixel point information of the second picture block at the same position to obtain a difference component;
taking a corresponding pixel point in the first picture block as a moving pixel point under the condition that the difference component exceeds a first preset threshold value;
respectively counting the number of the motion pixel points in each first picture block;
and under the condition that the number of the motion pixel points exceeds a second preset threshold value, taking the first picture block as a motion picture block.
In a preferred embodiment of the present invention, the first picture-by-pixel information and the second picture-by-pixel information have pixel information of each pixel;
the screening out the moving picture blocks from the first picture blocks according to the first picture pixel-by-pixel information of each first picture block and the second picture pixel-by-pixel information of each second picture block comprises the following steps:
counting pixel point information of the second picture block at the same position, and calculating average pixel point information;
carrying out difference processing on the pixel point information of the first picture block at the same position and the average pixel point information to obtain a difference component;
taking a corresponding pixel point in the first picture block as a moving pixel point under the condition that the difference component exceeds a third preset threshold value;
respectively counting the number of the motion pixel points in each first picture block;
and under the condition that the number of the motion pixel points exceeds a fourth preset threshold value, taking the first picture block as a motion picture block.
In a preferred embodiment of the present invention, the mobile terminal further includes:
calculating a difference between the first white balance gain factor and the second white balance gain factor;
determining that the second white balance gain coefficient needs to be updated in the case that the difference between the first white balance gain coefficient and the second white balance gain coefficient is greater than or equal to a preset difference;
and determining that the second white balance gain coefficient needs to be updated under the condition that the difference value between the first white balance gain coefficient and the second white balance gain coefficient is smaller than a preset difference value.
In a preferred embodiment of the present invention, the mobile terminal further includes:
and under the condition that the second white balance gain coefficient is not required to be updated, performing white balance processing on the target image by adopting the second white balance gain coefficient.
In a preferred embodiment of the present invention, the determining the updated reference coefficient according to the number includes:
setting the update reference coefficient to a first preset update reference coefficient if the number is greater than or equal to a fifth preset threshold;
setting the update reference coefficient to a second preset update reference coefficient when the number is smaller than a sixth preset threshold;
wherein the second preset updating reference coefficient is larger than the first preset updating reference coefficient.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
Fig. 7 is a schematic diagram of a hardware structure of a mobile terminal for implementing various embodiments of the present invention, where the mobile terminal 70 includes, but is not limited to: radio frequency unit 71, network module 72, audio output unit 73, input unit 74, sensor 75, display unit 76, user input unit 77, interface unit 78, memory 79, processor 710, and power supply 711. Those skilled in the art will appreciate that the mobile terminal architecture shown in fig. 7 is not intended to be limiting of mobile terminals, and that a mobile terminal may include more or fewer components than shown, or some components may be combined, or a different arrangement of components. In the embodiment of the present invention, the mobile terminal includes, but is not limited to, a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted terminal, a wearable device, a pedometer, and the like.
The processor 710 is configured to obtain picture pixel-by-pixel information of a target image, shooting physical parameters, and a first white balance gain coefficient of n frames before the target image; determining a second white balance gain coefficient and an updating reference coefficient based on the picture pixel-by-pixel information and the shooting physical parameter; under the condition that the second white balance gain coefficient needs to be updated, updating the second white balance gain coefficient by adopting the updating reference coefficient; performing white balance processing on the target image by adopting the updated second white balance gain coefficient; wherein the target image is a current frame image; n is a positive integer greater than or equal to 1.
The processor 710 is further configured to obtain pixel-by-pixel information of a first picture of a target image, pixel-by-pixel information of a second picture of n previous frames of the target image, and a first white balance gain coefficient of the n previous frames; determining a second white balance gain coefficient and determining an update reference coefficient based on the first picture pixel-by-pixel information and the second picture pixel-by-pixel information; under the condition that the second white balance gain coefficient needs to be updated, updating the second white balance gain coefficient by adopting the updating reference coefficient; performing white balance processing on the target image by adopting the updated second white balance gain coefficient; wherein the target image is a current frame image; n is a positive integer greater than or equal to 1.
The embodiment of the invention determines the updating reference coefficient according to the shooting physical parameters of the target image when shooting the target image, calculates the second white balance gain coefficient according to the picture pixel-by-pixel information of the target image, adopts the updating reference coefficient to update the second white balance gain coefficient when the second white balance gain coefficient needs to be updated, and finally adopts the updated second white balance gain coefficient to carry out white balance processing on the target image, and the embodiment of the invention enables the white balance gain coefficient for processing the white balance of the target image to be in a more stable state by setting the updating reference coefficient, so that the stable white balance gain coefficient can be obtained under the condition that the picture is changed due to the displacement of the lens of the mobile terminal and the ambient color temperature is not changed by applying the embodiment of the invention, and the picture is prevented from shaking due to the overlarge change of the white balance coefficient of the target image, and stabilizing the picture quality.
It should be understood that, in the embodiment of the present invention, the radio frequency unit 71 may be used for receiving and sending signals during a message sending and receiving process or a call process, and specifically, the processor 710 is configured to receive downlink data from a base station and process the received downlink data; in addition, the uplink data is transmitted to the base station. Typically, the radio frequency unit 71 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, and the like. In addition, the radio frequency unit 71 can also communicate with a network and other devices through a wireless communication system.
The mobile terminal provides wireless broadband internet access to the user via the network module 72, such as assisting the user in sending and receiving e-mails, browsing web pages, and accessing streaming media.
The audio output unit 73 may convert audio data received by the radio frequency unit 71 or the network module 72 or stored in the memory 79 into an audio signal and output as sound. Also, the audio output unit 73 may also provide audio output related to a specific function performed by the mobile terminal 70 (e.g., a call signal reception sound, a message reception sound, etc.). The audio output unit 73 includes a speaker, a buzzer, a receiver, and the like.
The input unit 74 is for receiving an audio or video signal. The input Unit 74 may include a Graphics Processing Unit (GPU) 741 and a microphone 742, and the Graphics processor 741 processes image data of a still picture or video obtained by an image capturing device (e.g., a camera) in a video capturing mode or an image capturing mode. The processed image frames may be displayed on the display unit 76. The image frames processed by the graphic processor 741 may be stored in the memory 79 (or other storage medium) or transmitted via the radio frequency unit 71 or the network module 72. The microphone 742 may receive sounds and may be capable of processing such sounds into audio data. The processed audio data may be converted into a format output transmittable to a mobile communication base station via the radio frequency unit 71 in case of the phone call mode.
The mobile terminal 70 also includes at least one sensor 75, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor that adjusts the brightness of the display panel 761 according to the brightness of ambient light, and a proximity sensor that turns off the display panel 761 and/or a backlight when the mobile terminal 70 moves to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), detect the magnitude and direction of gravity when stationary, and can be used to identify the posture of the mobile terminal (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), and vibration identification related functions (such as pedometer, tapping); the sensors 75 may also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which are not described in detail herein.
The display unit 76 is used to display information input by the user or information provided to the user. The Display unit 76 may include a Display panel 761, and the Display panel 761 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like.
The user input unit 77 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the mobile terminal. Specifically, the user input unit 77 includes a touch panel 771 and other input devices 772. The touch panel 771, also referred to as a touch screen, may collect touch operations by a user on or near the touch panel 771 (e.g., operations by a user on or near the touch panel 771 using a finger, stylus, or any suitable object or attachment). The touch panel 771 may include two parts of a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 710, receives a command from the processor 710, and executes the command. In addition, the touch panel 771 can be implemented by various types such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. In addition to the touch panel 771, the user input unit 77 may also include other input devices 772. In particular, other input devices 772 may include, but are not limited to, a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail herein.
Further, the touch panel 771 may be overlaid on the display panel 761, and when the touch panel 771 detects a touch operation thereon or nearby, the touch operation is transmitted to the processor 710 to determine the type of the touch event, and then the processor 710 provides a corresponding visual output on the display panel 761 according to the type of the touch event. Although the touch panel 771 and the display panel 761 are shown as two separate components in fig. 7 to implement the input and output functions of the mobile terminal, in some embodiments, the touch panel 771 and the display panel 761 may be integrated to implement the input and output functions of the mobile terminal, and is not limited herein.
The interface unit 78 is an interface for connecting an external device to the mobile terminal 70. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device having an identification module, an audio input/output (I/O) port, a video I/O port, an earphone port, and the like. The interface unit 78 may be used to receive input (e.g., data information, power, etc.) from external devices and transmit the received input to one or more elements within the mobile terminal 70 or may be used to transmit data between the mobile terminal 70 and external devices.
The memory 79 may be used to store software programs as well as various data. The memory 79 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the memory 79 may include high speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The processor 710 is a control center of the mobile terminal, connects various parts of the entire mobile terminal using various interfaces and lines, and performs various functions of the mobile terminal and processes data by operating or executing software programs and/or modules stored in the memory 79 and calling data stored in the memory 79, thereby integrally monitoring the mobile terminal. Processor 710 may include one or more processing units; preferably, the processor 710 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 710.
The mobile terminal 70 may also include a power supply 711 (e.g., a battery) for powering the various components, and the power supply 711 may be logically coupled to the processor 710 via a power management system that may be configured to manage charging, discharging, and power consumption.
In addition, the mobile terminal 70 includes some functional modules that are not shown, and thus, the detailed description thereof is omitted.
Preferably, an embodiment of the present invention further provides a mobile terminal, including a processor 710, a memory 79, and a computer program stored on the memory 79 and capable of running on the processor 710, where the computer program, when executed by the processor 710, implements each process of the foregoing white balance processing method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not described here again.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements each process of the white balance processing method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.
Claims (19)
1. A white balance processing method is applied to a mobile terminal, and is characterized by comprising the following steps:
acquiring picture pixel-by-pixel information of a target image, shooting physical parameters and a first white balance gain coefficient of n frames before the target image;
determining a second white balance gain coefficient based on the picture pixel-by-pixel information; determining an update reference coefficient based on the shooting physical parameters;
under the condition that the second white balance gain coefficient needs to be updated, updating the second white balance gain coefficient by adopting the updating reference coefficient;
performing white balance processing on the target image by adopting the updated second white balance gain coefficient;
wherein the target image is a current frame image; n is a positive integer greater than or equal to 1.
2. The method of claim 1, wherein determining a second white balance gain coefficient and updating a reference coefficient based on the picture pixel-by-pixel information and the shooting physical parameter comprises:
determining continuous variable quantity of the picture by adopting the shooting physical parameters;
calculating a second white balance gain coefficient of the target image by adopting the picture pixel-by-pixel information;
and determining an updating reference coefficient according to the continuous variation of the picture.
3. The method according to claim 2, wherein the shooting physical parameters include acceleration, rotation angle;
the determining the continuous variation of the picture by using the shooting physical parameters comprises:
calculating the translation amount of the picture by adopting the acceleration;
calculating the frame offset by adopting the rotation angle;
and calculating the continuous variable quantity of the picture by adopting the translation quantity and the offset quantity.
4. The method of claim 3, wherein the shooting physical parameters further include a focus distance;
the calculating the picture translation amount by adopting the acceleration comprises the following steps:
setting the translation amount as a preset numerical value under the condition that the focusing distance is greater than or equal to a preset distance;
and under the condition that the focusing distance is smaller than a preset distance, calculating the picture translation amount by adopting the acceleration.
5. The method of claim 3, wherein the shooting physical parameters further include a focus distance; the acceleration comprises a z-axis acceleration perpendicular to the mobile terminal and an x-axis acceleration and a y-axis acceleration parallel to the mobile terminal;
the calculating the picture translation amount by adopting the acceleration comprises the following steps:
under the condition that the focusing distance is larger than or equal to a preset distance, calculating the image translation amount by adopting the x-axis acceleration and the y-axis acceleration;
and under the condition that the focusing distance is smaller than a preset distance, calculating the picture translation amount by adopting the x-axis acceleration, the y-axis acceleration and the z-axis acceleration.
6. The method according to claim 3, wherein said calculating a picture shift amount using said rotation angle comprises:
and calculating the picture offset by adopting the rotation angle.
7. The method of claim 3, wherein the shooting physical parameters further include a focus distance;
the calculating the picture offset by adopting the rotation angle comprises the following steps:
under the condition that the focusing distance is larger than or equal to a preset distance, calculating the image offset by adopting the rotation angle;
and setting the picture offset as a preset numerical value under the condition that the focusing distance is smaller than a preset distance.
8. The method of claim 1, wherein determining a second white balance gain factor based on the picture pixel-by-pixel information; after determining the updated reference coefficient based on the shooting physical parameters, the method further includes:
calculating a difference between the first white balance gain factor and the second white balance gain factor;
determining that the second white balance gain coefficient needs to be updated in the case that the difference between the first white balance gain coefficient and the second white balance gain coefficient is greater than or equal to a preset difference;
determining that the second white balance gain factor does not need to be updated in a case where a difference between the first white balance gain factor and the second white balance gain factor is smaller than a preset difference.
9. The method according to claim 1 or 8, wherein said determining a second white balance gain factor based on said picture pixel-by-pixel information; after determining the updated reference coefficient based on the shooting physical parameters, the method further includes:
and under the condition that the second white balance gain coefficient is not required to be updated, carrying out white balance processing on the target image by adopting the second white balance gain coefficient.
10. The method according to claim 2, wherein the determining an updated reference coefficient according to the picture continuous variation comprises:
setting the updating reference coefficient as a first preset updating reference coefficient under the condition that the continuous variation of the picture is greater than or equal to a preset threshold value;
setting the updating reference coefficient as a second preset updating reference coefficient under the condition that the continuous variation of the picture is smaller than a preset threshold value;
wherein the second preset updating reference coefficient is larger than the first preset updating reference coefficient.
11. A white balance processing method is applied to a mobile terminal, and is characterized by comprising the following steps:
acquiring first picture pixel-by-pixel information of a target image, second picture pixel-by-pixel information of the first n frames of the target image and a first white balance gain coefficient of the first n frames;
determining a second white balance gain coefficient based on the first picture pixel-by-pixel information; determining an updating reference coefficient based on the first picture pixel-by-pixel information and the second picture pixel-by-pixel information;
under the condition that the second white balance gain coefficient needs to be updated, updating the second white balance gain coefficient by adopting the updating reference coefficient;
performing white balance processing on the target image by adopting the updated second white balance gain coefficient;
wherein the target image is a current frame image; n is a positive integer greater than or equal to 1.
12. The method of claim 11, wherein determining a second white balance gain factor based on the first picture pixel-by-pixel information; determining an update reference coefficient based on the first picture pixel-by-pixel information and the second picture pixel-by-pixel information, including:
dividing the target image into at least one first picture block, and dividing the first n frames into at least one second picture block;
screening out the moving picture blocks from the first picture blocks according to the first picture pixel-by-pixel information of each first picture block and the second picture pixel-by-pixel information of each second picture block;
counting the number of the motion picture surface blocks in the target image;
calculating a second white balance gain coefficient of the target image by adopting the pixel point-by-pixel point information of the first picture;
and determining an updated reference coefficient according to the number.
13. The method according to claim 12, wherein the first picture pixel-by-pixel information and the second picture pixel-by-pixel information have pixel information of each pixel;
the screening out the moving picture blocks from the first picture blocks according to the first picture pixel-by-pixel information of each first picture block and the second picture pixel-by-pixel information of each second picture block comprises the following steps:
carrying out difference processing on the pixel point information of the first picture block and the pixel point information of the second picture block at the same position to obtain a difference component;
taking a corresponding pixel point in the first picture block as a moving pixel point under the condition that the difference component exceeds a first preset threshold value;
respectively counting the number of the motion pixel points in each first picture block;
and under the condition that the number of the motion pixel points exceeds a second preset threshold value, taking the first picture block as a motion picture block.
14. The method according to claim 12, wherein the first picture pixel-by-pixel information and the second picture pixel-by-pixel information have pixel information of each pixel;
the screening out the moving picture blocks from the first picture blocks according to the first picture pixel-by-pixel information of each first picture block and the second picture pixel-by-pixel information of each second picture block comprises the following steps:
counting pixel point information of the second picture block at the same position, and calculating average pixel point information;
carrying out difference processing on the pixel point information of the first picture block at the same position and the average pixel point information to obtain a difference component;
taking a corresponding pixel point in the first picture block as a moving pixel point under the condition that the difference component exceeds a third preset threshold value;
respectively counting the number of the motion pixel points in each first picture block;
and under the condition that the number of the motion pixel points exceeds a fourth preset threshold value, taking the first picture block as a motion picture block.
15. The method of claim 12, wherein determining a second white balance gain factor based on said first picture pixel-by-pixel information; after determining the updated reference coefficient based on the first picture pixel-by-pixel information and the second picture pixel-by-pixel information, the method further includes:
calculating a difference between the first white balance gain factor and the second white balance gain factor;
determining that the second white balance gain coefficient needs to be updated in the case that the difference between the first white balance gain coefficient and the second white balance gain coefficient is greater than or equal to a preset difference;
determining that the second white balance gain factor does not need to be updated in a case where a difference between the first white balance gain factor and the second white balance gain factor is smaller than a preset difference.
16. The method according to claim 11 or 15, wherein a second white balance gain factor is determined based on the first picture pixel-by-pixel information; after determining the updated reference coefficient based on the first picture pixel-by-pixel information and the second picture pixel-by-pixel information, the method further includes:
and under the condition that the second white balance gain coefficient is not required to be updated, performing white balance processing on the target image by adopting the second white balance gain coefficient.
17. The method of claim 12, wherein determining the updated reference coefficients based on the number comprises:
setting the update reference coefficient to a first preset update reference coefficient if the number is greater than or equal to a fifth preset threshold;
setting the update reference coefficient to a second preset update reference coefficient when the number is smaller than a sixth preset threshold;
wherein the second preset updating reference coefficient is larger than the first preset updating reference coefficient.
18. A mobile terminal, characterized in that the mobile terminal comprises:
the first data acquisition module is used for acquiring picture pixel-by-pixel information of a target image, shooting physical parameters and a first white balance gain coefficient of n frames before the target image;
the first data determining module is used for determining a second white balance gain coefficient based on the picture pixel-by-pixel information; determining an update reference coefficient based on the shooting physical parameters;
a first updating module, configured to update the second white balance gain coefficient by using the update reference coefficient when the second white balance gain coefficient needs to be updated;
the first white balance processing module is used for carrying out white balance processing on the target image by adopting the updated second white balance gain coefficient;
wherein the target image is a current frame image; n is a positive integer greater than or equal to 1.
19. A mobile terminal, characterized in that the mobile terminal comprises:
the second data acquisition module is used for acquiring pixel point-by-pixel point information of a first picture of a target image, pixel point-by-pixel point information of a second picture of the previous n frames of the target image and a first white balance gain coefficient of the previous n frames; n is a positive integer greater than or equal to 1;
the second data determination module is used for determining a second white balance gain coefficient based on the pixel point-by-pixel point information of the first picture; determining an updating reference coefficient based on the first picture pixel-by-pixel information and the second picture pixel-by-pixel information;
a second updating module, configured to update the second white balance gain coefficient by using the updated reference coefficient when the second white balance gain coefficient needs to be updated;
the second white balance processing module is used for carrying out white balance processing on the target image by adopting the updated second white balance gain coefficient;
and the target image is a current frame image.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811643403.2A CN109462745B (en) | 2018-12-29 | 2018-12-29 | White balance processing method and mobile terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811643403.2A CN109462745B (en) | 2018-12-29 | 2018-12-29 | White balance processing method and mobile terminal |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109462745A CN109462745A (en) | 2019-03-12 |
CN109462745B true CN109462745B (en) | 2020-01-21 |
Family
ID=65615729
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811643403.2A Active CN109462745B (en) | 2018-12-29 | 2018-12-29 | White balance processing method and mobile terminal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109462745B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110611803A (en) * | 2019-09-03 | 2019-12-24 | 珠海格力电器股份有限公司 | Color temperature estimation method and device and computer readable medium |
WO2022126379A1 (en) * | 2020-12-15 | 2022-06-23 | 深圳市大疆创新科技有限公司 | Method and device for image processing, and image capturing device |
CN112802052A (en) * | 2021-01-19 | 2021-05-14 | 北京小米移动软件有限公司 | Image recognition method and device, electronic equipment and storage medium |
CN113038094B (en) * | 2021-03-29 | 2022-11-18 | 维沃移动通信(深圳)有限公司 | Image acquisition method and device |
CN113596426B (en) * | 2021-08-17 | 2023-04-07 | 浙江大华技术股份有限公司 | Method and device for determining white balance value of image, storage medium and electronic device |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103929631A (en) * | 2013-01-15 | 2014-07-16 | 瑞昱半导体股份有限公司 | White balance adjusting method using scene detection and device thereof |
CN106331661A (en) * | 2015-06-25 | 2017-01-11 | 西安中兴新软件有限责任公司 | White balance processing method and device |
CN107959839A (en) * | 2017-11-27 | 2018-04-24 | 努比亚技术有限公司 | A kind of method of blank level adjustment, terminal and computer-readable recording medium |
WO2018075133A1 (en) * | 2016-10-21 | 2018-04-26 | Qualcomm Incorporated | Mesh-based auto white balancing |
-
2018
- 2018-12-29 CN CN201811643403.2A patent/CN109462745B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103929631A (en) * | 2013-01-15 | 2014-07-16 | 瑞昱半导体股份有限公司 | White balance adjusting method using scene detection and device thereof |
CN106331661A (en) * | 2015-06-25 | 2017-01-11 | 西安中兴新软件有限责任公司 | White balance processing method and device |
WO2018075133A1 (en) * | 2016-10-21 | 2018-04-26 | Qualcomm Incorporated | Mesh-based auto white balancing |
CN107959839A (en) * | 2017-11-27 | 2018-04-24 | 努比亚技术有限公司 | A kind of method of blank level adjustment, terminal and computer-readable recording medium |
Also Published As
Publication number | Publication date |
---|---|
CN109462745A (en) | 2019-03-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109462745B (en) | White balance processing method and mobile terminal | |
CN109361865B (en) | Shooting method and terminal | |
CN109688322B (en) | Method and device for generating high dynamic range image and mobile terminal | |
CN107846583B (en) | Image shadow compensation method and mobile terminal | |
CN108307109B (en) | High dynamic range image preview method and terminal equipment | |
CN108924414B (en) | Shooting method and terminal equipment | |
CN108234894B (en) | Exposure adjusting method and terminal equipment | |
CN110213484B (en) | Photographing method, terminal equipment and computer readable storage medium | |
CN108449541B (en) | Panoramic image shooting method and mobile terminal | |
CN111083386B (en) | Image processing method and electronic device | |
CN107623818B (en) | Image exposure method and mobile terminal | |
CN107730460B (en) | Image processing method and mobile terminal | |
CN108040240B (en) | White balance adjustment method and device and mobile terminal | |
CN110868544B (en) | Shooting method and electronic equipment | |
CN111064895B (en) | Virtual shooting method and electronic equipment | |
CN111147752B (en) | Zoom factor adjusting method, electronic device, and medium | |
CN109819166B (en) | Image processing method and electronic equipment | |
CN110855901B (en) | Camera exposure time control method and electronic equipment | |
CN109474784B (en) | Preview image processing method and terminal equipment | |
CN109727212B (en) | Image processing method and mobile terminal | |
CN111028192B (en) | Image synthesis method and electronic equipment | |
CN111131722A (en) | Image processing method, electronic device, and medium | |
CN110708475B (en) | Exposure parameter determination method, electronic equipment and storage medium | |
CN111008929B (en) | Image correction method and electronic equipment | |
CN110363729B (en) | Image processing method, terminal equipment and computer readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |