CN113194303B - Image white balance method, device, electronic equipment and computer readable storage medium - Google Patents

Image white balance method, device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN113194303B
CN113194303B CN202110724183.1A CN202110724183A CN113194303B CN 113194303 B CN113194303 B CN 113194303B CN 202110724183 A CN202110724183 A CN 202110724183A CN 113194303 B CN113194303 B CN 113194303B
Authority
CN
China
Prior art keywords
ambient light
spectrum
information
optical information
image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110724183.1A
Other languages
Chinese (zh)
Other versions
CN113194303A (en
Inventor
虢礼
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Xiaomi Communication Technology Co ltd
Beijing Xiaomi Mobile Software Co Ltd
Original Assignee
Shenzhen Xiaomi Communication Technology Co ltd
Beijing Xiaomi Mobile Software Co Ltd
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 Shenzhen Xiaomi Communication Technology Co ltd, Beijing Xiaomi Mobile Software Co Ltd filed Critical Shenzhen Xiaomi Communication Technology Co ltd
Priority to CN202110724183.1A priority Critical patent/CN113194303B/en
Publication of CN113194303A publication Critical patent/CN113194303A/en
Application granted granted Critical
Publication of CN113194303B publication Critical patent/CN113194303B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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

Landscapes

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

Abstract

The application provides an image white balance method, an image white balance device, electronic equipment and a computer readable storage medium, wherein the method comprises the following steps: the method comprises the steps of acquiring first spectrum information of ambient light from a light sensor of a terminal, calibrating the first spectrum information by adopting calibration parameters calibrated in advance to obtain second spectrum information, determining optical information of the ambient light according to the second spectrum information, performing white balance processing on an image acquired by an image sensor of the terminal according to the optical information of the ambient light, calibrating the first spectrum information by adopting the calibration parameters calibrated in advance to obtain the optical information of the ambient light, performing white balance adjustment on the image based on the optical information of the ambient light obtained by calibration, and improving the effect of the white balance processing.

Description

Image white balance method, device, electronic equipment and computer readable storage medium
Technical Field
The present disclosure relates to the field of image processing technologies, and in particular, to an image white balancing method, an image white balancing device, an electronic device, and a computer readable storage medium.
Background
The white balance aims to enable the colors of the object to be displayed under different light source conditions to restore to the inherent colors of the object, and the human visual system has the characteristic of color constancy, so that human observation of the object is not influenced by the light source. However, the color of the object in the collected image is different under different light rays, and the object is blue in clear sky and red in candela.
In the related art, under some lighting scenes, automatic white balance of a camera may not be necessarily accurate, so that the image color cannot reach the optimal effect, and therefore, how to enable an image sensor to cover more application scenes with automatic white balance, and improving the photographing effect is a technical problem to be solved.
Disclosure of Invention
The present application aims to solve, at least to some extent, one of the technical problems in the related art.
For this reason, the present application proposes an image white balance method, apparatus, electronic device, and computer-readable storage medium to improve the effect of white balance processing.
An embodiment of a first aspect of the present application provides an image white balancing method, including:
acquiring first spectral information of ambient light from a light sensor of a terminal;
calibrating the first spectrum information by adopting calibration parameters calibrated in advance to obtain second spectrum information;
determining optical information of the ambient light according to the second spectrum information;
and performing white balance processing on the image acquired by the image sensor of the terminal according to the optical information of the ambient light.
An embodiment of a second aspect of the present application provides an image white balancing apparatus, including:
The acquisition module is used for acquiring first spectrum information of the ambient light from the optical sensor of the terminal;
the first calibration module is used for calibrating the first spectrum information by adopting calibration parameters calibrated in advance to obtain second spectrum information;
the generating module is used for determining optical information of the ambient light according to the second spectrum information;
and the processing module is used for carrying out white balance processing on the image acquired by the image sensor of the terminal according to the optical information of the ambient light.
An embodiment of a third aspect of the present application proposes an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, said processor implementing the method according to the first aspect when executing said program.
An embodiment of a fourth aspect of the present application proposes a non-transitory computer readable storage medium, which when executed by a processor, implements a method as described in the first aspect.
An embodiment of a fifth aspect of the present application proposes a computer program product, which when executed by an instruction processor in the computer program product, implements the method as described in the first aspect.
The technical scheme provided by the embodiment of the application comprises the following beneficial effects:
the method comprises the steps of acquiring first spectrum information of ambient light from a light sensor of a terminal, calibrating the first spectrum information by adopting calibration parameters calibrated in advance to obtain second spectrum information, determining optical information of the ambient light according to the second spectrum information, performing white balance processing on an image acquired by an image sensor of the terminal according to the optical information of the ambient light, calibrating the first spectrum information by adopting the calibration parameters calibrated in advance to obtain the optical information of the ambient light, performing white balance adjustment on the image based on the optical information of the ambient light obtained by calibration, and improving the effect of the white balance processing.
Additional aspects and advantages of the application will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the application.
Drawings
The foregoing and/or additional aspects and advantages of the present application will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings, in which:
fig. 1 is a schematic flow chart of an image white balancing method according to an embodiment of the present application;
fig. 2 is a flowchart of another image white balancing method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of spectral information comparison provided in an embodiment of the present application;
fig. 4 is a flowchart of another image white balancing method according to an embodiment of the present application;
fig. 5 is a flowchart of another image white balancing method according to an embodiment of the present application;
fig. 6 is a schematic diagram of a frame of an image white balancing method according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an image white balancing device according to an embodiment of the present application;
fig. 8 is a block diagram of an exemplary electronic device provided by an embodiment of the present application.
Detailed Description
Embodiments of the present application are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals refer to the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the drawings are exemplary and intended for the purpose of explaining the present application and are not to be construed as limiting the present application.
Image white balancing methods, apparatuses, electronic devices, and computer-readable storage media according to embodiments of the present application are described below with reference to the accompanying drawings.
Fig. 1 is a flowchart of an image white balancing method according to an embodiment of the present application.
As shown in fig. 1, the method comprises the steps of:
step 101, acquiring first spectral information of ambient light from a light sensor of a terminal.
The terminal may be an electronic device carrying an image acquisition device, such as a mobile phone, an intelligent wearable device, a palm computer, or the like, which is not listed in this embodiment.
The ambient light may be the ambient light of different light sources, such as stage, cosmetic room, market, sunset, incandescent lamp, LED lamp, etc.
In this embodiment, the first spectrum information indicates the frequency band corresponding to the wave of each wavelength in the ambient light acquired by the light sensor, that is, the electromagnetic radiation intensity corresponding to the wave of each wavelength.
In one implementation manner of this embodiment, when the terminal starts the image acquisition device, the terminal may acquire the first spectrum information of the ambient light through the optical sensor, or when the terminal detects an acquisition instruction for acquiring the spectrum information, the terminal acquires the first spectrum information of the ambient light through the optical sensor according to the acquisition instruction, where the acquisition instruction may be manually triggered in the terminal by a terminal user, or may be sent by other devices connected to the terminal. The image capturing by the image capturing sensor and the first spectrum information of the ambient light capturing by the light capturing sensor may be performed synchronously, where synchronization refers to that the image capturing and the first spectrum information capturing may be started or ended simultaneously, which is not limited in this embodiment.
And 102, calibrating the first spectrum information by adopting calibration parameters calibrated in advance to obtain second spectrum information.
In one implementation manner of this embodiment, the calibration parameter calibrated in advance may be obtained by calibrating the optical sensor of the terminal in advance according to the output of the standard optical sensor independent of the terminal to be calibrated, and since the standard optical sensor may be an optical sensor whose measurement accuracy screened from a large number of samples meets the set requirement, that is, the accuracy of the spectral information output by the standard optical sensor is considered to be reliable, and may be referred to as standard spectral information, the calibration parameter may be obtained in advance according to the mapping relationship established between the standard spectral information output by the standard optical sensor and the spectral information output by the optical sensor of the terminal. Therefore, when the terminal shoots an image, the first spectrum information of the ambient light collected by the light sensor of the terminal is calibrated according to the calibration parameter, that is to say, the calibration parameter and the first spectrum information are multiplied to obtain calibrated second spectrum information, and the accuracy of the second spectrum information corresponding to the terminal equipment can be improved through calibration.
In other embodiments, the standard optical sensor may be a sensor in the terminal, or may be a standard optical sensor independent of the terminal. The generation of the calibration parameters will be described in detail in the following embodiments.
And step 103, generating optical information of the ambient light according to the second spectrum information.
Wherein the optical information comprises at least one of correlated color temperature, color coordinates, and light source type.
In the embodiment of the application, the optical information of the ambient light is generated according to the second spectrum information obtained through calibration, so that the accuracy of the optical information is improved.
It should be noted that, according to the second spectral information, a method of generating optical information of the ambient light will be described in the following embodiments.
And 104, performing white balance processing on the image acquired by the image sensor of the terminal according to the optical information of the ambient light.
In this embodiment, white balance processing is performed on an image acquired by an image sensor of a terminal according to a correlated color temperature in optical information, where a determination manner of the correlated color temperature in the optical information may be determined by the following three implementation manners:
in the first implementation manner of the embodiment of the present application, the correlated color temperature is included in the optical information of the ambient light, and the correlated color temperature in the optical information may be used for the white balance processing.
In a second implementation manner of the embodiment of the present application, the optical information of the ambient light includes color coordinates, and the correlated color temperature is determined according to the color coordinates, where a manner of determining the correlated color temperature according to the color coordinates will be described in detail in the following embodiments.
In a third implementation manner of the embodiment of the present application, the optical information of the ambient light includes a light source type, and because different light source types have corresponding color temperatures, a table of correspondence between the light source type and the color temperature is queried based on the light source type, and the table of correspondence between the light source type and the color temperature is queried to determine the color temperature corresponding to the light source type included in the optical information, so that the color temperature corresponding to the light source type is used as the correlated color temperature of the ambient light.
In a fourth implementation manner of the embodiment of the present application, the average correlated color temperature may be obtained by taking an average of the correlated color temperatures determined according to the correlated color temperature determined by the light source type of the ambient light and the correlated color temperature determined by the color coordinates included in the optical information of the ambient light, and the average correlated color temperature is taken as the correlated color temperature of the ambient light. The average correlated color temperature is adopted to adjust the color temperature of the image acquired by the image sensor of the terminal, so that the adjustment of the color in the image is achieved, and the imaging effect is improved.
After the correlated color temperature is determined in the above manner, the corresponding relation between the correlated color temperature and the gain values of the three primary colors is queried to obtain the gain values of the three primary colors, wherein the three primary colors comprise Red, green and Blue. And multiplying the original gray values of the three primary colors of RGB by corresponding gain values for each pixel point in the image to obtain the adjusted gray value of RGB of each pixel point so as to adjust the color temperature of each pixel point in the image. The pixel value of each pixel point can be determined by the RGB gray value of each pixel point, namely the RGB gray value of the pixel point is the pixel value of the pixel point. Therefore, the color brought by ambient light is removed through the determined correlated color temperature, and the effect of white balance on the image is achieved.
According to the image white balance method, first spectrum information of ambient light is obtained from the optical sensor of the terminal, calibration parameters calibrated in advance are adopted for calibrating the first spectrum information to obtain second spectrum information, optical information of the ambient light is determined according to the second spectrum information, white balance processing is carried out on an image collected by the image sensor of the terminal according to the optical information of the ambient light, the ambient light is measured through the optical sensor and calibrated based on the calibrated calibration parameters, accuracy of determining the second spectrum information in the ambient light is improved, white balance adjustment is carried out according to the optical information in the second spectrum information, accuracy of determining the white balance is improved, complexity is reduced compared with an algorithm for calculating the ambient light according to the image information, and operation efficiency is improved. Meanwhile, white balance adjustment can be performed under a monochromatic light scene, so that the problem of interference of shooting monochromatic objects in a short distance is solved.
Based on the above embodiment, the present embodiment provides another implementation manner of the image white balance method, specifically explaining how to generate optical information of ambient light according to the calibrated second spectrum information. Fig. 2 is a flowchart of another image white balancing method according to an embodiment of the present application.
As shown in fig. 2, the step 103 may include the following steps:
in step 201, a spectral database is obtained.
In this embodiment, spectral information is generated in advance for different light sources under different environments, and as an implementation manner, spectral data of the different light sources under different environments can be generated by measuring with a spectrometer, and the acquired different spectral data is analyzed to generate spectral information of the different light sources under different environments, and the spectral information of the different light sources under different environments is stored in a spectral database to be used as a reference spectrum.
Step 202, the second spectrum information is respectively matched with each reference spectrum in the spectrum database, so as to obtain a matched target spectrum.
In this embodiment, the second spectrum information obtained after calibration is respectively matched with each reference spectrum in the spectrum database to determine a matched target spectrum, and when the matching degree between the second spectrum information obtained after calibration and the reference spectrum in the spectrum database is greater than a threshold value, the matched reference spectrum is used as the target spectrum. Wherein the threshold may be set by one skilled in the art as desired.
As shown in fig. 3, taking a full spectrum light sensor as an example for illustration, fig. 3 shows a schematic diagram of collected second spectrum information and reference spectrum information under the environment light of a standard light source D50, a standard light source D65 and a standard light source LED-NWG3, where the full spectrum sensor has a high matching degree between the second spectrum information under each standard light source and the reference spectrum information corresponding to the standard light source, that is, the spectrum information under each light source can be collected in advance and stored as a reference spectrum into a spectrum database, so that when the second spectrum information collected by the sensor is obtained, the second spectrum information can be respectively matched with each reference spectrum in the spectrum database, and a target light source matched with the second spectrum information can be determined, and as an implementation manner, a reference spectrum with the matching degree between the radiation illuminance of each reference spectrum and the radiation illuminance of the second spectrum information meeting a threshold value can be used as a matched target spectrum.
The threshold may be set by a person skilled in the art according to the accuracy requirement of scene matching, which is not limited in this embodiment.
In step 203, the optical information of the ambient light is determined according to the optical information of the target spectrum in the spectrum database.
The optical information of the target spectrum is determined by measuring the determined light source under the known ambient light, and the optical information of the target spectrum can be correspondingly stored in a spectrum database, so that after the target spectrum is determined, the optical information corresponding to the target spectrum can be searched, wherein the optical information comprises at least one of correlated color temperature, color coordinates and light source type.
In the white balance method of the embodiment, each reference spectrum stored in the spectrum database is matched with the second spectrum information obtained by calibration, the matched reference spectrum is taken as a target spectrum, so that correlated color temperature, illuminance, color coordinates and light source type contained in the optical information of the target spectrum are taken as the optical information of the second spectrum information, further, the white balance processing of the image is carried out based on the optical information, the color difference problem caused by the camera under automatic white balance is solved, the color authenticity is greatly reduced, and the effect of the white balance processing is improved.
Based on the above embodiments, the present embodiment provides another implementation manner of the image white balance method, and specifically describes another implementation manner of generating optical information of ambient light according to the calibrated second spectrum information. Fig. 4 is a flowchart of another image white balancing method according to an embodiment of the present application.
As shown in fig. 4, the step 103 may include the following steps:
in step 401, color coordinates of the ambient light are determined according to the second spectral information.
In one implementation manner of the embodiment of the present application, a set fitting relationship is adopted to fit the second spectrum information, for example, a linear fitting algorithm or a matrix fitting algorithm is adopted to obtain a tristimulus value of the ambient light; wherein the fit relationship is used to indicate the correlation between the spectrum and tristimulus values (Tristimulus values) which are a representation of the amount of stimulus that causes the human retina to three primary colors of a certain color. Further, the color coordinates of the ambient light are determined from the tristimulus values of the ambient light.
In this embodiment, a matrix fitting algorithm is described as an example.
Specifically, a preset fitting matrix and second spectrum information of the optical sensor are obtained, the second spectrum information comprises data of each channel of the optical sensor, the second spectrum information is fitted according to the fitting matrix, and tristimulus values of ambient light are obtained and can be expressed by the following formula:
Figure 570012DEST_PATH_IMAGE001
wherein,,
Figure 230801DEST_PATH_IMAGE002
for the fitting matrix, wherein each column in the fitting matrix corresponds to a channel, each row corresponds to a fitting coefficient of one of the tristimulus values, +. >
Figure 310752DEST_PATH_IMAGE003
For the second spectral information +.>
Figure 398794DEST_PATH_IMAGE004
Is a tristimulus value, where m is the number of channels of the photosensor, and each channel corresponds to a spectral band, for example, the number of channels is 10, which may include 8 visible light channels, 1 infrared channel, and a full spectral channel. />
Further, the color coordinates x, y are determined from the tristimulus values.
Where x=x/(x+y+z), y=y/(x+y+z).
Step 402, determining a correlated color temperature in the optical information according to the color coordinates of the ambient light.
In this embodiment, the correlated color temperature is obtained by conversion according to the color coordinates of the ambient light.
CCT=-499*((x-0.332)/(y-0.1858)) 3 +3525*((x-0.332)/(y-0.1858)) 2 -6823.3*((x-0.332)/(y-0.1858)) 1 +5520.33;
Wherein CCT is correlated color temperature (Correlated Colour Temperature, CCT).
In the white balance method of the embodiment, the data fitting is performed on the corrected second spectrum information to obtain the tristimulus value, the color coordinates of the ambient light are determined according to the tristimulus value, and then the correlated color temperature in the optical information is determined according to the color coordinates of the ambient light, so that the accuracy of determining the correlated color temperature of the ambient light is improved, and further the white balance processing of the image is performed according to the correlated color temperature, so that the color difference problem caused by shooting the image under automatic white balance is solved, the color authenticity is greatly reduced, and the effect of the white balance processing is improved.
Based on the above embodiments, the present embodiment provides another implementation manner of the white balancing method, and fig. 5 is a schematic flow chart of another white balancing method provided in the embodiment of the present application.
As shown in fig. 5, the method comprises the steps of:
step 501, calibrating the optical sensor of the terminal according to the output of the standard optical sensor to obtain calibration parameters.
In the embodiment, described with reference to fig. 6, the calibration matrix in fig. 6 is predetermined, and in one implementation of the embodiment, the spectrum of the external ambient light is F n (lambda), wherein n represents the light source spectrum of different ambient lights, the channel response function of the standard light sensor is G m( Lambda), wherein m is the number of channels of the standard light sensor, for example, m is 10 channels, each channel is provided with an independent analog-to-digital processing unit, and can convert external environment light into corresponding channel data, namely spectrum information, and further, convolution operation is carried out according to the spectrum information of the environment light and fatigue response function of the channel, wherein the spectrum information is an input signal, the channel response function is an excitation signal, and the spectrum information T of the corresponding environment light obtained by the standard light sensor gold(s) Can be expressed as:
Figure 931407DEST_PATH_IMAGE005
and under the same ambient light, the spectrum information T of the terminal sample(s) Can be expressed as:
Figure 648083DEST_PATH_IMAGE006
wherein F is mn Is an indexResponse data of channel m of the quasi-photosensor under light source n. F (F) mns Refers to response data of the channel m of the light sensor as a sample under the light source n, S being data for identifying the different sensors, i.e. data for identifying whether the data is of a standard sensor or of any of the sample sensors that need to be calibrated.
According to spectral information T of standard light sensor gold(s) And spectral information T of the terminal sample(s) Can determine the spectrum information T of the terminal sample(s) And spectral information T of the terminal sample(s) The mapping relation indicates a calibration parameter determined according to a standard light sensor, which may be represented by means of a matrix, also called a calibration matrix, so that according to the spectral calibration matrix, any light sensor measured spectral information may be calibrated. Wherein, the spectrum information T of the terminal sample(s) And spectral information T of the terminal sample(s) The mapping relation of (2) is shown by the following formula:
Figure 582541DEST_PATH_IMAGE007
wherein the calibration parameters, i.e. the calibration matrix, are
Figure 575905DEST_PATH_IMAGE008
Wherein V is mn Refers to the calibration factor of channel m in the calibration matrix under light source n.
The calibration parameters determined in the embodiment can be used for calibrating the first spectrum information of the ambient light acquired by the optical sensor of the terminal, so that the second spectrum information obtained by calibration is close to the spectrum information of the standard sensor, and the accuracy of calibration is improved.
Step 502, first spectral information of ambient light is acquired from a light sensor of a terminal.
Step 503, calibrating the first spectrum information by using calibration parameters calibrated in advance to obtain second spectrum information.
The principles of steps 502-503 may be the same as those explained in the foregoing method embodiments, and are not repeated in this embodiment.
In step 504, optical information of the ambient light is generated based on the second spectral information.
In this embodiment, the method for generating the optical information of the ambient light according to the second spectral information indicated by a and B in fig. 6 may refer to the explanation in the foregoing embodiments of the method in fig. 2 and 3, and the principle is the same, which is not repeated in this embodiment.
As shown in fig. 6, at least one of correlated color temperature, color coordinates, and light source type may be included in the optical information, and as an implementation, the optical information may further include illuminance, specifically, illuminance of the ambient light is determined according to the second spectral information.
In one implementation of the present embodiment, since the Infrared (IR) ratios included in the spectrum information of different light source types are different, the types of different light sources can be distinguished according to the IR ratio included in the spectrum information, so as to implement the determination of the light source type.
Step 505, performing white balance processing on the image acquired by the image sensor of the terminal according to the optical information of the ambient light.
The method for performing white balance processing on the image collected by the image sensor of the terminal according to the optical information of the ambient light may refer to the description in the foregoing method embodiment, which is not described in detail in this embodiment.
Step 506, adjusting the brightness of the screen of the terminal according to the illuminance and/or adjusting the color temperature of the screen of the terminal according to the correlated color temperature.
In this embodiment, the optical information includes illuminance, where the illuminance indicates a brightness condition of the environment, and the brightness of the automatic backlight of the terminal screen may be adjusted according to the illuminance, so as to automatically adjust the screen brightness according to the brightness condition of the environment, so as to improve the display effect of the terminal screen. And according to at least one of the color coordinates, the correlated color temperature and the light source type in the optical information, the correlated color temperature of the environment can be determined, the color temperature of the screen can be adjusted according to the correlated color temperature so as to meet the requirements of different scenes, for example, when the eye protection mode needs to be started, the screen color temperature is compensated according to the correlated color temperature of the environment, so that the difference value between the screen color temperature and the environment color temperature is in a set range so as to avoid the irritation to eyes and enter the eye protection mode. Alternatively, the color temperature of the screen may be adjusted to a color temperature corresponding to the eye-shielding mode, for example, around 3500K, according to the correlated color temperature.
It should be noted that, step 506 may also be performed before step 505 or performed synchronously with step 505, which is not limited in this embodiment.
In the image white balance method of the embodiment, first spectrum information of ambient light is acquired from the optical sensor of the terminal, calibration is performed on the first spectrum information by adopting calibration parameters calibrated in advance to obtain second spectrum information, optical information of the ambient light is generated according to the second spectrum information, white balance processing is performed on an image acquired by the image sensor of the terminal according to the optical information of the ambient light, the first spectrum information is calibrated by adopting the calibration parameters calibrated in advance in the method, so that the optical information of the ambient light is obtained, the accuracy of determining the optical information of the ambient light is improved, white balance adjustment of the image is performed on the basis of the optical information of the ambient light obtained by calibration, and the effect of white balance processing is improved. Meanwhile, according to at least one of color coordinates, correlated color temperature and light source type in the optical information, the color temperature of the screen can be adjusted to meet the requirements of different scenes.
In order to implement the above embodiment, the present application also proposes an image white balancing device.
Fig. 7 is a schematic structural diagram of an image white balancing device according to an embodiment of the present application.
As shown in fig. 7, the apparatus includes:
an acquisition module 71 for acquiring first spectral information of the ambient light from the light sensor of the terminal.
The first calibration module 72 is configured to calibrate the first spectrum information by using calibration parameters calibrated in advance, so as to obtain second spectrum information.
A generating module 73, configured to determine optical information of the ambient light according to the second spectrum information.
And the processing module 74 is used for performing white balance processing on the image acquired by the image sensor of the terminal according to the optical information of the ambient light.
Further, in an implementation manner of this embodiment, the generating module 73 is configured to:
acquiring a spectrum database;
respectively matching the second spectrum information with each reference spectrum in the spectrum database to obtain a matched target spectrum;
determining the optical information of the ambient light according to the optical information of the target spectrum in the spectrum database; wherein the optical information includes at least one of correlated color temperature, color coordinates, and light source type.
In one implementation of this embodiment, the generating module 73 is configured to:
Determining color coordinates of the ambient light according to the second spectrum information;
and determining the correlated color temperature in the optical information according to the color coordinates of the ambient light.
In one implementation of this embodiment, the generating module 73 is configured to:
fitting the second spectrum information by adopting a set fitting relation to obtain a tristimulus value of the ambient light; wherein the fit relationship is used to indicate a correlation between the spectrum and the tristimulus values;
and determining the color coordinates of the ambient light according to the tristimulus values of the ambient light.
In one implementation of this embodiment, the apparatus further includes:
and the second calibration module is used for calibrating the optical sensor of the terminal according to the output of the standard optical sensor so as to obtain the calibration parameter.
In one implementation of this embodiment, the processing module 74 is further configured to:
and removing the color of the ambient light from the image according to the optical information of the ambient light so as to perform white balance processing on the image acquired by the image sensor of the terminal.
In one implementation of this embodiment, the optical information further includes illuminance, and the apparatus further includes:
And the adjusting module is used for adjusting the brightness of the screen of the terminal according to the illuminance and/or adjusting the color temperature of the screen of the terminal according to the correlated color temperature.
It should be noted that the foregoing explanation of the method embodiment is also applicable to the apparatus of this embodiment, and the principles are the same, and will not be repeated here.
In the image white balance device of the embodiment, first spectrum information of ambient light is acquired from the optical sensor of the terminal, calibration is performed on the first spectrum information by adopting calibration parameters calibrated in advance to obtain second spectrum information, optical information of the ambient light is determined according to the second spectrum information, white balance processing is performed on an image acquired by the image sensor of the terminal according to the optical information of the ambient light, the first spectrum information is calibrated by adopting the calibration parameters calibrated in advance in the application to obtain the optical information of the ambient light, accuracy of determining the optical information of the ambient light is improved, white balance adjustment of the image is performed on the basis of the optical information of the ambient light obtained by calibration, and the effect of white balance processing is improved. Meanwhile, according to at least one of color coordinates, correlated color temperature and light source type in the optical information, the color temperature of the screen can be adjusted to meet the requirements of different scenes.
In order to implement the above embodiments, the embodiments of the present application provide a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the method according to the foregoing method embodiments when the processor executes the program.
In order to implement the above embodiments, the present application proposes a non-transitory computer readable storage medium, which when executed by a processor, implements a method as described in the foregoing method embodiments.
In order to implement the above embodiments, the present application proposes a computer program product, which when executed by an instruction processor in the computer program product implements a method according to the above method embodiments.
Fig. 8 is a block diagram of an exemplary electronic device provided by an embodiment of the present application. The electronic device 12 shown in fig. 8 is merely an example and should not be construed as limiting the functionality and scope of use of embodiments of the present application.
As shown in fig. 8, the electronic device 12 is in the form of a general purpose computing device. Components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a memory 28, and a bus 18 that connects the various system components, including the memory 28 and the processing unit 16.
Bus 18 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, and a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include industry Standard architecture (Industry Standard Architecture; hereinafter ISA) bus, micro channel architecture (Micro Channel Architecture; hereinafter MAC) bus, enhanced ISA bus, video electronics standards Association (Video Electronics Standards Association; hereinafter VESA) local bus, and peripheral component interconnect (Peripheral Component Interconnection; hereinafter PCI) bus.
Electronic device 12 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by electronic device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
Memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (Random Access Memory; hereinafter: RAM) 30 and/or cache memory 32. The electronic device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from or write to non-removable, nonvolatile magnetic media (not shown in FIG. 8, commonly referred to as a "hard disk drive"). Although not shown in fig. 8, a magnetic disk drive for reading from and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from or writing to a removable non-volatile optical disk (e.g., a compact disk read only memory (Compact Disc ReadOnly Memory; hereinafter CD-ROM), digital versatile read only optical disk (Digital Video DiscRead Only Memory; hereinafter DVD-ROM), or other optical media) may be provided. In such cases, each drive may be coupled to bus 18 through one or more data medium interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to carry out the functions of the embodiments of the present application.
A program/utility 40 having a set (at least one) of program modules 42 may be stored in, for example, memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment. Program modules 42 generally perform the functions and/or methods in the embodiments described herein.
The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), one or more devices that enable a user to interact with the electronic device 12, and/or any devices (e.g., network card, modem, etc.) that enable the electronic device 12 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 22. Also, the electronic device 12 may communicate with one or more networks, such as a local area network (Local Area Network; hereinafter: LAN), a wide area network (Wide Area Network; hereinafter: WAN) and/or a public network, such as the Internet, via the network adapter 20. As shown in fig. 8, the network adapter 20 communicates with other modules of the electronic device 12 over the bus 18. It should be appreciated that although not shown in fig. 8, other hardware and/or software modules may be used in connection with electronic device 12, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
The processing unit 16 executes various functional applications and data processing by running programs stored in the memory 28, for example, implementing the methods mentioned in the foregoing embodiments.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present application. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In the description of the present application, the meaning of "plurality" is at least two, such as two, three, etc., unless explicitly defined otherwise.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and additional implementations are included within the scope of the preferred embodiment of the present application in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the embodiments of the present application.
Logic and/or steps represented in the flowcharts or otherwise described herein, e.g., a ordered listing of executable instructions for implementing logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). In addition, the computer readable medium may even be paper or other suitable medium on which the program is printed, as the program may be electronically captured, via, for instance, optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner, if necessary, and then stored in a computer memory.
It is to be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. As with the other embodiments, if implemented in hardware, may be implemented using any one or combination of the following techniques, as is well known in the art: discrete logic circuits having logic gates for implementing logic functions on data signals, application specific integrated circuits having suitable combinational logic gates, programmable Gate Arrays (PGAs), field Programmable Gate Arrays (FPGAs), and the like.
Those of ordinary skill in the art will appreciate that all or a portion of the steps carried out in the method of the above-described embodiments may be implemented by a program to instruct related hardware, where the program may be stored in a computer readable storage medium, and where the program, when executed, includes one or a combination of the steps of the method embodiments.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing module, or each unit may exist alone physically, or two or more units may be integrated in one module. The integrated modules may be implemented in hardware or in software functional modules. The integrated modules may also be stored in a computer readable storage medium if implemented in the form of software functional modules and sold or used as a stand-alone product.
The above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, or the like. Although embodiments of the present application have been shown and described above, it will be understood that the above embodiments are illustrative and not to be construed as limiting the application, and that variations, modifications, alternatives, and variations may be made to the above embodiments by one of ordinary skill in the art within the scope of the application.

