WHITE BALANCE CONTROL METHOD AND APPARATUS, TERMINAL DEVICE, AND STORAGE MEDIUM

Information

  • Patent Application
  • 20230216998
  • Publication Number
    20230216998
  • Date Filed
    March 03, 2023
    a year ago
  • Date Published
    July 06, 2023
    9 months ago
Abstract
Disclosed is a white balance control method, including: acquiring a target pixel value of a target white point in a target image; calculating a target pixel sum value corresponding to a preset color temperature zone by using the target pixel value; obtaining a pixel gain value based on the target pixel sum value and a preset weight corresponding to the preset color temperature zone; and performing white balance adjustment on the target image by using the pixel gain value to obtain a result image. The present disclosure also provides a white balance control apparatus, a terminal device and a computer readable storage medium.
Description
TECHNICAL FIELD

The present disclosure relates to the technical field of image processing, and in particular to a white balance control method and a white balance control method apparatus, a terminal device, and a computer readable storage medium.


BACKGROUND

The basic concept of white balance refers to “a white object can be restored to white at any light source color temperature”. The color cast phenomenon occurs when shooting under a specific light source, and it is compensated by strengthening the corresponding complementary color.


Automatic white balance control may restore the image to a normal color image at different color temperatures. In the related technology, a white balance control method is disclosed, which uses the gray world method, the color temperature curve method or the perfect reflection method to control the white balance.


However, there is still color cast phenomenon with the existing white balance control methods.


SUMMARY

A main object of the present disclosure is to provide a white balance control method and apparatus, a terminal device, and a computer readable storage medium, aiming at solving the technical problem that the existing white balance control methods still have color cast phenomenon in the related art.


In order to achieve the above object, a white balance control method is provided in the present disclosure, the method including the following steps:


acquiring a target pixel value of a target white point in a target image;


calculating a target pixel sum value corresponding to a preset color temperature zone by using the target pixel value;


obtaining a pixel gain value based on the target pixel sum value and a preset weight corresponding to the preset color temperature zone; and


performing white balance adjustment on the target image by using the pixel gain value to obtain a result image.


In an embodiment, the target image is acquired by a target camera, and before the acquiring the target pixel value of the target white point in the target image, the method further includes:


performing curve calibration and fitting on the target camera by using a preset color temperature lamp corresponding to a preset color temperature range to obtain a target Planck color temperature curve of the target camera; and


obtaining the preset color temperature zone based on the target Planck color temperature curve,


the acquiring the target pixel value of the target white point in the target image includes:


determining a pixel point in the target image whose pixel value matches the target Planck color temperature curve as the target white point; and


acquiring the target pixel value of the target white point.


In an embodiment, before the obtaining the pixel gain value based on the target pixel sum value and the preset weight corresponding to the preset color temperature zone, the method further includes:


counting a number of white points of target white points in the preset color temperature zone; and


adjusting the preset weight by using the number of white points, a preset maximum number of white points and a preset minimum number of white points to obtain an actual weight corresponding to the preset color temperature zone,


the obtaining the pixel gain value based on the target pixel sum value and the preset weight corresponding to the preset color temperature zone includes:


obtaining a pixel gain value based on the target pixel sum value and the actual weight.


In an embodiment, the obtaining the pixel gain value based on the target pixel sum value and the actual weight includes:


obtaining a result pixel sum value based on the target pixel sum value and the actual weight; and


obtaining the pixel gain value based on the result pixel sum value.


In an embodiment, the adjusting the preset weight by using the number of white points, the preset maximum number of white points and the preset minimum number of white points to obtain the actual weight corresponding to the preset color temperature zone includes:


obtaining the actual weight by using formula I based on the number of white points, the preset maximum number of white points, the preset minimum number of white points, the preset weight and a minimum value of preset weight corresponding to the preset color temperature zone;


the formula I is as follows:







K
n


=

