WO2024092426A1 - White-balance gain compensation method and apparatus, and electronic device - Google Patents

White-balance gain compensation method and apparatus, and electronic device Download PDF

Info

Publication number
WO2024092426A1
WO2024092426A1 PCT/CN2022/128695 CN2022128695W WO2024092426A1 WO 2024092426 A1 WO2024092426 A1 WO 2024092426A1 CN 2022128695 W CN2022128695 W CN 2022128695W WO 2024092426 A1 WO2024092426 A1 WO 2024092426A1
Authority
WO
WIPO (PCT)
Prior art keywords
color temperature
white balance
temperature value
balance gain
value
Prior art date
Application number
PCT/CN2022/128695
Other languages
French (fr)
Chinese (zh)
Inventor
何波
Original Assignee
北京小米移动软件有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 北京小米移动软件有限公司 filed Critical 北京小米移动软件有限公司
Priority to PCT/CN2022/128695 priority Critical patent/WO2024092426A1/en
Publication of WO2024092426A1 publication Critical patent/WO2024092426A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N9/00Details of colour television systems
    • H04N9/64Circuits for processing colour signals
    • H04N9/73Colour balance circuits, e.g. white balance circuits or colour temperature control

Definitions

  • the present disclosure relates to the field of image processing technology, and in particular to a white balance gain compensation method, device and electronic equipment.
  • the pictures taken by the camera may be color cast if displayed directly without processing, so it is usually necessary to compensate the white balance gain of the three RGB channels output by the sensor.
  • a fixed white balance gain is usually set manually to compensate the white balance gain of the original image.
  • the fixed white balance gain may not necessarily match the current environment, which may lead to unreasonable compensated white balance gain, and further cause color cast in the output image, thus affecting the user experience.
  • Embodiments of the present disclosure provide a method, device and electronic device for compensating white balance gain.
  • an embodiment of the present disclosure provides a method for compensating a white balance gain, comprising:
  • white balance gain compensation is performed on the captured image.
  • determining the white balance gain compensation value includes:
  • a white balance gain compensation value is determined based on the first color temperature value, the third color temperature value and the corresponding first white balance gain group, and the fourth color temperature value and the corresponding second white balance gain group.
  • the method further includes:
  • the white balance gain corresponding to the color temperature value is determined as the white balance gain compensation value.
  • determining the white balance gain compensation value includes:
  • the white balance gain corresponding to the second color temperature value is determined as a white balance gain compensation value.
  • determining the white balance gain compensation value includes:
  • a white balance gain compensation value is determined based on a preset relationship table between color temperature values and gain values.
  • the obtaining of a first color temperature value of an environment when the camera is started and a second color temperature value during the historical use of the camera includes:
  • an average value of the multiple historical color temperature values is determined as the second color temperature value.
  • the performing white balance gain compensation on the captured image based on the white balance gain compensation value includes:
  • a result of multiplying the first gain value of each color channel in the white balance gain compensation value by the second gain value of the same color channel in the acquired image is determined as the white balance gain value of the corresponding color channel of the acquired image.
  • an embodiment of the present disclosure provides a white balance gain compensation device, including:
  • An acquisition module used to acquire a first color temperature value of the environment when the camera is started and a second color temperature value of the camera during historical use;
  • a determination module configured to determine a white balance gain compensation value according to a difference between the first color temperature value and the second color temperature value, and/or a preset relationship table between color temperature values and gain values;
  • the compensation module is used to compensate the white balance gain of the captured image based on the white balance gain compensation value.
  • the determining module is specifically used to:
  • a white balance gain compensation value is determined based on the first color temperature value, the third color temperature value and the corresponding first white balance gain group, and the fourth color temperature value and the corresponding second white balance gain group.
  • the determining module is further specifically configured to:
  • the white balance gain corresponding to the color temperature value is determined as the white balance gain compensation value.
  • the determining module is further specifically configured to:
  • the white balance gain corresponding to the second color temperature value is determined as a white balance gain compensation value.
  • the determining module is further specifically configured to:
  • a white balance gain compensation value is determined based on a preset relationship table between color temperature values and gain values.
  • the acquisition module is specifically used to:
  • an average value of the multiple historical color temperature values is determined as the second color temperature value.
  • the compensation module is specifically used to:
  • a result of multiplying the first gain value of each color channel in the white balance gain compensation value by the second gain value of the same color channel in the acquired image is determined as the white balance gain value of the corresponding color channel of the acquired image.
  • an embodiment of the present disclosure provides an electronic device, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to call and execute the executable instructions stored in the memory to implement the white balance gain compensation method proposed in the embodiment of the first aspect of the present disclosure.
  • an embodiment of the present disclosure provides a non-temporary computer-readable storage medium.
  • the instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the white balance gain compensation method proposed in the embodiment of the first aspect of the present disclosure.
  • an embodiment of the present disclosure provides a computer program product.
  • the computer program When the computer program is executed by a processor of an electronic device, the electronic device can execute the white balance gain compensation method proposed in the embodiment of the first aspect of the present disclosure.
  • the white balance gain compensation method, device, electronic device and storage medium provided by the present disclosure can first obtain the first color temperature value of the environment when the camera is started and the second color temperature value during the historical use of the camera, and then determine the white balance gain compensation value based on the difference between the first color temperature value and the second color temperature value, and/or the relationship table between the preset color temperature value and the gain value, and then compensate the white balance gain of the captured image based on the white balance gain compensation value.
  • the white balance gain compensation value adapted to the captured image can be dynamically calculated based on the first color temperature value obtained when the camera is started and the second color temperature value during the historical use, and then the white balance gain of the captured image is compensated based on the white balance gain compensation value, thereby improving the accuracy of the white balance gain compensation of the camera when it is initially awakened, avoiding the color cast problem that may occur when the camera is started, and effectively improving the user's camera experience.
  • FIG1 is a flow chart of a method for compensating a white balance gain according to an embodiment of the present disclosure
  • FIG2 is a flow chart of a method for compensating a white balance gain according to an embodiment of the present disclosure
  • FIG2A is a schematic diagram of a compensation scenario of a white balance gain according to an embodiment of the present disclosure
  • FIG2B is a schematic diagram of a white balance gain compensation process according to an embodiment of the present disclosure.
  • FIG3 is a schematic structural diagram of a white balance gain compensation device according to an embodiment of the present disclosure.
  • FIG. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
  • the white balance gain compensation method of the embodiment of the present disclosure may be executed by the white balance gain compensation device provided by the embodiment of the present disclosure, and the device may be configured in an electronic device.
  • FIG1 is a flow chart of a method for compensating a white balance gain provided by an embodiment of the present disclosure.
  • the white balance gain compensation method may include the following steps:
  • Step 101 obtaining a first color temperature value of the environment when the camera is started and a second color temperature value during the historical use of the camera.
  • the camera may be any electronic device with an image capture function, such as a professional video image capture device, or a mobile phone camera, a tablet camera, or the like, and the present disclosure does not limit this.
  • the picture taken by the camera may be color-biased if it is displayed directly without being processed. Therefore, in the embodiment of the present disclosure, the first color temperature value of the current environment can be obtained when the camera is started, wherein the startup of the camera can also be understood as the state when the camera is initially awakened, etc., which is not limited in the present disclosure.
  • the color temperature sensor spectrasensor can be used to detect the ambient light source and output the correlated color temperature (CCT) value of the current environment, etc. Therefore, in the embodiment of the present disclosure, the first color temperature value of the environment when the camera is started can be obtained through the color temperature sensor.
  • CCT correlated color temperature
  • the color temperature sensor may be disposed in the camera, and may be any type of color temperature sensor, which is not limited in the present disclosure.
  • a storage unit may be provided to store the second color temperature value during the history of the camera use.
  • a search may be performed in the storage unit to obtain the stored second color temperature value, etc., which is not limited in the present disclosure.
  • the second color temperature value during the historical use of the camera can be understood as the color temperature value when the camera was last exited, or can also be understood as the color temperature values of the most recent period of time, etc. Therefore, the second color temperature value during the historical use of the camera may be one, or may be multiple, or may be empty, etc., and the present disclosure does not limit this.
  • Step 102 determining a white balance gain compensation value according to a difference between the first color temperature value and the second color temperature value and/or a preset relationship table between color temperature values and gain values.
  • a threshold value can be set in advance. After obtaining the first color temperature value and the second color temperature value, the difference between the first color temperature value and the second color temperature value can be determined first, and then the difference is compared with the threshold value. According to the relationship between the two, a corresponding method is adopted to determine the white balance gain compensation value.
  • the white balance gain corresponding to the second color temperature value may be determined as the white balance gain compensation value.
  • the white balance gain corresponding to the second color temperature value can be determined as the white balance gain compensation value.
  • the threshold is 500 Kelvin (K)
  • the white balance gain corresponding to the second color temperature value can be determined as the white balance gain compensation value, etc.
  • the present disclosure does not limit this.
  • the white balance gain corresponding to the second color temperature value may be stored in association with it, and the present disclosure does not limit this.
  • the white balance gain compensation value can be determined based on a preset relationship table between color temperature values and gain values.
  • the white balance gain compensation value corresponding to the first color temperature value can be directly obtained based on the preset relationship table between the color temperature value and the gain value; or, the white balance gains corresponding to the remaining color temperature values associated with the first color temperature value can be obtained based on the relationship table, and processed to obtain the corresponding white balance gain compensation value, etc.
  • the present disclosure does not limit this.
  • Step 103 Compensate the white balance gain of the captured image based on the white balance gain compensation value.
  • the captured image may be the original raw image captured by the camera. If it is displayed directly without being processed, problems such as color cast may occur. Therefore, in the embodiment of the present disclosure, when capturing an image, the first color temperature value of the environment can be obtained when the camera is started, and based on the first color temperature value, a white balance gain compensation value suitable for the captured image is dynamically calculated. Thereafter, based on the white balance gain compensation value, the white balance gain of the captured image is compensated, thereby improving the accuracy of the white balance gain compensation of the camera when it is initially woken up, avoiding the color cast problem that may occur when the camera is started as much as possible, and effectively improving the user's camera experience.
  • the white balance gain compensation value can be multiplied by the gain value corresponding to the captured image, and the result is the white balance gain value corresponding to the image, thereby achieving white balance gain compensation for the captured image, etc.
  • the present disclosure does not limit this.
  • the first color temperature value of the environment when the camera is started and the second color temperature value during the historical use of the camera can be first obtained, and then the white balance gain compensation value can be determined according to the difference between the first color temperature value and the second color temperature value and/or the relationship table between the preset color temperature value and the gain value, and then the white balance gain compensation can be performed on the captured image based on the white balance gain compensation value.
  • the white balance gain compensation value adapted to the captured image can be dynamically calculated based on the first color temperature value obtained when the camera is started and the second color temperature value during the historical use, and then the white balance gain compensation can be performed on the captured image based on the white balance gain compensation value, thereby improving the accuracy of the white balance gain compensation of the camera when it is initially awakened, avoiding the color cast problem that may occur when the camera is started as much as possible, and effectively improving the user's camera experience.
  • FIG2 is a flow chart of a method for compensating a white balance gain provided by an embodiment of the present disclosure. As shown in FIG2 , the method for compensating a white balance gain may include the following steps:
  • Step 201 obtaining a first color temperature value of the environment when the camera is started and a second color temperature value during the camera's historical use.
  • the average value of the multiple historical color temperature values can be determined as the second color temperature value.
  • the historical color temperature value may refer to the color temperature value of the camera during all uses from the first use to the current moment; or, it may also refer to the color temperature value when used within a preset period before the current use, etc., which is not limited in the present disclosure.
  • the average value of the multiple historical color temperature values, 4200K may be determined as the second color temperature value.
  • Step 202 when the difference between the first color temperature value and the second color temperature value is greater than a threshold value, traverse a preset color temperature value and gain value relationship table to determine a third color temperature value associated with the first color temperature value, a fourth color temperature value, a first white balance gain group corresponding to the third color temperature value, and a second white balance gain group corresponding to the fourth color temperature value.
  • the white balance gain group may include gain values corresponding to any two color channels, for example, the gain values corresponding to the R channel and the G channel, or the gain values corresponding to the G channel and the B channel, or the gain values corresponding to the R channel and the B channel, etc., which are not limited in the present disclosure.
  • the threshold value may be a pre-set value, such as 100K, 600K, 880K, etc., which is not limited in the present disclosure.
  • color temperature values close to the first color temperature value may be determined as the third color temperature value and the fourth color temperature value associated with the first color temperature value.
  • the color temperature value associated with the first color temperature value can be understood as a color temperature value that is close to the first color temperature value.
  • the color temperature value that is closest to the first color temperature value and greater than the first color temperature value can be determined as the third color temperature value; the color temperature value that is closest to the first color temperature value and less than the first color temperature value can be determined as the fourth color temperature value.
  • the color temperature value that is closest to the first color temperature value and greater than the first color temperature value can be determined as the fourth color temperature value; the color temperature value that is closest to the first color temperature value and less than the first color temperature value can be determined as the third color temperature value, and so on.
  • the present disclosure does not limit this.
  • the relationship table can be traversed based on the first color temperature value to determine a third color temperature value associated with the first color temperature value, a fourth color temperature value, a first white balance gain group corresponding to the third color temperature value, and a second white balance gain group corresponding to the fourth color temperature value.
  • the threshold is 500K
  • the first color temperature value is 6000K and the second color temperature value is 5300K
  • the difference between the two is 700K, which is greater than the threshold 500K
  • the relationship table between the color temperature value and the gain value can be traversed based on the first color temperature value 6000K. It can then be determined that the third color temperature value associated with the first color temperature value can be: 6500K, and the corresponding gain values of the two color channels included in the first white balance gain group are: the gain value R_gain of the R channel is 2.85, and the gain value B_gain of the B channel is 0.96.
  • the fourth color temperature value associated with the first color temperature value can be: 5000K, and the corresponding gain values of the two color channels included in the second white balance gain group are: R_gain is 2.26, B_gain is 1.35, etc., and the present disclosure does not limit this.
  • each element and each corresponding relationship in Table 1 exist independently; these elements and corresponding relationships are exemplarily listed in the same table, but it does not mean that all elements and corresponding relationships in the table must exist at the same time as shown in Table 1.
  • the value of each element and each corresponding relationship is independent of any other element value or corresponding relationship in Table 1. Therefore, those skilled in the art can understand that the value of each element and each corresponding relationship in Table 1 are all independent embodiments.
  • Step 203 determining a white balance gain compensation value based on the first color temperature value, the third color temperature value and the corresponding first white balance gain group, and the fourth color temperature value and the corresponding second white balance gain group.
  • the white balance gain compensation value can be determined based on the first color temperature value in combination with the following formula (1).
  • gain_new represents the white balance gain compensation value
  • CCT_sensor represents the first color temperature value
  • D75_WBgain represents the white balance gain group corresponding to the standard light source D75 with a CCT of 7500K
  • D65_WBgain represents the white balance gain group corresponding to the standard light source D65 with a CCT of 6500K
  • D50_WBgain represents the white balance gain group corresponding to the standard light source D50 with a CCT of 5000K
  • TL84_WBgain represents the white balance gain group corresponding to the standard light source TL84 with a CCT of 3850K
  • A_WBgain represents the white balance gain group corresponding to the standard light source A with a CCT of 2850K
  • H_WBgain represents the white balance gain group corresponding to the standard light source A with a CCT of 2300K.
  • the gain values of the first white balance gain group corresponding to the third color temperature value of 6500K are: R_gain is 2.85, B_gain is 0.96; the gain values of the second white balance gain group corresponding to the fourth color temperature value of 5000K are: R_gain is 2.26, B_gain is 1.35.
  • the white balance gain compensation value gain_new R of the R channel can be:
  • the white balance gain compensation value gain_new G of the G channel can be:
  • the white balance gain corresponding to the color temperature value is determined as the white balance gain compensation value.
  • the color temperature value associated with the first color temperature value at this time is the corresponding boundary value.
  • the maximum color temperature value can be considered to be the color temperature value associated with the first color temperature value.
  • the minimum color temperature value can be considered to be the color temperature value associated with the first color temperature value, and so on. The present disclosure does not limit this.
  • the white balance gain corresponding to "7500K” R_gain is 3.15, B_gain is 0.75, which can be determined as the white balance gain compensation value.
  • the maximum color temperature value in the preset color temperature value and gain value relationship table is 7500K and the minimum color temperature value is 2300K, which can be determined to have exceeded the color temperature value range in the relationship table, and then it can be determined that there is only one color temperature value associated with the first color temperature value, that is, 2300K. Then, the white balance gain corresponding to "2300K": R_gain is 1.14, B_gain is 2.17, which can be determined as the white balance gain compensation value.
  • Step 204 When the difference between the first color temperature value and the second color temperature value is less than or equal to a threshold, a white balance gain corresponding to the second color temperature value is determined as a white balance gain compensation value.
  • Step 205 when the second color temperature value is empty, determine the white balance gain compensation value based on a preset relationship table between color temperature values and gain values.
  • the preset color temperature value and gain value relationship table can be traversed based on the first color temperature value to determine the third color temperature value associated with the first color temperature value, the fourth color temperature value, the first white balance gain group corresponding to the third color temperature value, and the second white balance gain group corresponding to the fourth color temperature value, wherein the white balance gain group contains gain values corresponding to two color channels respectively. Then, the white balance gain compensation value is determined based on the first color temperature value, the third color temperature value and the corresponding first white balance gain group, the fourth color temperature value and the corresponding second white balance gain group.
  • the relationship table between the preset color temperature value and the gain value is shown in Table 1, then based on the first color temperature value, the relationship table can be traversed to determine the first white balance gain group corresponding to the third color temperature value associated with the first color temperature value and the second white balance gain group corresponding to the fourth color temperature value, and perform linear difference, and combine with formula (1) to determine the white balance gain compensation value.
  • the specific content and implementation method can refer to the description of "Determining the white balance gain compensation value" in step 203 and step 204, which will not be repeated here.
  • the white balance gain corresponding to the color temperature value can be determined as the white balance gain compensation value, etc.
  • the present disclosure does not limit this.
  • Step 206 Compensate the white balance gain of the captured image based on the white balance gain compensation value.
  • a result of multiplying a first gain value of each color channel in the white balance gain compensation value by a second gain value of the same color channel in the captured image may be determined as the white balance gain value of the corresponding color channel of the captured image.
  • the first gain value of the R color channel in the white balance gain compensation value is: 2.65
  • the first gain value of the B color channel in the white balance gain compensation value is: 1.09
  • the second gain value of the R color channel in the captured image is: a
  • the second gain value of the B color channel in the captured image is: b
  • the white balance gain compensation method provided in the present disclosure can be applied to any scenario involving white balance gain compensation.
  • the camera and the sensor may be used to output the captured original image and the first color temperature value of the environment when the camera is started.
  • the storage and processing unit may store the second color temperature value during the camera's historical startup process and a relationship table between the preset color temperature value and the gain value.
  • a white balance gain compensation value may be determined, and then the original image may be compensated for the white balance gain based on the white balance gain compensation value.
  • the storage and processing unit may then output an image that has been compensated for the white balance gain, and then the image may be displayed on a display terminal. For example, for a mobile phone camera, it may be displayed in the "Album" of the mobile phone for the user to view, etc. The present disclosure does not limit this.
  • the color temperature sensor can be awakened to obtain the first color temperature value of the current environment and the second color temperature value of the camera during historical use.
  • the second color temperature value of the camera during historical use can be obtained by checking whether the storage unit stores the second color temperature value of the camera during historical use and the corresponding historical white balance gain value. For example, it can be checked whether the storage unit stores the second color temperature value and the corresponding historical white balance gain when the camera was last exited.
  • the difference between the first color temperature value and the second color temperature value can be calculated, and then the relationship between the difference and the threshold can be further determined.
  • the white balance gain compensation value can be determined based on the first color temperature value, the relationship table of the preset color temperature value and the gain value, and then the white balance gain of the captured image can be compensated based on the white balance gain compensation value.
  • the historical white balance gain corresponding to the second color temperature value can be used to compensate the white balance gain of the captured image.
  • a white balance gain compensation value can be determined based on the first color temperature value, a preset color temperature value and a gain value relationship table, and then the white balance gain of the captured image is compensated based on the white balance gain compensation value.
  • a first color temperature value of the environment when the camera is started and a second color temperature value during the historical use of the camera may be first obtained. Then, when the difference between the first color temperature value and the second color temperature value is greater than a threshold, a preset color temperature value and gain value relationship table may be traversed to determine a third color temperature value associated with the first color temperature value, a fourth color temperature value, a first white balance gain group corresponding to the third color temperature value, and a second white balance gain group corresponding to the fourth color temperature value, wherein the white balance gain group includes gain values corresponding to two color channels respectively.
  • a white balance gain compensation value may be determined based on the first color temperature value, the third color temperature value and the corresponding first white balance gain group, and the fourth color temperature value and the corresponding second white balance gain group.
  • the white balance gain corresponding to the second color temperature value may be determined as the white balance gain compensation value.
  • the second color temperature value is empty, a white balance gain compensation value may be determined based on the preset color temperature value and gain value relationship table. Then, based on the white balance gain compensation value, white balance gain compensation may be performed on the captured image.
  • the white balance gain compensation value suitable for the captured image can be dynamically calculated, and then the white balance gain compensation is performed on the captured image, thereby improving the accuracy of the white balance gain compensation of the camera when it is initially woken up, avoiding the color cast problem that may occur when the camera is started as much as possible, and effectively improving the user's camera experience.
  • FIG3 is a schematic structural diagram of the compensation device for white balance gain according to the embodiment of the present disclosure.
  • the white balance gain compensation device 300 includes: an acquisition module 310 , a determination module 320 , and a compensation module 330 .
  • the acquisition module 310 is used to acquire a first color temperature value of the environment when the camera is started and a second color temperature value during the historical use of the camera.
  • the determination module 320 is used to determine a white balance gain compensation value according to a difference between the first color temperature value and the second color temperature value and/or a preset relationship table between color temperature values and gain values.
  • the compensation module 330 is used to compensate the white balance gain of the captured image based on the white balance gain compensation value.
  • the determining module 320 is specifically configured to:
  • a white balance gain compensation value is determined based on the first color temperature value, the third color temperature value and the corresponding first white balance gain group, and the fourth color temperature value and the corresponding second white balance gain group.
  • the determining module 320 is further specifically configured to:
  • the white balance gain corresponding to the color temperature value is determined as the white balance gain compensation value.
  • the determining module 320 is further specifically configured to:
  • the white balance gain corresponding to the second color temperature value is determined as a white balance gain compensation value.
  • the determining module 320 is further specifically configured to:
  • a white balance gain compensation value is determined based on a preset relationship table between color temperature values and gain values.
  • the acquisition module 310 is specifically configured to:
  • an average value of the multiple historical color temperature values is determined as the second color temperature value.
  • the compensation module 330 is specifically used to:
  • a result of multiplying the first gain value of each color channel in the white balance gain compensation value by the second gain value of the same color channel in the acquired image is determined as the white balance gain value of the corresponding color channel of the acquired image.
  • the white balance gain compensation device of the embodiment of the present disclosure can first obtain the first color temperature value of the environment when the camera is started and the second color temperature value during the historical use of the camera, and then determine the white balance gain compensation value based on the difference between the first color temperature value and the second color temperature value, and/or the relationship table between the preset color temperature value and the gain value, and then compensate the white balance gain of the captured image based on the white balance gain compensation value.
  • the white balance gain compensation value adapted to the captured image can be dynamically calculated based on the first color temperature value obtained when the camera is started and the second color temperature value during the historical use, and then the white balance gain of the captured image can be compensated based on the white balance gain compensation value, thereby improving the accuracy of the white balance gain compensation of the camera when it is initially awakened, avoiding the color cast problem that may occur when the camera is started, and effectively improving the user's camera experience.
  • Figure 4 is a structural block diagram of an electronic device according to an embodiment of the present disclosure.
  • the electronic device 200 includes: a memory 210 and a processor 220 , and a bus 230 connecting different components (including the memory 210 and the processor 220 ).
  • the memory 210 is used to store executable instructions of the processor 220 ; the processor 201 is configured to call and execute the executable instructions stored in the memory 202 to implement the white balance gain compensation method proposed in the above embodiment of the present disclosure.
  • Bus 230 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures.
  • bus architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.
  • the electronic device 200 typically includes a variety of electronic device readable media. These media can be any available media that can be accessed by the electronic device 200, including volatile and non-volatile media, removable and non-removable media.
  • the memory 210 may also include computer system readable media in the form of volatile memory, such as random access memory (RAM) 240 and/or cache memory 250.
  • RAM random access memory
  • the electronic device 200 may further include other removable/non-removable, volatile/non-volatile computer system storage media.
  • the storage system 260 may be used to read and write non-removable, non-volatile magnetic media (not shown in FIG. 4 , commonly referred to as a “hard drive”). Although not shown in FIG.
  • a disk drive for reading and writing a removable non-volatile disk such as a “floppy disk”
  • an optical disk drive for reading and writing a removable non-volatile optical disk (such as a CD-ROM, DVD-ROM or other optical media)
  • each drive may be connected to the bus 230 via one or more data medium interfaces.
  • the memory 210 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present disclosure.
  • a program/utility 280 having a set (at least one) of program modules 270 may be stored, for example, in the memory 210, such program modules 270 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
  • the program modules 270 generally perform the functions and/or methods of the embodiments described in the present disclosure.
  • the electronic device 200 may also communicate with one or more external devices 290 (e.g., keyboard, pointing device, display 291, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 200, and/or communicate with any device that enables the electronic device 200 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed via an input/output (I/O) interface 292.
  • the electronic device 200 may also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN) and/or public network, such as the Internet) via a network adapter 293.
  • the network adapter 293 communicates with other modules of the electronic device 200 via a bus 230.
  • the processor 220 executes various functional applications and data processing by running the programs stored in the memory 210 .
  • the electronic device of the disclosed embodiment can first obtain the first color temperature value of the environment when the camera is started and the second color temperature value during the historical use of the camera, and then determine the white balance gain compensation value based on the difference between the first color temperature value and the second color temperature value and/or the relationship table between the preset color temperature value and the gain value, and then compensate the white balance gain of the captured image based on the white balance gain compensation value.
  • the white balance gain compensation value adapted to the captured image can be dynamically calculated based on the first color temperature value obtained when the camera is started and the second color temperature value during the historical use, and then the white balance gain compensation is performed on the captured image based on the white balance gain compensation value, thereby improving the accuracy of the white balance gain compensation of the camera when it is initially awakened, avoiding the color cast problem that may occur when the camera is started, and effectively improving the user's camera experience.
  • the embodiment of the present disclosure further proposes a non-transitory computer-readable storage medium.
  • the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can perform the white balance gain compensation method as described above.
  • the embodiment of the present disclosure further provides a computer program product.
  • the computer program When the computer program is executed by a processor of an electronic device, the electronic device can execute the white balance gain compensation method as described above.
  • the computer program product includes one or more computer programs.
  • the computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
  • the computer program can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer program can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center.
  • the computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated.
  • the available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a high-density digital video disc (DVD)), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.
  • a magnetic medium e.g., a floppy disk, a hard disk, a magnetic tape
  • an optical medium e.g., a high-density digital video disc (DVD)
  • DVD high-density digital video disc
  • SSD solid state disk
  • At least one in the present disclosure may also be described as one or more, and a plurality may be two, three, four or more, which is not limited in the present disclosure.
  • the technical features in the technical feature are distinguished by “first”, “second”, “third”, “A”, “B”, “C” and “D”, etc., and there is no order of precedence or size between the technical features described by the "first”, “second”, “third”, “A”, “B”, “C” and “D”.
  • the corresponding relationships shown in the tables in the present disclosure can be configured or predefined.
  • the values of the information in each table are only examples and can be configured as other values, which are not limited by the present disclosure.
  • the corresponding relationships shown in some rows may not be configured.
  • appropriate deformation adjustments can be made based on the above table, such as splitting, merging, etc.
  • the names of the parameters shown in the titles of the above tables can also use other names that can be understood by the communication device, and the values or representations of the parameters can also be other values or representations that can be understood by the communication device.
  • other data structures can also be used, such as arrays, queues, containers, stacks, linear lists, pointers, linked lists, trees, graphs, structures, classes, heaps, hash tables or hash tables.
  • the predefined in the present disclosure may be understood as defined, predefined, stored, pre-stored, pre-negotiated, pre-configured, solidified, or pre-burned.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Color Television Image Signal Generators (AREA)
  • Processing Of Color Television Signals (AREA)