Claims (14)

1. An image white balance method, comprising the steps of:
acquiring first spectral information of ambient light from a light sensor of a terminal;
calibrating the first spectrum information by adopting calibration parameters calibrated in advance to obtain second spectrum information;
determining optical information of the ambient light according to the second spectrum information;
performing white balance processing on an image acquired by an image sensor of the terminal according to the optical information of the ambient light;
the optical information of the ambient light at least comprises a light source type, and the white balance processing is performed on the image collected by the image sensor of the terminal according to the optical information of the ambient light, and the method comprises the following steps:
determining a color temperature corresponding to the type of the light source contained in the optical information as a correlated color temperature of the ambient light; or, determining the color coordinates of the ambient light according to the second spectrum information, and determining the correlated color temperature in the optical information according to the color coordinates of the ambient light;
Performing white balance processing on an image acquired by an image sensor of the terminal according to the correlated color temperature in the optical information;
wherein after determining the correlated color temperature, further comprising: inquiring the corresponding relation between the correlated color temperature and the gain values of the three primary colors to obtain the gain values of the three primary colors, and multiplying the original gray values of the three primary colors of RGB by the corresponding gain values respectively for each pixel point in the image to obtain the adjusted gray value of RGB of each pixel point so as to adjust the color temperature of each pixel point in the image;
the generating optical information of the ambient light according to the second spectrum information includes:
acquiring a spectrum database;
respectively matching the second spectrum information with each reference spectrum in the spectrum database to obtain a matched target spectrum;
determining the optical information of the ambient light according to the optical information of the target spectrum; wherein the optical information further comprises color coordinates.
2. The method of claim 1, wherein said determining color coordinates of said ambient light from said second spectral information comprises:
fitting the second spectrum information by adopting a set fitting relation to obtain a tristimulus value of the ambient light; wherein the fit relationship is used to indicate a correlation between the spectrum and the tristimulus values;
And determining the color coordinates of the ambient light according to the tristimulus values of the ambient light.
3. The method according to any one of claims 1-2, wherein the method further comprises:
and calibrating the optical sensor of the terminal according to the output of the standard optical sensor to obtain the calibration parameter.
4. The method according to any one of claims 1-2, wherein performing white balance processing on the image acquired by the image sensor of the terminal according to the optical information of the ambient light comprises:
and removing the color of the ambient light from the image according to the optical information of the ambient light so as to perform white balance processing on the image acquired by the image sensor of the terminal.
5. The method of any of claims 1-2, wherein the optical information further comprises illumination, the method further comprising:
and adjusting the brightness of the screen of the terminal according to the illuminance.
6. The method according to any one of claims 1-2, further comprising:
and adjusting the color temperature of the screen of the terminal according to the correlated color temperature.
7. An image white balance device, comprising:
The acquisition module is used for acquiring first spectrum information of the ambient light from the optical sensor of the terminal;
the first calibration module is used for calibrating the first spectrum information by adopting calibration parameters calibrated in advance to obtain second spectrum information;
the generating module is used for determining optical information of the ambient light according to the second spectrum information;
the processing module is used for carrying out white balance processing on the image acquired by the image sensor of the terminal according to the optical information of the ambient light;
the optical information of the ambient light at least comprises a light source type, and the white balance processing is performed on the image collected by the image sensor of the terminal according to the optical information of the ambient light, and the method comprises the following steps:
determining a color temperature corresponding to the type of the light source contained in the optical information as a correlated color temperature of the ambient light; or, determining the color coordinates of the ambient light according to the second spectrum information, and determining the correlated color temperature in the optical information according to the color coordinates of the ambient light;
performing white balance processing on an image acquired by an image sensor of the terminal according to the correlated color temperature in the optical information;
wherein after determining the correlated color temperature, further comprising: inquiring the corresponding relation between the correlated color temperature and the gain values of three primary colors to obtain the gain values of the three primary colors, multiplying the original gray values of the three primary colors of RGB by the corresponding gain values respectively for each pixel point in the image to obtain the adjusted gray value of RGB of each pixel point so as to adjust the color temperature of each pixel point in the image;
The generating module is used for:
acquiring a spectrum database;
respectively matching the second spectrum information with each reference spectrum in the spectrum database to obtain a matched target spectrum;
determining the optical information of the ambient light according to the optical information of the target spectrum in the spectrum database; wherein the optical information further comprises color coordinates.
8. The apparatus of claim 7, wherein the generating module is configured to:
fitting the second spectrum information by adopting a set fitting relation to obtain a tristimulus value of the ambient light; wherein the fit relationship is used to indicate a correlation between the spectrum and the tristimulus values;
and determining the color coordinates of the ambient light according to the tristimulus values of the ambient light.
9. The apparatus according to any one of claims 7-8, further comprising:
and the second calibration module is used for calibrating the optical sensor of the terminal according to the output of the standard optical sensor so as to obtain the calibration parameter.
10. The apparatus of any of claims 7-8, wherein the processing module is further configured to:
And removing the color of the ambient light from the image according to the optical information of the ambient light so as to perform white balance processing on the image acquired by the image sensor of the terminal.
11. The apparatus of any one of claims 7-8, wherein the optical information further comprises illumination, the apparatus further comprising:
and the adjusting module is used for adjusting the brightness of the screen of the terminal according to the illuminance.
12. The apparatus according to any one of claims 7-8, further comprising:
and adjusting the color temperature of the screen of the terminal according to the correlated color temperature.
13. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method according to any one of claims 1-6 when the computer program is executed.
14. A non-transitory computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when executed by a processor, implements the method according to any of claims 1-6.
CN202110724183.1A 2021-06-29 2021-06-29 Image white balance method, device, electronic equipment and computer readable storage medium Active CN113194303B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110724183.1A CN113194303B (en) 2021-06-29 2021-06-29 Image white balance method, device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110724183.1A CN113194303B (en) 2021-06-29 2021-06-29 Image white balance method, device, electronic equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN113194303A CN113194303A (en) 2021-07-30
CN113194303B true CN113194303B (en) 2023-05-23