{











K
n

,


T
n



T

max
,
n










(


K
n

-

K

min
,
n



)

*

(


T
n

-

T

min
,
n



)







T

max
,
n


-

T

min
,
n










K

min
,
n


,


T
n



T

min
,
n







+

K

min
,
n



,


T

max
,
n


>

T
n



T

min
,
n









in which K′n is the actual weight corresponding to any preset color temperature zone n of preset color temperature zones, Kn is the preset weight corresponding to the preset color temperature zone n, Kmin,n is the minimum value of preset weight corresponding to the preset color temperature zone n, Tn is the number of white points corresponding to the preset color temperature zone n, Tmin,n is the preset minimum number of white points corresponding to the preset color temperature zone n, and Tmax,n is the preset maximum number of white points corresponding to the preset color temperature zone n.


In an embodiment, the obtaining the result pixel sum value based on the target pixel sum value and the actual weight includes:


obtaining the result pixel sum value by using formula II based on the target pixel sum value and the actual weight;


the formula II is as follows:







SUM

(
R
)

=





i
=
1

N



K

n




*

SUM

(

R
n

)







i
=
1

N


K
n











SUM

(
G
)

=





i
=
1

N



K
n


*

SUM

(

G
n

)







i
=
1

N


K
n











SUM

(
B
)

=





i
=
1

N



K
n


*

SUM

(

B
n

)







i
=
1

N


K
n








in which SUM(R), SUM(G) and SUM(B) are a result red pixel sum value, a result green pixel sum value and a result blue pixel sum value in the result pixel sum value respectively, N is a quantity of the preset color temperature zones, SUM(Rn) is a target red pixel sum value in the target pixel sum value corresponding to the preset color temperature zone n, SUM(Gn) is a target green pixel sum value in the target pixel sum value corresponding to the preset color temperature zone n, and SUM(Bn) is a target blue pixel sum value in the target pixel sum value corresponding to the preset color temperature zone n.


In an embodiment, the pixel gain value includes a red gain value, a green gain value and a blue gain value; the step of obtaining the pixel gain value based on the result pixel sum value includes:


in response that the result green pixel sum value is largest, determining a ratio of the result green pixel sum value to the result red pixel sum value as the red gain value, determining a ratio of the result green pixel sum value to the result blue pixel sum value as the blue gain value, and determining a first preset constant as the green gain value; or


in response that the result red pixel sum value is largest, determining a ratio of the result red pixel sum value to the result green pixel sum value as the green gain value, determining a ratio of the result red pixel sum value to the result blue pixel sum value as the blue gain value, and determining a second preset constant as the red gain value; or


in response that the result blue pixel sum value is largest, determining a ratio of the result blue pixel sum value to the result red pixel sum value as the red gain value, determining a ratio of the result blue pixel sum value to the result green pixel sum value as the green gain value, and determining a third preset constant as the blue gain value.


In addition, in order to achieve the above object, a white balance control apparatus is also provided in the present disclosure, including:


an acquisition module configured to acquire a target pixel value of a target white point in a target image;


a calculation module configured to calculate a target pixel sum value corresponding to a preset color temperature zone by using the target pixel value;


an obtaining module configured to obtain a pixel gain value based on the target pixel sum value and a preset weight corresponding to the preset color temperature zone; and


an adjustment module configured to perform white balance adjustment on the target image by using the pixel gain value to obtain a result image.


In addition, in order to achieve the above object, a terminal device is also provided in the present disclosure, including a memory, a processor, and a white balance control program stored in the memory and executable by the processor, and the white balance control program, when executed by the processor, implements the white balance control method as described in any one of the above embodiments.


In addition, in order to achieve the above object, a computer readable storage medium is also provided in the present disclosure, on which a white balance control program is stored, and the white balance control program, when executed by a processor, implements the steps of the white balance control method as described in any one of the above embodiments.


The technical solution of the present disclosure provides a white balance control method, the method including the following steps: acquiring a target pixel value of a target white point in a target image; calculating a target pixel sum value corresponding to a preset color temperature zone by using the target pixel value; obtaining a pixel gain value based on the target pixel sum value and a preset weight corresponding to the preset color temperature zone; and performing white balance adjustment on the target image by using the pixel gain value to obtain a result image.


In the existing methods, when there are interfering color blocks in the target image, the interfering color blocks will have negative effects on the adjustment of the target image, so that the obtained result image still has inaccurate white balance, resulting in color cast of the result image. In the present disclosure, the final pixel gain value is obtained based on the target pixel value of the target white point in the target image, and the target image is subjected to white balance adjustment by using the pixel gain value to obtain the result image, so the target pixel value will not be affected by the interfering color blocks in the target image, thus making the accuracy of the pixel gain value higher, and in turn making the white balance of the result image accurate and avoiding the color cast of the result image.





BRIEF DESCRIPTION OF THE DRAWINGS

In order to describe technical solutions in the embodiments of the present disclosure or in the related art more clearly, accompanying drawings to be used in the description of the embodiments or the related art will be introduced briefly below. Obviously, the accompanying drawings to be described below are merely some embodiments of the present disclosure, and a person of ordinary skill in the art may obtain other drawings according to the structures shown in these drawings without any creative work.



FIG. 1 is a schematic structural diagram of a terminal device in a hardware operating environment related to embodiments of the present disclosure.



FIG. 2 is a schematic flowchart of a white balance control method according to a first embodiment of the present disclosure.



FIG. 3 is a schematic diagram of a target Planck color temperature curve of the present disclosure.



FIG. 4 shows a relationship between a preset color temperature zone and the target Planck color temperature curve of the present disclosure.



FIG. 5 is a structural block diagram of a white balance control apparatus according to a first embodiment of the present disclosure.





The implement of the objects, functional characteristics and advantages of the present disclosure will be further explained with reference to the accompanying drawings in combination with the embodiments.


DETAILED DESCRIPTION OF THE EMBODIMENTS

The technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by a person of ordinary skill in the art without creative work fall into the scope of the present disclosure.


Referring to FIG. 1, FIG. 1 is a schematic structural diagram of a terminal device in a hardware operating environment related to the embodiments of the present disclosure.


The terminal device may be a user equipment (UE) such as a mobile phone, a smart phone, a laptop, a digital broadcast receiver, a personal digital assistant (PDA), or a tablet (PAD), a hand-held device, a vehicle-mounted device, a wearable device, a computing device or other processing devices connected to a wireless modem, a Mobile station (MS) or the like. The terminal device may be known as a user terminal, a portable terminal, a desktop terminal, or the like.


Generally, the terminal device includes at least one processor 301, a memory 302, and a white balance control program stored in the memory and running on the processor, and the white balance control program is configured to implement the steps of the white balance control method as described above.


The processor 301 may include one or more processing cores, such as a 4-core processor, an 8-core processor, or the like. The processor 301 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA) and programmable logic array (PLA). The processor 301 may further include a main processor and a co-processor. The main processor is a processor for processing data in a wake-up state, and also known as central processing unit (CPU). The co-processor is a low-power processor for processing data in a standby state. In some embodiments, the processor 301 may be integrated with a graphics processing unit (GPU), which is used to be responsible for rendering and drawing the contents to be displayed on the display screen. The processor 301 may further include an artificial intelligence (AI) processor, which is used to process operations related to the white balance control method, so that the white balance control method model may be trained and learned autonomously to improve efficiency and accuracy.