Abstract

The embodiments of the present disclosure relate to the technical field of image processing. Disclosed are a white-balance gain compensation method and apparatus, and an electronic device. The method comprises: acquiring a first color temperature value of an environment of when a camera is started, and a second color temperature value during a historical use process of the camera; determining a white-balance gain compensation value according to the difference between the first color temperature value and the second color temperature value, and/or a preset relationship table between color temperature values and gain values; and performing white-balance gain compensation on a collected image on the basis of the white-balance gain compensation value. In the method, the white-balance gain compensation value, which is adapted to the collected image, can be dynamically calculated on the basis of the first color temperature value, which is acquired when the camera is started, and the second color temperature value, which is acquired during the historical use process, and then white-balance gain compensation is performed on the collected image on the basis of the white-balance gain compensation value, such that the accuracy of white-balance gain compensation when the camera is initially woken up is improved, the problem whereby color casts may occur when the camera is started is avoided, and the user experience is also improved.

Description

一种白平衡增益的补偿方法、装置及电子设备A white balance gain compensation method, device and electronic equipment 技术领域Technical Field
本公开涉及图像处理技术领域,尤其涉及一种白平衡增益的补偿方法、装置及电子设备。The present disclosure relates to the field of image processing technology, and in particular to a white balance gain compensation method, device and electronic equipment.
背景技术Background technique
通常,由于相机的传感器对一个灰色物体的响应,在RGB三通道是不等的,对于相机拍摄的图片,如果未经处理直接显示出来可能会偏色,所以通常需要对传感器输出的RGB三通道进行白平衡增益的补偿。Usually, since the camera sensor's response to a gray object is unequal in the three RGB channels, the pictures taken by the camera may be color cast if displayed directly without processing, so it is usually necessary to compensate the white balance gain of the three RGB channels output by the sensor.
相关技术中,通常人为的设置固定的白平衡增益,以对原始图像进行白平衡增益的补偿。但是由于相机启动时的环境可能存在较大差异,固定的白平衡增益可能不一定与当前的环境相匹配,从而可能导致补偿的白平衡增益不合理,进而导致输出图像出现偏色等情况,从而影响用户体验。In the related art, a fixed white balance gain is usually set manually to compensate the white balance gain of the original image. However, since the environment when the camera is started may be quite different, the fixed white balance gain may not necessarily match the current environment, which may lead to unreasonable compensated white balance gain, and further cause color cast in the output image, thus affecting the user experience.
发明内容Summary of the invention
本公开实施例提供一种白平衡增益的补偿方法、装置及电子设备。Embodiments of the present disclosure provide a method, device and electronic device for compensating white balance gain.
第一方面,本公开实施例提供一种白平衡增益的补偿方法,,包括:In a first aspect, an embodiment of the present disclosure provides a method for compensating a white balance gain, comprising:
获取相机启动时环境的第一色温值及所述相机历史使用过程中的第二色温值;Acquire a first color temperature value of the environment when the camera is started and a second color temperature value of the camera during historical use;
根据所述第一色温值与所述第二色温值间的差值、和/或预设的色温值与增益值的关系表,确定白平衡增益补偿值;Determine a white balance gain compensation value according to a difference between the first color temperature value and the second color temperature value, and/or a preset relationship table between color temperature values and gain values;
基于所述白平衡增益补偿值,对采集的图像进行白平衡增益的补偿。Based on the white balance gain compensation value, white balance gain compensation is performed on the captured image.
可选的,所述确定白平衡增益补偿值,包括:Optionally, determining the white balance gain compensation value includes:
在所述差值大于阈值的情况下,遍历所述关系表,以确定与所述第一色温值关联的第三色温值、第四色温值、所述第三色温值对应的第一白平衡增益组及所述第四色温值对应的第二白平衡增益组,其中,所述白平衡增益组中包含两个色彩通道分别对应的增益值;When the difference is greater than a threshold, traverse the relationship table to determine a third color temperature value associated with the first color temperature value, a fourth color temperature value, a first white balance gain group corresponding to the third color temperature value, and a second white balance gain group corresponding to the fourth color temperature value, wherein the white balance gain group includes gain values corresponding to two color channels respectively;
基于所述第一色温值、所述第三色温值及对应的第一白平衡增益组、所述第四色温值及对应的第二白平衡增益组,确定白平衡增益补偿值。A white balance gain compensation value is determined based on the first color temperature value, the third color temperature value and the corresponding first white balance gain group, and the fourth color temperature value and the corresponding second white balance gain group.
可选的,在所述遍历所述关系表之后,还包括:Optionally, after traversing the relationship table, the method further includes:
在所述关系表中与所述第一色温值有关联关系的色温值仅为一个的情况下,将所述色温值对应的白平衡增益,确定为白平衡增益补偿值。When there is only one color temperature value associated with the first color temperature value in the relationship table, the white balance gain corresponding to the color temperature value is determined as the white balance gain compensation value.
可选的,所述确定白平衡增益补偿值,包括:Optionally, determining the white balance gain compensation value includes:
在所述差值小于或等于阈值的情况下,将所述第二色温值对应的白平衡增益确定为白平衡增益补偿值。When the difference is less than or equal to a threshold, the white balance gain corresponding to the second color temperature value is determined as a white balance gain compensation value.
可选的,所述确定白平衡增益补偿值,包括:Optionally, determining the white balance gain compensation value includes:
在所述第二色温值为空的情况下,基于预设的色温值与增益值的关系表,确定白平衡增益补偿值。When the second color temperature value is empty, a white balance gain compensation value is determined based on a preset relationship table between color temperature values and gain values.
可选的,所述获取相机启动时环境的第一色温值及所述相机历史使用过程中的第二色温值,包括:Optionally, the obtaining of a first color temperature value of an environment when the camera is started and a second color temperature value during the historical use of the camera includes:
在历史色温值为多个的情况下,将所述多个历史色温值的平均值确定为第二色温值。In the case that there are multiple historical color temperature values, an average value of the multiple historical color temperature values is determined as the second color temperature value.
可选的,所述基于所述白平衡增益补偿值,对采集的图像进行白平衡增益的补偿,包括:Optionally, the performing white balance gain compensation on the captured image based on the white balance gain compensation value includes:
将所述白平衡增益补偿值中的每个色彩通道的第一增益值与所述采集的图像中相同色彩通道的第二增益值相乘的结果,确定为所述采集的图像的对应色彩通道的白平衡增益值。A result of multiplying the first gain value of each color channel in the white balance gain compensation value by the second gain value of the same color channel in the acquired image is determined as the white balance gain value of the corresponding color channel of the acquired image.
第二方面,本公开实施例提供一种白平衡增益的补偿装置,包括:In a second aspect, an embodiment of the present disclosure provides a white balance gain compensation device, including:
获取模块,用于获取相机启动时环境的第一色温值及所述相机历史使用过程中的第二色温值;An acquisition module, used to acquire a first color temperature value of the environment when the camera is started and a second color temperature value of the camera during historical use;
确定模块,用于根据所述第一色温值与所述第二色温值间的差值、和/或预设的色温值与增益值的关系表,确定白平衡增益补偿值;A determination module, configured to determine a white balance gain compensation value according to a difference between the first color temperature value and the second color temperature value, and/or a preset relationship table between color temperature values and gain values;
补偿模块,用于基于所述白平衡增益补偿值,对采集的图像进行白平衡增益的补偿。The compensation module is used to compensate the white balance gain of the captured image based on the white balance gain compensation value.
可选的,所述确定模块,具体用于:Optionally, the determining module is specifically used to:
在所述差值大于阈值的情况下,遍历所述关系表,以确定与所述第一色温值关联的第三色温值、第四色温值、所述第三色温值对应的第一白平衡增益组及所述第四色温值对应的第二白平衡增益组,其中,所述白平衡增益组中包含两个色彩通道分别对应的增益值;When the difference is greater than a threshold, traverse the relationship table to determine a third color temperature value associated with the first color temperature value, a fourth color temperature value, a first white balance gain group corresponding to the third color temperature value, and a second white balance gain group corresponding to the fourth color temperature value, wherein the white balance gain group includes gain values corresponding to two color channels respectively;
基于所述第一色温值、所述第三色温值及对应的第一白平衡增益组、所述第四色温值及对应的第二白平衡增益组,确定白平衡增益补偿值。A white balance gain compensation value is determined based on the first color temperature value, the third color temperature value and the corresponding first white balance gain group, and the fourth color temperature value and the corresponding second white balance gain group.
可选的,所述确定模块,还具体用于:Optionally, the determining module is further specifically configured to:
在所述关系表中与所述第一色温值有关联关系的色温值仅为一个的情况下,将所述色温值对应的白平衡增益,确定为白平衡增益补偿值。When there is only one color temperature value associated with the first color temperature value in the relationship table, the white balance gain corresponding to the color temperature value is determined as the white balance gain compensation value.
可选的,所述确定模块,还具体用于:Optionally, the determining module is further specifically configured to:
在所述差值小于或等于阈值的情况下,将所述第二色温值对应的白平衡增益确定为白平衡增益补偿值。When the difference is less than or equal to a threshold, the white balance gain corresponding to the second color temperature value is determined as a white balance gain compensation value.
可选的,所述确定模块,还具体用于:Optionally, the determining module is further specifically configured to:
在所述第二色温值为空的情况下,基于预设的色温值与增益值的关系表,确定白平衡增益补偿值。When the second color temperature value is empty, a white balance gain compensation value is determined based on a preset relationship table between color temperature values and gain values.
可选的,所述获取模块,具体用于:Optionally, the acquisition module is specifically used to:
在历史色温值为多个的情况下,将所述多个历史色温值的平均值确定为第二色温值。In the case where there are multiple historical color temperature values, an average value of the multiple historical color temperature values is determined as the second color temperature value.
可选的,所述补偿模块,具体用于:Optionally, the compensation module is specifically used to:
将所述白平衡增益补偿值中的每个色彩通道的第一增益值与所述采集的图像中相同色彩通道的第二增益值相乘的结果,确定为所述采集的图像的对应色彩通道的白平衡增益值。A result of multiplying the first gain value of each color channel in the white balance gain compensation value by the second gain value of the same color channel in the acquired image is determined as the white balance gain value of the corresponding color channel of the acquired image.
第三方面,本公开实施例提供一种电子设备,包括:处理器;用于存储所述处理器的可执行指令的存储器;其中,所述处理器被配置为调用并执行所述存储器存储的可执行指令,以实现本公开第一方面实施例提出的白平衡增益的补偿方法。In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to call and execute the executable instructions stored in the memory to implement the white balance gain compensation method proposed in the embodiment of the first aspect of the present disclosure.
第四方面,本公开实施例提供一种非临时性计算机可读存储介质,当所述存储介质中的指令由电子设备的处理器执行时,使得电子设备能够执行本公开第一方面实施例提出的白平衡增益的补偿方法。In a fourth aspect, an embodiment of the present disclosure provides a non-temporary computer-readable storage medium. When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the white balance gain compensation method proposed in the embodiment of the first aspect of the present disclosure.
第五方面,本公开实施例提供一种计算机程序产品,该计算机程序由电子设备的处理器执行时,使得电子设备能够执行本公开第一方面实施例提出的白平衡增益的补偿方法。In a fifth aspect, an embodiment of the present disclosure provides a computer program product. When the computer program is executed by a processor of an electronic device, the electronic device can execute the white balance gain compensation method proposed in the embodiment of the first aspect of the present disclosure.
本公开提供的白平衡增益的补偿方法、装置、电子设备及存储介质,可以先获取相机启动时环境的第一色温值及相机历史使用过程中的第二色温值,之后可以根据第一色温值与第二色温值间的差值、和/或预设的色温值与增益值的关系表,确定白平衡增益补偿值,之后可以基于白平衡增益补偿值,对采集的图像进行白平衡增益的补偿。由此,可以基于相机启动时获取的第一色温值与历史使用过程中的第二色温值,动态地计算适配于采集图像的白平衡增益补偿值,之后基于该白平衡增益补偿值,对采集的图像进行白平衡增益的补偿,从而提高了相机在初始唤醒时白平衡增益补偿的准确性,避免了相机启动时可能出现的偏色问题,也有效提高了用户的相机体验。The white balance gain compensation method, device, electronic device and storage medium provided by the present disclosure can first obtain the first color temperature value of the environment when the camera is started and the second color temperature value during the historical use of the camera, and then determine the white balance gain compensation value based on the difference between the first color temperature value and the second color temperature value, and/or the relationship table between the preset color temperature value and the gain value, and then compensate the white balance gain of the captured image based on the white balance gain compensation value. Therefore, the white balance gain compensation value adapted to the captured image can be dynamically calculated based on the first color temperature value obtained when the camera is started and the second color temperature value during the historical use, and then the white balance gain of the captured image is compensated based on the white balance gain compensation value, thereby improving the accuracy of the white balance gain compensation of the camera when it is initially awakened, avoiding the color cast problem that may occur when the camera is started, and effectively improving the user's camera experience.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本公开实施例或背景技术中的技术方案,下面将对本公开实施例或背景技术中所需要使用的附图进行说明。In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or the background technology, the drawings required for use in the embodiments of the present disclosure or the background technology will be described below.
图1是根据本公开实施例的白平衡增益的补偿方法的流程图;FIG1 is a flow chart of a method for compensating a white balance gain according to an embodiment of the present disclosure;
图2是根据本公开实施例的白平衡增益的补偿方法的流程图;FIG2 is a flow chart of a method for compensating a white balance gain according to an embodiment of the present disclosure;
图2A是根据本公开实施例的白平衡增益的补偿场景的示意图;FIG2A is a schematic diagram of a compensation scenario of a white balance gain according to an embodiment of the present disclosure;
图2B是根据本公开实施例的白平衡增益的补偿过程的示意图;FIG2B is a schematic diagram of a white balance gain compensation process according to an embodiment of the present disclosure;
图3是根据本公开实施例的白平衡增益的补偿装置的结构示意图;FIG3 is a schematic structural diagram of a white balance gain compensation device according to an embodiment of the present disclosure;
图4是根据本公开实施例的电子设备的结构示意图。FIG. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
具体实施方式Detailed ways
下面详细描述本公开的实施例,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,旨在用于解释本公开,而不能理解为对本公开的限制。Embodiments of the present disclosure are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and should not be construed as limiting the present disclosure.
下面参考附图描述本公开实施例的白平衡增益的补偿方法、装置、电子设备及存储介质。The following describes a method, device, electronic device, and storage medium for compensating white balance gain according to an embodiment of the present disclosure with reference to the accompanying drawings.
本公开实施例的白平衡增益的补偿方法,可由本公开实施例提供的白平衡增益的补偿装置执行,该装置可配置于电子设备中。The white balance gain compensation method of the embodiment of the present disclosure may be executed by the white balance gain compensation device provided by the embodiment of the present disclosure, and the device may be configured in an electronic device.
图1为本公开实施例提供的一种白平衡增益的补偿方法的流程示意图,该方法。FIG1 is a flow chart of a method for compensating a white balance gain provided by an embodiment of the present disclosure.
如图1所示,该白平衡增益的补偿方法可以包括以下步骤:As shown in FIG1 , the white balance gain compensation method may include the following steps:
步骤101,获取相机启动时环境的第一色温值及相机历史使用过程中的第二色温值。 Step 101, obtaining a first color temperature value of the environment when the camera is started and a second color temperature value during the historical use of the camera.
其中,相机可以为任意具有图像捕获功能的电子设备,比如可以是专业的视频图像捕获设备,或者也可以是手机相机、平板相机等设备,本公开对此不做限定。The camera may be any electronic device with an image capture function, such as a professional video image capture device, or a mobile phone camera, a tablet camera, or the like, and the present disclosure does not limit this.
可以理解的是,由于相机的传感器对物体的响应,在RGB三通道通常是不等的,对于相机拍摄的图片,如果未经处理直接显示出来可能会偏色。从而,本公开实施例中,可以在相机启动时,获取当前环境的第一色温值,其中,相机的启动,也可以理解为相机初始被唤醒时的状态等等,本公开对此不做限定。It is understandable that, since the response of the camera sensor to the object is usually unequal in the three channels of RGB, the picture taken by the camera may be color-biased if it is displayed directly without being processed. Therefore, in the embodiment of the present disclosure, the first color temperature value of the current environment can be obtained when the camera is started, wherein the startup of the camera can also be understood as the state when the camera is initially awakened, etc., which is not limited in the present disclosure.
另外,由于色温传感器spectrasensor可以用于检测环境光源,并输出当前环境的相关色温(correlated color temperature,CCT)值等。从而,本公开实施例中,可以通过色温传感器,获取相机启动时环境的第一色温值。In addition, since the color temperature sensor spectrasensor can be used to detect the ambient light source and output the correlated color temperature (CCT) value of the current environment, etc. Therefore, in the embodiment of the present disclosure, the first color temperature value of the environment when the camera is started can be obtained through the color temperature sensor.
其中,色温传感器可以设置在相机中,其可以为任意类型的色温传感器,本公开对此不做限定。The color temperature sensor may be disposed in the camera, and may be any type of color temperature sensor, which is not limited in the present disclosure.
可选的,可以设置存储单元,用于存储相机历史使用过程中的第二色温值。从而,本公开实施例中,在相机启动时,可以在该存储单元中进行查找,以获取存储的第二色温值等等,本公开对此不做限定。Optionally, a storage unit may be provided to store the second color temperature value during the history of the camera use. Thus, in the embodiment of the present disclosure, when the camera is started, a search may be performed in the storage unit to obtain the stored second color temperature value, etc., which is not limited in the present disclosure.
可以理解的是,相机历史使用过程中的第二色温值,可以理解为相机上次退出时的色温值,或者也可以为理解为最近一段时间内历次色温值等等。从而相机历史使用过程中的第二色温值,可能为一个,或者也可能为多个,或者也可能为空等等,本公开对此不做限定。It is understandable that the second color temperature value during the historical use of the camera can be understood as the color temperature value when the camera was last exited, or can also be understood as the color temperature values of the most recent period of time, etc. Therefore, the second color temperature value during the historical use of the camera may be one, or may be multiple, or may be empty, etc., and the present disclosure does not limit this.
步骤102,根据第一色温值与第二色温值间的差值、和/或预设的色温值与增益值的关系表,确定白平衡增益补偿值。Step 102: determining a white balance gain compensation value according to a difference between the first color temperature value and the second color temperature value and/or a preset relationship table between color temperature values and gain values.
其中,可以提前设定阈值,在获取到第一色温值与第二色温值之后,可以先确定第一色温值与第二色温值间的差值,之后将该差值与阈值进行比较,根据二者间的关系,采用对应的方式,确定白平衡增益补偿值。Among them, a threshold value can be set in advance. After obtaining the first color temperature value and the second color temperature value, the difference between the first color temperature value and the second color temperature value can be determined first, and then the difference is compared with the threshold value. According to the relationship between the two, a corresponding method is adopted to determine the white balance gain compensation value.
可选的,在第一色温值与第二色温值间的差值小于或等于阈值的情况下,可以将第二色温值对应的白平衡增益确定为白平衡增益补偿值。Optionally, when the difference between the first color temperature value and the second color temperature value is less than or equal to a threshold value, the white balance gain corresponding to the second color temperature value may be determined as the white balance gain compensation value.
可以理解的是,若第一色温值与第二色温值间的差值,小于阈值,那么可以认为相机启动时的环境色温值与相机历史使用过程中的环境色温值相差较小,此时为了减少数据处理量可以将第二色温值对应的白平衡增益确定为白平衡增益补偿值。It can be understood that if the difference between the first color temperature value and the second color temperature value is less than the threshold value, then it can be considered that the ambient color temperature value when the camera is started is slightly different from the ambient color temperature value during the historical use of the camera. At this time, in order to reduce the amount of data processing, the white balance gain corresponding to the second color temperature value can be determined as the white balance gain compensation value.
举例来说,在阈值为500开尔文(kelvin,K)的情况下,若当前第一色温值与第二色温值间的差值为150K,其小于阈值500K,那么此时可以将第二色温值对应的白平衡增益,确定为白平衡增益补偿值等等,本公开对此不做限定。For example, when the threshold is 500 Kelvin (K), if the difference between the current first color temperature value and the second color temperature value is 150K, which is less than the threshold 500K, then the white balance gain corresponding to the second color temperature value can be determined as the white balance gain compensation value, etc. The present disclosure does not limit this.
可选的,在存储相机历史使用过程中的第二色温值时,可以同时关联存储该第二色温值对应的白平衡增益等等,本公开对此不做限定。Optionally, when storing the second color temperature value during the historical use of the camera, the white balance gain corresponding to the second color temperature value may be stored in association with it, and the present disclosure does not limit this.
可选的,在相机历史使用过程中的第二色温值为空的情况下,那么此时可以基于预设的色温值与增益值的关系表,确定白平衡增益补偿值。Optionally, when the second color temperature value in the history of camera use is empty, the white balance gain compensation value can be determined based on a preset relationship table between color temperature values and gain values.
比如,可以直接基于该预设的色温值与增益值的关系表,获取与第一色温值对应的白平衡增益补偿值;或者,也可以基于该关系表,获取与第一色温值关联的其余色温值对应的白平衡增益,并对其进行处理,以得到对应的白平衡增益补偿值等等,本公开对此不做限定。For example, the white balance gain compensation value corresponding to the first color temperature value can be directly obtained based on the preset relationship table between the color temperature value and the gain value; or, the white balance gains corresponding to the remaining color temperature values associated with the first color temperature value can be obtained based on the relationship table, and processed to obtain the corresponding white balance gain compensation value, etc. The present disclosure does not limit this.
步骤103,基于白平衡增益补偿值,对采集的图像进行白平衡增益的补偿。Step 103: Compensate the white balance gain of the captured image based on the white balance gain compensation value.
其中,采集的图像,可以为相机采集的原始raw图像,若未经处理直接显示,可能会出现偏色等问题,从而本公开实施例中,在采集图像时,可以在相机启动时,获取环境的第一色温值,并基于该第一色温值,动态地计算适配于采集图像的白平衡增益补偿值,之后基于该白平衡增益补偿值,对采集的图像进行白平衡增益的补偿,从而提高了相机在初始唤醒时白平衡增益补偿的准确性,尽量避免了相机启动时可能出现的偏色问题,也有效提高了用户的相机体验。Among them, the captured image may be the original raw image captured by the camera. If it is displayed directly without being processed, problems such as color cast may occur. Therefore, in the embodiment of the present disclosure, when capturing an image, the first color temperature value of the environment can be obtained when the camera is started, and based on the first color temperature value, a white balance gain compensation value suitable for the captured image is dynamically calculated. Thereafter, based on the white balance gain compensation value, the white balance gain of the captured image is compensated, thereby improving the accuracy of the white balance gain compensation of the camera when it is initially woken up, avoiding the color cast problem that may occur when the camera is started as much as possible, and effectively improving the user's camera experience.
可以理解的是,在确定出白平衡增益补偿值之后,可以将该白平衡增益补偿值与采集的图像对应的增益值相乘,所得结果即为该图像对应的白平衡增益值,从而实现对采集的图像进行白平衡增益的补偿等等,本公开对此不做限定。It can be understood that after the white balance gain compensation value is determined, the white balance gain compensation value can be multiplied by the gain value corresponding to the captured image, and the result is the white balance gain value corresponding to the image, thereby achieving white balance gain compensation for the captured image, etc. The present disclosure does not limit this.
本公开实施例,可以先获取相机启动时环境的第一色温值及相机历史使用过程中的第二色温值,之后可以根据第一色温值与第二色温值间的差值、和/或预设的色温值与增益值的关系表,确定白平衡增益补偿值,之后可以基于白平衡增益补偿值,对采集的图像进行白平衡增益的补偿。由此,可以基于相机启动时获取的第一色温值与历史使用过程中的第二色温值,动态地计算适配于采集图像的白平衡增益补偿值,之后基于该白平衡增益补偿值,对采集的图像进行白平衡增益的补偿,从而提高了相机在初始唤醒时白平衡增益补偿的准确性,尽量避免了相机启动时可能出现的偏色问题,也有效提高了用户的相机体验。In the disclosed embodiment, the first color temperature value of the environment when the camera is started and the second color temperature value during the historical use of the camera can be first obtained, and then the white balance gain compensation value can be determined according to the difference between the first color temperature value and the second color temperature value and/or the relationship table between the preset color temperature value and the gain value, and then the white balance gain compensation can be performed on the captured image based on the white balance gain compensation value. Thus, the white balance gain compensation value adapted to the captured image can be dynamically calculated based on the first color temperature value obtained when the camera is started and the second color temperature value during the historical use, and then the white balance gain compensation can be performed on the captured image based on the white balance gain compensation value, thereby improving the accuracy of the white balance gain compensation of the camera when it is initially awakened, avoiding the color cast problem that may occur when the camera is started as much as possible, and effectively improving the user's camera experience.
图2为本公开实施例提供的一种白平衡增益的补偿方法的流程示意图,该方法。如图2所示,该白平衡增益的补偿方法可以包括以下步骤:FIG2 is a flow chart of a method for compensating a white balance gain provided by an embodiment of the present disclosure. As shown in FIG2 , the method for compensating a white balance gain may include the following steps:
步骤201,获取相机启动时环境的第一色温值及相机历史使用过程中的第二色温值。可选的,在历史色温值为多个的情况下,可以将多个历史色温值的平均值确定为第二色温值。 Step 201, obtaining a first color temperature value of the environment when the camera is started and a second color temperature value during the camera's historical use. Optionally, if there are multiple historical color temperature values, the average value of the multiple historical color temperature values can be determined as the second color temperature value.
其中,历史色温值,可以指相机从初次使用至当前时刻的所有使用过程中的色温值;或者,也可以指当前使用之前的预设时段内使用时的色温值等等,本公开对此不做限定。Among them, the historical color temperature value may refer to the color temperature value of the camera during all uses from the first use to the current moment; or, it may also refer to the color temperature value when used within a preset period before the current use, etc., which is not limited in the present disclosure.
举例来说,若多个历史色温值分别为:4000K、4500K、4100K,那么可以将上述多个历史色温值的平均值4200K,确定为第二色温值。For example, if the multiple historical color temperature values are 4000K, 4500K, and 4100K, respectively, then the average value of the multiple historical color temperature values, 4200K, may be determined as the second color temperature value.
需要说明的是,上述示例只是示意性说明,不能作为对本公开实施例中历史色温值的数量及对应值等的限定。It should be noted that the above examples are merely illustrative and cannot be used as limitations on the number and corresponding values of historical color temperature values in the embodiments of the present disclosure.
步骤202,在第一色温值与第二色温值间的差值大于阈值的情况下,遍历预设的色温值与增益值的关系表,以确定与第一色温值关联的第三色温值、第四色温值、第三色温值对应的第一白平衡增益组及第四色温值对应的第二白平衡增益组。Step 202, when the difference between the first color temperature value and the second color temperature value is greater than a threshold value, traverse a preset color temperature value and gain value relationship table to determine a third color temperature value associated with the first color temperature value, a fourth color temperature value, a first white balance gain group corresponding to the third color temperature value, and a second white balance gain group corresponding to the fourth color temperature value.
其中,白平衡增益组中可以包含任意两个色彩通道分别对应的增益值。比如,可以包含R通道和G通道分别对应的增益值,或者也可以包含G通道和B通道分别对应的增益值,或者还可以包含R通道和B通道分别对应的增益值等等,本公开对此不做限定。The white balance gain group may include gain values corresponding to any two color channels, for example, the gain values corresponding to the R channel and the G channel, or the gain values corresponding to the G channel and the B channel, or the gain values corresponding to the R channel and the B channel, etc., which are not limited in the present disclosure.
其中,阈值可以为提前设定的数值,比如可以为100K、600K、880K等等,本公开对此不做限定。The threshold value may be a pre-set value, such as 100K, 600K, 880K, etc., which is not limited in the present disclosure.
另外,可以将色温值与增益值的关系表中,与第一色温值相近的色温值,确定为与第一色温值有关联关系的第三色温值、第四色温值。In addition, in the relationship table between color temperature values and gain values, color temperature values close to the first color temperature value may be determined as the third color temperature value and the fourth color temperature value associated with the first color temperature value.
其中,与第一色温值有关联关系的色温值,可以理解为与第一色温值数值相近的色温值。比如,可以将与第一色温值最近的、大于第一色温值的色温值确定为第三色温值;将与第一色温值最近的、小于第一色温值的色温值确定为第四色温值。或者,也可以将与第一色温值最近的、大于第一色温值的色温值确定为第四色温值;将与第一色温值最近的、小于第一色温值的色温值确定为第三色温值等等,本公开对此不做限定。Among them, the color temperature value associated with the first color temperature value can be understood as a color temperature value that is close to the first color temperature value. For example, the color temperature value that is closest to the first color temperature value and greater than the first color temperature value can be determined as the third color temperature value; the color temperature value that is closest to the first color temperature value and less than the first color temperature value can be determined as the fourth color temperature value. Alternatively, the color temperature value that is closest to the first color temperature value and greater than the first color temperature value can be determined as the fourth color temperature value; the color temperature value that is closest to the first color temperature value and less than the first color temperature value can be determined as the third color temperature value, and so on. The present disclosure does not limit this.
可以理解的是,可以在标准光源下进行色温值与增益值的实验,以得到预设的色温值与增益值的关系表。或者也可以通过其他任何可取的方式,确定预设的色温值与增益值的关系表等等,本公开对此不做限定。It is understandable that experiments on color temperature values and gain values can be conducted under standard light sources to obtain a preset relationship table between color temperature values and gain values. Alternatively, the preset relationship table between color temperature values and gain values can be determined in any other desirable manner, and the present disclosure does not limit this.
举例来说,在预设的色温值与增益值的关系表,如下表1所示的情况下,可以基于第一色温值,遍历该关系表,以确定与第一色温值关联的第三色温值、第四色温值、第三色温值对应的第一白平衡增益组及第四色温值对应的第二白平衡增益组。For example, in a preset relationship table between color temperature values and gain values, such as that shown in Table 1 below, the relationship table can be traversed based on the first color temperature value to determine a third color temperature value associated with the first color temperature value, a fourth color temperature value, a first white balance gain group corresponding to the third color temperature value, and a second white balance gain group corresponding to the fourth color temperature value.
表1Table 1
标准光源Standard light source CCT/KCCT/K 白平衡增益WB gainWhite balance gain WB gain
D75D75 75007500 R_gain:3.15,B_gain:0.75R_gain:3.15,B_gain:0.75
D65D65 65006500 R_gain:2.85,B_gain:0.96R_gain:2.85,B_gain:0.96
D50D50 50005000 R_gain:2.26,B_gain:1.35R_gain:2.26,B_gain:1.35
TL84TL84 38503850 R_gain:1.89,B_gain:1.67R_gain:1.89,B_gain:1.67
AA 28502850 R_gain:1.32,B_gain:1.99R_gain:1.32,B_gain:1.99
HH 23002300 R_gain:1.14,B_gain:2.17R_gain:1.14,B_gain:2.17
举例来说,在阈值为500K的情况下,若第一色温值为6000K、第二色温值为5300K,二者间的差值为700K,其大于该阈值500K,那么可以基于该第一色温值6000K,遍历上述色温值与增益值的关系表。之后可以确定与该第一色温值关联的第三色温值可以为:6500K,其对应的第一白平衡增益组中包含的两个色彩通道对应增益值分别为:R通道的增益值R_gain为2.85、B通道的增益值B_gain为0.96。与该第一色温值关联的第四色温值可以为:5000K,其对应的第二白平衡增益组中包含的两个色彩通道对应增益值分别为:R_gain为2.26、B_gain为1.35等等,本公开对此不做限定。For example, when the threshold is 500K, if the first color temperature value is 6000K and the second color temperature value is 5300K, the difference between the two is 700K, which is greater than the threshold 500K, then the relationship table between the color temperature value and the gain value can be traversed based on the first color temperature value 6000K. It can then be determined that the third color temperature value associated with the first color temperature value can be: 6500K, and the corresponding gain values of the two color channels included in the first white balance gain group are: the gain value R_gain of the R channel is 2.85, and the gain value B_gain of the B channel is 0.96. The fourth color temperature value associated with the first color temperature value can be: 5000K, and the corresponding gain values of the two color channels included in the second white balance gain group are: R_gain is 2.26, B_gain is 1.35, etc., and the present disclosure does not limit this.
可以理解的是,表1中的每一个元素、每一条对应关系,都是独立存在的;这些元素、对应关系被示例性的列在同一张表格中,但是并不代表表格中的所有元素、对应关系必须根据表1中所示的同时存在。其中每一个元素的值和每一对应关系,是不依赖于表1中任何其他元素值或对应关系。因此本领域内技术人员可以理解,该表1中的每一个元素的取值、每一条对应关系,各种都是一个独立的实施例。It is understandable that each element and each corresponding relationship in Table 1 exist independently; these elements and corresponding relationships are exemplarily listed in the same table, but it does not mean that all elements and corresponding relationships in the table must exist at the same time as shown in Table 1. The value of each element and each corresponding relationship is independent of any other element value or corresponding relationship in Table 1. Therefore, those skilled in the art can understand that the value of each element and each corresponding relationship in Table 1 are all independent embodiments.
需要说明的是,上述表1只是示意性说明,实际使用过程中,可以设置任意两个色彩通道对应的增益值,比如可以为R通道和G通道、G通道和B通道等等,本公开对此不做限定。It should be noted that the above Table 1 is only a schematic illustration. In actual use, the gain values corresponding to any two color channels can be set, such as R channel and G channel, G channel and B channel, etc., and the present disclosure does not limit this.
步骤203,基于第一色温值、第三色温值及对应的第一白平衡增益组、第四色温值及对应的第二白平衡增益组,确定白平衡增益补偿值。Step 203: determining a white balance gain compensation value based on the first color temperature value, the third color temperature value and the corresponding first white balance gain group, and the fourth color temperature value and the corresponding second white balance gain group.
可选的,在确定出第一色温值、第三色温值及对应的第一白平衡增益组、第四色温值及对应的第二白平衡增益组之后,可以基于第一色温值,结合如下公式(1),确定白平衡增益补偿值。Optionally, after determining the first color temperature value, the third color temperature value and the corresponding first white balance gain group, the fourth color temperature value and the corresponding second white balance gain group, the white balance gain compensation value can be determined based on the first color temperature value in combination with the following formula (1).
Figure PCTCN2022128695-appb-000001
Figure PCTCN2022128695-appb-000001
其中,gain_new表示白平衡增益补偿值,CCT_sensor表示第一色温值,D75_WBgain表示CCT为7500K的标准光源D75对应的白平衡增益组,D65_WBgain表示CCT为6500K的标准光源D65对应的白平衡增益组,D50_WBgain表示CCT为5000K的标准光源D50对应的白平衡增益组,TL84_WBgain表示CCT为3850K的标准光源TL84对应的白平衡增益组,A_WBgain表示CCT为2850K的标准光源A对应的白平衡增益组,H_WBgain表示CCT为2300K的标准光源A对应的白平衡增益组。Wherein, gain_new represents the white balance gain compensation value, CCT_sensor represents the first color temperature value, D75_WBgain represents the white balance gain group corresponding to the standard light source D75 with a CCT of 7500K, D65_WBgain represents the white balance gain group corresponding to the standard light source D65 with a CCT of 6500K, D50_WBgain represents the white balance gain group corresponding to the standard light source D50 with a CCT of 5000K, TL84_WBgain represents the white balance gain group corresponding to the standard light source TL84 with a CCT of 3850K, A_WBgain represents the white balance gain group corresponding to the standard light source A with a CCT of 2850K, and H_WBgain represents the white balance gain group corresponding to the standard light source A with a CCT of 2300K.
举例来说,若第一色温值6000K,遍历上述色温值与增益值的关系表,确定出第三色温值6500K对应的第一白平衡增益组的增益值分别为:R_gain为2.85、B_gain为0.96;第四色温值5000K对应的第二白平衡增益组的增益值分别为:R_gain为2.26、B_gain为1.35。For example, if the first color temperature value is 6000K, by traversing the relationship table between the color temperature value and the gain value, it is determined that the gain values of the first white balance gain group corresponding to the third color temperature value of 6500K are: R_gain is 2.85, B_gain is 0.96; the gain values of the second white balance gain group corresponding to the fourth color temperature value of 5000K are: R_gain is 2.26, B_gain is 1.35.
那么可以选用公式:Then you can use the formula:
Figure PCTCN2022128695-appb-000002
Figure PCTCN2022128695-appb-000002
计算白平衡增益补偿值。Calculates white balance gain compensation value.
从而可以确定出R通道的白平衡增益补偿值gain_new R可以为: Therefore, it can be determined that the white balance gain compensation value gain_new R of the R channel can be:
Figure PCTCN2022128695-appb-000003
Figure PCTCN2022128695-appb-000003
G通道的白平衡增益补偿值gain_new G可以为: The white balance gain compensation value gain_new G of the G channel can be:
Figure PCTCN2022128695-appb-000004
Figure PCTCN2022128695-appb-000004
需要说明的是,上述示例只是示意性说明,不能作为对本公开实施例中确定白平衡增益补偿值的方式等的限定。It should be noted that the above examples are merely illustrative and cannot be used as limitations on the method of determining the white balance gain compensation value in the embodiments of the present disclosure.
可以理解的是,预设的色温值与增益值的关系表中,与第一色温值有关联关系的色温值可能有多个,或者也可能为一个等等,本公开对此不做限定。It is understandable that in the preset table of relationships between color temperature values and gain values, there may be multiple color temperature values associated with the first color temperature value, or there may be only one color temperature value, and the present disclosure does not limit this.
可选的,在预设的色温值与增益值的关系表中,与第一色温值有关联关系的色温值仅为一个的情况下,将色温值对应的白平衡增益,确定为白平衡增益补偿值。Optionally, in a preset relationship table between color temperature values and gain values, when there is only one color temperature value associated with the first color temperature value, the white balance gain corresponding to the color temperature value is determined as the white balance gain compensation value.
可以理解的是,在第一色温值超出预设的色温值与增益值的关系表中的色温值范围时,可以认为此时与该第一色温值有关联关系的色温值即为相应的边界值。比如,若第一色温值超出该关系表中的最大色温值,那么可以认为该最大色温值即为与该第一色温值有关联关系的色温值。或者,若第一色温值超出该关系表中的最小色温值,那么可以认为该最小色温值即为与该第一色温值有关联关系的色温值等等,本公开对此不做限定。It is understandable that when the first color temperature value exceeds the color temperature value range in the preset color temperature value and gain value relationship table, it can be considered that the color temperature value associated with the first color temperature value at this time is the corresponding boundary value. For example, if the first color temperature value exceeds the maximum color temperature value in the relationship table, then the maximum color temperature value can be considered to be the color temperature value associated with the first color temperature value. Or, if the first color temperature value exceeds the minimum color temperature value in the relationship table, then the minimum color temperature value can be considered to be the color temperature value associated with the first color temperature value, and so on. The present disclosure does not limit this.
举例来说,若第一色温值为8000K,预设的色温值与增益值的关系表中色温值最大值为7500K、最小值为2300K,可以确定其已超出该关系表中的色温值范围,那么可以确定与该第一色温值有关联关系的色温值仅为一个,也即:7500K。之后可以将“7500K”对应的白平衡增益:R_gain为3.15、B_gain为0.75,确定为白平衡增益补偿值。For example, if the first color temperature value is 8000K, and the maximum color temperature value in the preset color temperature value and gain value relationship table is 7500K and the minimum color temperature value is 2300K, it can be determined that it has exceeded the color temperature value range in the relationship table, and then it can be determined that there is only one color temperature value associated with the first color temperature value, that is, 7500K. Then, the white balance gain corresponding to "7500K": R_gain is 3.15, B_gain is 0.75, which can be determined as the white balance gain compensation value.
或者,若第一色温值为2000K,预设的色温值与增益值的关系表中色温值最大值为7500K、最小值为2300K,可以确定其已超出该关系表中的色温值范围,那么可以确定与该第一色温值有关联关系的色温值仅为一个,也即:2300K。之后可以将“2300K”对应的白平衡增益:R_gain为1.14、B_gain为2.17,确定为白平衡增益补偿值。Alternatively, if the first color temperature value is 2000K, the maximum color temperature value in the preset color temperature value and gain value relationship table is 7500K and the minimum color temperature value is 2300K, which can be determined to have exceeded the color temperature value range in the relationship table, and then it can be determined that there is only one color temperature value associated with the first color temperature value, that is, 2300K. Then, the white balance gain corresponding to "2300K": R_gain is 1.14, B_gain is 2.17, which can be determined as the white balance gain compensation value.
需要说明的是,上述示例只是示意性说明,不能作为对本公开实施例中确定白平衡增益补偿值的方式等的限定。It should be noted that the above examples are merely illustrative and cannot be used as limitations on the method of determining the white balance gain compensation value in the embodiments of the present disclosure.
步骤204,在第一色温值与第二色温值间的差值小于或等于阈值的情况下,将第二色温值对应的白平衡增益确定为白平衡增益补偿值。Step 204: When the difference between the first color temperature value and the second color temperature value is less than or equal to a threshold, a white balance gain corresponding to the second color temperature value is determined as a white balance gain compensation value.
步骤205,在第二色温值为空的情况下,基于预设的色温值与增益值的关系表,确定白平衡增益补偿值。 Step 205 , when the second color temperature value is empty, determine the white balance gain compensation value based on a preset relationship table between color temperature values and gain values.
可以理解的是,若未获取到第二色温值,也即第二色温值为空的情况下,此时可以基于第一色温值,遍历预设的色温值与增益值的关系表,以确定与第一色温值关联的第三色温值、第四色温值、第三色温值对应的第一白平衡增益组及第四色温值对应的第二白平衡增益组,其中,白平衡增益组中包含两个色彩通道分别对应的增益值。之后再基于第一色温值、第三色温值及对应的第一白平衡增益组、第四色温值及对应的第二白平衡增益组,确定白平衡增益补偿值。It is understandable that if the second color temperature value is not obtained, that is, the second color temperature value is empty, then the preset color temperature value and gain value relationship table can be traversed based on the first color temperature value to determine the third color temperature value associated with the first color temperature value, the fourth color temperature value, the first white balance gain group corresponding to the third color temperature value, and the second white balance gain group corresponding to the fourth color temperature value, wherein the white balance gain group contains gain values corresponding to two color channels respectively. Then, the white balance gain compensation value is determined based on the first color temperature value, the third color temperature value and the corresponding first white balance gain group, the fourth color temperature value and the corresponding second white balance gain group.
举例来说,若预设的色温值与增益值的关系表如表1所示,那么可以基于第一色温值,遍历该关系表,以确定与该第一色温值有关联关系的第三色温值对应的第一白平衡增益组、第四色温值对应的第二白平衡增益组进行线性差值,并结合公式(1),确定白平衡增益补偿值,其具体内容及实现方式可以参照步骤203和步骤204处“确定白平衡增益补偿值”的说明,此处不再赘述。For example, if the relationship table between the preset color temperature value and the gain value is shown in Table 1, then based on the first color temperature value, the relationship table can be traversed to determine the first white balance gain group corresponding to the third color temperature value associated with the first color temperature value and the second white balance gain group corresponding to the fourth color temperature value, and perform linear difference, and combine with formula (1) to determine the white balance gain compensation value. The specific content and implementation method can refer to the description of "Determining the white balance gain compensation value" in step 203 and step 204, which will not be repeated here.
可选的,在第二色温值为空的情况下,若基于第一色温值,遍历预设的色温值与增益值的关系表后,确定出该关系表中与第一色温值有关联关系的色温值仅为一个,那么此时可以将该色温值对应的白平衡增益,确定为白平衡增益补偿值等等,本公开对此不做限定。Optionally, when the second color temperature value is empty, if based on the first color temperature value, after traversing the preset color temperature value and gain value relationship table, it is determined that there is only one color temperature value in the relationship table that is associated with the first color temperature value, then at this time the white balance gain corresponding to the color temperature value can be determined as the white balance gain compensation value, etc. The present disclosure does not limit this.
步骤206,基于白平衡增益补偿值,对采集的图像进行白平衡增益的补偿。Step 206: Compensate the white balance gain of the captured image based on the white balance gain compensation value.
可选的,可以将白平衡增益补偿值中的每个色彩通道的第一增益值与采集的图像中相同色彩通道的第二增益值相乘的结果,确定为采集的图像的对应色彩通道的白平衡增益值。Optionally, a result of multiplying a first gain value of each color channel in the white balance gain compensation value by a second gain value of the same color channel in the captured image may be determined as the white balance gain value of the corresponding color channel of the captured image.
举例来说,若白平衡增益补偿值中R色彩通道的第一增益值为:2.65,白平衡增益补偿值中B色彩通道的第一增益值为:1.09,采集的图像中R色彩通道的第二增益值为:a,采集的图像中B色彩通道的第二增益值为:b,那么利用该白平衡增益补偿值对采集的图像进行白平衡增益补偿后,可以确定该采集的图像R色彩通道的白平衡增益值为:2.65*a,B色彩通道的白平衡增益值为:1.09*b等等,本公开对此不做限定。For example, if the first gain value of the R color channel in the white balance gain compensation value is: 2.65, the first gain value of the B color channel in the white balance gain compensation value is: 1.09, the second gain value of the R color channel in the captured image is: a, and the second gain value of the B color channel in the captured image is: b, then after performing white balance gain compensation on the captured image using the white balance gain compensation value, it can be determined that the white balance gain value of the R color channel of the captured image is: 2.65*a, the white balance gain value of the B color channel is: 1.09*b, and so on. The present disclosure is not limited to this.
需要说明的是,本公开提供的白平衡增益的补偿方法,可以适用于任何涉及白平衡增益补偿的场景。It should be noted that the white balance gain compensation method provided in the present disclosure can be applied to any scenario involving white balance gain compensation.
举例来说,在任意使用相机进行图像采集的场景下,可以利用相机和传感器,输出采集的原始图像和相机启动时环境的第一色温值。For example, in any scenario where a camera is used to capture images, the camera and the sensor may be used to output the captured original image and the first color temperature value of the environment when the camera is started.
另外,存储与处理单元中,可以存储有相机历史启动过程中的第二色温值及预设的色温值与增益值的关系表。之后经过该存储与处理单元的处理,可以确定出白平衡增益补偿值,之后基于该白平衡增益补偿值,对该原始图像进行白平衡增益的补偿。之后存储与处理单元可以输出经过白平衡增益的补偿的图像,之后可以将该图像在显示端进行展示。比如,可以对于手机相机,可以展示在手机中的“相册”中,以便用户查看等等。本公开对此不做限定。In addition, the storage and processing unit may store the second color temperature value during the camera's historical startup process and a relationship table between the preset color temperature value and the gain value. After processing by the storage and processing unit, a white balance gain compensation value may be determined, and then the original image may be compensated for the white balance gain based on the white balance gain compensation value. The storage and processing unit may then output an image that has been compensated for the white balance gain, and then the image may be displayed on a display terminal. For example, for a mobile phone camera, it may be displayed in the "Album" of the mobile phone for the user to view, etc. The present disclosure does not limit this.
下面结合图2B对本公开提供的白平衡增益的补偿过程进行说明。The compensation process of the white balance gain provided by the present disclosure is described below in conjunction with FIG. 2B .
首先,相机启动时,可以唤醒色温传感器,获取当前环境的第一色温值及相机历史使用过程中的第二色温值。其中,可以通过检查存储单元中是否保存有相机历史使用过程中的第二色温值及对应的历史白平衡增益值,以获取相机历史使用过程中的第二色温值。比如,可以检查存储单元中是否保存相机上次退出时的第二色温值及对应的历史白平衡增益等等。First, when the camera is started, the color temperature sensor can be awakened to obtain the first color temperature value of the current environment and the second color temperature value of the camera during historical use. The second color temperature value of the camera during historical use can be obtained by checking whether the storage unit stores the second color temperature value of the camera during historical use and the corresponding historical white balance gain value. For example, it can be checked whether the storage unit stores the second color temperature value and the corresponding historical white balance gain when the camera was last exited.
在存储单元中存储有第二色温值的情况下,可以根据第一色温值和第二色温值,计算二者间的差值,之后可以进一步判断差值和阈值间的关系。在差值大于阈值的情况下,可以基于第一色温值、预设的色温值与增益值的关系表,确定白平衡增益补偿值,之后基于该白平衡增益补偿值,对采集的图像进行白平衡增益的补偿。在差值小于或等于阈值的情况下,可以使用第二色温值对应的历史白平衡增益,对采集的图像进行白平衡增益的补偿。In the case where the second color temperature value is stored in the storage unit, the difference between the first color temperature value and the second color temperature value can be calculated, and then the relationship between the difference and the threshold can be further determined. In the case where the difference is greater than the threshold, the white balance gain compensation value can be determined based on the first color temperature value, the relationship table of the preset color temperature value and the gain value, and then the white balance gain of the captured image can be compensated based on the white balance gain compensation value. In the case where the difference is less than or equal to the threshold, the historical white balance gain corresponding to the second color temperature value can be used to compensate the white balance gain of the captured image.
在存储单元中未存储有第二色温值的情况下,可以基于第一色温值、预设的色温值与增益值的关系表,确定白平衡增益补偿值,之后基于该白平衡增益补偿值,对采集的图像进行白平衡增益的补偿。When the second color temperature value is not stored in the storage unit, a white balance gain compensation value can be determined based on the first color temperature value, a preset color temperature value and a gain value relationship table, and then the white balance gain of the captured image is compensated based on the white balance gain compensation value.
需要说明的是,上述示例只是示意性说明,不能作为对本公开实施例中白平衡增益的补偿过程等的限定。It should be noted that the above examples are merely illustrative and cannot be used as a limitation on the compensation process of the white balance gain in the embodiments of the present disclosure.
本公开实施例,可以先获取相机启动时环境的第一色温值及相机历史使用过程中的第二色温值,之后可以在第一色温值与第二色温值间的差值大于阈值的情况下,遍历预设的色温值与增益值的关系表,以确定与第一色温值关联的第三色温值、第四色温值、第三色温值对应的第一白平衡增益组及第四色温值对应的第二白平衡增益组,其中,白平衡增益组中包含两个色彩通道分别对应的增益值,之后可以基于第一色温值、第三色温值及对应的第一白平衡增益组、第四色温值及对应的第二白平衡增益组,确定白平衡增益补偿值;在第一色温值与第二色温值的差值小于或等于阈值的情况下,可以将第二色温值对应的白平衡增益确定为白平衡增益补偿值,在第二色温值为空的情况下,可以基于预设的色温值与增益值的关系表,确定白平衡增益补偿值,之后可以基于白平衡增益补偿值,对采集的图像进行白平衡增益的补偿。由此,可以基于相机启动时获取的第一色温值与历史使用过程中的第二色温值,动态地计算适配于采集图像的白平衡增益补偿值,之后再基对采集的图像进行白平衡增益的补偿,从而提高了相机在初始唤醒时白平衡增益补偿的准确性,尽量避免了相机启动时可能出现的偏色问题,也有效提高了用户的相机体验。In the disclosed embodiment, a first color temperature value of the environment when the camera is started and a second color temperature value during the historical use of the camera may be first obtained. Then, when the difference between the first color temperature value and the second color temperature value is greater than a threshold, a preset color temperature value and gain value relationship table may be traversed to determine a third color temperature value associated with the first color temperature value, a fourth color temperature value, a first white balance gain group corresponding to the third color temperature value, and a second white balance gain group corresponding to the fourth color temperature value, wherein the white balance gain group includes gain values corresponding to two color channels respectively. Then, a white balance gain compensation value may be determined based on the first color temperature value, the third color temperature value and the corresponding first white balance gain group, and the fourth color temperature value and the corresponding second white balance gain group. When the difference between the first color temperature value and the second color temperature value is less than or equal to the threshold, the white balance gain corresponding to the second color temperature value may be determined as the white balance gain compensation value. When the second color temperature value is empty, a white balance gain compensation value may be determined based on the preset color temperature value and gain value relationship table. Then, based on the white balance gain compensation value, white balance gain compensation may be performed on the captured image. Therefore, based on the first color temperature value obtained when the camera is started and the second color temperature value during historical use, the white balance gain compensation value suitable for the captured image can be dynamically calculated, and then the white balance gain compensation is performed on the captured image, thereby improving the accuracy of the white balance gain compensation of the camera when it is initially woken up, avoiding the color cast problem that may occur when the camera is started as much as possible, and effectively improving the user's camera experience.
本公开实施例还提出了一种白平衡增益的补偿装置,图3是根据本公开实施例的白平衡增益的补偿装置的结构示意图。The embodiment of the present disclosure further proposes a compensation device for white balance gain. FIG3 is a schematic structural diagram of the compensation device for white balance gain according to the embodiment of the present disclosure.
如图3所示,该白平衡增益的补偿装置300,包括:获取模块310、确定模块320、及补偿模块330。As shown in FIG. 3 , the white balance gain compensation device 300 includes: an acquisition module 310 , a determination module 320 , and a compensation module 330 .
其中,获取模块310,用于获取相机启动时环境的第一色温值及所述相机历史使用过程中的第二色温值。The acquisition module 310 is used to acquire a first color temperature value of the environment when the camera is started and a second color temperature value during the historical use of the camera.
确定模块320,用于根据所述第一色温值与所述第二色温值间的差值、和/或预设的色温值与增益值的关系表,确定白平衡增益补偿值。The determination module 320 is used to determine a white balance gain compensation value according to a difference between the first color temperature value and the second color temperature value and/or a preset relationship table between color temperature values and gain values.
补偿模块330,用于基于所述白平衡增益补偿值,对采集的图像进行白平衡增益的补偿。The compensation module 330 is used to compensate the white balance gain of the captured image based on the white balance gain compensation value.
可选的,所述确定模块320,具体用于:Optionally, the determining module 320 is specifically configured to:
在所述差值大于阈值的情况下,遍历所述关系表,以确定与所述第一色温值关联的第三色温值、第四色温值、所述第三色温值对应的第一白平衡增益组及所述第四色温值对应的第二白平衡增益组,其中,所述白平衡增益组中包含两个色彩通道分别对应的增益值;When the difference is greater than a threshold, traverse the relationship table to determine a third color temperature value associated with the first color temperature value, a fourth color temperature value, a first white balance gain group corresponding to the third color temperature value, and a second white balance gain group corresponding to the fourth color temperature value, wherein the white balance gain group includes gain values corresponding to two color channels respectively;
基于所述第一色温值、所述第三色温值及对应的第一白平衡增益组、所述第四色温值及对应的第二白平衡增益组,确定白平衡增益补偿值。A white balance gain compensation value is determined based on the first color temperature value, the third color temperature value and the corresponding first white balance gain group, and the fourth color temperature value and the corresponding second white balance gain group.
可选的,所述确定模块320,还具体用于:Optionally, the determining module 320 is further specifically configured to:
在所述关系表中与所述第一色温值有关联关系的色温值仅为一个的情况下,将所述色温值对应的白平衡增益,确定为白平衡增益补偿值。When there is only one color temperature value associated with the first color temperature value in the relationship table, the white balance gain corresponding to the color temperature value is determined as the white balance gain compensation value.
可选的,所述确定模块320,还具体用于:Optionally, the determining module 320 is further specifically configured to:
在所述差值小于或等于阈值的情况下,将所述第二色温值对应的白平衡增益确定为白平衡增益补偿值。When the difference is less than or equal to a threshold, the white balance gain corresponding to the second color temperature value is determined as a white balance gain compensation value.
可选的,所述确定模块320,还具体用于:Optionally, the determining module 320 is further specifically configured to:
在所述第二色温值为空的情况下,基于预设的色温值与增益值的关系表,确定白平衡增益补偿值。When the second color temperature value is empty, a white balance gain compensation value is determined based on a preset relationship table between color temperature values and gain values.
可选的,所述获取模块310,具体用于:Optionally, the acquisition module 310 is specifically configured to:
在历史色温值为多个的情况下,将所述多个历史色温值的平均值确定为第二色温值。In the case where there are multiple historical color temperature values, an average value of the multiple historical color temperature values is determined as the second color temperature value.
可选的,所述补偿模块330,具体用于:Optionally, the compensation module 330 is specifically used to:
将所述白平衡增益补偿值中的每个色彩通道的第一增益值与所述采集的图像中相同色彩通道的第二增益值相乘的结果,确定为所述采集的图像的对应色彩通道的白平衡增益值。A result of multiplying the first gain value of each color channel in the white balance gain compensation value by the second gain value of the same color channel in the acquired image is determined as the white balance gain value of the corresponding color channel of the acquired image.
本公开实施例中的上述各模块的功能及具体实现原理,可参照上述各方法实施例,此处不再赘述。The functions and specific implementation principles of the above modules in the embodiments of the present disclosure can be referred to the above method embodiments, and will not be repeated here.
本公开实施例的白平衡增益的补偿装置,可以先获取相机启动时环境的第一色温值及相机历史使用过程中的第二色温值,之后可以根据第一色温值与第二色温值间的差值、和/或预设的色温值与增益值的关系表,确定白平衡增益补偿值,之后可以基于白平衡增益补偿值,对采集的图像进行白平衡增益的补偿。由此,可以基于相机启动时获取的第一色温值与历史使用过程中的第二色温值,动态地计算适配于采集图像的白平衡增益补偿值,之后基于该白平衡增益补偿值,对采集的图像进行白平衡增益的补偿,从而提高了相机在初始唤醒时白平衡增益补偿的准确性,避免了相机启动时可能出现的偏色问题,也有效提高了用户的相机体验。图4是根据本公开实施例的电子设备的结构框图。The white balance gain compensation device of the embodiment of the present disclosure can first obtain the first color temperature value of the environment when the camera is started and the second color temperature value during the historical use of the camera, and then determine the white balance gain compensation value based on the difference between the first color temperature value and the second color temperature value, and/or the relationship table between the preset color temperature value and the gain value, and then compensate the white balance gain of the captured image based on the white balance gain compensation value. Therefore, the white balance gain compensation value adapted to the captured image can be dynamically calculated based on the first color temperature value obtained when the camera is started and the second color temperature value during the historical use, and then the white balance gain of the captured image can be compensated based on the white balance gain compensation value, thereby improving the accuracy of the white balance gain compensation of the camera when it is initially awakened, avoiding the color cast problem that may occur when the camera is started, and effectively improving the user's camera experience. Figure 4 is a structural block diagram of an electronic device according to an embodiment of the present disclosure.
如图4所示,该电子设备200包括:存储器210和处理器220,连接不同组件(包括存储器210和处理器220)的总线230。As shown in FIG. 4 , the electronic device 200 includes: a memory 210 and a processor 220 , and a bus 230 connecting different components (including the memory 210 and the processor 220 ).
其中,存储器210用于存储处理器220的可执行指令;处理器201被配置为调用并执行存储器202存储的可执行指令,以实现本公开上述实施例提出的白平衡增益的补偿方法。The memory 210 is used to store executable instructions of the processor 220 ; the processor 201 is configured to call and execute the executable instructions stored in the memory 202 to implement the white balance gain compensation method proposed in the above embodiment of the present disclosure.
总线230表示几类总线结构中的一种或多种,包括存储器总线或者存储器控制器,外围总线,图形加速端口,处理器或者使用多种总线结构中的任意总线结构的局域总线。举例来说,这些体系结构包括但不限于工业标准体系结构(ISA)总线,微通道体系结构(MAC)总线,增强型ISA总线、视频电子标准协会(VESA)局域总线以及外围组件互连(PCI)总线。 Bus 230 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.
电子设备200典型地包括多种电子设备可读介质。这些介质可以是任何能够被电子设 备200访问的可用介质,包括易失性和非易失性介质,可移动的和不可移动的介质。The electronic device 200 typically includes a variety of electronic device readable media. These media can be any available media that can be accessed by the electronic device 200, including volatile and non-volatile media, removable and non-removable media.
存储器210还可以包括易失性存储器形式的计算机系统可读介质,例如随机存取存储器(RAM)240和/或高速缓存存储器250。电子设备200可以进一步包括其它可移动/不可移动的、易失性/非易失性计算机系统存储介质。仅作为举例,存储系统260可以用于读写不可移动的、非易失性磁介质(图4未显示,通常称为“硬盘驱动器”)。尽管图4中未示出,可以提供用于对可移动非易失性磁盘(例如“软盘”)读写的磁盘驱动器,以及对可移动非易失性光盘(例如CD-ROM,DVD-ROM或者其它光介质)读写的光盘驱动器。在这些情况下,每个驱动器可以通过一个或者多个数据介质接口与总线230相连。存储器210可以包括至少一个程序产品,该程序产品具有一组(例如至少一个)程序模块,这些程序模块被配置以执行本公开各实施例的功能。The memory 210 may also include computer system readable media in the form of volatile memory, such as random access memory (RAM) 240 and/or cache memory 250. The electronic device 200 may further include other removable/non-removable, volatile/non-volatile computer system storage media. By way of example only, the storage system 260 may be used to read and write non-removable, non-volatile magnetic media (not shown in FIG. 4 , commonly referred to as a “hard drive”). Although not shown in FIG. 4 , a disk drive for reading and writing a removable non-volatile disk (such as a “floppy disk”) and an optical disk drive for reading and writing a removable non-volatile optical disk (such as a CD-ROM, DVD-ROM or other optical media) may be provided. In these cases, each drive may be connected to the bus 230 via one or more data medium interfaces. The memory 210 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present disclosure.
具有一组(至少一个)程序模块270的程序/实用工具280,可以存储在例如存储器210中,这样的程序模块270包括——但不限于——操作系统、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。程序模块270通常执行本公开所描述的实施例中的功能和/或方法。A program/utility 280 having a set (at least one) of program modules 270 may be stored, for example, in the memory 210, such program modules 270 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 270 generally perform the functions and/or methods of the embodiments described in the present disclosure.
电子设备200也可以与一个或多个外部设备290(例如键盘、指向设备、显示器291等)通信,还可与一个或者多个使得用户能与该电子设备200交互的设备通信,和/或与使得该电子设备200能与一个或多个其它计算设备进行通信的任何设备(例如网卡,调制解调器等等)通信。这种通信可以通过输入/输出(I/O)接口292进行。并且,电子设备200还可以通过网络适配器293与一个或者多个网络(例如局域网(LAN),广域网(WAN)和/或公共网络,例如因特网)通信。如图所示,网络适配器293通过总线230与电子设备200的其它模块通信。应当明白,尽管图中未示出,可以结合电子设备200使用其它硬件和/或软件模块,包括但不限于:微代码、设备驱动器、冗余处理单元、外部磁盘驱动阵列、RAID系统、磁带驱动器以及数据备份存储系统等。The electronic device 200 may also communicate with one or more external devices 290 (e.g., keyboard, pointing device, display 291, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 200, and/or communicate with any device that enables the electronic device 200 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed via an input/output (I/O) interface 292. Furthermore, the electronic device 200 may also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN) and/or public network, such as the Internet) via a network adapter 293. As shown, the network adapter 293 communicates with other modules of the electronic device 200 via a bus 230. It should be understood that, although not shown in the figure, other hardware and/or software modules may be used in conjunction with the electronic device 200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
处理器220通过运行存储在存储器210中的程序,从而执行各种功能应用以及数据处理。The processor 220 executes various functional applications and data processing by running the programs stored in the memory 210 .
需要说明的是,本公开实施例的电子设备的实施过程参见前述对本公开实施例的白平衡增益的补偿方法的解释说明,此处不再赘述。It should be noted that the implementation process of the electronic device of the embodiment of the present disclosure refers to the aforementioned explanation of the white balance gain compensation method of the embodiment of the present disclosure, which will not be repeated here.
本公开实施例的电子设备,可以先获取相机启动时环境的第一色温值及相机历史使用过程中的第二色温值,之后可以根据第一色温值与第二色温值间的差值、和/或预设的色温值与增益值的关系表,确定白平衡增益补偿值,之后可以基于白平衡增益补偿值,对采集的图像进行白平衡增益的补偿。由此,可以基于相机启动时获取的第一色温值与历史使用过程中的第二色温值,动态地计算适配于采集图像的白平衡增益补偿值,之后基于该白平衡增益补偿值,对采集的图像进行白平衡增益的补偿,从而提高了相机在初始唤醒时白平衡增益补偿的准确性,避免了相机启动时可能出现的偏色问题,也有效提高了用户的相机体验。The electronic device of the disclosed embodiment can first obtain the first color temperature value of the environment when the camera is started and the second color temperature value during the historical use of the camera, and then determine the white balance gain compensation value based on the difference between the first color temperature value and the second color temperature value and/or the relationship table between the preset color temperature value and the gain value, and then compensate the white balance gain of the captured image based on the white balance gain compensation value. Therefore, the white balance gain compensation value adapted to the captured image can be dynamically calculated based on the first color temperature value obtained when the camera is started and the second color temperature value during the historical use, and then the white balance gain compensation is performed on the captured image based on the white balance gain compensation value, thereby improving the accuracy of the white balance gain compensation of the camera when it is initially awakened, avoiding the color cast problem that may occur when the camera is started, and effectively improving the user's camera experience.
为了实现上述实施例,本公开实施例还提出了一种非临时性计算机可读存储介质,该存储介质中的指令由电子设备的处理器执行时,使得电子设备能够执行如前所述的白平衡增益的补偿方法。In order to implement the above embodiment, the embodiment of the present disclosure further proposes a non-transitory computer-readable storage medium. When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can perform the white balance gain compensation method as described above.
为了实现上述实施例,本公开实施例还提供一种计算机程序产品,该计算机程序由电子设备的处理器执行时,使得电子设备能够执行如前所述的白平衡增益的补偿方法。In order to implement the above embodiment, the embodiment of the present disclosure further provides a computer program product. When the computer program is executed by a processor of an electronic device, the electronic device can execute the white balance gain compensation method as described above.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机程序。在计算机上加载和执行所述计算机程序时,全部或部分地产生按照本公开实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机程序可以存储在计算机可读存储介质中, 或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机程序可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(digital subscriber line,DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如,高密度数字视频光盘(digital video disc,DVD))、或者半导体介质(例如,固态硬盘(solid state disk,SSD))等。In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer programs. When the computer program is loaded and executed on a computer, the process or function described in the embodiment of the present disclosure is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer program can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer program can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a high-density digital video disc (DVD)), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.
本领域普通技术人员可以理解:本公开中涉及的第一、第二等各种数字编号仅为描述方便进行的区分,并不用来限制本公开实施例的范围,也表示先后顺序。Those skilled in the art can understand that the various numerical numbers such as first and second involved in the present disclosure are only used for the convenience of description and are not used to limit the scope of the embodiments of the present disclosure, but also indicate the order of precedence.
本公开中的至少一个还可以描述为一个或多个,多个可以是两个、三个、四个或者更多个,本公开不做限制。在本公开实施例中,对于一种技术特征,通过“第一”、“第二”、“第三”、“A”、“B”、“C”和“D”等区分该种技术特征中的技术特征,该“第一”、“第二”、“第三”、“A”、“B”、“C”和“D”描述的技术特征间无先后顺序或者大小顺序。At least one in the present disclosure may also be described as one or more, and a plurality may be two, three, four or more, which is not limited in the present disclosure. In the embodiments of the present disclosure, for a technical feature, the technical features in the technical feature are distinguished by "first", "second", "third", "A", "B", "C" and "D", etc., and there is no order of precedence or size between the technical features described by the "first", "second", "third", "A", "B", "C" and "D".
本公开中各表所示的对应关系可以被配置,也可以是预定义的。各表中的信息的取值仅仅是举例,可以配置为其他值,本公开并不限定。在配置信息与各参数的对应关系时,并不一定要求必须配置各表中示意出的所有对应关系。例如,本公开中的表格中,某些行示出的对应关系也可以不配置。又例如,可以基于上述表格做适当的变形调整,例如,拆分,合并等等。上述各表中标题示出参数的名称也可以采用通信装置可理解的其他名称,其参数的取值或表示方式也可以通信装置可理解的其他取值或表示方式。上述各表在实现时,也可以采用其他的数据结构,例如可以采用数组、队列、容器、栈、线性表、指针、链表、树、图、结构体、类、堆、散列表或哈希表等。The corresponding relationships shown in the tables in the present disclosure can be configured or predefined. The values of the information in each table are only examples and can be configured as other values, which are not limited by the present disclosure. When configuring the corresponding relationship between the information and each parameter, it is not necessarily required to configure all the corresponding relationships illustrated in each table. For example, in the table in the present disclosure, the corresponding relationships shown in some rows may not be configured. For another example, appropriate deformation adjustments can be made based on the above table, such as splitting, merging, etc. The names of the parameters shown in the titles of the above tables can also use other names that can be understood by the communication device, and the values or representations of the parameters can also be other values or representations that can be understood by the communication device. When implementing the above tables, other data structures can also be used, such as arrays, queues, containers, stacks, linear lists, pointers, linked lists, trees, graphs, structures, classes, heaps, hash tables or hash tables.
本公开中的预定义可以理解为定义、预先定义、存储、预存储、预协商、预配置、固化、或预烧制。The predefined in the present disclosure may be understood as defined, predefined, stored, pre-stored, pre-negotiated, pre-configured, solidified, or pre-burned.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本公开的范围。Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this disclosure.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
以上所述,仅为本公开的具体实施方式,但本公开的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本公开揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本公开的保护范围之内。因此,本公开的保护范围应以所述权利要求的保护范围为准。The above is only a specific embodiment of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present disclosure, which should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims (10)

  1. 一种白平衡增益的补偿方法,其特征在于,包括:A white balance gain compensation method, characterized by comprising:
    获取相机启动时环境的第一色温值及所述相机历史使用过程中的第二色温值;Acquire a first color temperature value of the environment when the camera is started and a second color temperature value of the camera during historical use;
    根据所述第一色温值与所述第二色温值间的差值、和/或预设的色温值与增益值的关系表,确定白平衡增益补偿值;Determine a white balance gain compensation value according to a difference between the first color temperature value and the second color temperature value, and/or a preset relationship table between color temperature values and gain values;
    基于所述白平衡增益补偿值,对采集的图像进行白平衡增益的补偿。Based on the white balance gain compensation value, white balance gain compensation is performed on the captured image.
  2. 如权利要求1所述的方法,其特征在于,所述确定白平衡增益补偿值,包括:The method according to claim 1, wherein determining the white balance gain compensation value comprises:
    在所述差值大于阈值的情况下,遍历所述关系表,以确定与所述第一色温值关联的第三色温值、第四色温值、所述第三色温值对应的第一白平衡增益组及所述第四色温值对应的第二白平衡增益组,其中,所述白平衡增益组中包含两个色彩通道分别对应的增益值;When the difference is greater than a threshold, traverse the relationship table to determine a third color temperature value associated with the first color temperature value, a fourth color temperature value, a first white balance gain group corresponding to the third color temperature value, and a second white balance gain group corresponding to the fourth color temperature value, wherein the white balance gain group includes gain values corresponding to two color channels respectively;
    基于所述第一色温值、所述第三色温值及对应的第一白平衡增益组、所述第四色温值及对应的第二白平衡增益组,确定白平衡增益补偿值。A white balance gain compensation value is determined based on the first color temperature value, the third color temperature value and the corresponding first white balance gain group, and the fourth color temperature value and the corresponding second white balance gain group.
  3. 如权利要求2所述的方法,其特征在于,在所述遍历所述关系表之后,还包括:The method according to claim 2, characterized in that after traversing the relationship table, it also includes:
    在所述关系表中与所述第一色温值有关联关系的色温值仅为一个的情况下,将所述色温值对应的白平衡增益,确定为白平衡增益补偿值。When there is only one color temperature value associated with the first color temperature value in the relationship table, the white balance gain corresponding to the color temperature value is determined as the white balance gain compensation value.
  4. 如权利要求1所述的方法,其特征在于,所述确定白平衡增益补偿值,包括:The method according to claim 1, wherein determining the white balance gain compensation value comprises:
    在所述差值小于或等于阈值的情况下,将所述第二色温值对应的白平衡增益确定为白平衡增益补偿值。When the difference is less than or equal to a threshold, the white balance gain corresponding to the second color temperature value is determined as a white balance gain compensation value.
  5. 如权利要求1所述的方法,其特征在于,所述确定白平衡增益补偿值,包括:The method according to claim 1, wherein determining the white balance gain compensation value comprises:
    在所述第二色温值为空的情况下,基于所述预设的色温值与增益值的关系表,确定白平衡增益补偿值。When the second color temperature value is empty, a white balance gain compensation value is determined based on the preset relationship table between color temperature values and gain values.
  6. 如权利要求1所述的方法,其特征在于,所述获取相机启动时环境的第一色温值及所述相机历史使用过程中的第二色温值,包括:The method according to claim 1, wherein obtaining a first color temperature value of the environment when the camera is started and a second color temperature value during the historical use of the camera comprises:
    在历史色温值为多个的情况下,将所述多个历史色温值的平均值确定为第二色温值。In the case that there are multiple historical color temperature values, an average value of the multiple historical color temperature values is determined as the second color temperature value.
  7. 如权利要求1-6中任一所述的方法,其特征在于,所述基于所述白平衡增益补偿值,对采集的图像进行白平衡增益的补偿,包括:The method according to any one of claims 1 to 6, characterized in that the step of compensating the white balance gain of the captured image based on the white balance gain compensation value comprises:
    将所述白平衡增益补偿值中的每个色彩通道的第一增益值与所述采集的图像中相同色彩通道的第二增益值相乘的结果,确定为所述采集的图像的对应色彩通道的白平衡增益值。A result of multiplying the first gain value of each color channel in the white balance gain compensation value by the second gain value of the same color channel in the acquired image is determined as the white balance gain value of the corresponding color channel of the acquired image.
  8. 一种白平衡增益的补偿装置,其特征在于,包括:A white balance gain compensation device, characterized by comprising:
    获取模块,用于获取相机启动时环境的第一色温值及所述相机历史使用过程中的第二色温值;An acquisition module, used to acquire a first color temperature value of the environment when the camera is started and a second color temperature value of the camera during historical use;
    确定模块,用于根据所述第一色温值与所述第二色温值间的差值、和/或预设的色温值与增益值的关系表,确定白平衡增益补偿值;A determination module, configured to determine a white balance gain compensation value according to a difference between the first color temperature value and the second color temperature value, and/or a preset relationship table between color temperature values and gain values;
    补偿模块,用于基于所述白平衡增益补偿值,对采集的图像进行白平衡增益的补偿。The compensation module is used to compensate the white balance gain of the captured image based on the white balance gain compensation value.
  9. 一种电子设备,其中,包括:An electronic device, comprising:
    处理器;processor;
    用于存储所述处理器的可执行指令的存储器;a memory for storing executable instructions for the processor;
    其中,所述处理器被配置为调用并执行所述存储器存储的可执行指令,以实现如权利要求1-7中任一项所述的白平衡增益的补偿方法。The processor is configured to call and execute the executable instructions stored in the memory to implement the white balance gain compensation method as described in any one of claims 1 to 7.
  10. 一种非临时性计算机可读存储介质,当所述存储介质中的指令由电子设备的处理器执行时,使得电子设备能够执行如权利要求1-7中任一项所述的白平衡增益的补偿方法。A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform the white balance gain compensation method as described in any one of claims 1 to 7.