Family

ID=76976842

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110724183.1A Active CN113194303B (en) 2021-06-29 2021-06-29 Image white balance method, device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN113194303B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114216573B (en) * 2021-12-13 2023-12-19 Oppo广东移动通信有限公司 Color temperature detection method and device, computer readable medium and electronic equipment
CN115190282B (en) * 2022-06-23 2023-11-28 重庆市天实精工科技有限公司 Method for avoiding white balance distortion of camera module under high color temperature
CN115278191B (en) * 2022-07-28 2024-04-16 Oppo广东移动通信有限公司 Image white balance method and device, computer readable medium and electronic equipment
CN117729412A (en) * 2022-09-07 2024-03-19 北京与光科技有限公司 Photographing method based on spectrum information and electronic equipment
CN115937147B (en) * 2022-12-09 2023-09-26 北京小米移动软件有限公司 Defect detection parameter determining method, device, equipment and storage medium
CN115941919A (en) * 2022-12-23 2023-04-07 杭州中科极光科技有限公司 White balance control device, control method and laser display equipment

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103634581A (en) * 2012-08-21 2014-03-12 联想(北京)有限公司 White balance control method, device and electronic equipment
CN107809629A (en) * 2017-11-24 2018-03-16 西安易朴通讯技术有限公司 A kind of white balance correction method, terminal and light source
CN110139088B (en) * 2019-05-28 2021-03-02 Oppo广东移动通信有限公司 Color temperature compensation method, electronic device, and computer-readable storage medium
CN112710383B (en) * 2019-10-24 2024-07-09 北京小米移动软件有限公司 Light sensor calibration method, device and storage medium
CN110913194B (en) * 2019-11-22 2021-12-28 Oppo广东移动通信有限公司 Automatic white balance compensation method, terminal and computer storage medium
CN111586300B (en) * 2020-05-09 2022-02-08 展讯通信(上海)有限公司 Color correction method, device and readable storage medium
CN111551266B (en) * 2020-05-25 2021-01-22 吉林求是光谱数据科技有限公司 Environmental color temperature testing method and system based on multispectral image detection technology