The memory 302 may include one or more computer-readable storage media, which may be non-transitory. The memory 302 may also include a high-speed random access memory, and a non-volatile memory, such as one or more magnetic disk storage devices and flash memory storage devices. In some embodiments, the non-transitory computer readable storage medium in the memory 302 is used to store at least one instruction, which is used to be executed by the processor 301 to implement the white balance control method provided by the method embodiments in the present disclosure.


In some embodiments, the terminal device may further include a communication interface 303 and at least one peripheral device. The processor 301, the memory 302 and the communication interface 303 may be connected through a bus or a signal line. Each peripheral device may be connected with the communication interface 303 through a bus, a signal line or a circuit board. Specifically, the peripheral device includes at least one of a radio frequency circuit 304, a display screen 305 and a power supply 306.


The communication interface 303 may be used to connect at least one peripheral device related to input/output (I/O) to the processor 301 and the memory 302. In some embodiments, the processor 301, the memory 302 and the communication interface 303 are integrated on the same chip or circuit board. In some other embodiments, any one or two of the processor 301, the memory 302 and the communication interface 303 may be implemented on separated chips or circuit boards, which is not limited is this embodiment.


The radio frequency circuit 304 is used for receiving and transmitting radio frequency (RF) signals, which is also known as electromagnetic signals. The radio frequency circuit 304 communicates with the communication network and other communication devices through electromagnetic signals. The radio frequency circuit 304 converts an electrical signal into an electromagnetic signal for transmission, or converts the received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 304 includes an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and the like. The radio frequency circuit 304 may communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to, metropolitan area network, various mobile communication networks (2G, 3G, 4G and 5G), wireless local area network and/or wireless fidelity (WiFi) network. In some embodiments, the radio frequency circuit 304 may further include a circuit related to near field communication (NFC), which is not limited in the present disclosure.


The display screen 305 is used to display a user interface (UI). The UI may include graphics, text, icon, video and any combination thereof. When the display screen 305 is a touch display screen, the display screen 305 also has the ability to collect the touch signal on or above the surface of the display screen 305. The touch signal may be input to the processor 301 as a control signal for processing. At this time, the display screen 305 may also be used to provide a virtual button and/or a virtual keyboard, also known as a soft button and/or a soft keyboard. In some embodiments, the display screen 305 may be a front panel of an electronic equipment. In other embodiments, there may be at least two display screens 305, which are respectively arranged on different surfaces of the electronic equipment or in a folding design. In other embodiments, the display screen 305 may be a flexible display screen, which is arranged on a curved surface or a folded surface of the electronic equipment. Even, the display screen 305 may be set as a non-rectangular irregular shape, that is, a profiled screen. The display screen 305 may be made of liquid crystal display (LCD), organic light-emitting diode (OLED) and other materials.


The power supply 306 may be used to supply power to various assemblies in the electronic equipment. The power source 306 may be AC, DC, disposable battery or rechargeable battery. When the power supply 306 includes a rechargeable battery, the rechargeable battery may support wired charging or wireless charging. The rechargeable battery may also be used to support fast charging technology.


Those skilled in the art may understand that the structure shown in FIG. 1 does not constitute a limitation on the terminal device, and may include more or less components than those shown, or a combination of some components, or include differently arranged components.


In addition, the embodiment of the present disclosure also provides a computer readable storage medium, on which a white balance control program is stored, and the white balance control program, when executed by a processor, implements the steps of the white balance control method as described above. Therefore, the white balance control method will not be repeated here. In addition, the beneficial effects achieved by using the same method will not be repeated. For the technical details not disclosed in the embodiment of the computer readable storage medium related to the present disclosure, please refer to the description of the method embodiment of the present disclosure. As an example, the program instructions may be deployed to be executed on one terminal device, or on a plurality of terminal devices located in one place, or on a plurality of terminal devices distributed in a plurality of places and interconnected by a communication network.


A person of ordinary skill in the art may understand that all or part of the processes for implementing the embodiments of the above methods may be completed by instructing related hardware via the computer program, and the above program may be stored in a computer-readable storage medium, and when executed, the program may include the processes of the embodiments of the above methods. The computer readable storage medium may be a magnetic disk, an optical disk, a read only memory (ROM), a random access memory (RAM), or the like.


Based on the above hardware structure, an embodiment of the white balance control method of the present disclosure is provided.


Referring to FIG. 2, FIG. 2 is a schematic flowchart of a white balance control method according to a first embodiment of the present disclosure. The method, which is applied to a terminal device, includes the following steps:


S11: acquiring a target pixel value of a target white point in a target image.


It should be noted that a subject for implementing the present disclosure is a terminal device, the mechanism of which is described above and thus will not be repeated here. The terminal device is installed with a white balance control program, and when the terminal device executes the white balance control program, the steps of the white balance control method of the present disclosure are implemented.


The target image is an image for which the white balance is to be adjusted. The target image may be an image already taken by a target camera (such as a camera configured to shoot the target image), an image being scanned by the target camera (for example, scanning a QR code), or an image being prepared to be shot by the target camera (the target camera is turned on, and the user sees the image through the target camera, and the user does not press the shutter release button at this time). The target camera may be a camera built into the terminal device, or a camera connected to the terminal device.


Further, the target image is acquired by a target camera, and before the step of acquiring the target pixel value of the target white point in the target image, the method further includes: performing curve calibration and fitting on the target camera by using a preset color temperature lamp corresponding to a preset color temperature range to obtain a target Planck color temperature curve of the target camera; obtaining a preset color temperature zone based on the target Planck color temperature curve. Accordingly, the step of acquiring the target pixel value of the target white point in the target image includes: determining a pixel point in the target image whose pixel value matches the target Planck color temperature curve as the target white point; and acquiring the target pixel value of the target white point.


It should be noted that the preset color temperature range may be a color temperature range with a color temperature value of 1800 K to 10000 K. Generally, in order to obtain the Planck color temperature curve corresponding to the preset color temperature range, it is necessary to select a plurality of preset color temperature lamps (for example, D65 color temperature lamps with a color temperature value of 6500 K, D50 color temperature lamps with a color temperature value of 5000 K, TL40 color temperature lamps with a color temperature value of 4000 K, F color temperature lamps with a color temperature value of 2700 K) to perform curve calibration and fitting on the target camera to obtain the Planck color temperature curve of the target camera, namely the target Planck color temperature curve. For a target camera, the step of performing curve calibration and fitting on the target camera by using the preset color temperature lamp corresponding to the preset color temperature range is carried out only once to obtain the target Planck color temperature curve of the target camera. For a plurality of target cameras, curve calibration and fitting are carried out on each target camera by using the preset color temperature lamp corresponding to the preset color temperature range to obtain the respective target Planck color temperature curves of the target cameras.


Referring to FIG. 3, which is a schematic diagram of the target Planck color temperature curve of the present disclosure, the dotted line part represents the target Planck color temperature curve, and the solid line part represents the color temperature space threshold which may be set by the user based on the requirements and is not limited in the present disclosure.


In the present disclosure, the preset color temperature zones may be obtained based on the target Planck color temperature curve, and the number of the preset color temperature zones is preferably selected as five.


Referring to FIG. 4, FIG. 4 shows a relationship between the preset color temperature zone and the target Planck color temperature curve. In FIG. 3, the effective area of the target Planck color temperature curve is divided into five preset color temperature zones: ZONE1-ZONE5, in which the area covered by ZONE1-ZONE5 is the effective area, and the areas outside ZONE1-ZONE5 are the non-effective areas and thus do not have to be selected. The color temperature range of ZONE1 is 1800 K to 2700 K, the color temperature range of ZONE2 is 2700 K to 4000 K, the color temperature range of ZONE 3 is 4000 K to 5500 K, the color temperature range of ZONE 4 is 5500 K to 7500 K, and the color temperature range of ZONE 5 is 7500 K to 10000 K.


The pixel value of each pixel point in the target image needs to be acquired, and the pixel point whose pixel value matches the target Planck color temperature curve is determined as the target white point. Matching the pixel value of a pixel point with the target Planck color temperature curve means that the pixel value of the pixel point falls within the range of the color temperature space threshold in the target Planck color temperature curve, and the pixel value falls in the effective area of the target Planck color temperature curve (for example, the area set corresponding to the five areas of ZONE1-ZONE5 as above). The pixel value of the target white point needs to be acquired.


S12: calculating a target pixel sum value corresponding to a preset color temperature zone by using the target pixel value.


It should be noted that in the present disclosure, each preset color temperature zone corresponds to a number of target white points. For a preset color temperature zone, the pixel values of all target white points included in the preset color temperature zone need to be summed to obtain a target pixel sum value.


It should be understood that for a preset color temperature zone, the target pixel sum value includes a target red pixel sum value, a target blue pixel sum value and a target green pixel sum value. That is to say, for this preset color temperature zone, it is necessary to calculate the blue pixel sum value of all target white points, the red pixel sum value of all target white points, and the green pixel sum value of all target white points.


For example, if the ZONE1 area includes 100 target white points, the red pixel value of the 100 white points need to be summed to obtain the red pixel sum value of the ZONE1 area, and similarly, the green pixel sum value of the ZONE1 area and the blue pixel sum value of the ZONE1 area are also obtained.


S13: obtaining a pixel gain value based on the target pixel sum value and a preset weight corresponding to the preset color temperature zone.


It should be noted that the preset weight includes a red preset weight, a blue preset weight and a green preset weight. Correspondingly, the pixel gain value includes a green pixel gain value, a red pixel gain value and a blue pixel gain value. For a preset color temperature zone, the red pixel gain value needs to be obtained based on the red pixel sum value and the red preset weight of the preset color temperature zone. Similarly, the green pixel gain value needs to be obtained based on the green pixel sum value and the green preset weight of the preset color temperature zone, and the blue pixel gain value needs to be obtained based on the blue pixel sum value and the blue preset weight of the preset color temperature zone. However, for a plurality of preset color temperature zones, step S11 is required for each preset color temperature zone to obtain the pixel gain value corresponding to each preset color temperature zone.


According to the conventional application environment, referring to the settings of ZONE1-ZONE5 as above, the preset weight of ZONE4 is the highest, followed by that of ZONE3, followed by that of ZONE5, and then followed by that of ZONE2, and finally ZONE1. The preset weights of the ZONE1-ZONE5 may be set as Kn (n is a natural number of 1 to 5), and then the minimum value of the preset weights of ZONE1-ZONE5 is Kmin,n. The sum of preset weights corresponding to the plurality of preset color temperature zones may be equal to 1. If the target white points in a preset color temperature range are not considered at all, all the corresponding preset weights should be set to 0.


Further, before the step of obtaining the pixel gain value based on the target pixel sum value and the preset weight corresponding to the preset color temperature zone, the method further includes: counting a number of white points of the target white points in the preset color temperature zone; and adjusting the preset weight by using the number of white points, a preset maximum number of white points and a preset minimum number of white points to obtain an actual weight corresponding to the preset color temperature zone. Accordingly, the step of obtaining the pixel gain value based on the target pixel sum value and the preset weight corresponding to the preset color temperature zone includes: obtaining a pixel gain value based on the target pixel sum value and the actual weight.


It should be noted that the preset weight needs to be adjusted based on the number of white points corresponding to the target image, and the red preset weight, blue preset weight and green preset weight all need to be adjusted.


In particular, the step of adjusting the preset weight by using the number of white points, the preset maximum number of white points and the preset minimum number of white points to obtain the actual weight corresponding to the preset color temperature zone includes:


obtaining the actual weight by using formula I based on the number of white points, the preset maximum number of white points, the preset minimum number of white points, the preset weight and a minimum value of preset weight corresponding to the preset color temperature zone;


the formula I is as follows:







K
n


=

{











K
n

,


T
n



T

max
,
n










(


K
n

-

K

min
,
n



)

*

(


T
n

-

T

min
,
n



)







T

max
,
n


-

T

min
,
n










K

min
,
n


,


T
n



T

min
,
n







+

K

min
,
n



,


T

max
,
n


>

T
n



T

min
,
n









in which K′n is the actual weight corresponding to any preset color temperature zone n of the preset color temperature zones, Kn is the preset weight corresponding to the preset color temperature zone n, Kn is the minimum value of preset weight corresponding to the preset color temperature zone n, Tn is the number of white points corresponding to the preset color temperature zone n, Tmin,n is the preset minimum number of white points corresponding to the preset color temperature zone n, and Tmax,n is the preset maximum number of white points corresponding to the preset color temperature zone n.


It should be noted that, in the present disclosure, the red preset weight, the blue preset weight and the green preset weight in the preset weight are the same, that is, the preset weight Kn, and similarly, the calculated actual weight K′n and the minimum value of preset weight Kmin,n corresponding to the red, blue and green weights are the same. In addition, the preset maximum number of white points Tmax,n and the preset minimum number of white points Tmin,n for a preset color temperature zone are determined based on the size of the actual target image and the proportion of the target white points in the preset color temperature zone.


It should be understood that, if five preset color temperature zones (ZONE1-ZONE5) are set according to the above contents, five actual weights need to be obtained, and the pixel gain value is obtained based on the five actual weights and the target pixel sum value of the target white point.


In particular, the step of obtaining the pixel gain value based on the target pixel sum value and the actual weight includes: obtaining a result pixel sum value based on the target pixel sum value and the actual weight; and obtaining the pixel gain value based on the result pixel sum value.


The step of obtaining the result pixel sum value based on the target pixel sum value and the actual weight includes: obtaining the result pixel sum value by using formula II based on the target pixel sum value and the actual weight;


the formula II is as follows:







SUM

(
R
)

=





i
=
1

N



K

n




*

SUM

(

R
n

)







i
=
1

N


K
n











SUM

(
G
)

=





i
=
1

N



K
n


*

SUM

(

G
n

)







i
=
1

N


K
n











SUM

(
B
)

=





i
=
1

N



K
n


*

SUM

(

B
n

)







i
=
1

N


K
n








in which SUM(R), SUM(G) and SUM(B) are a result red pixel sum value, a result green pixel sum value and a result blue pixel sum value in the result pixel sum value respectively, N is a quantity of the preset color temperature zones, SUM(Rn) is a target red pixel sum value in the target pixel sum value corresponding to the preset color temperature zone n, SUM(Gn) is a target green pixel sum value in the target pixel sum value corresponding to the preset color temperature zone n, and SUM(Bn) is a target blue pixel sum value in the target pixel sum value corresponding to the preset color temperature zone n.


It should be noted that the target pixel sum value includes the target pixel sum value corresponding to each preset color temperature zone. For a preset color temperature zone, the target pixel sum value includes a target red pixel sum value, a target green pixel sum value and a target blue pixel sum value. A result red pixel sum value, a result blue pixel sum value and a result green pixel sum value corresponding to all preset color temperature zones should be obtained according to formula II.


The result red pixel sum value, the result blue pixel sum value and the result green pixel sum value are obtained in the manner described above, and the pixel gain value is obtained based on the result red pixel sum value, the result blue pixel sum value and the result green pixel sum value, in which the pixel gain value includes a red gain value, a green gain value and a blue gain value. The step of obtaining the pixel gain value based on the result pixel sum value includes:


if the result green pixel sum value is the largest, determining a ratio of the result green pixel sum value to the result red pixel sum value as the red gain value, determining a ratio of the result green pixel sum value to the result blue pixel sum value as the blue gain value, and determining a first preset constant as the green gain value; or


if the result red pixel sum value is the largest, determining a ratio of the result red pixel sum value to the result green pixel sum value as the green gain value, determining a ratio of the result red pixel sum value to the result blue pixel sum value as the blue gain value, and determining a second preset constant as the red gain value; or


if the result blue pixel sum value is the largest, determining a ratio of the result blue pixel sum value to the result red pixel sum value as the red gain value, determining a ratio of the result blue pixel sum value to the result green pixel sum value as the green gain value, and determining a third preset constant as the blue gain value.


Step S14: performing white balance adjustment on the target image by using the pixel gain value to obtain a result image.


After the red gain value, the green gain value and the blue gain value are obtained, all pixel values of the target image may be adjusted by using the red gain value, the green gain value and the blue gain value, so as to realize the white balance adjustment of the target image, and the final adjusted result image may be obtained without color cast.


The technical solution of the present disclosure provides a white balance control method, the method including the following steps: acquiring a target pixel value of a target white point in a target image; calculating a target pixel sum value corresponding to a preset color temperature zone by using the target pixel value; obtaining a pixel gain value based on the target pixel sum value and a preset weight corresponding to the preset color temperature zone; and performing white balance adjustment on the target image by using the pixel gain value to obtain a result image.


In the existing methods, when there are interfering color blocks in the target image, the interfering color blocks will have negative effects on the adjustment of the target image, so that the obtained result image still has inaccurate white balance, resulting in color cast of the result image. In the present disclosure, the final pixel gain value is obtained based on the target pixel value of the target white point in the target image, and the target image is subjected to white balance adjustment by using the pixel gain value to obtain the result image, so the target pixel value will not be affected by the interfering color blocks in the target image, thus making the accuracy of the pixel gain value higher, and in turn making the white balance of the result image accurate and avoiding the color cast of the result image.


Refer to FIG. 5, which is a structural block diagram of a white balance control apparatus according to a first embodiment of the present disclosure, the apparatus is used in a terminal device, and based on the same application concept as the previous embodiment, the apparatus includes:


an acquisition module 10 configured to acquire a target pixel value of a target white point in a target image;


a calculation module 20 configured to calculate a target pixel sum value corresponding to a preset color temperature zone by using the target pixel value;


an obtaining module 30 configured to obtain a pixel gain value based on the target pixel sum value and a preset weight corresponding to the preset color temperature zone; and


an adjustment module 40 configured to perform white balance adjustment on the target image by using the pixel gain value to obtain a result image.


It should be noted that, since the steps performed by the device of this embodiment are the same as those of the previous method embodiments, the specific implementation and the technical effects that may be achieved may be referred to the previous embodiments and will not be repeated here.


The above-mentioned embodiments are only optional embodiments of the present disclosure, and do not limit the protection scope of the present disclosure. All equivalent changes made by using the contents of the specification and drawings of the present disclosure, or direct/indirect application in other related technical fields under the concept of the present disclosure are included in the protection scope of the present disclosure.

Claims
  • 1. A white balance control method, comprising: acquiring a target pixel value of a target white point in a target image;calculating a target pixel sum value corresponding to a preset color temperature zone by using the target pixel value;obtaining a pixel gain value based on the target pixel sum value and a preset weight corresponding to the preset color temperature zone; andperforming white balance adjustment on the target image by using the pixel gain value to obtain a result image.
  • 2. The method according to claim 1, wherein the target image is acquired by a target camera, and before the acquiring the target pixel value of the target white point in the target image, the method further comprises: performing curve calibration and fitting on the target camera by using a preset color temperature lamp corresponding to a preset color temperature range to obtain a target Planck color temperature curve of the target camera; andobtaining the preset color temperature zone based on the target Planck color temperature curve; andwherein the acquiring the target pixel value of the target white point in the target image comprises:determining a pixel point in the target image whose pixel value matches the target Planck color temperature curve as the target white point; andacquiring the target pixel value of the target white point.
  • 3. The method according to claim 2, wherein before the obtaining the pixel gain value based on the target pixel sum value and the preset weight corresponding to the preset color temperature zone, the method further comprises: counting a number of white points of target white points in the preset color temperature zone; andadjusting the preset weight by using the number of white points, a preset maximum number of white points and a preset minimum number of white points to obtain an actual weight corresponding to the preset color temperature zone; andwherein the obtaining the pixel gain value based on the target pixel sum value and the preset weight corresponding to the preset color temperature zone comprises:obtaining a pixel gain value based on the target pixel sum value and the actual weight.
  • 4. The method according to claim 3, wherein the obtaining the pixel gain value based on the target pixel sum value and the actual weight comprises: obtaining a result pixel sum value based on the target pixel sum value and the actual weight; andobtaining the pixel gain value based on the result pixel sum value.
  • 5. The method according to claim 4, wherein the adjusting the preset weight by using the number of white points, the preset maximum number of white points and the preset minimum number of white points to obtain the actual weight corresponding to the preset color temperature zone comprises: obtaining the actual weight by using formula I based on the number of white points, the preset maximum number of white points, the preset minimum number of white points, the preset weight and a minimum value of preset weight corresponding to the preset color temperature zone;wherein the formula I is as follows:
  • 6. The method according to claim 5, wherein the obtaining the result pixel sum value based on the target pixel sum value and the actual weight comprises: obtaining the result pixel sum value by using formula II based on the target pixel sum value and the actual weight;wherein the formula II is as follows:
  • 7. The method according to claim 6, wherein the pixel gain value comprises a red gain value, a green gain value and a blue gain value, and the obtaining the pixel gain value based on the result pixel sum value comprises: in response that the result green pixel sum value is largest, determining a ratio of the result green pixel sum value to the result red pixel sum value as the red gain value, determining a ratio of the result green pixel sum value to the result blue pixel sum value as the blue gain value, and determining a first preset constant as the green gain value; orin response that the result red pixel sum value is largest, determining a ratio of the result red pixel sum value to the result green pixel sum value as the green gain value, determining a ratio of the result red pixel sum value to the result blue pixel sum value as the blue gain value, and determining a second preset constant as the red gain value; orin response that the result blue pixel sum value is largest, determining a ratio of the result blue pixel sum value to the result red pixel sum value as the red gain value, determining a ratio of the result blue pixel sum value to the result green pixel sum value as the green gain value, and determining a third preset constant as the blue gain value.
  • 8. The method according to claim 6, wherein calculating the target pixel sum value corresponding to the preset color temperature zone by using the target pixel value comprises: each preset color temperature zone corresponding to a number of target white points; andsumming, for each preset color temperature zone, pixel values of all target white points comprised in the preset color temperature zone to obtain the target pixel sum value, the target pixel sum value comprising a target red pixel sum value, a target blue pixel sum value and a target green pixel sum value.
  • 9. The method according to claim 6, wherein the preset color temperature range is a color temperature range with a color temperature value of 1800 K to 10000 K.
  • 10. The method according to claim 5, wherein the red preset weight, the blue preset weight and the green preset weight in the preset weight are same, and weights K′n and minimum values of preset weights Kmin,n corresponding to red, blue and green are the same.
  • 11. The method according to claim 5, wherein the preset maximum number of white points Tmax,n and the preset minimum number of white points Tmin,n for the preset color temperature zone are determined based on a size of an actual target image and a proportion of the target white points in the preset color temperature zone.
  • 12. The method according to claim 5, wherein a plurality of preset color temperature lamps are selected to perform curve calibration and fitting on the target camera to obtain the Planck color temperature curve of the target camera; and the preset color temperature zone is obtained based on the target Planck color temperature curve.
  • 13. The method according to claim 6, wherein for the preset color temperature zone, the target pixel sum value comprises the target red pixel sum value, the target blue pixel sum value, and the target green pixel sum value.
  • 14. A terminal device, comprising a memory, a processor, and a white balance control program stored in the memory and executable by the processor, wherein the white balance control program, when executed by the processor, implements the white balance control method according to claim 1.
  • 15. A non-transitory computer readable storage medium, wherein a white balance control program is stored on the non-transitory computer readable storage medium, and the white balance control program, when executed by a processor, implements the white balance control method according to claim 1.
Priority Claims (1)
Number Date Country Kind
202110971603.6 Aug 2021 CN national
CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation application of International Application No. PCT/CN2021/132137, filed on Nov. 22, 2021, which claims priority to Chinese Patent Application No. 202110971603.6, filed on Aug. 23, 2021. The disclosures of the above-mentioned applications are incorporated herein by reference in their entireties.

Continuations (1)
Number Date Country
Parent PCT/CN2021/132137 Nov 2021 US
Child 18177920 US