PCT/CN2022/128695 2022-10-31 2022-10-31 White-balance gain compensation method and apparatus, and electronic device WO2024092426A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/128695 WO2024092426A1 (en) 2022-10-31 2022-10-31 White-balance gain compensation method and apparatus, and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/128695 WO2024092426A1 (en) 2022-10-31 2022-10-31 White-balance gain compensation method and apparatus, and electronic device

Publications (1)

Publication Number Publication Date
WO2024092426A1 true WO2024092426A1 (en) 2024-05-10

Family

ID=90929215

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/128695 WO2024092426A1 (en) 2022-10-31 2022-10-31 White-balance gain compensation method and apparatus, and electronic device

Country Status (1)

Country Link
WO (1) WO2024092426A1 (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003324755A (en) * 2002-05-08 2003-11-14 Sony Corp Image processing apparatus and method, recording medium, and program
JP2004032067A (en) * 2002-06-21 2004-01-29 Nikon Corp Image processing apparatus and electronic camera
JP2008172422A (en) * 2007-01-10 2008-07-24 Nikon Corp Imaging apparatus
CN105554489A (en) * 2015-07-10 2016-05-04 宇龙计算机通信科技(深圳)有限公司 White balance adjusting method and shooting terminal
CN107360410A (en) * 2017-07-10 2017-11-17 广东欧珀移动通信有限公司 Method for controlling white balance, device and terminal device
CN112449112A (en) * 2020-11-18 2021-03-05 努比亚技术有限公司 Camera white balance adjusting method, mobile terminal and computer readable storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003324755A (en) * 2002-05-08 2003-11-14 Sony Corp Image processing apparatus and method, recording medium, and program
JP2004032067A (en) * 2002-06-21 2004-01-29 Nikon Corp Image processing apparatus and electronic camera
JP2008172422A (en) * 2007-01-10 2008-07-24 Nikon Corp Imaging apparatus
CN105554489A (en) * 2015-07-10 2016-05-04 宇龙计算机通信科技(深圳)有限公司 White balance adjusting method and shooting terminal
CN107360410A (en) * 2017-07-10 2017-11-17 广东欧珀移动通信有限公司 Method for controlling white balance, device and terminal device
CN112449112A (en) * 2020-11-18 2021-03-05 努比亚技术有限公司 Camera white balance adjusting method, mobile terminal and computer readable storage medium

Similar Documents

Publication Publication Date Title
US8493619B2 (en) Hardware-accelerated color data processing
JP6888167B2 (en) White balance processing method, electronic devices and computer readable storage media
US8713456B2 (en) Establishing a graphical user interface (‘GUI’) theme
US8885935B2 (en) Image processing apparatus and image processing method
US9251176B2 (en) Photo chapters organization
US7965341B2 (en) Color correction method, color correction device, and color correction program
WO2019084788A1 (en) Computation apparatus, circuit and relevant method for neural network
CN108337496A (en) White balancing treatment method, processing unit, processing equipment and storage medium
WO2020135224A1 (en) Color space mapping method and device, computer readable storage medium and apparatus
WO2024092426A1 (en) White-balance gain compensation method and apparatus, and electronic device
US7505069B2 (en) Method and apparatus for maintaining consistent white balance in successive digital images
JP3800873B2 (en) Image processing apparatus and method
US7080058B1 (en) Managing dynamic device color profiles
WO2018219304A1 (en) Picture processing method and apparatus, computer readable storage medium, and electronic device
US20080130987A1 (en) Color Management of RAW Content from Digital Capture Devices
US20160093066A1 (en) Saturation compensation method
JP4215014B2 (en) Image processing apparatus and image processing program
CN107767350B (en) Video image restoration method and device
WO2018214900A1 (en) Storage apparatus, mobile terminal and image processing method thereof
TW201811018A (en) Filtering method and filter device of the same
JP2003125227A (en) Image processor and image processing program
TWI482099B (en) Image processing and recording system and image processing and recording method thereof
WO2005048133A1 (en) Image processing method, image processing system, and image processing program
US10742862B2 (en) Information processing device, information processing method, and information processing system
WO2020124808A1 (en) Image enhancement device and image enhancement method

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22963746

Country of ref document: EP

Kind code of ref document: A1