Also Published As

Publication number Publication date
CN113194303A (en) 2021-07-30

Similar Documents

Publication Publication Date Title
CN113194303B (en) Image white balance method, device, electronic equipment and computer readable storage medium
CN108024055B (en) Method, apparatus, mobile terminal and the storage medium of white balance processing
US9996913B2 (en) Contrast based image fusion
JP5377691B2 (en) Image processing apparatus with auto white balance
US8310561B2 (en) White balance correction apparatus and method
US8111302B2 (en) White balance control apparatus and method
TWI769509B (en) Method of using a camera system to characterize ambient illumination, computer readable storage medium, and camera system
US8629919B2 (en) Image capture with identification of illuminant
JP2000171304A (en) Detecting method of color illumination color temperature and device therefor
CN103108469B (en) Method and device for controlling output light of illuminating device and illuminating system
US9460521B2 (en) Digital image analysis
JPWO2006059573A1 (en) Color adjustment apparatus and method
US9479708B2 (en) Image processing device, image processing method, and image processing program
KR20070042508A (en) Method and device for colour calibrating a camera and/or a display device and for correcting colour defects from digital images
Kim et al. Characterization for high dynamic range imaging
JP4677699B2 (en) Image processing method, image processing device, photographing device evaluation method, image information storage method, and image processing system
EP1832108A2 (en) Automatic white balance control
JP5899894B2 (en) Imaging apparatus, image processing apparatus, image processing program, and image processing method
JP4692872B2 (en) Image processing apparatus and program
CN109819150B (en) Multi-channel image acquisition device and method for acquiring multi-channel image
JP6276564B2 (en) Image processing apparatus and image processing method
Brauers et al. Multispectral image acquisition with flash light sources
CN115190282B (en) Method for avoiding white balance distortion of camera module under high color temperature
Kamath et al. Prediction of illuminance on the work plane using low dynamic unprocessed image data
Zhang et al. High dynamic range content calibration for accurate acquisition and display

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant