CN107483908A - White balance calibration method and electronic equipment - Google Patents

White balance calibration method and electronic equipment Download PDF

Info

Publication number
CN107483908A
CN107483908A CN201710890224.8A CN201710890224A CN107483908A CN 107483908 A CN107483908 A CN 107483908A CN 201710890224 A CN201710890224 A CN 201710890224A CN 107483908 A CN107483908 A CN 107483908A
Authority
CN
China
Prior art keywords
light source
colour temperature
image block
ratio
image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201710890224.8A
Other languages
Chinese (zh)
Inventor
魏明月
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Goertek Techology Co Ltd
Original Assignee
Goertek Techology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Goertek Techology Co Ltd filed Critical Goertek Techology Co Ltd
Priority to CN201710890224.8A priority Critical patent/CN107483908A/en
Publication of CN107483908A publication Critical patent/CN107483908A/en
Pending legal-status Critical Current

Links

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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N17/00Diagnosis, testing or measuring for television systems or their details
    • H04N17/002Diagnosis, testing or measuring for television systems or their details for television cameras
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/10Cameras or camera modules comprising electronic image sensors; Control thereof for generating image signals from different wavelengths

Abstract

The embodiment of the present invention, which provides a kind of white balance calibration method and electronic equipment, this method, to be included:The colour temperature weight coefficient of multiple light sources is determined according to ambient brightness during shooting image.Piecemeal processing is carried out to image, the actual color ratio of each image block after piecemeal processing is calculated, determines which light source each image block should correspond to according to the reference color ratio of the actual color ratio of image block and each light source.According to each self-corresponding image block quantity of multiple light sources and colour temperature weight coefficient, the respective score of multiple light sources, the higher closer colour temperature with such a light source of colour temperature for meaning that photo environment of score are determined respectively.The color of each pixel in image is calibrated according to the reference color ratio of the light source of highest scoring, to realize the white balance calibration of image.Using the present invention program, light source corresponding during shooting image can be accurately determined according to brightness, is also not in that light source determines mistake, so as to improve picture quality when occurring large area monochrome in the picture.

Description

White balance calibration method and electronic equipment
Technical field
The present invention relates to technical field of image processing, more particularly to a kind of white balance calibration method and electronic equipment.
Background technology
Many people can have found when being taken pictures using photographing device:In photo the color of object can because photo environment difference and Change is produced, will be partially yellow for example, shooting the object come under tungsten light indoors, daylight shaded side out of doors is shot The object come will be partially blue.
Different light sources has different spectral components and distribution, and this is referred to as colour temperature in colorimetry, and colour temperature is color Definition, with K (kelvin) for unit.In real life, whether under fine day, cloudy day, indoor incandescent lamp or fluorescent lamp, Ren Mensuo The white object seen is always white, and this is often based on white balance calibration realization.White balance is sought to different-colour Caused aberration is corrected, so that really white is presented in the object of white.
Based on the white balance calibration method of gray world algorithm because its have the advantages that to calculate simple, calibration effect it is good by Extensive use.But the method also has certain use limitation:When color information is not enriched in the photo of shooting, such as occur big During area monochrome object, such a method can not then carry out white balance calibration exactly, so as to cause the quality of photo to reduce.
The content of the invention
In view of this, the embodiment of the present invention provides a kind of white balance calibration method and electronic equipment, using ambient brightness with And colour temperature weight coefficient corresponding with brightness carries out white balance calibration to photo, to improve photographic quality.
The embodiment of the present invention provides a kind of white balance calibration method, including:
The respective colour temperature weight coefficient of multiple light sources is determined according to ambient brightness during shooting image;
Face is referred to according to the respective actual color ratio of multiple images block in described image and the multiple light source are respective Color ratio value, determines each self-corresponding light source of the multiple image block, and the multiple image block is to carry out piecemeal to described image to obtain Arrive;
According to each self-corresponding image block quantity of the multiple light source and colour temperature weight coefficient, determine that the multiple light source is each From score;
White balance calibration is carried out to described image according to the reference color ratio of the light source of highest scoring.
Alternatively, the ambient brightness according to during shooting image determines the respective colour temperature weight coefficient of multiple light sources, bag Include:
According to appearance possibility of the respective colour temperature of the multiple light source under the ambient brightness, the multiple light is determined The respective colour temperature weight coefficient in source.
Alternatively, the appearance possibility according to the respective colour temperature of the multiple light source under the ambient brightness, really The fixed the multiple respective colour temperature weight coefficient of light source, including:
It is determined that the colour temperature for being not under the ambient brightness;
It is determined that the colour temperature weight coefficient of the light source corresponding to the colour temperature for being not in is 0, the color of remaining light sources is determined Warm weight coefficient is the preset value more than 0.
Alternatively, it is described each according to the respective actual color ratio of multiple images block in described image and the multiple light source From reference color ratio, before determining each self-corresponding light source of the multiple image block, in addition to:
The respective reference color ratio of the multiple light source is marked in colour temperature coordinate system;
The respective reference color ratio of the multiple light source is fitted, to obtain colour temperature curve.
Alternatively, it is described each according to the respective actual color ratio of multiple images block in described image and the multiple light source From reference color ratio, determine each self-corresponding light source of the multiple image block, including:
For any image block in the multiple image block, the actual color ratio for calculating any image block is distinguished With the distance between the respective reference color ratio of the multiple light source;
It is determined that the light source corresponding to minimum range is light source corresponding to any image block.
Alternatively, the multiple respective reference color ratio of light source of fitting, after obtaining colour temperature curve, is also wrapped Include:
For any point (x, y) on the colour temperature curve, respectively along the change in coordinate axis direction of the colour temperature coordinate system, it is determined that The coordinate points that distance apart from any point (x, y) is preset value w:(x-w, y), (x+w, y), (x, y-w) and (x, y+w);
It is determined that pass through 4 straight lines of the coordinate points, X=x-w, X=x+w, Y=y-w, Y=y+w, with by described 4 respectively Bar straight line surrounds colour temperature band corresponding to described and any point (x, y);
Colour temperature band obtains color corresponding with the colour temperature curve according to corresponding on the colour temperature curve with any point (x, y) Temperate zone.
Alternatively, the actual color ratio for calculating any image block respectively with the respective ginseng of the multiple light source The distance between color ratio is examined, including:
If the actual color ratio of any image block is located within the colour temperature band, any image block is calculated The actual color ratio distance between the respective reference color ratio of the multiple light source respectively.
Alternatively, it is described each according to the respective actual color ratio of multiple images block in described image and the multiple light source From reference color ratio, before determining each self-corresponding light source of the multiple image block, in addition to:
Any image block being directed to respectively in the multiple image block, calculates each pixel in any image block The first ratio and the second ratio of the 3rd color value and the second color value of first color value and the second color value;
The actual color ratio for determining any image block is:First ratio of whole pixels in any image block The average value of second ratio of whole pixels in the average value of value, and any image block.
Alternatively, it is described each according to the respective actual color ratio of multiple images block in described image and the multiple light source From reference color ratio, before determining each self-corresponding light source of the multiple image block, in addition to:
Any light source being directed to respectively in the multiple light source, obtains the grey card graphic clapped under any light source;
Choose the reference zone of the default size of the gray card picture centre;
Calculate the first color value of whole pixels in the reference zone and, the second color value and and the 3rd face The sum of colour;
The reference color ratio for determining any light source is:It is first color value and with second color value 3rd ratio of sum, and the 3rd color value and it is with second color value and the 4th ratio.
The embodiment of the present invention provides a kind of electronic equipment, including:Memory, and the processing being connected with the memory Device;
The memory, for storing one or more computer instruction, wherein, one or more computer instruction Call and perform for the processor;
The processor, for performing one or more computer instruction with appointing in above-mentioned white balance calibration method Anticipate a kind of method.
White balance calibration method provided in an embodiment of the present invention and electronic equipment, photographing device is according to ring during shooting image Border brightness determines the colour temperature weight coefficient of the multiple light sources pre-set corresponding with this ambient brightness.Image to photographing again Piecemeal processing is carried out to obtain multiple images block, the actual color ratio of each image block is calculated, according to the actual face of image block The reference color ratio of color ratio value and each light source determines which light source each image block should correspond to.Respectively statistics with The number of image block corresponding to each light source, for a light source, can according to this light source correspondence image block number with And colour temperature weight coefficient determines the score of this light source corresponding to the light source under the ambient brightness of shooting image.Repeat above-mentioned " calculating score " process can respectively obtain score corresponding to each light source.And the higher colour temperature for meaning that photo environment of score The closer colour temperature with such a light source.Finally, can be calibrated according to the reference color ratio of the light source of highest scoring in image The color of each pixel, to realize the white balance calibration of image.It can be seen that the present invention is according to ambient brightness during shooting image Light source corresponding with shooting environmental is determined, recycles the reference color value of this light source to carry out white balance calibration.Go out in the picture During existing large area monochrome, light source corresponding during shooting image also can be accurately determined according to brightness, and then carry out white balance Calibration, is not in determine the light source to make mistake because color of image is single, so as to cause the situation of white balance calibration mistake, carries High image quality.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing There is the required accompanying drawing used in technology description to be briefly described, it should be apparent that, drawings in the following description are this hairs Some bright embodiments, for those of ordinary skill in the art, on the premise of not paying creative work, can be with root Other accompanying drawings are obtained according to these accompanying drawings.
Fig. 1 is the flow chart of white balance calibration embodiment of the method one provided in an embodiment of the present invention;
Fig. 2 is the flow chart of white balance calibration embodiment of the method two provided in an embodiment of the present invention;
Fig. 3 is the flow chart of white balance calibration embodiment of the method three provided in an embodiment of the present invention;
Fig. 4 is the structural representation of electronic equipment embodiment one provided in an embodiment of the present invention.
Embodiment
To make the purpose, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention In accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is Part of the embodiment of the present invention, rather than whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art The every other embodiment obtained under the premise of creative work is not made, belongs to the scope of protection of the invention.
The term used in embodiments of the present invention is only merely for the purpose of description specific embodiment, and is not intended to be limiting The present invention." one kind ", " described " and "the" of singulative used in the embodiment of the present invention and appended claims It is also intended to including most forms, unless context clearly shows that other implications, " a variety of " generally comprise at least two, but not Exclusion includes at least one situation.
It should be appreciated that term "and/or" used herein is only a kind of incidence relation for describing affiliated partner, represent There may be three kinds of relations, for example, A and/or B, can be represented:Individualism A, while A and B be present, individualism B these three Situation.In addition, character "/" herein, it is a kind of relation of "or" to typically represent forward-backward correlation object.
It will be appreciated that though XXX may be described using term first, second, third, etc. in embodiments of the present invention, but These XXX should not necessarily be limited by these terms.These terms are only used for XXX being distinguished from each other out.For example, implementation of the present invention is not being departed from In the case of example scope, the first XXX can also be referred to as the 2nd XXX, and similarly, the 2nd XXX can also be referred to as the first XXX.
Depending on linguistic context, word as used in this " if ", " if " can be construed to " ... when " or " when ... " or " in response to determining " or " in response to detection ".Similarly, depending on linguistic context, phrase " if it is determined that " or " such as Fruit detects (condition or event of statement) " can be construed to " when it is determined that when " or " in response to determine " or " when detection (statement Condition or event) when " or " in response to detect (condition or event of statement) ".
It should also be noted that, term " comprising ", "comprising" or its any other variant are intended to nonexcludability Comprising, so that commodity or system including a series of elements not only include those key elements, but also including without clear and definite The other element listed, or also include for this commodity or the intrinsic key element of system.In the feelings not limited more Under condition, the key element that is limited by sentence "including a ...", it is not excluded that in the commodity including the key element or system also Other identical element be present.
Fig. 1 is the flow chart of white balance calibration embodiment of the method one provided in an embodiment of the present invention, what the present embodiment provided The executive agent of the white balance calibration method can be photographing device, as shown in figure 1, this method comprises the following steps:
S101, the respective colour temperature weight coefficient of multiple light sources is determined according to ambient brightness during shooting image.
User shoots an image using photographing device under any environment.Alternatively, it is bright in the presence of one in photographing device Sensor is spent, can be using the brightness value that this luminance sensor detects as ambient brightness during shooting image.Alternatively, may be used also One average computation is done with the brightness value to each pixel in the image photographed, and using obtained average brightness value as bat Take the photograph ambient brightness during image.Specifically, the brightness value of each pixel can be according to each pixel respectively in R, G, B tri- Default transformational relation obtains between color value and color value and brightness value in Color Channel.Further according to each pixel Brightness value obtains an average brightness value, using this average brightness value as ambient brightness during shooting image.
After obtaining ambient brightness, according to the corresponding relation of default ambient brightness and colour temperature weight coefficient, can obtain with One group of colour temperature weight coefficient corresponding to ambient brightness during shooting image.Wherein, every group of colour temperature weight coefficient includes multiple colour temperatures Colour temperature weight coefficient corresponding to scope, colour temperature weight coefficient can be pre-set, alternatively, corresponding to each reference color temperature Colour temperature weight coefficient is different.In addition, each reference color temperature has a corresponding light source corresponding.Each ambient brightness can be with Regard as by multiple light sources mixed exposure and caused.Therefore, every group of colour temperature weight coefficient is it can be understood that in a certain environment Under brightness, the respective colour temperature weight coefficient of various light sources.
For example, multiple reference color temperatures can be 8000K~7000K, 7000K~6000K, 6000K~5000K, 5000K~4000K, 4000K~3500K, 3500K~3000K, 3000K~2500K and it is corresponding with this multiple reference color temperature Light source can be D75, D65, D50, CWF, U35, F, A successively.Above-mentioned light source is all the common light source of daily life, for example, D75 The light that light source is sent is that the light that simulated solar irradiation, D65 light sources are sent is international standard alpine light, cool white in CWF light sources shop Light of Guang Wei hotels lamp that light source, F light sources are sent etc..
S102, according to the respective actual color ratio of multiple images block in image and the respective reference color ratio of multiple light sources Value, determines each self-corresponding light source of multiple images block, and multiple images block carries out piecemeal to image and obtained.
Piecemeal processing is carried out to the image photographed, it is alternatively possible to be divided an image into according to default number default Number image block;Alternatively, multiple images block can also be divided an image into according to default pixel quantity.
Calculate the actual color ratio of each image block.A kind of alternatively calculation, first, is obtained in a certain image block Each first color value, second color value and threeth color value of the pixel in three Color Channels, alternatively, the first face Colour can be the r values under R Color Channels, and the second color value can be the g values under G Color Channels, and the 3rd color value can To be the b values under B color channel.And the actual color ratio of each pixel can be by the first ratio and the second ratio group Into, wherein, the first ratio is the color value of the first color value/second, and the second ratio is the color value of the 3rd color value/second.Then, It is alternatively possible to the first ratio and the second ratio of each pixel in same image block are obtained, respectively by each The median of the median of one ratio and each second ratio is defined as the actual color ratio of this image block.To each image block Above-mentioned calculating is all carried out, to obtain the actual color ratio of each image block.
By the actual color ratio of each image block respectively compared with the reference color ratio of each light source, so as to really The light source corresponding to each image block is made, that is to say and determine that each image block and which light source have same or like color Temperature.Similar to actual color ratio, the reference color ratio for each light source that described above is related to can be by each light source The 3rd ratio and the 4th ratio composition, and the 3rd ratio is the color value of the first color value/second, and the 4th ratio is the 3rd face The color value of colour/second.And the specific acquisition modes of the reference color ratio of each light source may be referred in following embodiments three Related content.
S103, according to each self-corresponding image block quantity of multiple light sources and colour temperature weight coefficient, determine multiple light sources each Score.
Statistics and the quantity of each self-corresponding image block of multiple light sources.Obtain it is corresponding with ambient brightness during shooting image The respective colour temperature weight coefficient of multiple light sources after, for a certain light source, by the colour temperature weight coefficient of this light source with it is corresponding It is multiplied in the image block number of this light source, so as to obtain the score of this light source.Said process is repeated to obtain obtaining for each light source Point.Score is more high, shows the closer colour temperature with this light source of colour temperature of environment during shooting image.
S104, white balance calibration is carried out to image according to the reference color ratio of the light source of highest scoring.
Light source corresponding to top score is determined, alternatively, using the reciprocal as white flat of the reference color ratio of this light source Weigh the gain parameter calibrated, and carries out white balance calibration to each pixel in image according to this gain parameter.Specifically, it is first First, white balance calibration can be carried out to any pixel point in image in the following ways:Any pixel o'clock is obtained in three face The first color value, the second color value and the 3rd color value under chrominance channel, by the in the first color value and reference color value The reciprocal multiplication of three ratios, with the first color value after being calibrated;By the 4th ratio in the 3rd color value and reference color ratio The reciprocal multiplication of value, with the 3rd color value after being calibrated.
The color value of each pixel in image is calibrated as procedure described above, so as to complete the white of whole image Balance calibration, and the image photographed is shown according to the color value after calibration.The image now shown is can to reflect thing Body obtains true colors.
In the present embodiment, photographing device determines corresponding with this ambient brightness advance according to ambient brightness during shooting image The colour temperature weight coefficient of the multiple light sources of setting.Piecemeal processing is carried out to obtain multiple images block to the image photographed again, counted The actual color ratio of each image block is calculated, according to the actual color ratio of image block and the reference color ratio of each light source Determine which light source each image block should correspond to.The number of image block corresponding with each light source is counted respectively, for For one light source, can according to this light source correspondence image block number and the light source pair under the ambient brightness of shooting image The colour temperature weight coefficient answered determines the score of this light source.Repeating the process of above-mentioned " calculating score " can respectively obtain often Score corresponding to individual light source.And the higher closer colour temperature with such a light source of colour temperature for meaning that photo environment of score.Finally, may be used The color of each pixel in image is calibrated with the reference color ratio of the light source according to highest scoring, to realize the white of image Balance calibration.It can be seen that the present invention is to determine light source corresponding with shooting environmental, then profit according to ambient brightness during shooting image White balance calibration is carried out with the reference color value of this light source, even if when occurring large area monochrome in image, also can be according to bright Degree is accurate to determine light source corresponding during shooting image, and then carries out white balance calibration, is not in because color of image is single And the light source to make mistake is determined, so as to cause the situation of white balance calibration mistake, improve picture quality.
Fig. 2 is the flow chart of white balance calibration embodiment of the method two provided in an embodiment of the present invention, as shown in Fig. 2 the party Method comprises the following steps:
S201, according to appearance possibility of the respective colour temperature of multiple light sources under ambient brightness, determine multiple light sources each Colour temperature weight coefficient.
Photographing device after shooting image, can obtain under a certain ambient brightness according to the associated description in previous embodiment one Take the ambient brightness of image.Then, it is alternatively possible to according to recording the multiple light sources under varying environment brightness in configuration file The possibility and the respective colour temperature weight system of multiple light sources under varying environment brightness whether respective reference color temperature occurs Number, determine under this ambient brightness the respective reference color temperature of multiple light sources occur possibility and under this ambient brightness it is multiple The respective colour temperature weight coefficient of light source.
Alternatively, above-mentioned configuration file can generate in the following manner.
Understood after carrying out analytic statistics to the lot of experimental data being obtained ahead of time:Ambient brightness to a certain extent with colour temperature It is contact be present, this contact can specifically be presented as:Under different ambient brightness, some reference color temperatures have what is occurred Possibility, some reference color temperatures are without the possibility occurred.Therefore, can occur the difference of possibility according to reference color temperature, It is arranged on multiple each self-corresponding colour temperature weight coefficients of reference color temperature under varying environment brightness.Because each reference color temperature is corresponding In a kind of light source, therefore, namely the respective colour temperature weight coefficient of multiple light sources under varying environment brightness is provided in.And colour temperature is weighed The numerical value of weight coefficient can then characterize the possibility whether respective reference color temperature of multiple light sources occurs under varying environment brightness Property.Finally, the possibility that whether is occurred under varying environment brightness of the record respective reference color temperature of multiple light sources and not With the respective colour temperature weight coefficient of multiple light sources under ambient brightness, so as to generate configuration file.
Alternatively, the respective colour temperature weight coefficient of multiple light sources corresponding to any environment brightness can enter in the following ways Row is set.
First, it is determined that the colour temperature for being not under ambient brightness.
And then it is determined that the colour temperature weight coefficient of light source corresponding to the colour temperature for being not in is 0, determine the color of remaining light sources Warm weight coefficient is the preset value more than 0.
Specifically, according to substantial amounts of experimental data, count the reference color temperature that is not under every kind of ambient brightness with And the remaining reference color temperature for being possible to occur.For example, accept in embodiment one the multiple color temperatures scope that provides and with it is more Various light sources corresponding to kind reference color temperature, in the case where ambient brightness is higher, the reference color temperature for being typically not in is 3000K ~2500K, at this point it is possible to the colour temperature weight coefficient of this reference color temperature is arranged into 0, that is to say by this reference color temperature 3000K~ The colour temperature weight coefficient of light source A corresponding to 2500K is arranged to 0.Meanwhile by remaining reference color temperature 8000K~7000K, 7000K The color of each self-corresponding light sources of~6000K, 6000K~5000K, 5000K~4000K, 4000K~3500K, 3500K~3000K Warm weight coefficient is arranged to any preset value more than 0.
And for the colour temperature weight coefficient of each self-corresponding light source of remaining reference color temperature, a kind of alternatively mode, it can incite somebody to action The colour temperature weight coefficient of remaining each self-corresponding light source of reference color temperature is both configured to an identical preset value.Another kind is alternatively Mode, the colour temperature weight coefficient that can also be possible to each self-corresponding light source of reference color temperature to residue according to following principle are set Put:The colour temperature weight coefficient that will appear from light source corresponding to the higher reference color temperature of possibility is arranged to a larger value, such as 6 Or 7, the colour temperature weight coefficient that will appear from light source corresponding to the relatively low reference color temperature of possibility is arranged to a less value, such as 1 or 2.And the height of the possibility of every kind of reference color temperature for being possible to occur can also equally count according to lot of experimental data Arrive.
S202, respectively for any image block in multiple images block, calculate the of each pixel in any image block The first ratio and the second ratio of the 3rd color value and the second color value of one color value and the second color value.
S203, the actual color ratio for determining any image block are:First ratio of whole pixels in any image block Average value, and in any image block the second ratio of whole pixels average value.
Piecemeal processing is carried out to the image photographed, the concrete mode of piecemeal processing may be referred to the correlation in embodiment one Description, will not be repeated here.Identical with associated description in the step S102 of embodiment one, each pixel has the first face in image Colour, the second color value and the 3rd color value, the first ratio and the second ratio of each pixel are calculated respectively, its In, the first ratio is the color value of the first color value/second, and the second ratio is the color value of the 3rd color value/second.
Then, the first ratio of each pixel in same image block is carried out seeking median calculation, to obtain The average value of one ratio;Similarly, the second ratio is carried out seeking median calculation, to obtain the average value of the second ratio.By corresponding The actual color ratio of this image block is formed in the average value of the first ratio of same image block and the average value of the second ratio. Can be to determine the actual color ratio of any image block according to said process.
S204, for any image block in multiple images block, calculate the actual color ratio of any image block respectively with Distance between the respective reference color ratio of multiple light sources.
S205, it is determined that the light source corresponding to minimum range is light source corresponding to any image block.
It is alternatively possible to actual color ratio and reference color ratio are labeled in a colour temperature coordinate system, this color The abscissa of warm coordinate system is the color value of the first color value/second, and ordinate is the color value of the 3rd color value/second.Therefore, often The respective reference color ratio of actual color ratio and multiple light sources of individual image block may be expressed as one in coordinate system Individual coordinate points.
Then, actual color ratio and the respective reference of multiple light sources of any image block are calculated respectively using range formula Distance between color ratio.A light source corresponding to minimum range is determined according to multiple distance values, and this light source is determined For light source corresponding to this any image block, it is same or like to that is to say that this any image block of expression has with the light source determined Colour temperature.
S206, according to each self-corresponding image block quantity of multiple light sources and colour temperature weight coefficient, determine multiple light sources each Score.
S207, white balance calibration is carried out to image according to the reference color ratio of the light source of highest scoring.
Above-mentioned steps S206-S207 implementation procedure is similar to the corresponding steps of previous embodiment, may refer to such as Fig. 1 institutes Show the associated description in embodiment, or else repeat herein.
It should be noted that taking pictures in reality, due to the influences of many reasons such as ambient noise or capture apparatus, Some abnormal image blocks are likely that there are in the image that can to photograph.If these abnormal image blocks not filtered out, Then probably influence whether the accuracy of final image white balance calibration.Therefore, in order to further improve white balance calibration Accuracy, alternatively, before step S202 is performed, the white balance calibration method can perform following steps:
Judge that the actual color ratio of any image block whether within colour temperature band, if within colour temperature band, is held Row above-mentioned steps S204.
When image block is not in colour temperature band, then it is abnormal image block to show this image block, is directly ignored.When image block position In in colour temperature band, then showing that this image block is normal picture block, further subsequently calculated.Pass through above-mentioned deterministic process To filter out the abnormal image block in image, so as to improve the accuracy of white balance calibration.Wherein, colour temperature band is according to colour temperature curve What extension obtained, the forming process of colour temperature curve and colour temperature band may be referred to the related content in following embodiments three.
In the present embodiment, after the ambient brightness when obtaining shooting image, it can know not homochromy under this ambient brightness Colour temperature weight parameter corresponding to the possibility and different-colour scope that warm scope occurs, and colour temperature weight coefficient is according to colour temperature What the possibility that scope occurs was configured, and colour temperature weight coefficient corresponding to the reference color temperature that would be impossible to occur is arranged to 0.Because each reference color temperature corresponds to a kind of light source, therefore it that is to say light source corresponding to the reference color temperature that would be impossible to occur Colour temperature weight coefficient is arranged to 0, so when it is determined that carrying out white balance calibration with the reference color ratio of which kind of light source, can keep away Exempt from the interference for the light source that colour temperature weight coefficient is 0, so as to carry out white balance calibration to image exactly, improve image matter Amount.In addition, before it is determined which light source image block in image correspond to, can also one be carried out to image block and filter out processing, So as to filter out abnormal image block, to ensure that the image block for being used to calculate light source score is all normal, obtained so as to improve light source Divide the accuracy calculated, also just correspondingly improve the accuracy of white balance calibration.
It can be seen from the associated description of above-described embodiment, during white balance calibration is carried out, except multiple light sources are each From colour temperature weight coefficient outside, it is also necessary to using the respective reference color ratio of multiple light sources, colour temperature curve and according to colour temperature The colour temperature band that curve obtains.Fig. 3 be white balance calibration embodiment of the method three provided in an embodiment of the present invention flow chart, such as Fig. 3 It is shown, in step " according to the respective actual color ratio of multiple images block in image and the respective reference color ratio of multiple light sources Value, determines each self-corresponding light source of multiple images block " before, this method comprises the following steps:
S301, the respective reference color ratio of multiple light sources is marked in colour temperature coordinate system.
S302, the respective reference color ratio of multiple light sources is fitted, to obtain colour temperature curve.
The respective reference color ratio of multiple light sources is labeled in colour temperature coordinate system so that the reference color of each light source Ratio is referred to as a coordinate points in colour temperature coordinate system.Carried out curve fitting using this multiple coordinate points to form a colour temperature song Line.It is readily appreciated that, the number of light source is more, obtains the accuracy for the colour temperature curve that reference color ratio is more, then fits It is higher.And the complexity of light source acquisition is considered in practical application and repeats the reasons such as the number of experiment, alternatively, light source Number can be 8.
S303, for any point (x, y) on colour temperature curve, respectively along the change in coordinate axis direction of colour temperature coordinate system, it is determined that away from Leave one's post a bit (x, y) distance be preset value w coordinate points:(x-w, y), (x+w, y), (x, y-w) and (x, y+w).
S304, it is determined that passing through 4 straight lines of coordinate points, X=x-w, X=x+w, Y=y-w, Y=y+w, with by 4 respectively Straight line surround with any point (x, y) corresponding to colour temperature band.
S305, colour temperature band obtains colour temperature corresponding with colour temperature curve according to corresponding on colour temperature curve with any point (x, y) Band.
For any point (x, y) on colour temperature curve, it may be determined that go out in this coordinate system with this any point (x, y) Vertical range is preset value w 4 coordinate points, i.e., (x-w, y), (x+w, y), (x, y-w) and (x, y+w).According to this 4 coordinates Point can determine 44 straight line X=x-w perpendicular to reference axis, X=x+w, Y=y-w, Y=y+w.Can be straight by this 4 Line forms a rectangular area, and the center of this rectangular area is this any point (x, y).This region formed is then this Some colour temperature band corresponding to (x, y).
The colour temperature band as corresponding to every bit on colour temperature curve collectively constitutes colour temperature band corresponding to whole piece colour temperature curve again.And this Colour temperature band can be understood as an extension to colour temperature curve.
The border of the colour temperature band generated according to the method described above is typically a zigzag, and in actual applications, alternatively, The border of colour temperature band can also be smoothed, to obtain the colour temperature band of an edge smoothing.Specifically, line can be used Property smoothing algorithm, such as gaussian filtering method, or nonlinear smoothing algorithm, such as median filtering method.
Alternatively, the respective reference color ratio of multiple light sources being related in step S301 can be counted in the following manner Obtain.
First, respectively for any light source in multiple light sources, obtain the grey card graphic clapped under any light source.
Second, choose the reference zone of the default size of gray card picture centre.
3rd, calculate reference zone in whole pixels the first color value and, the second color value and the and the 3rd The sum of color value.
4th, the reference color ratio for determining any light source is:It is first color value and with the second color value and Three ratios, and the 3rd color value and it is with the second color value and the 4th ratio.
Specifically, put together gray card is overlapping with jobbie, then an optional light source from multiple light sources, and A grey card graphic is clapped to obtain using photographing device under this light source, contains gray card and object simultaneously in this grey card graphic.From what is clapped A reference zone of the default size centered on grey card graphic is selected in grey card graphic, subsequent optical is carried out using this region The determination of source reference color ratio.Alternatively, the area in grey card graphic shared by gray card can be more than or equal to 50%, and in reality In the application of border, it is alternatively possible to which the reference zone of default size to be arranged to a quarter region of gray card picture centre.
It is calculated according to the first color value of all pixels point, the second color value and the 3rd color value in reference zone In this reference zone the first color value of all pixels point and, the second color value and and the 3rd color value sum.By first Color value and the/the second color value and be used as the 3rd ratio, using the 3rd color value and the/the second color value and as the 4th Ratio, the reference color ratio of such a light source is finally made up of the 3rd ratio and the 4th ratio.The weight under different light sources respectively Aforesaid operations are carried out again can obtain the respective reference color ratio of various light sources.
In the present embodiment, a grey card graphic corresponding to every kind of light source is shot, according to the reference zone positioned at grey card graphic The color value of interior pixel calculates the reference color ratio of every kind of light source.This reference color ratio is labeled in colour temperature coordinate In system, to obtain colour temperature curve.And then an extension process is carried out to any point on this colour temperature curve, and most color temperature at last Curve extension is a colour temperature band.This colour temperature band can be realized during white balance calibration is carried out to image filters out Abnormal Map As the effect of block, so as to accurately determine the parameter for white balance calibration, so as to carry out carrying out accurate school to image Standard, improve picture quality.
Fig. 4 is the structural representation of electronic equipment embodiment one provided in an embodiment of the present invention, as shown in figure 4, the electronics Equipment includes:Memory 11, and the processor 12 being connected with memory, memory 11 are above-mentioned for storing electronic equipment execution The program of the white balance calibration method provided in any embodiment, processor 12 are configurable for performing and stored in memory 11 Program.
Program includes one or more computer instruction, wherein, one or more computer instruction is performed by processor 12 When can realize following steps:
The respective colour temperature weight coefficient of multiple light sources is determined according to ambient brightness during shooting image;
According to the respective actual color ratio of multiple images block in image and the respective reference color ratio of multiple light sources, really Determine each self-corresponding light source of multiple images block, multiple images block carries out piecemeal to image and divides to obtain;
According to each self-corresponding image block quantity of multiple light sources and colour temperature weight coefficient, determine that multiple light sources are respective and obtain Point;
Blank level adjustment is carried out to image according to the reference color ratio of the light source of highest scoring.
Alternatively, processor 12 is additionally operable to perform all or part of step in aforementioned approaches method step.
Wherein, communication interface 13 can also be included in the structure of electronic equipment, for electronic equipment and other equipment or logical Communication network communicates.
Device embodiment described above is only schematical, wherein the unit illustrated as separating component can To be or may not be physically separate, it can be as the part that unit is shown or may not be physics list Member, you can with positioned at a place, or can also be distributed on multiple NEs.It can be selected according to the actual needs In some or all of module realize the purpose of this embodiment scheme.Those of ordinary skill in the art are not paying creativeness Work in the case of, you can to understand and implement.
Through the above description of the embodiments, those skilled in the art can be understood that each embodiment can Realized by the mode of general hardware platform necessary to add, naturally it is also possible to come real by way of hardware and software combination It is existing.Based on such understanding, the part that above-mentioned technical proposal substantially contributes to prior art in other words can be with product Form embody, the computer product can store in a computer-readable storage medium, such as ROM/RAM, magnetic disc, CD Deng, including some instructions are causing a computer installation (can be personal computer, server, or network equipment etc.) Perform the method described in some parts of each embodiment or embodiment.
Finally it should be noted that:The above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although The present invention is described in detail with reference to the foregoing embodiments, it will be understood by those within the art that:It still may be used To be modified to the technical scheme described in foregoing embodiments, or equivalent substitution is carried out to which part technical characteristic; And these modification or replace, do not make appropriate technical solution essence depart from various embodiments of the present invention technical scheme spirit and Scope.

Claims (10)

  1. A kind of 1. white balance calibration method, it is characterised in that including:
    The respective colour temperature weight coefficient of multiple light sources is determined according to ambient brightness during shooting image;
    According to the respective actual color ratio of multiple images block in described image and the respective reference color ratio of the multiple light source Value, determines each self-corresponding light source of the multiple image block, and the multiple image block carries out piecemeal to described image and obtained;
    According to each self-corresponding image block quantity of the multiple light source and colour temperature weight coefficient, determine that the multiple light source is respective Score;
    White balance calibration is carried out to described image according to the reference color ratio of the light source of highest scoring.
  2. 2. according to the method for claim 1, it is characterised in that the ambient brightness according to during shooting image determines multiple The respective colour temperature weight coefficient of light source, including:
    According to appearance possibility of the respective colour temperature of the multiple light source under the ambient brightness, determine that the multiple light source is each From colour temperature weight coefficient.
  3. 3. according to the method for claim 2, it is characterised in that it is described according to the respective colour temperature of the multiple light source described Appearance possibility under ambient brightness, the respective colour temperature weight coefficient of the multiple light source is determined, including:
    It is determined that the colour temperature for being not under the ambient brightness;
    It is determined that the colour temperature weight coefficient of the light source corresponding to the colour temperature for being not in is 0, the colour temperature power of remaining light sources is determined Weight coefficient is the preset value more than 0.
  4. 4. according to the method in any one of claims 1 to 3, it is characterised in that described according to multiple figures in described image As the respective actual color ratio of block and the respective reference color ratio of the multiple light source, the multiple image block is determined each Before corresponding light source, in addition to:
    The respective reference color ratio of the multiple light source is marked in colour temperature coordinate system;
    The respective reference color ratio of the multiple light source is fitted, to obtain colour temperature curve.
  5. 5. according to the method for claim 4, it is characterised in that described according to the respective reality of multiple images block in described image Border color ratio and the respective reference color ratio of the multiple light source, determine each self-corresponding light source of the multiple image block, Including:
    For any image block in the multiple image block, calculate the actual color ratio of any image block respectively with institute State the distance between the respective reference color ratio of multiple light sources;
    It is determined that the light source corresponding to minimum range is light source corresponding to any image block.
  6. 6. according to the method for claim 5, it is characterised in that the multiple respective reference color ratio of light source of fitting Value, after obtaining colour temperature curve, in addition to:
    For any point (x, y) on the colour temperature curve, respectively along the change in coordinate axis direction of the colour temperature coordinate system, it is determined that distance The distance of any point (x, y) is preset value w coordinate points:(x-w, y), (x+w, y), (x, y-w) and (x, y+w);
    It is determined that pass through 4 straight lines of the coordinate points, X=x-w, X=x+w, Y=y-w, Y=y+w, with straight by described 4 respectively Line surrounds colour temperature band corresponding to described and any point (x, y);
    Colour temperature band obtains colour temperature corresponding with the colour temperature curve according to corresponding on the colour temperature curve with any point (x, y) Band.
  7. 7. according to the method for claim 6, it is characterised in that the actual color ratio for calculating any image block Distance between the respective reference color ratio of the multiple light source respectively, including:
    If the actual color ratio of any image block is located within the colour temperature band, the reality of any image block is calculated The border color ratio distance between the respective reference color ratio of the multiple light source respectively.
  8. 8. according to the method for claim 4, it is characterised in that described according to the respective reality of multiple images block in described image Border color ratio and the respective reference color ratio of the multiple light source, determine each self-corresponding light source of the multiple image block it Before, in addition to:
    Any image block being directed to respectively in the multiple image block, calculates first of each pixel in any image block The first ratio and the second ratio of the 3rd color value and the second color value of color value and the second color value;
    The actual color ratio for determining any image block is:First ratio of whole pixels in any image block The average value of second ratio of whole pixels in average value, and any image block.
  9. 9. according to the method for claim 4, it is characterised in that described according to the respective reality of multiple images block in described image Border color ratio and the respective reference color ratio of the multiple light source, determine each self-corresponding light source of the multiple image block it Before, in addition to:
    Any light source being directed to respectively in the multiple light source, obtains the grey card graphic clapped under any light source;
    Choose the reference zone of the default size of the gray card picture centre;
    Calculate the first color value of whole pixels in the reference zone and, the second color value and and the 3rd color value Sum;
    The reference color ratio for determining any light source is:It is first color value and with second color value and 3rd ratio, and the 3rd color value and it is with second color value and the 4th ratio.
  10. 10. a kind of electronic equipment, it is characterised in that including:Memory, and the processor being connected with the memory;
    The memory, for storing one or more computer instruction, wherein, one or more computer instruction supplies institute State processor and call execution;
    The processor, for performing one or more computer instruction to realize any one of claim 1-9 Method.
CN201710890224.8A 2017-09-27 2017-09-27 White balance calibration method and electronic equipment Pending CN107483908A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710890224.8A CN107483908A (en) 2017-09-27 2017-09-27 White balance calibration method and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710890224.8A CN107483908A (en) 2017-09-27 2017-09-27 White balance calibration method and electronic equipment

Publications (1)

Publication Number Publication Date
CN107483908A true CN107483908A (en) 2017-12-15

Family

ID=60585968

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710890224.8A Pending CN107483908A (en) 2017-09-27 2017-09-27 White balance calibration method and electronic equipment

Country Status (1)

Country Link
CN (1) CN107483908A (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107959851A (en) * 2017-12-25 2018-04-24 广东欧珀移动通信有限公司 Colour temperature detection method and device, computer-readable recording medium and computer equipment
CN108063934A (en) * 2017-12-25 2018-05-22 广东欧珀移动通信有限公司 Image processing method and device, computer readable storage medium and computer equipment
CN108200421A (en) * 2017-12-28 2018-06-22 努比亚技术有限公司 A kind of white balancing treatment method, terminal and computer readable storage medium
CN108280857A (en) * 2017-12-28 2018-07-13 努比亚技术有限公司 Camera method for parameter configuration, mobile terminal and computer readable storage medium
WO2020142871A1 (en) * 2019-01-07 2020-07-16 华为技术有限公司 White balance processing method and device for image
CN112903758A (en) * 2021-01-21 2021-06-04 电子科技大学 Intelligent temperature and humidity self-calibration method for overlapped blocks of gas sensor
CN113411555A (en) * 2021-06-08 2021-09-17 珠海市杰理科技股份有限公司 White balance processing method and device, storage medium and image capturing device
CN113452980A (en) * 2020-03-24 2021-09-28 Oppo广东移动通信有限公司 Image processing method, terminal and storage medium
CN113766203A (en) * 2020-06-03 2021-12-07 杭州海康威视数字技术股份有限公司 Image white balance processing method
CN114143447A (en) * 2021-11-08 2022-03-04 维沃移动通信有限公司 Image processing method and device and electronic equipment
CN114500969A (en) * 2022-01-17 2022-05-13 Oppo广东移动通信有限公司 Image processing method, image processing device, storage medium and terminal
CN114710654A (en) * 2022-04-24 2022-07-05 安谋科技(中国)有限公司 Image processing method, image processing device, readable storage medium and electronic equipment
WO2023024286A1 (en) * 2021-08-23 2023-03-02 深圳创维-Rgb电子有限公司 White balance control method and apparatus, and terminal device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101079954A (en) * 2007-06-26 2007-11-28 北京中星微电子有限公司 Method and device for realizing white balance correction
CN101897192A (en) * 2007-12-11 2010-11-24 奥林巴斯株式会社 White balance adjustment device and white balance adjustment method
CN102957918A (en) * 2011-08-31 2013-03-06 联咏科技股份有限公司 White balance method for displayed image
US20130278793A1 (en) * 2012-04-24 2013-10-24 Canon Kabushiki Kaisha Image processing apparatus, image processing method, and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101079954A (en) * 2007-06-26 2007-11-28 北京中星微电子有限公司 Method and device for realizing white balance correction
CN101897192A (en) * 2007-12-11 2010-11-24 奥林巴斯株式会社 White balance adjustment device and white balance adjustment method
CN102957918A (en) * 2011-08-31 2013-03-06 联咏科技股份有限公司 White balance method for displayed image
US20130278793A1 (en) * 2012-04-24 2013-10-24 Canon Kabushiki Kaisha Image processing apparatus, image processing method, and storage medium

Cited By (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108063934A (en) * 2017-12-25 2018-05-22 广东欧珀移动通信有限公司 Image processing method and device, computer readable storage medium and computer equipment
CN107959851B (en) * 2017-12-25 2019-07-19 Oppo广东移动通信有限公司 Colour temperature detection method and device, computer readable storage medium and computer equipment
CN107959851A (en) * 2017-12-25 2018-04-24 广东欧珀移动通信有限公司 Colour temperature detection method and device, computer-readable recording medium and computer equipment
CN108200421B (en) * 2017-12-28 2020-07-17 珠海大横琴科技发展有限公司 White balance processing method, terminal and computer readable storage medium
CN108200421A (en) * 2017-12-28 2018-06-22 努比亚技术有限公司 A kind of white balancing treatment method, terminal and computer readable storage medium
CN108280857A (en) * 2017-12-28 2018-07-13 努比亚技术有限公司 Camera method for parameter configuration, mobile terminal and computer readable storage medium
CN111670575B (en) * 2019-01-07 2021-09-21 华为技术有限公司 White balance processing method and device for image
CN111670575A (en) * 2019-01-07 2020-09-15 华为技术有限公司 White balance processing method and device for image
WO2020142871A1 (en) * 2019-01-07 2020-07-16 华为技术有限公司 White balance processing method and device for image
CN113452980A (en) * 2020-03-24 2021-09-28 Oppo广东移动通信有限公司 Image processing method, terminal and storage medium
CN113452980B (en) * 2020-03-24 2023-03-14 Oppo广东移动通信有限公司 Image processing method, terminal and storage medium
CN113766203A (en) * 2020-06-03 2021-12-07 杭州海康威视数字技术股份有限公司 Image white balance processing method
CN112903758B (en) * 2021-01-21 2021-09-28 电子科技大学 Intelligent temperature and humidity self-calibration method for overlapped blocks of gas sensor
CN112903758A (en) * 2021-01-21 2021-06-04 电子科技大学 Intelligent temperature and humidity self-calibration method for overlapped blocks of gas sensor
CN113411555A (en) * 2021-06-08 2021-09-17 珠海市杰理科技股份有限公司 White balance processing method and device, storage medium and image capturing device
CN113411555B (en) * 2021-06-08 2022-07-22 珠海市杰理科技股份有限公司 White balance processing method and device, storage medium and image capturing equipment
WO2023024286A1 (en) * 2021-08-23 2023-03-02 深圳创维-Rgb电子有限公司 White balance control method and apparatus, and terminal device and storage medium
CN114143447A (en) * 2021-11-08 2022-03-04 维沃移动通信有限公司 Image processing method and device and electronic equipment
CN114143447B (en) * 2021-11-08 2024-03-05 维沃移动通信有限公司 Image processing method and device and electronic equipment
CN114500969A (en) * 2022-01-17 2022-05-13 Oppo广东移动通信有限公司 Image processing method, image processing device, storage medium and terminal
CN114710654A (en) * 2022-04-24 2022-07-05 安谋科技(中国)有限公司 Image processing method, image processing device, readable storage medium and electronic equipment
CN114710654B (en) * 2022-04-24 2024-01-23 安谋科技(中国)有限公司 Image processing method, device, readable storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
CN107483908A (en) White balance calibration method and electronic equipment
CN105430367B (en) A kind of method and apparatus of AWB
CN105578166B (en) A kind of colour temperature determines method and device
US9875724B2 (en) Method and electronic device for adjusting display
DE102019106252A1 (en) Method and system for light source estimation for image processing
CN105959662B (en) Self-adapted white balance method of adjustment and device
CN106251286B (en) Image processing method, device and equipment
CN102867295B (en) A kind of color correction method for color image
US9307213B2 (en) Robust selection and weighting for gray patch automatic white balancing
CN109729332A (en) A kind of automatic white balance antidote and system
CN112399163B (en) Image sensing device and automatic white balance method
CN108551576A (en) A kind of white balance method and device
CN107872663A (en) Image processing method and device, computer-readable recording medium and computer equipment
CN105828058A (en) Adjustment method and device of white balance
CN108063926A (en) Image processing method and device, computer readable storage medium and computer equipment
CN107231549A (en) AWB detecting system
CN112788322B (en) Adaptive white balance processing method, device, medium, and electronic apparatus
CN109949250B (en) Image processing method and device
CN101088297A (en) Automatic white balance control
CN107194901A (en) Image processing method, device, computer equipment and computer-readable recording medium
CN109587466A (en) The method and apparatus of colored shadow correction
CN108063934A (en) Image processing method and device, computer readable storage medium and computer equipment
US9030575B2 (en) Transformations and white point constraint solutions for a novel chromaticity space
CN108156434B (en) Image processing method and device, computer readable storage medium and computer equipment
CN107464225A (en) Image processing method, device, computer-readable recording medium and mobile terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20171215