WO2016184167A1 - Method and device for realizing auto white balance function - Google Patents

Method and device for realizing auto white balance function Download PDF

Info

Publication number
WO2016184167A1
WO2016184167A1 PCT/CN2016/072738 CN2016072738W WO2016184167A1 WO 2016184167 A1 WO2016184167 A1 WO 2016184167A1 CN 2016072738 W CN2016072738 W CN 2016072738W WO 2016184167 A1 WO2016184167 A1 WO 2016184167A1
Authority
WO
WIPO (PCT)
Prior art keywords
color temperature
color
flash
test
photograph
Prior art date
Application number
PCT/CN2016/072738
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 中兴通讯股份有限公司
Publication of WO2016184167A1 publication Critical patent/WO2016184167A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/80Camera processing pipelines; Components thereof
    • H04N23/84Camera processing pipelines; Components thereof for processing colour signals
    • H04N23/88Camera processing pipelines; Components thereof for processing colour signals for colour balance, e.g. white-balance circuits or colour temperature control

Definitions

  • This application relates to, but is not limited to, the field of terminal image processing technology.
  • the human eye and the brain have certain physiological and psychological adaptability to the color temperature, so the color seen is less affected by the color temperature shift, and the camera sensor does not have this ability, so if the photo taken does not pass the white balance If processed, there will be a large deviation from the color seen by the human eye (although the true color of the human eye is also deviated from the white light).
  • the white balance processing mainly processes the image data obtained by photographing the camera sensor.
  • RGB format describes the color according to the principle of the three-primary color adding system
  • YUV format describes the color according to the principle of brightness (Y) and color difference (U, V).
  • the two data formats can be converted to each other.
  • the commonly used white balance algorithm is usually based on the assumption of Grey World, which is based on the assumption that the average value of the color of the scene falls within a specific range. If the measured result deviates from the range, the corresponding parameter is adjusted. The correction causes its mean to fall within the specified range.
  • the white balance algorithm is affected by the color temperature. For example, if the camera is in warm tones, using a cool-tone flash can cause the photo to be bluish. If the subject is cold, using a warm-tone flash can cause the photo to turn yellow. For professional recording, you can use the gray board with a light reflectivity of 18% to adjust the exposure parameters, or manually set the ambient color temperature to perform white balance color temperature calibration.
  • the automatic white balance function of the mobile phone camera is usually used, but the automatic white balance function is affected by the ambient color temperature.
  • the photos taken in some scenes have the defect of color cast.
  • This paper provides a method and device for realizing the automatic white balance function, which can adaptively match the ambient color temperature and optimize the automatic white balance function.
  • An embodiment of the present invention provides a method for implementing an automatic white balance function, where the method includes:
  • the subject is re-photographed based on the estimated color temperature of the subject and white balance correction is performed on the photograph taken.
  • the known color temperature flash lamp comprises any one of the following a)-e):
  • the pre-flash shooting is performed by using a flash of a known color temperature to obtain a test photograph of the subject at an ambient color temperature determined by the flash, including:
  • the ambient color temperature determined by the flash being the color temperature of the flash, obtaining a test photograph of the subject at an ambient color temperature determined by the flash;
  • Pre-flash shooting is sequentially performed by using flash lamps of different color temperatures, and the ambient color temperature determined by the flash is the color temperature of the flash, and the test photos of the subject at each ambient color temperature are sequentially obtained.
  • performing color shift detection on the test photo to obtain the corresponding target in the ring Color shift data at ambient temperature including:
  • the color shift data includes: a red-green color cast coefficient, a yellow-blue color cast coefficient, and a color cast factor for indicating the degree of color shift.
  • the estimating the color temperature of the photographic subject according to the color cast data provided by the test photo comprises:
  • the test photo is a sheet
  • the color shift data of the test photograph indicates a reddish or yellowish color
  • the color shift data indicates a greenish or bluish color, and it is estimated that the color temperature of the subject is lower than the ambient color temperature corresponding to the test photograph; or
  • the test photograph with the lightest color deviation is selected as the first test photograph from the test photograph indicating the reddish or yellowish color shift data, and the green color or bluish color is indicated from the color shift data.
  • the test photograph having the lightest degree of color deviation is selected as the second test photograph, and the color temperature of the photographed object is estimated to be higher than the ambient color temperature corresponding to the first test photograph and lower than the ambient color temperature corresponding to the second test photograph. .
  • the estimating the color temperature of the photographic subject according to the color cast data provided by the test photo comprises:
  • test photo When the test photo is a sheet, compare the color shift data of the test photograph with each record corresponding to the flashing light of the reference photograph in the reference table, and if the exact matching record is found, The ambient temperature corresponding to the found record is taken as the color temperature of the subject. If no exact match is found, a record with the same color shift and the closest color shift is found, and the ambient color temperature corresponding to the found record is taken as the shooting.
  • the color temperature of the object
  • the reference table includes a color shift data record when each of the known color temperature flashes captures different scenes.
  • the estimating the color temperature of the photographic subject according to the color cast data provided by the test photo comprises:
  • the color of the test photograph is The partial data is compared with each record corresponding to the flashing light of the reference photo in the reference table. If an exact matching record is found, the ambient color temperature corresponding to the found record is taken as the color temperature of the shooting object, and the end is all The comparison of the test photos; if the exact matching record is not found, the reference color temperature interval is determined according to the interval corresponding to the color cast factor;
  • the color temperature value of the subject is determined according to the reference color temperature interval determined by each test photo;
  • the reference table includes a color shift data record when each of the known color temperature flashes captures different scenes.
  • determining the color temperature value of the photographic subject according to the reference color temperature interval determined according to each test photo includes:
  • the photographing the photographing object according to the estimated color temperature of the photographing object and performing white balance correction on the photograph taken includes:
  • the estimated color temperature of the subject is used as a white balance parameter, and white balance correction is performed on the photograph taken; or
  • selecting a flash whose color temperature is closest to the subject is flashing, including:
  • the flash of the known color temperature includes a dual color temperature flash
  • the estimated color temperature of the subject is within a color temperature range of the dual color temperature flash output
  • the dual color temperature flash outputs light of a corresponding color temperature.
  • An embodiment of the present invention further provides an apparatus for implementing an automatic white balance function, including:
  • the pre-shooting and color-shift detection module is configured to: perform pre-flash shooting with a flash of a known color temperature, obtain a test photograph of the subject at an ambient color temperature determined by the flash, perform color shift detection on the test photograph, obtain a Depicting color shift data of the subject at a corresponding ambient color temperature;
  • a color temperature estimation module configured to: estimate a color temperature of the photographic subject according to color cast data provided by the test photo;
  • the photographing and white balance correction module is configured to: re-photograph the subject according to the estimated color temperature of the subject and perform white balance correction on the photograph taken.
  • the known color temperature flash lamp comprises any one of the following a)-e):
  • the pre-shooting and color-shift detection module is configured to:
  • the ambient color temperature determined by the flash being the color temperature of the flash, obtaining a test photograph of the subject at an ambient color temperature determined by the flash;
  • Pre-flash shooting is sequentially performed by using flash lamps of different color temperatures, and the ambient color temperature determined by the flash is the color temperature of the flash, and the test photos of the subject at each ambient color temperature are sequentially obtained.
  • the pre-shooting and color-shift detection module is configured to:
  • the color shift data includes: a red-green color cast coefficient, a yellow-blue color cast coefficient, and a color cast factor for indicating the degree of color shift.
  • the color temperature estimation module is configured to:
  • the test photo is a sheet
  • the color shift data of the test photograph indicates a reddish or yellowish color
  • the color shift data indicates a greenish or bluish color, and it is estimated that the color temperature of the subject is lower than the ambient color temperature corresponding to the test photograph; or
  • the test photograph with the lightest color deviation is selected as the first test photograph from the test photograph indicating the reddish or yellowish color shift data, and the green color or bluish color is indicated from the color shift data.
  • the test photograph having the lightest degree of color deviation is selected as the second test photograph, and the color temperature of the photographed object is estimated to be higher than the ambient color temperature corresponding to the first test photograph and lower than the ambient color temperature corresponding to the second test photograph. .
  • the color temperature estimation module is configured to:
  • test photo When the test photo is a sheet, compare the color shift data of the test photograph with each record corresponding to the flashing light of the reference photograph in the reference table, and if the exact matching record is found, The ambient temperature corresponding to the found record is taken as the color temperature of the subject. If no exact match is found, a record with the same color shift and the closest color shift is found, and the ambient color temperature corresponding to the found record is taken as the shooting.
  • the color temperature of the object
  • the reference table includes a color shift data record when each of the known color temperature flashes captures different scenes.
  • the color temperature estimation module is configured to:
  • test photograph When the test photograph is multiple sheets, for each test photograph, compare the color shift data of the test photograph with each record corresponding to the flashing light of the reference photograph in the reference table, such as finding For a perfectly matched record, the ambient color temperature corresponding to the found record is taken as the color temperature of the subject, and the comparison of all the test photos is ended; if the completely matched record is not found, the reference color temperature is determined according to the interval corresponding to the color cast factor.
  • the color temperature value of the subject is determined according to the reference color temperature interval determined by each test photo;
  • the reference table includes a color shift data record when each of the known color temperature flashes captures different scenes.
  • the color temperature estimation module is configured to:
  • the shooting and white balance correction module is configured to:
  • the estimated color temperature of the subject is used as a white balance parameter, and white balance correction is performed on the photograph taken; or
  • the shooting and white balance correction module is configured to:
  • the flash of the known color temperature includes a dual color temperature flash
  • the estimated color temperature of the subject is within a color temperature range of the dual color temperature flash output
  • the dual color temperature flash outputs light of a corresponding color temperature.
  • the embodiment of the present invention further provides a computer readable storage medium storing computer executable instructions for performing the method of any of the above.
  • the method and device for implementing the automatic white balance function pre-flashes by using a flash with a known color temperature to obtain a test photo of the photographed object, and the test photograph is calculated by the color shift detection algorithm.
  • Color shift data estimate the ambient color temperature based on the color shift data, and assist the automatic white balance function.
  • the input current of the dual color temperature flash is controlled to perform the photographing by mixing and outputting the appropriate color temperature, thereby optimizing the automatic white balance function.
  • FIG. 1 is a flowchart of a method for implementing an automatic white balance function according to an embodiment of the present invention.
  • FIG. 2 is a schematic diagram of an apparatus for implementing an automatic white balance function according to an embodiment of the present invention.
  • the embodiment of the invention can construct a brand new flash system, which comprises an electronic flash LED1 (color temperature 5500K) and a pair of dual color temperature flashes, wherein the dual color temperature flash comprises: 1 cold tone flash LED2 (color temperature 7000K) and 1 A warm tone flash LED3 (color temperature 2500K, amber).
  • Each flash of the flash system is controlled by a DC-DC power supply.
  • the input current of the dual color temperature flash LED2 and LED3 is adjustable (for example, adjustable from 100mA to 1.5A), and the input current can be divided into multiple levels. Control, for example, every 200 mA level, can be divided into 8 levels for control.
  • the color shift detection algorithm can estimate the color temperature value of the current photographing environment, which is an important hardware aid for the automatic white balance function.
  • an embodiment of the present invention provides a method for implementing an automatic white balance function, where the method includes:
  • S101 Perform pre-flash shooting with a flash of a known color temperature, obtain a test photograph of the subject at an ambient color temperature determined by the flash, perform color shift detection on the test photograph, and obtain the photographed object at a corresponding ambient color temperature.
  • Color shift data
  • the pre-flash shooting is performed by using a flash of a known color temperature, and a test photo of the subject under the ambient color temperature determined by the flash is obtained, including:
  • the ambient color temperature determined by the flash Obtaining a test photograph of the subject at an ambient color temperature determined by the flash for the color temperature of the flash;
  • Pre-flash shooting is performed by using flashes of different color temperatures in sequence, and the ambient color temperature determined by the flash is the color temperature of the flash, and the test photos of the subject at each ambient color temperature are sequentially obtained;
  • the flash of the known color temperature comprises any one of the following a)-e):
  • the color temperature of the flash lamp used in the flash system constructed in the embodiment of the present invention is 2500K, 5500K, and 7000K, respectively, which is a relatively popular flash lamp on the market.
  • the color shift detection is performed on the test photo, and the color shift data of the photographed object at a corresponding ambient color temperature is obtained, including:
  • the color shift data includes: a red-green color cast coefficient, a yellow-blue color cast coefficient, and a color cast factor for indicating the degree of color shift.
  • the principle of the color circle detection method based on the equivalent circle is that the color cast of the image is not only directly related to the average value of the image chromaticity, but also related to the chromaticity distribution characteristic of the image. If the chromaticity distribution in the two-dimensional histogram on the ab chromaticity coordinate plane is basically a single peak, or the distribution is concentrated, and the chromaticity average is relatively large, there is generally a color shift, and the average value of the chromaticity is Large, the color is more serious.
  • the a-b chromaticity coordinate plane uses the CIE1976L-a-b chromaticity space standard, and the YUV signal and the a-b chromaticity coordinate can be converted to each other.
  • the center coordinates of the equivalent circle are ⁇ Da, Db ⁇ , and the radius is M.
  • the distance from the center of the equivalent circle to the ab chromaticity plane neutral axis dot (0,0) is D.
  • L and W be the length and width of the image, the unit is the pixel, a ij is the a chromaticity data of the pixel of i row j column, and b ij is the b chromaticity data of the pixel of i row j column.
  • the a chrominance component Da of the central coordinate of the equivalent circle is the mean of the chromaticity value of the image a
  • the b chrominance component Db of the central coordinate of the equivalent circle is the mean of the chromaticity value of the image b:
  • M a is the variance of the image a chromaticity value
  • M b is the variance of the image b chromaticity value
  • the variance reflects the degree of deviation from the center of chromaticity
  • Ma is the degree of deviation of the a-axis
  • Mb is the degree of deviation of the b-axis
  • the deviation radius M represents the deviation radius from the central coordinate ⁇ Da, Db ⁇ .
  • the ratio of the image average chromaticity D to the chromaticity center distance M that is, the color cast factor K, is used to measure the degree of color cast of the image.
  • the color cast of the image as a whole can be judged by the position of the equivalent circle on the a-b chromaticity plane.
  • the red and green color cast coefficient is represented by Da
  • the yellow and blue color cast coefficient is represented by Db
  • the color cast factor is represented by K.
  • Da>0 indicating that the image is reddish
  • Da ⁇ 0 indicating that the image is greenish
  • Db>0 indicating that the image is yellowish
  • Db ⁇ 0 indicating that the image is bluish.
  • the larger the value of the color cast factor K the more severe the image color cast.
  • the calculated values of the red-green color cast coefficient Da, the yellow-blue color cast coefficient Db, and the color cast factor K are used as color shift data.
  • the pre-flash shooting is performed by using a flash of a known color temperature, and a test photo of the subject at an ambient color temperature determined by the flash is obtained, and color shift detection is performed on the test photo, including:
  • the number of the flashes of the known color temperature is plural, after the pre-flash shooting is performed by using one flash and the test photos of the subject at the color temperature corresponding to the flash are obtained, color shift detection is performed on the test photo. At the same time, the next flash is used for pre-flash shooting.
  • the above-described pre-flash shooting and color shift detection by means of a pipeline can improve real-time performance.
  • the estimating the color temperature of the photographic subject according to the color shift data provided by the test photo includes:
  • the test photo is a sheet
  • the color shift data of the test photograph indicates a reddish or yellowish color
  • the color shift data indicates a greenish or bluish color, and it is estimated that the color temperature of the subject is lower than the ambient color temperature corresponding to the test photograph; or
  • the test photograph with the lightest color deviation is selected as the first test photograph from the test photograph indicating the reddish or yellowish color shift data, and the green color or bluish color is indicated from the color shift data.
  • the test photograph having the lightest degree of color deviation is selected as the second test photograph, and the color temperature of the photographed object is estimated to be higher than the ambient color temperature corresponding to the first test photograph and lower than the ambient color temperature corresponding to the second test photograph. ;
  • the color temperature of the subject can be estimated by using the look-up table method, and a reference table including a color shift data record when each of the scenes of the known color temperature captures different scenes is preset.
  • the color shift record includes at least: a red-green color cast coefficient, a yellow-blue color cast coefficient, and a color cast factor for indicating the degree of color shift.
  • the estimating the color temperature of the photographic subject according to the color shift data provided by the test photo includes:
  • test photo When the test photo is a sheet, compare the color shift data of the test photograph with each record corresponding to the flashing light of the reference photograph in the reference table, and if the exact matching record is found, The ambient temperature corresponding to the found record is taken as the color temperature of the subject. If no exact match is found, a record with the same color shift and the closest color shift is found, and the ambient color temperature corresponding to the found record is taken as the shooting.
  • the color temperature of the object
  • the color of the subject is estimated according to the color cast data provided by the test photo Warm, including:
  • test photograph When the test photograph is multiple sheets, for each test photograph, compare the color shift data of the test photograph with each record corresponding to the flashing light of the reference photograph in the reference table, such as finding For a perfectly matched record, the ambient color temperature corresponding to the found record is taken as the color temperature of the subject, and the comparison of all the test photos is ended; if the completely matched record is not found, the reference color temperature is determined according to the interval corresponding to the color cast factor.
  • the color temperature value of the subject is determined according to the reference color temperature interval determined by each test photo;
  • the determining, according to the reference color temperature interval determined by each test photo, the color temperature value of the subject including:
  • the degree of deviation between the two sequences is calculated, and the two sequences can be mapped into the n-dimensional space, and the degree of deviation between the two sequences is determined by calculating the Euclidean distance between the two points in the n-dimensional space. That is, the degree of deviation L between the two sequences corresponding to the above-mentioned color cast factor can be expressed as:
  • the color temperatures of the three flashes are 2500K, 5500K, and 7000K, respectively.
  • Different flash pre-shoots obtain three sets of corresponding picture data, and Da, Db, and K values are respectively calculated according to the color-shift detection algorithm.
  • the positive and negative of Da and Db determine which color is biased, and the value of K reflects the degree of color shift. Since three color temperature points are known, the color temperature of the photographed object can be divided into a relatively accurate region according to the values of Da, Db, and K.
  • the photo is taken at 2500K
  • the film is greenish, blue, and the degree of color shift is general, indicating that the color temperature of the object at that time is slightly closer to 5500K.
  • the ambient color temperature estimation using the look-up table method it is necessary to take a picture of each color temperature scene in advance, and calculate the Da, Db, and K values of the three flashes of the known color temperature when shooting different scenes, and obtain a table array (check table method) The basis of the three, indicating the Da, Db, K values of the three reference color temperatures in different color temperature environments.
  • the data obtained from the subsequent comparison table can estimate the current photo color temperature.
  • the interval can be determined first, then the degree of deviation between the actual value and the original value in the table can be calculated, and finally the color temperature value with the lowest degree of deviation is selected as the estimated value. Color temperature value.
  • Each camera environment can get a color cast record (including Da, Db, K values) under each flash.
  • Some color cast records form a table for easy table lookup (for example, Table 2, where the data is used for examples does not represent real test values).
  • the degree of deviation of the current photograph from the tabular data can be estimated, and the data with a lower degree of deviation is selected for estimating the final color temperature value.
  • the degree of deviation between the color cast factor sequence of the test photos taken by the three flashes and the standard color cast factor sequence is ⁇ 2, 1.7, 1.8 ⁇ , three.
  • the standard color cast factor sequence corresponding to the 3450K environment is ⁇ 1.7, 1.8, 1.9 ⁇
  • the standard color cast factor sequence corresponding to the 4040K environment is ⁇ 2.1, 1.5, 1.7 ⁇ , so the calculation
  • the deviation of the actual color cast factor sequence of the test photograph from the color cast factor sequence corresponding to the 3450K environment in the tabular data is L1
  • the actual color cast factor sequence of the test photograph is corresponding to the color cast factor sequence corresponding to the 4040K environment in the tabular data.
  • the degree of deviation is L2;
  • the look-up table method mentioned in the embodiment of the present invention is a method for processing the color cast data of the color cast detection algorithm. Other schemes are also feasible if the data is processed by other methods to obtain the estimated color temperature value.
  • S103 Re-photograph the subject according to the estimated color temperature of the subject, and perform white balance correction on the photograph taken.
  • the photographing the photographing object and performing white balance correction on the photographed photograph according to the estimated color temperature of the photographed object includes:
  • the estimated color temperature of the subject is used as a white balance parameter, and white balance correction is performed on the photograph taken; or
  • selecting a flash with the color temperature closest to the subject to perform flash shooting includes:
  • the flash of the known color temperature includes a dual color temperature flash
  • the estimated color temperature of the subject is within a color temperature range of the dual color temperature flash output
  • the two-color temperature flash outputs light of a corresponding color temperature; the photo thus obtained must have no color temperature deviation, so the white balance algorithm can be simplified.
  • an embodiment of the present invention provides an apparatus for implementing an automatic white balance function, including:
  • the pre-shooting and color-shift detection module 201 is configured to: perform pre-flash shooting with a flash of a known color temperature, obtain a test photo of the subject at an ambient color temperature determined by the flash, and perform color-shift detection on the test photo to obtain Color shift data of the subject at a corresponding ambient color temperature;
  • the color temperature estimation module 202 is configured to: estimate a color temperature of the photographic subject according to color cast data provided by the test photo;
  • the photographing and white balance correction module 203 is configured to re-photograph the photographed object based on the estimated color temperature of the photographed subject and perform white balance correction on the photographed photograph.
  • the flash of the known color temperature comprises any one of the following a)-e):
  • the pre-shooting and color shift detecting module 201 is configured to:
  • the ambient color temperature determined by the flash Obtaining a test photograph of the subject at an ambient color temperature determined by the flash for the color temperature of the flash;
  • Pre-flash shooting is sequentially performed by using flash lamps of different color temperatures, and the ambient color temperature determined by the flash is the color temperature of the flash, and the test photos of the subject at each ambient color temperature are sequentially obtained.
  • the pre-shooting and color shift detecting module 201 is configured to:
  • the color shift data includes: a red-green color cast coefficient, a yellow-blue color cast coefficient, and a color cast factor for indicating the degree of color shift.
  • the color temperature estimation module 202 is configured to:
  • the test photo is a sheet
  • the color shift data of the test photograph indicates a reddish or yellowish color
  • the color shift data indicates a greenish or bluish color, and it is estimated that the color temperature of the subject is lower than the ambient color temperature corresponding to the test photograph; or
  • the test photograph with the lightest color deviation is selected as the first test photograph from the test photograph indicating the reddish or yellowish color shift data, and the green color or bluish color is indicated from the color shift data.
  • the test photograph having the lightest degree of color deviation is selected as the second test photograph, and the color temperature of the photographed object is estimated to be higher than the ambient color temperature corresponding to the first test photograph and lower than the ambient color temperature corresponding to the second test photograph. .
  • the color temperature estimation module 202 is configured to:
  • test photo When the test photo is a sheet, compare the color shift data of the test photograph with each record corresponding to the flashing light of the reference photograph in the reference table, and if the exact matching record is found, The ambient temperature corresponding to the found record is taken as the color temperature of the subject. If no exact match is found, a record with the same color shift and the closest color shift is found, and the ambient color temperature corresponding to the found record is taken as the shooting.
  • the color temperature of the object
  • the reference table includes a color shift data record when each of the known color temperature flashes captures different scenes.
  • the color temperature estimation module 202 is configured to:
  • test photograph When the test photograph is multiple sheets, for each test photograph, compare the color shift data of the test photograph with each record corresponding to the flashing light of the reference photograph in the reference table, such as finding For a perfectly matched record, the ambient color temperature corresponding to the found record is taken as the color temperature of the subject, and the comparison of all the test photos is ended; if the completely matched record is not found, the reference color temperature is determined according to the interval corresponding to the color cast factor.
  • the color temperature value of the subject is determined according to the reference color temperature interval determined by each test photo;
  • the reference table includes a color shift data record when each of the known color temperature flashes captures different scenes.
  • the color temperature estimation module 202 is configured to:
  • the shooting and white balance correction module 203 is configured to:
  • the estimated color temperature of the subject is used as a white balance parameter, and white balance correction is performed on the photograph taken; or
  • the shooting and white balance correction module 203 is configured to:
  • the flash of the known color temperature includes a dual color temperature flash
  • the estimated color temperature of the subject is within a color temperature range of the dual color temperature flash output
  • the dual color temperature flash outputs light of a corresponding color temperature.
  • all or part of the steps of the above embodiments may also be implemented by using an integrated circuit. These steps may be separately fabricated into individual integrated circuit modules, or multiple modules or steps may be fabricated into a single integrated circuit module. achieve.
  • the devices/function modules/functional units in the above embodiments may be implemented by a general-purpose computing device, which may be centralized on a single computing device or distributed over a network of multiple computing devices.
  • the device/function module/functional unit in the above embodiment When the device/function module/functional unit in the above embodiment is implemented in the form of a software function module and sold or used as a stand-alone product, it can be stored in a computer readable storage medium.
  • the above mentioned computer readable storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
  • a method and device for realizing an automatic white balance function provided by an embodiment of the present invention, pre-flashing by a flash with a known color temperature, obtaining a test photograph of a photographed object, and calculating a color shift data of the test photograph by a color shift detection algorithm, according to the color
  • the partial data estimates the ambient color temperature and assists the automatic white balance function.
  • the input current of the dual color temperature flash is controlled to perform the photographing by mixing and outputting the appropriate color temperature, thereby optimizing the automatic white balance function.

Landscapes

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

Abstract

Disclosed in this paper is a method for realizing auto white balance function. The method comprises: performing preliminary flashing photography by using a flash whose color temperature is known, so as to obtain a test photograph of an object to be photographed under the environment color temperature determined by the flash, and performing color shift detection on the test photograph, so as to obtain the color shift data of the object to be photographed under the corresponding environment color temperature; estimating the color temperature of the object to be photographed on the basis of the color shift data provided by the test photograph; and according to the estimated color temperature of the object to be photographed, re-photographing the object to be photographed and performing white balance correction on the photographed photograph.

Description

一种实现自动白平衡功能的方法和装置Method and device for realizing automatic white balance function 技术领域Technical field
本申请涉及但不限于终端图像处理技术领域。This application relates to, but is not limited to, the field of terminal image processing technology.
背景技术Background technique
人眼及大脑对色温有一定的生理和心理的自适应性,所以看到的颜色受色温偏移的影响较小,而摄像头的传感器没有这种能力,所以拍出来的照片如果不经过白平衡处理的话,和人眼看到的颜色会有较大的偏差(虽然人眼看到的和白光下真实的色彩也有偏差)。The human eye and the brain have certain physiological and psychological adaptability to the color temperature, so the color seen is less affected by the color temperature shift, and the camera sensor does not have this ability, so if the photo taken does not pass the white balance If processed, there will be a large deviation from the color seen by the human eye (although the true color of the human eye is also deviated from the white light).
白平衡处理主要是对摄像头传感器拍照得到的图像数据进行处理。摄像头传感器拍照得到的数据有两种,RGB格式和YUV格式。RGB格式是按三基色加光系统的原理来描述颜色,而YUV格式则是按照亮度(Y)、色差(U、V)的原理来描述颜色。两种数据格式可以互相转换。The white balance processing mainly processes the image data obtained by photographing the camera sensor. There are two kinds of data obtained by the camera sensor photographing, RGB format and YUV format. The RGB format describes the color according to the principle of the three-primary color adding system, while the YUV format describes the color according to the principle of brightness (Y) and color difference (U, V). The two data formats can be converted to each other.
目前常用的白平衡算法通常基于Grey World(灰度世界)的假设,该假设是基于假设场景的色彩的平均值落在一个特定的范围内,如果测量得到的结果偏离该范围,则调整对应参数,校正使得其均值落入指定范围。The commonly used white balance algorithm is usually based on the assumption of Grey World, which is based on the assumption that the average value of the color of the scene falls within a specific range. If the measured result deviates from the range, the corresponding parameter is adjusted. The correction causes its mean to fall within the specified range.
但是,白平衡算法会受到色温的影响。比如,如果摄像目标是暖色调,使用冷色调闪光灯会导致照片偏蓝,如果摄像目标是冷色调,使用暖色调闪光灯会导致照片偏黄红。对于专业摄像,可以使用反光率为18%的灰板进行拍摄以调整曝光参数,或者,通过手动设置环境色温,进行白平衡色温校准。However, the white balance algorithm is affected by the color temperature. For example, if the camera is in warm tones, using a cool-tone flash can cause the photo to be bluish. If the subject is cold, using a warm-tone flash can cause the photo to turn yellow. For professional recording, you can use the gray board with a light reflectivity of 18% to adjust the exposure parameters, or manually set the ambient color temperature to perform white balance color temperature calibration.
对于大多数非专业摄像的手机用户,由于往往不知道应该如何设置白平衡的参数(包括环境色温),因此,通常使用手机相机的自动白平衡功能,但是,自动白平衡功能受到环境色温的影响,在某些场景下拍摄出的照片存在偏色的缺陷。For most non-professional camera users, because they often do not know how to set the white balance parameters (including the ambient color temperature), the automatic white balance function of the mobile phone camera is usually used, but the automatic white balance function is affected by the ambient color temperature. The photos taken in some scenes have the defect of color cast.
发明内容 Summary of the invention
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。The following is an overview of the topics detailed in this document. This Summary is not intended to limit the scope of the claims.
本文提供一种实现自动白平衡功能的方法和装置,能够自适应匹配环境色温,优化自动白平衡功能。This paper provides a method and device for realizing the automatic white balance function, which can adaptively match the ambient color temperature and optimize the automatic white balance function.
本发明实施例提供了一种实现自动白平衡功能的方法,该方法包括:An embodiment of the present invention provides a method for implementing an automatic white balance function, where the method includes:
利用已知色温的闪光灯进行预闪拍摄,获得拍摄对象在所述闪光灯确定的环境色温下的测试照片,对所述测试照片进行色偏检测,获得所述拍摄对象在对应的环境色温下的色偏数据;Performing pre-flash shooting with a flash of a known color temperature, obtaining a test photograph of the subject at an ambient color temperature determined by the flash, performing color shift detection on the test photograph, and obtaining a color of the photographed object at a corresponding ambient color temperature. Partial data
根据所述测试照片提供的色偏数据估计所述拍摄对象的色温;Estimating a color temperature of the photographic subject according to color cast data provided by the test photograph;
根据估计出的所述拍摄对象的色温重新对所述拍摄对象进行拍摄并对拍摄出的照片进行白平衡校正。The subject is re-photographed based on the estimated color temperature of the subject and white balance correction is performed on the photograph taken.
可选地,所述已知色温的闪光灯包括以下a)-e)中任意一种:Optionally, the known color temperature flash lamp comprises any one of the following a)-e):
a)一个电子闪光灯;a) an electronic flash;
b)一对双色温闪光灯;b) a pair of dual color temperature flashes;
c)一个电子闪光灯和一对双色温闪光灯;c) an electronic flash and a pair of dual color temperature flashes;
d)一对双色温闪光灯以及由所述双色温闪光灯模拟出的其他色温的闪光灯;d) a pair of dual color temperature flashes and other color temperature flashes simulated by the dual color temperature flash;
e)一个电子闪光灯、一对双色温闪光灯以及由所述双色温闪光灯模拟出的其他色温的闪光灯。e) an electronic flash, a pair of dual color temperature flashes, and other color temperature flashes that are simulated by the two color temperature flash.
可选地,所述利用已知色温的闪光灯进行预闪拍摄,获得拍摄对象在所述闪光灯确定的环境色温下的测试照片,包括:Optionally, the pre-flash shooting is performed by using a flash of a known color temperature to obtain a test photograph of the subject at an ambient color temperature determined by the flash, including:
利用一个已知色温的闪光灯进行预闪拍摄,所述闪光灯确定的环境色温为所述闪光灯的色温,获得拍摄对象在所述闪光灯确定的环境色温下的测试照片;或者Performing pre-flash shooting with a flash of a known color temperature, the ambient color temperature determined by the flash being the color temperature of the flash, obtaining a test photograph of the subject at an ambient color temperature determined by the flash; or
依次利用不同色温的闪光灯进行预闪拍摄,所述闪光灯确定的环境色温为所述闪光灯的色温,依次获得拍摄对象在每一种环境色温下的测试照片。Pre-flash shooting is sequentially performed by using flash lamps of different color temperatures, and the ambient color temperature determined by the flash is the color temperature of the flash, and the test photos of the subject at each ambient color temperature are sequentially obtained.
可选地,对所述测试照片进行色偏检测,获得所述拍摄对象在对应的环 境色温下的色偏数据,包括:Optionally, performing color shift detection on the test photo to obtain the corresponding target in the ring Color shift data at ambient temperature, including:
采用基于等效圆的色偏检测算法对所述测试照片进行色偏检测,获得所述拍摄对象在对应的环境色温下的色偏数据;Performing color shift detection on the test photograph by using a color circle detection algorithm based on an equivalent circle, and obtaining color shift data of the photographed object at a corresponding ambient color temperature;
其中,所述色偏数据包括:红绿偏色系数、黄蓝偏色系数和用于指示色偏程度的偏色因子。The color shift data includes: a red-green color cast coefficient, a yellow-blue color cast coefficient, and a color cast factor for indicating the degree of color shift.
可选地,所述根据所述测试照片提供的色偏数据估计所述拍摄对象的色温,包括:Optionally, the estimating the color temperature of the photographic subject according to the color cast data provided by the test photo comprises:
在所述测试照片为一张时,如所述测试照片的色偏数据指示偏红或偏黄,则估计所述拍摄对象的色温高于所述测试照片对应的环境色温;如所述测试照片的色偏数据指示偏绿或偏蓝,则估计所述拍摄对象的色温低于所述测试照片对应的环境色温;或者When the test photo is a sheet, if the color shift data of the test photograph indicates a reddish or yellowish color, it is estimated that the color temperature of the photographed object is higher than an ambient color temperature corresponding to the test photograph; The color shift data indicates a greenish or bluish color, and it is estimated that the color temperature of the subject is lower than the ambient color temperature corresponding to the test photograph; or
在所述测试照片为多张时,从色偏数据指示偏红或偏黄的测试照片中选取色偏程度最轻的测试照片作为第一测试照片,从色偏数据指示偏绿或偏蓝的测试照片中选取色偏程度最轻的测试照片作为第二测试照片,估计所述拍摄对象的色温高于所述第一测试照片对应的环境色温且低于所述第二测试照片对应的环境色温。When the test photograph is multiple sheets, the test photograph with the lightest color deviation is selected as the first test photograph from the test photograph indicating the reddish or yellowish color shift data, and the green color or bluish color is indicated from the color shift data. The test photograph having the lightest degree of color deviation is selected as the second test photograph, and the color temperature of the photographed object is estimated to be higher than the ambient color temperature corresponding to the first test photograph and lower than the ambient color temperature corresponding to the second test photograph. .
可选地,所述根据所述测试照片提供的色偏数据估计所述拍摄对象的色温,包括:Optionally, the estimating the color temperature of the photographic subject according to the color cast data provided by the test photo comprises:
在所述测试照片为一张时,将所述测试照片的色偏数据与参考表中拍摄该测试照片的闪关灯对应的每条记录进行比对,如查找到完全匹配的记录,则将查找到的记录对应的环境色温作为拍摄对象的色温,如未查找到完全匹配的记录,则查找色偏情况一致且色偏程度最接近的一条记录,将查找到的记录对应的环境色温作为拍摄对象的色温;When the test photo is a sheet, compare the color shift data of the test photograph with each record corresponding to the flashing light of the reference photograph in the reference table, and if the exact matching record is found, The ambient temperature corresponding to the found record is taken as the color temperature of the subject. If no exact match is found, a record with the same color shift and the closest color shift is found, and the ambient color temperature corresponding to the found record is taken as the shooting. The color temperature of the object;
其中,所述参考表中包括每一个已知色温的闪光灯拍摄不同场景时的色偏数据记录。Wherein, the reference table includes a color shift data record when each of the known color temperature flashes captures different scenes.
可选地,所述根据所述测试照片提供的色偏数据估计所述拍摄对象的色温,包括:Optionally, the estimating the color temperature of the photographic subject according to the color cast data provided by the test photo comprises:
在所述测试照片为多张时,对于每一张测试照片,将所述测试照片的色 偏数据与参考表中拍摄该测试照片的闪关灯对应的每条记录进行比对,如查找到完全匹配的记录,则将查找到的记录对应的环境色温作为拍摄对象的色温,结束对所有测试照片的比对;如未查找到完全匹配的记录,则根据偏色因子对应的区间确定参考色温区间;When the test photo is multiple sheets, for each test photo, the color of the test photograph is The partial data is compared with each record corresponding to the flashing light of the reference photo in the reference table. If an exact matching record is found, the ambient color temperature corresponding to the found record is taken as the color temperature of the shooting object, and the end is all The comparison of the test photos; if the exact matching record is not found, the reference color temperature interval is determined according to the interval corresponding to the color cast factor;
如所有测试照片均未查找到完全匹配的记录,则根据每张测试照片确定的参考色温区间确定所述拍摄对象的色温值;If all the test photos do not find an exact match record, the color temperature value of the subject is determined according to the reference color temperature interval determined by each test photo;
其中,所述参考表中包括每一个已知色温的闪光灯拍摄不同场景时的色偏数据记录。Wherein, the reference table includes a color shift data record when each of the known color temperature flashes captures different scenes.
可选地,所述根据每张测试照片确定的参考色温区间确定所述拍摄对象的色温值,包括:Optionally, determining the color temperature value of the photographic subject according to the reference color temperature interval determined according to each test photo includes:
计算所述拍摄对象在每个闪光灯拍摄时的偏色因子序列{k1,k2,...,kn}与每一个参考色温区间的区间端点对应的场景下每个闪光灯拍摄时的偏色因子序列{kref1,kref2,...,krefn}之间的偏离程度,将偏离程度最低的一个参考色温区间的区间端点对应的场景的环境色温作为拍摄对象的色温;其中,n是闪光灯的个数。Calculating a partial deviation of the color cast factor sequence {k 1 , k 2 , . . . , k n } of the subject at each flash shooting with each of the flash corresponding to the end point of the interval of each reference color temperature interval The degree of deviation between the color factor sequences {k ref1 , k ref2 , . . . , k refn } is the color temperature of the scene corresponding to the endpoint of the interval of the reference color temperature interval with the lowest degree of deviation; wherein, n It is the number of flashes.
可选地,所述根据估计出的所述拍摄对象的色温重新对所述拍摄对象进行拍摄并对拍摄出的照片进行白平衡校正,包括:Optionally, the photographing the photographing object according to the estimated color temperature of the photographing object and performing white balance correction on the photograph taken includes:
在未使用闪光灯进行重新拍摄时,将估计出的所述拍摄对象的色温作为白平衡参数,对拍摄出的照片进行白平衡校正;或者When re-shooting without using the flash, the estimated color temperature of the subject is used as a white balance parameter, and white balance correction is performed on the photograph taken; or
在使用闪光灯进行重新拍摄时,选择色温与所述拍摄对象最接近的闪光灯进行闪光拍摄,对拍摄出的照片进行白平衡校正。When re-shooting with the flash, select the flash whose color temperature is closest to the subject for flash shooting, and perform white balance correction on the photograph taken.
可选地,选择色温与所述拍摄对象最接近的闪光灯进行闪光拍摄,包括:Optionally, selecting a flash whose color temperature is closest to the subject is flashing, including:
在所述已知色温的闪光灯包括双色温闪光灯时,如所述估计出的所述拍摄对象的色温在所述双色温闪光灯输出的色温范围内,则调节所述双色温闪光灯的输入电流以控制所述双色温闪光灯输出相应色温的光线。When the flash of the known color temperature includes a dual color temperature flash, if the estimated color temperature of the subject is within a color temperature range of the dual color temperature flash output, adjusting an input current of the dual color temperature flash to control The dual color temperature flash outputs light of a corresponding color temperature.
本发明实施例还提供了一种实现自动白平衡功能的装置,包括: An embodiment of the present invention further provides an apparatus for implementing an automatic white balance function, including:
预拍摄及色偏检测模块,设置为:利用已知色温的闪光灯进行预闪拍摄,获得拍摄对象在所述闪光灯确定的环境色温下的测试照片,对所述测试照片进行色偏检测,获得所述拍摄对象在对应的环境色温下的色偏数据;The pre-shooting and color-shift detection module is configured to: perform pre-flash shooting with a flash of a known color temperature, obtain a test photograph of the subject at an ambient color temperature determined by the flash, perform color shift detection on the test photograph, obtain a Depicting color shift data of the subject at a corresponding ambient color temperature;
色温估计模块,设置为:根据所述测试照片提供的色偏数据估计所述拍摄对象的色温;a color temperature estimation module, configured to: estimate a color temperature of the photographic subject according to color cast data provided by the test photo;
拍摄及白平衡校正模块,设置为:根据估计出的所述拍摄对象的色温重新对所述拍摄对象进行拍摄并对拍摄出的照片进行白平衡校正。The photographing and white balance correction module is configured to: re-photograph the subject according to the estimated color temperature of the subject and perform white balance correction on the photograph taken.
可选地,所述已知色温的闪光灯包括以下a)-e)中任意一种:Optionally, the known color temperature flash lamp comprises any one of the following a)-e):
a)一个电子闪光灯;a) an electronic flash;
b)一对双色温闪光灯;b) a pair of dual color temperature flashes;
c)一个电子闪光灯和一对双色温闪光灯;c) an electronic flash and a pair of dual color temperature flashes;
d)一对双色温闪光灯以及由所述双色温闪光灯模拟出的其他色温的闪光灯;d) a pair of dual color temperature flashes and other color temperature flashes simulated by the dual color temperature flash;
e)一个电子闪光灯、一对双色温闪光灯以及由所述双色温闪光灯模拟出的其他色温的闪光灯。e) an electronic flash, a pair of dual color temperature flashes, and other color temperature flashes that are simulated by the two color temperature flash.
可选地,所述预拍摄及色偏检测模块,是设置为:Optionally, the pre-shooting and color-shift detection module is configured to:
利用一个已知色温的闪光灯进行预闪拍摄,所述闪光灯确定的环境色温为所述闪光灯的色温,获得拍摄对象在所述闪光灯确定的环境色温下的测试照片;或者Performing pre-flash shooting with a flash of a known color temperature, the ambient color temperature determined by the flash being the color temperature of the flash, obtaining a test photograph of the subject at an ambient color temperature determined by the flash; or
依次利用不同色温的闪光灯进行预闪拍摄,所述闪光灯确定的环境色温为所述闪光灯的色温,依次获得拍摄对象在每一种环境色温下的测试照片。Pre-flash shooting is sequentially performed by using flash lamps of different color temperatures, and the ambient color temperature determined by the flash is the color temperature of the flash, and the test photos of the subject at each ambient color temperature are sequentially obtained.
可选地,所述预拍摄及色偏检测模块,是设置为:Optionally, the pre-shooting and color-shift detection module is configured to:
采用基于等效圆的色偏检测算法对所述测试照片进行色偏检测,获得所述拍摄对象在对应的环境色温下的色偏数据;Performing color shift detection on the test photograph by using a color circle detection algorithm based on an equivalent circle, and obtaining color shift data of the photographed object at a corresponding ambient color temperature;
其中,所述色偏数据包括:红绿偏色系数、黄蓝偏色系数和用于指示色偏程度的偏色因子。The color shift data includes: a red-green color cast coefficient, a yellow-blue color cast coefficient, and a color cast factor for indicating the degree of color shift.
可选地,所述色温估计模块,是设置为: Optionally, the color temperature estimation module is configured to:
在所述测试照片为一张时,如所述测试照片的色偏数据指示偏红或偏黄,则估计所述拍摄对象的色温高于所述测试照片对应的环境色温;如所述测试照片的色偏数据指示偏绿或偏蓝,则估计所述拍摄对象的色温低于所述测试照片对应的环境色温;或者When the test photo is a sheet, if the color shift data of the test photograph indicates a reddish or yellowish color, it is estimated that the color temperature of the photographed object is higher than an ambient color temperature corresponding to the test photograph; The color shift data indicates a greenish or bluish color, and it is estimated that the color temperature of the subject is lower than the ambient color temperature corresponding to the test photograph; or
在所述测试照片为多张时,从色偏数据指示偏红或偏黄的测试照片中选取色偏程度最轻的测试照片作为第一测试照片,从色偏数据指示偏绿或偏蓝的测试照片中选取色偏程度最轻的测试照片作为第二测试照片,估计所述拍摄对象的色温高于所述第一测试照片对应的环境色温且低于所述第二测试照片对应的环境色温。When the test photograph is multiple sheets, the test photograph with the lightest color deviation is selected as the first test photograph from the test photograph indicating the reddish or yellowish color shift data, and the green color or bluish color is indicated from the color shift data. The test photograph having the lightest degree of color deviation is selected as the second test photograph, and the color temperature of the photographed object is estimated to be higher than the ambient color temperature corresponding to the first test photograph and lower than the ambient color temperature corresponding to the second test photograph. .
可选地,所述色温估计模块,是设置为:Optionally, the color temperature estimation module is configured to:
在所述测试照片为一张时,将所述测试照片的色偏数据与参考表中拍摄该测试照片的闪关灯对应的每条记录进行比对,如查找到完全匹配的记录,则将查找到的记录对应的环境色温作为拍摄对象的色温,如未查找到完全匹配的记录,则查找色偏情况一致且色偏程度最接近的一条记录,将查找到的记录对应的环境色温作为拍摄对象的色温;When the test photo is a sheet, compare the color shift data of the test photograph with each record corresponding to the flashing light of the reference photograph in the reference table, and if the exact matching record is found, The ambient temperature corresponding to the found record is taken as the color temperature of the subject. If no exact match is found, a record with the same color shift and the closest color shift is found, and the ambient color temperature corresponding to the found record is taken as the shooting. The color temperature of the object;
其中,所述参考表中包括每一个已知色温的闪光灯拍摄不同场景时的色偏数据记录。Wherein, the reference table includes a color shift data record when each of the known color temperature flashes captures different scenes.
可选地,所述色温估计模块,是设置为:Optionally, the color temperature estimation module is configured to:
在所述测试照片为多张时,对于每一张测试照片,将所述测试照片的色偏数据与参考表中拍摄该测试照片的闪关灯对应的每条记录进行比对,如查找到完全匹配的记录,则将查找到的记录对应的环境色温作为拍摄对象的色温,结束对所有测试照片的比对;如未查找到完全匹配的记录,则根据偏色因子对应的区间确定参考色温区间;When the test photograph is multiple sheets, for each test photograph, compare the color shift data of the test photograph with each record corresponding to the flashing light of the reference photograph in the reference table, such as finding For a perfectly matched record, the ambient color temperature corresponding to the found record is taken as the color temperature of the subject, and the comparison of all the test photos is ended; if the completely matched record is not found, the reference color temperature is determined according to the interval corresponding to the color cast factor. Interval
如所有测试照片均未查找到完全匹配的记录,则根据每张测试照片确定的参考色温区间确定所述拍摄对象的色温值;If all the test photos do not find an exact match record, the color temperature value of the subject is determined according to the reference color temperature interval determined by each test photo;
其中,所述参考表中包括每一个已知色温的闪光灯拍摄不同场景时的色偏数据记录。Wherein, the reference table includes a color shift data record when each of the known color temperature flashes captures different scenes.
可选地,所述色温估计模块,是设置为: Optionally, the color temperature estimation module is configured to:
计算所述拍摄对象在每个闪光灯拍摄时的偏色因子序列{k1,k2,...,kn}与每一个参考色温区间的区间端点对应的场景下每个闪光灯拍摄时的偏色因子序列{kref1,kref2,...,krefn}之间的偏离程度,将偏离程度最低的一个参考色温区间的区间端点对应的场景的环境色温作为拍摄对象的色温;其中,n是闪光灯的个数。Calculating a partial deviation of the color cast factor sequence {k 1 , k 2 , . . . , k n } of the subject at each flash shooting with each of the flash corresponding to the end point of the interval of each reference color temperature interval The degree of deviation between the color factor sequences {k ref1 , k ref2 , . . . , k refn } is the color temperature of the scene corresponding to the endpoint of the interval of the reference color temperature interval with the lowest degree of deviation; wherein, n It is the number of flashes.
可选地,所述拍摄及白平衡校正模块,是设置为:Optionally, the shooting and white balance correction module is configured to:
在未使用闪光灯进行重新拍摄时,将估计出的所述拍摄对象的色温作为白平衡参数,对拍摄出的照片进行白平衡校正;或者When re-shooting without using the flash, the estimated color temperature of the subject is used as a white balance parameter, and white balance correction is performed on the photograph taken; or
在使用闪光灯进行重新拍摄时,选择色温与所述拍摄对象最接近的闪光灯进行闪光拍摄,对拍摄出的照片进行白平衡校正。When re-shooting with the flash, select the flash whose color temperature is closest to the subject for flash shooting, and perform white balance correction on the photograph taken.
可选地,所述拍摄及白平衡校正模块,是设置为:Optionally, the shooting and white balance correction module is configured to:
在所述已知色温的闪光灯包括双色温闪光灯时,如所述估计出的所述拍摄对象的色温在所述双色温闪光灯输出的色温范围内,则调节所述双色温闪光灯的输入电流以控制所述双色温闪光灯输出相应色温的光线。When the flash of the known color temperature includes a dual color temperature flash, if the estimated color temperature of the subject is within a color temperature range of the dual color temperature flash output, adjusting an input current of the dual color temperature flash to control The dual color temperature flash outputs light of a corresponding color temperature.
本发明实施例还提供了一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令用于执行上述任一项的方法。The embodiment of the present invention further provides a computer readable storage medium storing computer executable instructions for performing the method of any of the above.
与相关技术相比,本发明实施例提供的一种实现自动白平衡功能的方法和装置,通过已知色温的闪光灯进行预闪,得到拍摄对象的测试照片,通过色偏检测算法计算测试照片的色偏数据,根据色偏数据估计环境色温,辅助自动白平衡功能。而且可以根据估计出的色温,在需要闪光的应用场景下,控制双色温闪光灯的输入电流以混合输出合适的色温进行拍照,从而优化自动白平衡功能。Compared with the related art, the method and device for implementing the automatic white balance function provided by the embodiment of the present invention pre-flashes by using a flash with a known color temperature to obtain a test photo of the photographed object, and the test photograph is calculated by the color shift detection algorithm. Color shift data, estimate the ambient color temperature based on the color shift data, and assist the automatic white balance function. Moreover, according to the estimated color temperature, in the application scene requiring flash, the input current of the dual color temperature flash is controlled to perform the photographing by mixing and outputting the appropriate color temperature, thereby optimizing the automatic white balance function.
在阅读并理解了附图和详细描述后,可以明白其他方面。Other aspects will be apparent upon reading and understanding the drawings and detailed description.
附图概述BRIEF abstract
图1为本发明实施例的一种实现自动白平衡功能的方法流程图。 FIG. 1 is a flowchart of a method for implementing an automatic white balance function according to an embodiment of the present invention.
图2为本发明实施例的一种实现自动白平衡功能的装置示意图。FIG. 2 is a schematic diagram of an apparatus for implementing an automatic white balance function according to an embodiment of the present invention.
本发明的实施方式Embodiments of the invention
下文中将结合附图对本发明的实施方式进行详细说明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互任意组合。Embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be noted that, in the case of no conflict, the features in the embodiments and the embodiments in the present application may be arbitrarily combined with each other.
本发明实施例可以构建一个全新的闪光灯系统,该系统包括1个电子闪光灯LED1(色温5500K)和一对双色温闪光灯,其中,双色温闪光灯包括:1个冷色调闪光灯LED2(色温7000K)和1个暖色调闪光灯LED3(色温2500K,琥珀色)。该闪光灯系统的每一路闪光灯都由一路DC-DC电源控制输出,其中双色温闪光灯LED2和LED3的输入电流可调(比如,从100mA-1.5A可调),可以将输入电流分成多个等级进行控制,比如,每隔200mA一个等级,可以分成8个等级进行控制。理论上通过控制双色温闪光灯的电流可以混合出2500K-7000K范围内的所有色温,但是由于电流控制精度以及器件本身的精度,得到的色温还是比较粗略的。通过厂商的技术手册可以查阅到如何通过调节电流获得相应的色温,本发明实施例的闪光灯系统只要负责输出相应的电流就可以。The embodiment of the invention can construct a brand new flash system, which comprises an electronic flash LED1 (color temperature 5500K) and a pair of dual color temperature flashes, wherein the dual color temperature flash comprises: 1 cold tone flash LED2 (color temperature 7000K) and 1 A warm tone flash LED3 (color temperature 2500K, amber). Each flash of the flash system is controlled by a DC-DC power supply. The input current of the dual color temperature flash LED2 and LED3 is adjustable (for example, adjustable from 100mA to 1.5A), and the input current can be divided into multiple levels. Control, for example, every 200 mA level, can be divided into 8 levels for control. In theory, by controlling the current of the two-color temperature flash lamp, all the color temperatures in the range of 2500K-7000K can be mixed, but the color temperature obtained is relatively rough due to the current control precision and the accuracy of the device itself. The manufacturer's technical manual can refer to how to obtain a corresponding color temperature by adjusting the current. The flash system of the embodiment of the present invention is only responsible for outputting the corresponding current.
利用基于多个闪光灯组成的拍照系统,通过色偏检测算法可以估计出当前拍照环境的色温值,对自动白平衡功能是很重要的硬件辅助手段。Using a camera system based on multiple flash units, the color shift detection algorithm can estimate the color temperature value of the current photographing environment, which is an important hardware aid for the automatic white balance function.
如图1所示,本发明实施例提供了一种实现自动白平衡功能的方法,该方法包括:As shown in FIG. 1 , an embodiment of the present invention provides a method for implementing an automatic white balance function, where the method includes:
S101,利用已知色温的闪光灯进行预闪拍摄,获得拍摄对象在所述闪光灯确定的环境色温下的测试照片,对所述测试照片进行色偏检测,获得所述拍摄对象在对应的环境色温下的色偏数据;S101: Perform pre-flash shooting with a flash of a known color temperature, obtain a test photograph of the subject at an ambient color temperature determined by the flash, perform color shift detection on the test photograph, and obtain the photographed object at a corresponding ambient color temperature. Color shift data;
其中,所述利用已知色温的闪光灯进行预闪拍摄,获得拍摄对象在所述闪光灯确定的环境色温下的测试照片,包括:Wherein, the pre-flash shooting is performed by using a flash of a known color temperature, and a test photo of the subject under the ambient color temperature determined by the flash is obtained, including:
利用一个已知色温的闪光灯进行预闪拍摄,所述闪光灯确定的环境色温 为所述闪光灯的色温,获得拍摄对象在所述闪光灯确定的环境色温下的测试照片;或者Pre-flash shooting with a flash of known color temperature, the ambient color temperature determined by the flash Obtaining a test photograph of the subject at an ambient color temperature determined by the flash for the color temperature of the flash; or
依次利用不同色温的闪光灯进行预闪拍摄,所述闪光灯确定的环境色温为所述闪光灯的色温,依次获得拍摄对象在每一种环境色温下的测试照片;Pre-flash shooting is performed by using flashes of different color temperatures in sequence, and the ambient color temperature determined by the flash is the color temperature of the flash, and the test photos of the subject at each ambient color temperature are sequentially obtained;
其中,所述已知色温的闪光灯包括以下a)-e)中任意一种:Wherein the flash of the known color temperature comprises any one of the following a)-e):
a)一个电子闪光灯;a) an electronic flash;
b)一对双色温闪光灯;b) a pair of dual color temperature flashes;
c)一个电子闪光灯和一对双色温闪光灯;c) an electronic flash and a pair of dual color temperature flashes;
d)一对双色温闪光灯以及由所述双色温闪光灯模拟出的其他色温的闪光灯;d) a pair of dual color temperature flashes and other color temperature flashes simulated by the dual color temperature flash;
e)一个电子闪光灯、一对双色温闪光灯以及由所述双色温闪光灯模拟出的其他色温的闪光灯;e) an electronic flash, a pair of dual color temperature flashes, and other color temperature flashes simulated by the dual color temperature flash;
其中,本发明实施例中构建的闪光灯系统采用的闪光灯的色温分别是2500K、5500K、7000K,是目前市面上比较主流的闪光灯。The color temperature of the flash lamp used in the flash system constructed in the embodiment of the present invention is 2500K, 5500K, and 7000K, respectively, which is a relatively popular flash lamp on the market.
其中,对所述测试照片进行色偏检测,获得所述拍摄对象在对应的环境色温下的色偏数据,包括:The color shift detection is performed on the test photo, and the color shift data of the photographed object at a corresponding ambient color temperature is obtained, including:
采用基于等效圆的色偏检测算法对所述测试照片进行色偏检测,获得所述拍摄对象在对应的环境色温下的色偏数据;Performing color shift detection on the test photograph by using a color circle detection algorithm based on an equivalent circle, and obtaining color shift data of the photographed object at a corresponding ambient color temperature;
其中,所述色偏数据包括:红绿偏色系数、黄蓝偏色系数和用于指示色偏程度的偏色因子。The color shift data includes: a red-green color cast coefficient, a yellow-blue color cast coefficient, and a color cast factor for indicating the degree of color shift.
其中,基于等效圆的色偏检测方法的原理是:图像的偏色不仅与图像色度的平均值有直接关系,还与图像的色度分布特性有关。如果在a-b色度坐标平面上的二维直方图中色度分布基本上为单峰值,或者分布较为集中,色度平均值又比较大时,一般都存在色偏,而且色度的平均值越大,色偏越严重。其中,a-b色度坐标平面使用的是CIE1976L-a-b色度空间标准,YUV信号与a-b色度坐标可以互相转换。Among them, the principle of the color circle detection method based on the equivalent circle is that the color cast of the image is not only directly related to the average value of the image chromaticity, but also related to the chromaticity distribution characteristic of the image. If the chromaticity distribution in the two-dimensional histogram on the ab chromaticity coordinate plane is basically a single peak, or the distribution is concentrated, and the chromaticity average is relatively large, there is generally a color shift, and the average value of the chromaticity is Large, the color is more serious. Among them, the a-b chromaticity coordinate plane uses the CIE1976L-a-b chromaticity space standard, and the YUV signal and the a-b chromaticity coordinate can be converted to each other.
在a-b色度平面上,等效圆的中心坐标是{Da,Db},半径为M。等效圆 中心到a-b色度平面中性轴圆点(0,0)的距离是D。假设L、W分别是图像的长、宽,单位是像素,aij是i行j列的像素点的a色度数据,bij是i行j列的像素点的b色度数据。则等效圆的中心坐标的a色度分量Da是图像a色度值的均值,等效圆的中心坐标的b色度分量Db是图像b色度值的均值:On the ab chromaticity plane, the center coordinates of the equivalent circle are {Da, Db}, and the radius is M. The distance from the center of the equivalent circle to the ab chromaticity plane neutral axis dot (0,0) is D. Let L and W be the length and width of the image, the unit is the pixel, a ij is the a chromaticity data of the pixel of i row j column, and b ij is the b chromaticity data of the pixel of i row j column. Then the a chrominance component Da of the central coordinate of the equivalent circle is the mean of the chromaticity value of the image a, and the b chrominance component Db of the central coordinate of the equivalent circle is the mean of the chromaticity value of the image b:
Figure PCTCN2016072738-appb-000001
Figure PCTCN2016072738-appb-000001
Figure PCTCN2016072738-appb-000002
Figure PCTCN2016072738-appb-000002
Ma是图像a色度值的方差,Mb是图像b色度值的方差:M a is the variance of the image a chromaticity value, and M b is the variance of the image b chromaticity value:
Figure PCTCN2016072738-appb-000003
Figure PCTCN2016072738-appb-000003
Figure PCTCN2016072738-appb-000004
Figure PCTCN2016072738-appb-000004
其中,方差反应了与色度中心的偏离程度,Ma是a轴的偏离程度,Mb是b轴的偏离程度,偏离半径M表示与中心坐标{Da,Db}的偏离半径。Among them, the variance reflects the degree of deviation from the center of chromaticity, Ma is the degree of deviation of the a-axis, Mb is the degree of deviation of the b-axis, and the deviation radius M represents the deviation radius from the central coordinate {Da, Db}.
引入等效圆的概念后,采用图像平均色度D和色度中心距M的比值,即偏色因子K来衡量图像的偏色程度。After introducing the concept of the equivalent circle, the ratio of the image average chromaticity D to the chromaticity center distance M, that is, the color cast factor K, is used to measure the degree of color cast of the image.
K=D/M                 (1-5)K=D/M (1-5)
可以由等效圆在a-b色度平面上的位置来判断图像整体的偏色。比如,红绿偏色系数用Da表示,黄蓝偏色系数由Db表示,偏色因子由K表示。Da>0,表示图像偏红,Da<0,表示图像偏绿;Db>0,表示图像偏黄,Db<0,表示图像偏蓝。偏色因子K的值越大,说明图像偏色越严重。将计算出的红绿偏色系数Da、黄蓝偏色系数Db以及偏色因子K的值作为色偏数据。The color cast of the image as a whole can be judged by the position of the equivalent circle on the a-b chromaticity plane. For example, the red and green color cast coefficient is represented by Da, the yellow and blue color cast coefficient is represented by Db, and the color cast factor is represented by K. Da>0, indicating that the image is reddish, Da<0, indicating that the image is greenish; Db>0, indicating that the image is yellowish, and Db<0, indicating that the image is bluish. The larger the value of the color cast factor K, the more severe the image color cast. The calculated values of the red-green color cast coefficient Da, the yellow-blue color cast coefficient Db, and the color cast factor K are used as color shift data.
其中,所述利用已知色温的闪光灯进行预闪拍摄,获得拍摄对象在所述闪光灯确定的环境色温下的测试照片,对所述测试照片进行色偏检测,包括: Wherein, the pre-flash shooting is performed by using a flash of a known color temperature, and a test photo of the subject at an ambient color temperature determined by the flash is obtained, and color shift detection is performed on the test photo, including:
如所述已知色温的闪光灯的数目为多个,则在采用一个闪光灯进行预闪拍摄并获得拍摄对象在所述闪光灯对应的色温下的测试照片后,对所述测试照片进行色偏检测,同时利用下一个闪光灯进行预闪拍摄。If the number of the flashes of the known color temperature is plural, after the pre-flash shooting is performed by using one flash and the test photos of the subject at the color temperature corresponding to the flash are obtained, color shift detection is performed on the test photo. At the same time, the next flash is used for pre-flash shooting.
上述通过流水线的方式进行预闪拍摄和色偏检测,可以提高实时性。The above-described pre-flash shooting and color shift detection by means of a pipeline can improve real-time performance.
S102,根据所述测试照片提供的色偏数据估计所述拍摄对象的色温;S102. Estimating a color temperature of the photographic subject according to the color shift data provided by the test photo.
其中,所述根据所述测试照片提供的色偏数据估计所述拍摄对象的色温,包括:The estimating the color temperature of the photographic subject according to the color shift data provided by the test photo includes:
在所述测试照片为一张时,如所述测试照片的色偏数据指示偏红或偏黄,则估计所述拍摄对象的色温高于所述测试照片对应的环境色温;如所述测试照片的色偏数据指示偏绿或偏蓝,则估计所述拍摄对象的色温低于所述测试照片对应的环境色温;或者When the test photo is a sheet, if the color shift data of the test photograph indicates a reddish or yellowish color, it is estimated that the color temperature of the photographed object is higher than an ambient color temperature corresponding to the test photograph; The color shift data indicates a greenish or bluish color, and it is estimated that the color temperature of the subject is lower than the ambient color temperature corresponding to the test photograph; or
在所述测试照片为多张时,从色偏数据指示偏红或偏黄的测试照片中选取色偏程度最轻的测试照片作为第一测试照片,从色偏数据指示偏绿或偏蓝的测试照片中选取色偏程度最轻的测试照片作为第二测试照片,估计所述拍摄对象的色温高于所述第一测试照片对应的环境色温且低于所述第二测试照片对应的环境色温;When the test photograph is multiple sheets, the test photograph with the lightest color deviation is selected as the first test photograph from the test photograph indicating the reddish or yellowish color shift data, and the green color or bluish color is indicated from the color shift data. The test photograph having the lightest degree of color deviation is selected as the second test photograph, and the color temperature of the photographed object is estimated to be higher than the ambient color temperature corresponding to the first test photograph and lower than the ambient color temperature corresponding to the second test photograph. ;
可以利用查表法估计拍摄对象的色温,预先设置一张参考表,所述参考表中包括每一个已知色温的闪光灯拍摄不同场景时的色偏数据记录。所述色偏记录至少包含:红绿偏色系数、黄蓝偏色系数和用于指示色偏程度的偏色因子。The color temperature of the subject can be estimated by using the look-up table method, and a reference table including a color shift data record when each of the scenes of the known color temperature captures different scenes is preset. The color shift record includes at least: a red-green color cast coefficient, a yellow-blue color cast coefficient, and a color cast factor for indicating the degree of color shift.
其中,所述根据所述测试照片提供的色偏数据估计所述拍摄对象的色温,包括:The estimating the color temperature of the photographic subject according to the color shift data provided by the test photo includes:
在所述测试照片为一张时,将所述测试照片的色偏数据与参考表中拍摄该测试照片的闪关灯对应的每条记录进行比对,如查找到完全匹配的记录,则将查找到的记录对应的环境色温作为拍摄对象的色温,如未查找到完全匹配的记录,则查找色偏情况一致且色偏程度最接近的一条记录,将查找到的记录对应的环境色温作为拍摄对象的色温;When the test photo is a sheet, compare the color shift data of the test photograph with each record corresponding to the flashing light of the reference photograph in the reference table, and if the exact matching record is found, The ambient temperature corresponding to the found record is taken as the color temperature of the subject. If no exact match is found, a record with the same color shift and the closest color shift is found, and the ambient color temperature corresponding to the found record is taken as the shooting. The color temperature of the object;
其中,所述根据所述测试照片提供的色偏数据估计所述拍摄对象的色 温,包括:Wherein the color of the subject is estimated according to the color cast data provided by the test photo Warm, including:
在所述测试照片为多张时,对于每一张测试照片,将所述测试照片的色偏数据与参考表中拍摄该测试照片的闪关灯对应的每条记录进行比对,如查找到完全匹配的记录,则将查找到的记录对应的环境色温作为拍摄对象的色温,结束对所有测试照片的比对;如未查找到完全匹配的记录,则根据偏色因子对应的区间确定参考色温区间;When the test photograph is multiple sheets, for each test photograph, compare the color shift data of the test photograph with each record corresponding to the flashing light of the reference photograph in the reference table, such as finding For a perfectly matched record, the ambient color temperature corresponding to the found record is taken as the color temperature of the subject, and the comparison of all the test photos is ended; if the completely matched record is not found, the reference color temperature is determined according to the interval corresponding to the color cast factor. Interval
如所有测试照片均未查找到完全匹配的记录,则根据每张测试照片确定的参考色温区间确定所述拍摄对象的色温值;If all the test photos do not find an exact match record, the color temperature value of the subject is determined according to the reference color temperature interval determined by each test photo;
其中,所述根据每张测试照片确定的参考色温区间确定所述拍摄对象的色温值,包括:The determining, according to the reference color temperature interval determined by each test photo, the color temperature value of the subject, including:
计算所述拍摄对象在每个闪光灯拍摄时的偏色因子序列{k1,k2,...,kn}与每一个参考色温区间的区间端点对应的场景下每个闪光灯拍摄时的偏色因子序列{kref1,kref2,...,krefn}之间的偏离程度,将偏离程度最低的一个参考色温区间的区间端点对应的场景的环境色温作为拍摄对象的色温;其中,n是闪光灯的个数。Calculating a partial deviation of the color cast factor sequence {k 1 , k 2 , . . . , k n } of the subject at each flash shooting with each of the flash corresponding to the end point of the interval of each reference color temperature interval The degree of deviation between the color factor sequences {k ref1 , k ref2 , . . . , k refn } is the color temperature of the scene corresponding to the endpoint of the interval of the reference color temperature interval with the lowest degree of deviation; wherein, n It is the number of flashes.
其中,计算两个序列之间的偏离程度,可以将两个序列映射到n维空间中,通过计算n维空间中的两点之间的欧氏距离确定两个序列之间的偏离程度,也即,上述偏色因子对应的两个序列之间的偏离程度L可以表示为:Wherein, the degree of deviation between the two sequences is calculated, and the two sequences can be mapped into the n-dimensional space, and the degree of deviation between the two sequences is determined by calculating the Euclidean distance between the two points in the n-dimensional space. That is, the degree of deviation L between the two sequences corresponding to the above-mentioned color cast factor can be expressed as:
Figure PCTCN2016072738-appb-000005
Figure PCTCN2016072738-appb-000005
在预闪阶段,三个闪光灯的色温分别是2500K,5500K,7000K,不同的闪光灯预拍得到了三组对应的图片数据,根据色偏检测算法分别计算出Da,Db,K值。Da,Db的正负决定了往哪个颜色偏,K的值反应了色偏的程度。由于已知了三个色温点,所以拍照对象的色温根据Da,Db,K值可以划分一个相对准确的区域。In the pre-flash phase, the color temperatures of the three flashes are 2500K, 5500K, and 7000K, respectively. Different flash pre-shoots obtain three sets of corresponding picture data, and Da, Db, and K values are respectively calculated according to the color-shift detection algorithm. The positive and negative of Da and Db determine which color is biased, and the value of K reflects the degree of color shift. Since three color temperature points are known, the color temperature of the photographed object can be divided into a relatively accurate region according to the values of Da, Db, and K.
例如2500K拍摄的照片,如果Da>0,Db>0,K=1.5,则说明拍摄的照片偏红,偏黄,而且色偏比较严重,说明当时的对象色温一定是大于2500K的。再看5500K拍摄的照片,如果Da<0,Db<0,K=0.8,则说明拍摄的照 片偏绿,偏蓝,色偏程度一般,说明当时的对象色温是略接近于5500K的。For example, if the photo is taken at 2500K, if Da>0, Db>0, and K=1.5, the photo taken is reddish, yellowish, and the color shift is serious, indicating that the color temperature of the object at that time must be greater than 2500K. Look at the photos taken at 5500K. If Da<0, Db<0, K=0.8, then the photo taken. The film is greenish, blue, and the degree of color shift is general, indicating that the color temperature of the object at that time is slightly closer to 5500K.
对于利用查表法进行环境色温估计,预先需要对每种色温场景进行拍摄,计算出三个已知色温的闪光灯拍摄不同场景时的Da,Db,K值,得出一个表格阵列(查表法的依据),表明不同色温环境下,三个参考色温的Da,Db,K值。后续得到的数据对照表格就可以估计当前的拍照色温。当出现实际计算得到的值没有和表格中数据完全相符的情况,可以先确定区间,然后再计算实际值与表格中的原始值之间的偏离程度,最终选择偏离程度最低的色温值作为估计的色温值。For the ambient color temperature estimation using the look-up table method, it is necessary to take a picture of each color temperature scene in advance, and calculate the Da, Db, and K values of the three flashes of the known color temperature when shooting different scenes, and obtain a table array (check table method) The basis of the three, indicating the Da, Db, K values of the three reference color temperatures in different color temperature environments. The data obtained from the subsequent comparison table can estimate the current photo color temperature. When the actual calculated value does not exactly match the data in the table, the interval can be determined first, then the degree of deviation between the actual value and the original value in the table can be calculated, and finally the color temperature value with the lowest degree of deviation is selected as the estimated value. Color temperature value.
由于色温的区分不需要很细化,仅仅需要对几个常用场景的色温进行区分就可以,所以表格的数量也不是很多,这样可以简化表格的数量,减少查表的时间。Since the distinction of color temperature does not need to be very detailed, it is only necessary to distinguish the color temperature of several common scenes, so the number of tables is not many, which can simplify the number of tables and reduce the time for table lookup.
国标GB/T 17263-2002对色温的数值范围定义如下表1:The national standard GB/T 17263-2002 defines the numerical range of color temperature as shown in Table 1:
Figure PCTCN2016072738-appb-000006
Figure PCTCN2016072738-appb-000006
表1Table 1
在光学实验室模拟上述色温,用三个闪光灯分别进行拍照,每一种拍照环境在每一个闪光灯下都能得到一个偏色记录(包括Da,Db,K值),将所 有的偏色记录组成一个表格便于查表(例如表2,其中的数据用于举例不代表真实测试数值)。Simulate the above color temperature in the optical laboratory, and take photos with three flashlights. Each camera environment can get a color cast record (including Da, Db, K values) under each flash. Some color cast records form a table for easy table lookup (for example, Table 2, where the data is used for examples does not represent real test values).
Figure PCTCN2016072738-appb-000007
Figure PCTCN2016072738-appb-000007
表2Table 2
例如,用2500K闪光灯拍摄的测试照片,如果Da>0,Db>0,K=1.5,则说明拍摄的照片偏红,偏黄,而且色偏程度一般,说明当时的对象色温应该大于2500K,据表格查表得到的是2940K-3450K的色温范围。用5500K闪光灯拍摄的测试照片,如果Da<0,Db<0,K=2,则说明拍摄的照片偏绿,偏蓝,色偏比较多,据表格查表得到的是2940K的色温。因此最终确定当前的色温为2940K。For example, if a test photograph taken with a 2500K flash, if Da>0, Db>0, and K=1.5, the photograph taken is reddish, yellowish, and the degree of color shift is general, indicating that the color temperature of the object at that time should be greater than 2500K. The table lookup table gives the color temperature range of 2940K-3450K. For the test photos taken with the 5500K flash, if Da<0, Db<0, K=2, the photos taken are greenish, blue, and the color shift is more. According to the table, the color temperature of 2940K is obtained. Therefore, it is finally determined that the current color temperature is 2940K.
如果实际情况下测试照片的色偏数据没有完全匹配上表格中的数据,则可以估计当前拍摄对象与表格数据的偏离程度,选择偏离程度较低的数据用于估计最终的色温值。 If the color shift data of the test photograph does not exactly match the data in the above table, the degree of deviation of the current photograph from the tabular data can be estimated, and the data with a lower degree of deviation is selected for estimating the final color temperature value.
例如,用2500K闪光灯拍摄的测试照片,如果Da>0,Db>0,K=2,则说明拍摄的照片偏红,偏黄,而且色偏比较多,据表格查表得到的是3450K-4040K的色温范围;用5500K闪光灯拍摄的测试照片,如果Da<0,Db<0,K=1.7,则说明拍摄的照片偏绿,偏蓝,色偏比较多,据表格查表得到的也是3450K-4040K的色温;用7000K闪光灯拍摄的测试照片,如果Da<0,Db<0,K=1.8,则说明拍摄的照片偏绿,偏蓝,色偏比较多,据表格查表得到的也是3450K-4040K的色温。然后计算三种闪光灯拍摄的测试照片的偏色因子序列与标准偏色因子序列之间的偏离程度,三种闪光灯分别拍摄的测试照片的实际偏色因子序列为{2,1.7,1.8},三种闪光灯分别拍摄3450K的环境对应的标准偏色因子序列为{1.7,1.8,1.9},三种闪光灯分别拍摄4040K的环境对应的标准偏色因子序列为{2.1,1.5,1.7},因此,计算出测试照片的实际偏色因子序列与表格数据中3450K的环境对应的偏色因子序列的偏离程度为L1,测试照片的实际偏色因子序列与表格数据中4040K的环境对应的偏色因子序列的偏离程度为L2;For example, if a test photo taken with a 2500K flash, Da>0, Db>0, K=2, the photo taken is reddish, yellowish, and the color shift is more. According to the table, the table is 3450K-4040K. Color temperature range; test photos taken with 5500K flash, if Da<0, Db<0, K=1.7, it means that the photos taken are greenish, blue, and the color deviation is more. According to the table, the table is also 3450K- 4040K color temperature; test photos taken with 7000K flash, if Da<0, Db<0, K=1.8, then the photo taken is greenish, blue, and the color deviation is more, according to the table lookup table is also 3450K- 4040K color temperature. Then calculate the degree of deviation between the color cast factor sequence of the test photos taken by the three flashes and the standard color cast factor sequence. The actual color cast factor sequence of the test photos taken by the three flash lights is {2, 1.7, 1.8}, three. The standard color cast factor sequence corresponding to the 3450K environment is {1.7, 1.8, 1.9}, and the standard color cast factor sequence corresponding to the 4040K environment is {2.1, 1.5, 1.7}, so the calculation The deviation of the actual color cast factor sequence of the test photograph from the color cast factor sequence corresponding to the 3450K environment in the tabular data is L1, and the actual color cast factor sequence of the test photograph is corresponding to the color cast factor sequence corresponding to the 4040K environment in the tabular data. The degree of deviation is L2;
Figure PCTCN2016072738-appb-000008
Figure PCTCN2016072738-appb-000008
Figure PCTCN2016072738-appb-000009
Figure PCTCN2016072738-appb-000009
L2<L1,因此选择偏离程度较低的L2代表的4040K拍摄环境的色温作为拍摄对象的色温。L2 < L1, so the color temperature of the 4040K shooting environment represented by L2 with a lower degree of deviation is selected as the color temperature of the subject.
本发明实施例中提到的查表法,是处理色偏检测算法的色偏数据的一种方法,其他方案如果采用其他方式来处理数据,得到估计的色温值,也是可行的。The look-up table method mentioned in the embodiment of the present invention is a method for processing the color cast data of the color cast detection algorithm. Other schemes are also feasible if the data is processed by other methods to obtain the estimated color temperature value.
S103,根据估计出的所述拍摄对象的色温重新对所述拍摄对象进行拍摄并对拍摄出的照片进行白平衡校正。S103: Re-photograph the subject according to the estimated color temperature of the subject, and perform white balance correction on the photograph taken.
其中,所述根据估计出的所述拍摄对象的色温重新对所述拍摄对象进行拍摄并对拍摄出的照片进行白平衡校正,包括:The photographing the photographing object and performing white balance correction on the photographed photograph according to the estimated color temperature of the photographed object includes:
在未使用闪光灯进行重新拍摄时,将估计出的所述拍摄对象的色温作为白平衡参数,对拍摄出的照片进行白平衡校正;或者When re-shooting without using the flash, the estimated color temperature of the subject is used as a white balance parameter, and white balance correction is performed on the photograph taken; or
在使用闪光灯进行重新拍摄时,选择色温与所述拍摄对象最接近的闪光 灯进行闪光拍摄,对拍摄出的照片进行白平衡校正;When re-shooting with the flash, select the flash with the color temperature closest to the subject The lamp is flashed to perform white balance correction on the captured photo;
其中,选择色温与所述拍摄对象最接近的闪光灯进行闪光拍摄,包括:Wherein, selecting a flash with the color temperature closest to the subject to perform flash shooting includes:
在所述已知色温的闪光灯包括双色温闪光灯时,如所述估计出的所述拍摄对象的色温在所述双色温闪光灯输出的色温范围内,则调节所述双色温闪光灯的输入电流以控制所述双色温闪光灯输出相应色温的光线;这样得到的照片一定是没有色温偏差的,因此可以简化白平衡算法。When the flash of the known color temperature includes a dual color temperature flash, if the estimated color temperature of the subject is within a color temperature range of the dual color temperature flash output, adjusting an input current of the dual color temperature flash to control The two-color temperature flash outputs light of a corresponding color temperature; the photo thus obtained must have no color temperature deviation, so the white balance algorithm can be simplified.
如图2所示,本发明实施例提供了一种实现自动白平衡功能的装置,包括:As shown in FIG. 2, an embodiment of the present invention provides an apparatus for implementing an automatic white balance function, including:
预拍摄及色偏检测模块201,设置为:利用已知色温的闪光灯进行预闪拍摄,获得拍摄对象在所述闪光灯确定的环境色温下的测试照片,对所述测试照片进行色偏检测,获得所述拍摄对象在对应的环境色温下的色偏数据;The pre-shooting and color-shift detection module 201 is configured to: perform pre-flash shooting with a flash of a known color temperature, obtain a test photo of the subject at an ambient color temperature determined by the flash, and perform color-shift detection on the test photo to obtain Color shift data of the subject at a corresponding ambient color temperature;
色温估计模块202,设置为:根据所述测试照片提供的色偏数据估计所述拍摄对象的色温;The color temperature estimation module 202 is configured to: estimate a color temperature of the photographic subject according to color cast data provided by the test photo;
拍摄及白平衡校正模块203,设置为:根据估计出的所述拍摄对象的色温重新对所述拍摄对象进行拍摄并对拍摄出的照片进行白平衡校正。The photographing and white balance correction module 203 is configured to re-photograph the photographed object based on the estimated color temperature of the photographed subject and perform white balance correction on the photographed photograph.
其中,所述已知色温的闪光灯包括以下a)-e)中任意一种:Wherein the flash of the known color temperature comprises any one of the following a)-e):
a)一个电子闪光灯;a) an electronic flash;
b)一对双色温闪光灯;b) a pair of dual color temperature flashes;
c)一个电子闪光灯和一对双色温闪光灯;c) an electronic flash and a pair of dual color temperature flashes;
d)一对双色温闪光灯以及由所述双色温闪光灯模拟出的其他色温的闪光灯;d) a pair of dual color temperature flashes and other color temperature flashes simulated by the dual color temperature flash;
e)一个电子闪光灯、一对双色温闪光灯以及由所述双色温闪光灯模拟出的其他色温的闪光灯。e) an electronic flash, a pair of dual color temperature flashes, and other color temperature flashes that are simulated by the two color temperature flash.
其中,所述预拍摄及色偏检测模块201,是设置为:The pre-shooting and color shift detecting module 201 is configured to:
利用一个已知色温的闪光灯进行预闪拍摄,所述闪光灯确定的环境色温 为所述闪光灯的色温,获得拍摄对象在所述闪光灯确定的环境色温下的测试照片;或者Pre-flash shooting with a flash of known color temperature, the ambient color temperature determined by the flash Obtaining a test photograph of the subject at an ambient color temperature determined by the flash for the color temperature of the flash; or
依次利用不同色温的闪光灯进行预闪拍摄,所述闪光灯确定的环境色温为所述闪光灯的色温,依次获得拍摄对象在每一种环境色温下的测试照片。Pre-flash shooting is sequentially performed by using flash lamps of different color temperatures, and the ambient color temperature determined by the flash is the color temperature of the flash, and the test photos of the subject at each ambient color temperature are sequentially obtained.
其中,所述预拍摄及色偏检测模块201,是设置为:The pre-shooting and color shift detecting module 201 is configured to:
采用基于等效圆的色偏检测算法对所述测试照片进行色偏检测,获得所述拍摄对象在对应的环境色温下的色偏数据;Performing color shift detection on the test photograph by using a color circle detection algorithm based on an equivalent circle, and obtaining color shift data of the photographed object at a corresponding ambient color temperature;
其中,所述色偏数据包括:红绿偏色系数、黄蓝偏色系数和用于指示色偏程度的偏色因子。The color shift data includes: a red-green color cast coefficient, a yellow-blue color cast coefficient, and a color cast factor for indicating the degree of color shift.
其中,所述色温估计模块202,是设置为:The color temperature estimation module 202 is configured to:
在所述测试照片为一张时,如所述测试照片的色偏数据指示偏红或偏黄,则估计所述拍摄对象的色温高于所述测试照片对应的环境色温;如所述测试照片的色偏数据指示偏绿或偏蓝,则估计所述拍摄对象的色温低于所述测试照片对应的环境色温;或者When the test photo is a sheet, if the color shift data of the test photograph indicates a reddish or yellowish color, it is estimated that the color temperature of the photographed object is higher than an ambient color temperature corresponding to the test photograph; The color shift data indicates a greenish or bluish color, and it is estimated that the color temperature of the subject is lower than the ambient color temperature corresponding to the test photograph; or
在所述测试照片为多张时,从色偏数据指示偏红或偏黄的测试照片中选取色偏程度最轻的测试照片作为第一测试照片,从色偏数据指示偏绿或偏蓝的测试照片中选取色偏程度最轻的测试照片作为第二测试照片,估计所述拍摄对象的色温高于所述第一测试照片对应的环境色温且低于所述第二测试照片对应的环境色温。When the test photograph is multiple sheets, the test photograph with the lightest color deviation is selected as the first test photograph from the test photograph indicating the reddish or yellowish color shift data, and the green color or bluish color is indicated from the color shift data. The test photograph having the lightest degree of color deviation is selected as the second test photograph, and the color temperature of the photographed object is estimated to be higher than the ambient color temperature corresponding to the first test photograph and lower than the ambient color temperature corresponding to the second test photograph. .
其中,所述色温估计模块202,是设置为:The color temperature estimation module 202 is configured to:
在所述测试照片为一张时,将所述测试照片的色偏数据与参考表中拍摄该测试照片的闪关灯对应的每条记录进行比对,如查找到完全匹配的记录,则将查找到的记录对应的环境色温作为拍摄对象的色温,如未查找到完全匹配的记录,则查找色偏情况一致且色偏程度最接近的一条记录,将查找到的记录对应的环境色温作为拍摄对象的色温;When the test photo is a sheet, compare the color shift data of the test photograph with each record corresponding to the flashing light of the reference photograph in the reference table, and if the exact matching record is found, The ambient temperature corresponding to the found record is taken as the color temperature of the subject. If no exact match is found, a record with the same color shift and the closest color shift is found, and the ambient color temperature corresponding to the found record is taken as the shooting. The color temperature of the object;
其中,所述参考表中包括每一个已知色温的闪光灯拍摄不同场景时的色偏数据记录。 Wherein, the reference table includes a color shift data record when each of the known color temperature flashes captures different scenes.
其中,所述色温估计模块202,是设置为:The color temperature estimation module 202 is configured to:
在所述测试照片为多张时,对于每一张测试照片,将所述测试照片的色偏数据与参考表中拍摄该测试照片的闪关灯对应的每条记录进行比对,如查找到完全匹配的记录,则将查找到的记录对应的环境色温作为拍摄对象的色温,结束对所有测试照片的比对;如未查找到完全匹配的记录,则根据偏色因子对应的区间确定参考色温区间;When the test photograph is multiple sheets, for each test photograph, compare the color shift data of the test photograph with each record corresponding to the flashing light of the reference photograph in the reference table, such as finding For a perfectly matched record, the ambient color temperature corresponding to the found record is taken as the color temperature of the subject, and the comparison of all the test photos is ended; if the completely matched record is not found, the reference color temperature is determined according to the interval corresponding to the color cast factor. Interval
如所有测试照片均未查找到完全匹配的记录,则根据每张测试照片确定的参考色温区间确定所述拍摄对象的色温值;If all the test photos do not find an exact match record, the color temperature value of the subject is determined according to the reference color temperature interval determined by each test photo;
其中,所述参考表中包括每一个已知色温的闪光灯拍摄不同场景时的色偏数据记录。Wherein, the reference table includes a color shift data record when each of the known color temperature flashes captures different scenes.
其中,所述色温估计模块202,是设置为:The color temperature estimation module 202 is configured to:
计算所述拍摄对象在每个闪光灯拍摄时的偏色因子序列{k1,k2,...,kn}与每一个参考色温区间的区间端点对应的场景下每个闪光灯拍摄时的偏色因子序列{kref1,kref2,...,krefn}之间的偏离程度,将偏离程度最低的一个参考色温区间的区间端点对应的场景的环境色温作为拍摄对象的色温;其中,n是闪光灯的个数。Calculating a partial deviation of the color cast factor sequence {k 1 , k 2 , . . . , k n } of the subject at each flash shooting with each of the flash corresponding to the end point of the interval of each reference color temperature interval The degree of deviation between the color factor sequences {k ref1 , k ref2 , . . . , k refn } is the color temperature of the scene corresponding to the endpoint of the interval of the reference color temperature interval with the lowest degree of deviation; wherein, n It is the number of flashes.
其中,所述拍摄及白平衡校正模块203,是设置为:The shooting and white balance correction module 203 is configured to:
在未使用闪光灯进行重新拍摄时,将估计出的所述拍摄对象的色温作为白平衡参数,对拍摄出的照片进行白平衡校正;或者When re-shooting without using the flash, the estimated color temperature of the subject is used as a white balance parameter, and white balance correction is performed on the photograph taken; or
在使用闪光灯进行重新拍摄时,选择色温与所述拍摄对象最接近的闪光灯进行闪光拍摄,对拍摄出的照片进行白平衡校正。When re-shooting with the flash, select the flash whose color temperature is closest to the subject for flash shooting, and perform white balance correction on the photograph taken.
其中,所述拍摄及白平衡校正模块203,是设置为:The shooting and white balance correction module 203 is configured to:
在所述已知色温的闪光灯包括双色温闪光灯时,如所述估计出的所述拍摄对象的色温在所述双色温闪光灯输出的色温范围内,则调节所述双色温闪光灯的输入电流以控制所述双色温闪光灯输出相应色温的光线。When the flash of the known color temperature includes a dual color temperature flash, if the estimated color temperature of the subject is within a color temperature range of the dual color temperature flash output, adjusting an input current of the dual color temperature flash to control The dual color temperature flash outputs light of a corresponding color temperature.
本领域普通技术人员可以理解上述实施例的全部或部分步骤可以使用计算机程序流程来实现,所述计算机程序可以存储于一计算机可读存储介质中, 所述计算机程序在相应的硬件平台上(如系统、设备、装置、器件等)执行,在执行时,包括方法实施例的步骤之一或其组合。Those of ordinary skill in the art will appreciate that all or a portion of the steps of the above-described embodiments can be implemented using a computer program flow, which can be stored in a computer readable storage medium. The computer program is executed on a corresponding hardware platform (eg, system, device, device, device, etc.), and when executed, includes one or a combination of the steps of the method embodiments.
可选地,上述实施例的全部或部分步骤也可以使用集成电路来实现,这些步骤可以被分别制作成一个个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。Alternatively, all or part of the steps of the above embodiments may also be implemented by using an integrated circuit. These steps may be separately fabricated into individual integrated circuit modules, or multiple modules or steps may be fabricated into a single integrated circuit module. achieve.
上述实施例中的装置/功能模块/功能单元可以采用通用的计算装置来实现,它们可以集中在单个的计算装置上,也可以分布在多个计算装置所组成的网络上。The devices/function modules/functional units in the above embodiments may be implemented by a general-purpose computing device, which may be centralized on a single computing device or distributed over a network of multiple computing devices.
上述实施例中的装置/功能模块/功能单元以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。上述提到的计算机可读取存储介质可以是只读存储器,磁盘或光盘等。When the device/function module/functional unit in the above embodiment is implemented in the form of a software function module and sold or used as a stand-alone product, it can be stored in a computer readable storage medium. The above mentioned computer readable storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
工业实用性Industrial applicability
本发明实施例提供的一种实现自动白平衡功能的方法和装置,通过已知色温的闪光灯进行预闪,得到拍摄对象的测试照片,通过色偏检测算法计算测试照片的色偏数据,根据色偏数据估计环境色温,辅助自动白平衡功能。而且可以根据估计出的色温,在需要闪光的应用场景下,控制双色温闪光灯的输入电流以混合输出合适的色温进行拍照,从而优化自动白平衡功能。 A method and device for realizing an automatic white balance function provided by an embodiment of the present invention, pre-flashing by a flash with a known color temperature, obtaining a test photograph of a photographed object, and calculating a color shift data of the test photograph by a color shift detection algorithm, according to the color The partial data estimates the ambient color temperature and assists the automatic white balance function. Moreover, according to the estimated color temperature, in the application scene requiring flash, the input current of the dual color temperature flash is controlled to perform the photographing by mixing and outputting the appropriate color temperature, thereby optimizing the automatic white balance function.

Claims (15)

  1. 一种实现自动白平衡功能的方法,该方法包括:A method of implementing an automatic white balance function, the method comprising:
    利用已知色温的闪光灯进行预闪拍摄,获得拍摄对象在所述闪光灯确定的环境色温下的测试照片,对所述测试照片进行色偏检测,获得所述拍摄对象在对应的环境色温下的色偏数据;Performing pre-flash shooting with a flash of a known color temperature, obtaining a test photograph of the subject at an ambient color temperature determined by the flash, performing color shift detection on the test photograph, and obtaining a color of the photographed object at a corresponding ambient color temperature. Partial data
    根据所述测试照片提供的色偏数据估计所述拍摄对象的色温;Estimating a color temperature of the photographic subject according to color cast data provided by the test photograph;
    根据估计出的所述拍摄对象的色温重新对所述拍摄对象进行拍摄并对拍摄出的照片进行白平衡校正。The subject is re-photographed based on the estimated color temperature of the subject and white balance correction is performed on the photograph taken.
  2. 如权利要求1所述的方法,其中:The method of claim 1 wherein:
    所述已知色温的闪光灯包括以下a)-e)中任意一种:The known color temperature flash lamp includes any one of the following a)-e):
    a)一个电子闪光灯;a) an electronic flash;
    b)一对双色温闪光灯;b) a pair of dual color temperature flashes;
    c)一个电子闪光灯和一对双色温闪光灯;c) an electronic flash and a pair of dual color temperature flashes;
    d)一对双色温闪光灯以及由所述双色温闪光灯模拟出的其他色温的闪光灯;d) a pair of dual color temperature flashes and other color temperature flashes simulated by the dual color temperature flash;
    e)一个电子闪光灯、一对双色温闪光灯以及由所述双色温闪光灯模拟出的其他色温的闪光灯。e) an electronic flash, a pair of dual color temperature flashes, and other color temperature flashes that are simulated by the two color temperature flash.
  3. 如权利要求2所述的方法,其中:The method of claim 2 wherein:
    所述利用已知色温的闪光灯进行预闪拍摄,获得拍摄对象在所述闪光灯确定的环境色温下的测试照片,包括:Performing pre-flash shooting with a flash of a known color temperature to obtain a test photograph of the subject at an ambient color temperature determined by the flash, including:
    利用一个已知色温的闪光灯进行预闪拍摄,所述闪光灯确定的环境色温为所述闪光灯的色温,获得拍摄对象在所述闪光灯确定的环境色温下的测试照片;或者Performing pre-flash shooting with a flash of a known color temperature, the ambient color temperature determined by the flash being the color temperature of the flash, obtaining a test photograph of the subject at an ambient color temperature determined by the flash; or
    依次利用不同色温的闪光灯进行预闪拍摄,所述闪光灯确定的环境色温为所述闪光灯的色温,依次获得拍摄对象在每一种环境色温下的测试照片。 Pre-flash shooting is sequentially performed by using flash lamps of different color temperatures, and the ambient color temperature determined by the flash is the color temperature of the flash, and the test photos of the subject at each ambient color temperature are sequentially obtained.
  4. 如权利要求3所述的方法,其中:The method of claim 3 wherein:
    对所述测试照片进行色偏检测,获得所述拍摄对象在对应的环境色温下的色偏数据,包括:Performing color shift detection on the test photograph to obtain color shift data of the photographed object at a corresponding ambient color temperature, including:
    采用基于等效圆的色偏检测算法对所述测试照片进行色偏检测,获得所述拍摄对象在对应的环境色温下的色偏数据;Performing color shift detection on the test photograph by using a color circle detection algorithm based on an equivalent circle, and obtaining color shift data of the photographed object at a corresponding ambient color temperature;
    其中,所述色偏数据包括:红绿偏色系数、黄蓝偏色系数和用于指示色偏程度的偏色因子。The color shift data includes: a red-green color cast coefficient, a yellow-blue color cast coefficient, and a color cast factor for indicating the degree of color shift.
  5. 如权利要求4所述的方法,其中:The method of claim 4 wherein:
    所述根据所述测试照片提供的色偏数据估计所述拍摄对象的色温,包括:The estimating a color temperature of the photographic subject according to the color shift data provided by the test photo includes:
    在所述测试照片为一张时,如所述测试照片的色偏数据指示偏红或偏黄,则估计所述拍摄对象的色温高于所述测试照片对应的环境色温;如所述测试照片的色偏数据指示偏绿或偏蓝,则估计所述拍摄对象的色温低于所述测试照片对应的环境色温;或者When the test photo is a sheet, if the color shift data of the test photograph indicates a reddish or yellowish color, it is estimated that the color temperature of the photographed object is higher than an ambient color temperature corresponding to the test photograph; The color shift data indicates a greenish or bluish color, and it is estimated that the color temperature of the subject is lower than the ambient color temperature corresponding to the test photograph; or
    在所述测试照片为多张时,从色偏数据指示偏红或偏黄的测试照片中选取色偏程度最轻的测试照片作为第一测试照片,从色偏数据指示偏绿或偏蓝的测试照片中选取色偏程度最轻的测试照片作为第二测试照片,估计所述拍摄对象的色温高于所述第一测试照片对应的环境色温且低于所述第二测试照片对应的环境色温。When the test photograph is multiple sheets, the test photograph with the lightest color deviation is selected as the first test photograph from the test photograph indicating the reddish or yellowish color shift data, and the green color or bluish color is indicated from the color shift data. The test photograph having the lightest degree of color deviation is selected as the second test photograph, and the color temperature of the photographed object is estimated to be higher than the ambient color temperature corresponding to the first test photograph and lower than the ambient color temperature corresponding to the second test photograph. .
  6. 如权利要求4所述的方法,其中:The method of claim 4 wherein:
    所述根据所述测试照片提供的色偏数据估计所述拍摄对象的色温,包括:The estimating a color temperature of the photographic subject according to the color shift data provided by the test photo includes:
    在所述测试照片为一张时,将所述测试照片的色偏数据与参考表中拍摄该测试照片的闪关灯对应的每条记录进行比对,如查找到完全匹配的记录,则将查找到的记录对应的环境色温作为拍摄对象的色温,如未查找到完全匹配的记录,则查找色偏情况一致且色偏程度最接近的一条记录,将查找到的记录对应的环境色温作为拍摄对象的色温; When the test photo is a sheet, compare the color shift data of the test photograph with each record corresponding to the flashing light of the reference photograph in the reference table, and if the exact matching record is found, The ambient temperature corresponding to the found record is taken as the color temperature of the subject. If no exact match is found, a record with the same color shift and the closest color shift is found, and the ambient color temperature corresponding to the found record is taken as the shooting. The color temperature of the object;
    其中,所述参考表中包括每一个已知色温的闪光灯拍摄不同场景时的色偏数据记录。Wherein, the reference table includes a color shift data record when each of the known color temperature flashes captures different scenes.
  7. 如权利要求4所述的方法,其中:The method of claim 4 wherein:
    所述根据所述测试照片提供的色偏数据估计所述拍摄对象的色温,包括:The estimating a color temperature of the photographic subject according to the color shift data provided by the test photo includes:
    在所述测试照片为多张时,对于每一张测试照片,将所述测试照片的色偏数据与参考表中拍摄该测试照片的闪关灯对应的每条记录进行比对,如查找到完全匹配的记录,则将查找到的记录对应的环境色温作为拍摄对象的色温,结束对所有测试照片的比对;如未查找到完全匹配的记录,则根据偏色因子对应的区间确定参考色温区间;When the test photograph is multiple sheets, for each test photograph, compare the color shift data of the test photograph with each record corresponding to the flashing light of the reference photograph in the reference table, such as finding For a perfectly matched record, the ambient color temperature corresponding to the found record is taken as the color temperature of the subject, and the comparison of all the test photos is ended; if the completely matched record is not found, the reference color temperature is determined according to the interval corresponding to the color cast factor. Interval
    如所有测试照片均未查找到完全匹配的记录,则根据每张测试照片确定的参考色温区间确定所述拍摄对象的色温值;If all the test photos do not find an exact match record, the color temperature value of the subject is determined according to the reference color temperature interval determined by each test photo;
    其中,所述参考表中包括每一个已知色温的闪光灯拍摄不同场景时的色偏数据记录。Wherein, the reference table includes a color shift data record when each of the known color temperature flashes captures different scenes.
  8. 如权利要求7所述的方法,其中:The method of claim 7 wherein:
    所述根据每张测试照片确定的参考色温区间确定所述拍摄对象的色温值,包括:Determining a color temperature value of the subject according to the reference color temperature interval determined according to each test photo, including:
    计算所述拍摄对象在每个闪光灯拍摄时的偏色因子序列{k1,k2,...,kn}与每一个参考色温区间的区间端点对应的场景下每个闪光灯拍摄时的偏色因子序列{kref1,kref2,...,krefn}之间的偏离程度,将偏离程度最低的一个参考色温区间的区间端点对应的场景的环境色温作为拍摄对象的色温;其中,n是闪光灯的个数。Calculating a partial deviation of the color cast factor sequence {k 1 , k 2 , . . . , k n } of the subject at each flash shooting with each of the flash corresponding to the end point of the interval of each reference color temperature interval The degree of deviation between the color factor sequences {k ref1 , k ref2 , . . . , k refn } is the color temperature of the scene corresponding to the endpoint of the interval of the reference color temperature interval with the lowest degree of deviation; wherein, n It is the number of flashes.
  9. 如权利要求2-8中任一项所述的方法,其中:A method according to any of claims 2-8, wherein:
    所述根据估计出的所述拍摄对象的色温重新对所述拍摄对象进行拍摄并对拍摄出的照片进行白平衡校正,包括:The photographing the photographing object and performing white balance correction on the photographed photograph according to the estimated color temperature of the photographed object includes:
    在未使用闪光灯进行重新拍摄时,将估计出的所述拍摄对象的色温作为白平衡参数,对拍摄出的照片进行白平衡校正;或者 When re-shooting without using the flash, the estimated color temperature of the subject is used as a white balance parameter, and white balance correction is performed on the photograph taken; or
    在使用闪光灯进行重新拍摄时,选择色温与所述拍摄对象最接近的闪光灯进行闪光拍摄,对拍摄出的照片进行白平衡校正。When re-shooting with the flash, select the flash whose color temperature is closest to the subject for flash shooting, and perform white balance correction on the photograph taken.
  10. 如权利要求9所述的方法,其中:The method of claim 9 wherein:
    选择色温与所述拍摄对象最接近的闪光灯进行闪光拍摄,包括:Select the flash with the color temperature closest to the subject for flash shooting, including:
    在所述已知色温的闪光灯包括双色温闪光灯时,如所述估计出的所述拍摄对象的色温在所述双色温闪光灯输出的色温范围内,则调节所述双色温闪光灯的输入电流以控制所述双色温闪光灯输出相应色温的光线。When the flash of the known color temperature includes a dual color temperature flash, if the estimated color temperature of the subject is within a color temperature range of the dual color temperature flash output, adjusting an input current of the dual color temperature flash to control The dual color temperature flash outputs light of a corresponding color temperature.
  11. 一种实现自动白平衡功能的装置,包括:A device for realizing an automatic white balance function, comprising:
    预拍摄及色偏检测模块,设置为:利用已知色温的闪光灯进行预闪拍摄,获得拍摄对象在所述闪光灯确定的环境色温下的测试照片,对所述测试照片进行色偏检测,获得所述拍摄对象在对应的环境色温下的色偏数据;The pre-shooting and color-shift detection module is configured to: perform pre-flash shooting with a flash of a known color temperature, obtain a test photograph of the subject at an ambient color temperature determined by the flash, perform color shift detection on the test photograph, obtain a Depicting color shift data of the subject at a corresponding ambient color temperature;
    色温估计模块,设置为:根据所述测试照片提供的色偏数据估计所述拍摄对象的色温;a color temperature estimation module, configured to: estimate a color temperature of the photographic subject according to color cast data provided by the test photo;
    拍摄及白平衡校正模块,设置为:根据估计出的所述拍摄对象的色温重新对所述拍摄对象进行拍摄并对拍摄出的照片进行白平衡校正。The photographing and white balance correction module is configured to: re-photograph the subject according to the estimated color temperature of the subject and perform white balance correction on the photograph taken.
  12. 如权利要求11所述的装置,其中:The apparatus of claim 11 wherein:
    所述已知色温的闪光灯包括以下a)-e)中任意一种:The known color temperature flash lamp includes any one of the following a)-e):
    a)一个电子闪光灯;a) an electronic flash;
    b)一对双色温闪光灯;b) a pair of dual color temperature flashes;
    c)一个电子闪光灯和一对双色温闪光灯;c) an electronic flash and a pair of dual color temperature flashes;
    d)一对双色温闪光灯以及由所述双色温闪光灯模拟出的其他色温的闪光灯;d) a pair of dual color temperature flashes and other color temperature flashes simulated by the dual color temperature flash;
    e)一个电子闪光灯、一对双色温闪光灯以及由所述双色温闪光灯模拟出的其他色温的闪光灯。e) an electronic flash, a pair of dual color temperature flashes, and other color temperature flashes that are simulated by the two color temperature flash.
  13. 如权利要求12所述的装置,其中: The apparatus of claim 12 wherein:
    所述预拍摄及色偏检测模块,是设置为:The pre-shooting and color shift detecting module is set to:
    利用一个已知色温的闪光灯进行预闪拍摄,所述闪光灯确定的环境色温为所述闪光灯的色温,获得拍摄对象在所述闪光灯确定的环境色温下的测试照片;或者Performing pre-flash shooting with a flash of a known color temperature, the ambient color temperature determined by the flash being the color temperature of the flash, obtaining a test photograph of the subject at an ambient color temperature determined by the flash; or
    依次利用不同色温的闪光灯进行预闪拍摄,所述闪光灯确定的环境色温为所述闪光灯的色温,依次获得拍摄对象在每一种环境色温下的测试照片。Pre-flash shooting is sequentially performed by using flash lamps of different color temperatures, and the ambient color temperature determined by the flash is the color temperature of the flash, and the test photos of the subject at each ambient color temperature are sequentially obtained.
  14. 如权利要求13所述的装置,其中:The apparatus of claim 13 wherein:
    所述预拍摄及色偏检测模块,是设置为:The pre-shooting and color shift detecting module is set to:
    采用基于等效圆的色偏检测算法对所述测试照片进行色偏检测,获得所述拍摄对象在对应的环境色温下的色偏数据;Performing color shift detection on the test photograph by using a color circle detection algorithm based on an equivalent circle, and obtaining color shift data of the photographed object at a corresponding ambient color temperature;
    其中,所述色偏数据包括:红绿偏色系数、黄蓝偏色系数和用于指示色偏程度的偏色因子。The color shift data includes: a red-green color cast coefficient, a yellow-blue color cast coefficient, and a color cast factor for indicating the degree of color shift.
  15. 一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令用于执行权利要求1-10任一项的方法。 A computer readable storage medium storing computer executable instructions for performing the method of any of claims 1-10.
PCT/CN2016/072738 2015-10-16 2016-01-29 Method and device for realizing auto white balance function WO2016184167A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510677231.0 2015-10-16
CN201510677231.0A CN106604009A (en) 2015-10-16 2015-10-16 Method and device for achieving automatic white balance function

Publications (1)

Publication Number Publication Date
WO2016184167A1 true WO2016184167A1 (en) 2016-11-24

Family

ID=57319340

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/072738 WO2016184167A1 (en) 2015-10-16 2016-01-29 Method and device for realizing auto white balance function

Country Status (2)

Country Link
CN (1) CN106604009A (en)
WO (1) WO2016184167A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116744125A (en) * 2023-08-14 2023-09-12 北京邮电大学 Image color data processing method, device, equipment and storage medium

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107798664B (en) * 2017-10-27 2021-08-06 北京小米移动软件有限公司 Color temperature calibration method and device of flash lamp
CN110022475B (en) * 2018-01-10 2021-10-15 中兴通讯股份有限公司 Camera calibration method, camera and computer readable storage medium
CN108848363A (en) * 2018-05-31 2018-11-20 江苏乙生态农业科技有限公司 A kind of auto white balance method suitable for large scene
CN111277699B (en) * 2020-03-25 2021-08-17 Oppo(重庆)智能科技有限公司 Flash lamp color temperature calibration method and device, electronic equipment and readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101895774A (en) * 2009-05-20 2010-11-24 深圳市融创天下科技发展有限公司 Chrominance information pre-treatment method for encoded source image
CN103581638A (en) * 2012-08-01 2014-02-12 佳能株式会社 Image processing apparatus and image processing method
CN104243832A (en) * 2014-09-30 2014-12-24 北京金山安全软件有限公司 Method and device for shooting through mobile terminal and mobile terminal

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101895774A (en) * 2009-05-20 2010-11-24 深圳市融创天下科技发展有限公司 Chrominance information pre-treatment method for encoded source image
CN103581638A (en) * 2012-08-01 2014-02-12 佳能株式会社 Image processing apparatus and image processing method
CN104243832A (en) * 2014-09-30 2014-12-24 北京金山安全软件有限公司 Method and device for shooting through mobile terminal and mobile terminal

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116744125A (en) * 2023-08-14 2023-09-12 北京邮电大学 Image color data processing method, device, equipment and storage medium
CN116744125B (en) * 2023-08-14 2023-10-24 北京邮电大学 Image color data processing method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN106604009A (en) 2017-04-26

Similar Documents

Publication Publication Date Title
WO2016184167A1 (en) Method and device for realizing auto white balance function
US7728880B2 (en) Automatic white balance method and apparatus
US9420248B2 (en) Multi-LED camera flash for color temperature matching
US8941755B2 (en) Image processing device with automatic white balance
KR100478064B1 (en) Illumination light color estimating method of obtaining white balance and image sensing apparatus
US9497433B2 (en) Imaging device with color adjustment function, imaging method using the same, and non-transitory storage medium in which imaging program is stored
JP5162905B2 (en) Imaging device
JP2002290979A (en) Camera having verification display with reverse white balanced viewer adaptation compensation and capturing method therefor
JP2015106737A (en) Multi-area white balance controller, multi-area white balance control method, multi-area white balance control program, computer recording multi-area white balance control program therein, multi-area white balance image processing device, multi-area white balance image processing method, multi-area white balance image processing program, computer recording multi-area white balance image processing program therein, and imaging apparatus equipped with multi-area white balance image processing device
US20090021526A1 (en) Determination method for white-point and correction method of the white balance
JP2012523799A (en) Automatic backlight detection
CN108234971A (en) White balance parameter determines method, white balance adjustment method and device, storage medium, terminal
KR20100095253A (en) Apparatus and method for adjusting white balance of digital image
JP2012165069A (en) Image processing apparatus and method
US20090244316A1 (en) Automatic white balance control
US9030575B2 (en) Transformations and white point constraint solutions for a novel chromaticity space
WO2019087547A1 (en) Image processing device, image processing method, and program
JP5854716B2 (en) Image processing apparatus, image processing method, and program
WO2016184153A1 (en) Method, terminal for preventing color shift and computer storage medium
US20200228769A1 (en) Lens rolloff assisted auto white balance
JP2021002707A (en) White balance objective evaluation method, white balance objective evaluation program, and imaging device
JP3958700B2 (en) Digital camera
JP2008022474A (en) Imaging apparatus and imaging processing method
JP2015192179A (en) White balance control device, imaging apparatus, and white balance control method
CN114268778A (en) Color temperature compensation method and system in white balance algorithm and image acquisition equipment

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: 16795654

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16795654

Country of ref document: EP

Kind code of ref document: A1