Summary of the invention
The objective of the invention is to overcome deficiency of the prior art, provide a kind of and cut apart and the automatic explosion method of fuzzy logic based on multizone.The automatic exposure way of light measuring method newly that the present invention is integrated, it has exposure and relatively reaches arbitration functions automatically, can compare the image under the different exposures by distinctive automatic exposure module, owing to used different judgement approach, exposure effect is significantly improved, also more approaching with professional photographer's naked eyes judged result.
The present invention is achieved by the following technical solutions, the present invention is cut apart and the automatic explosion method of fuzzy logic based on multizone for a kind of, according to the characteristic distributions of face complexion in color space YCbCr, and Gauss's Mathematical Modeling, the logarithmic code image carries out Region Segmentation, with the 6 big zones of image segmentation one-tenth based on human body, the corresponding relation that distributes according to image exposure situation and its grey level histogram again, carrying out read group total by statistic histogram near the pixel quantity in certain neighborhood of gray value 0 and 255, with its as a result val (i) characterize the exposure evaluation of estimate in each zone, its value is more little, exposure effect is then better, and introduces fuzzy logic system, comprehensively each regional half-tone information, obtain the different weighted value w (i) in each zone, calculate the automatic exposure judged result that the res value obtains whole image at last.
The present invention is directed to the characteristics of digital image based on personal portrait, at first utilize the human body complexion model, in different colours space Y CbCR and HSV, people's face is detected, utilizing Gauss model to detect with people's face is the bianry image of gray scale foundation, wherein people's face is represented with white, background then replaces with black, after this be that image segmentation is carried out on the basis with its position, the human face region that at first finds be nucleus 1., according to the human body proportion factor, 3. width is decided to be the zone for zone 1.5 times lower zone 1., the zone is 2. for comprising the annular region of head peripheral part background more than the chest, the zone 2. the top be the zenith zone 6., 4. the zone reaches the zone and 5. lays respectively at both sides, in this process if fail to detect people's face, then attach most importance to, by a certain percentage, equally image is divided into 6 zones with middle section.
After the relation of research digital image and its grey level histogram, there is direct corresponding correlation in the characteristic distributions of finding pixel in image exposure degree and its grey level histogram, according to this rule, utilization mathematical statistics means are carried out independent statistics to the histogram information of each subregion, specifically are to be weighted synthetic according to its gray scale the pixel count near the histogram marginal portion.
Introduce fuzzy logic at last, at first calculate 6 subregions monochrome information separately of dividing just now, in conjunction with the mathematical statistics result of grey level histogram, use two fuzzy rules to carry out adaptive judgement again, make the exposure value of digital image can be adapted to exposure requirement under the various illumination conditions.
Effect of the present invention: by better analyzing based on the exposure status of Region Segmentation, statistics with histogram and the fuzzy logic system logarithmic code image of complexion model and judging.At first according to the histogram information of picture, by image segmentation and fuzzy logic whether the exposure under the various different light and shade conditions is suitably judged based on the digital image imaging characteristics, all has adaptability preferably for those portraiture photographies comparatively commonly used and the differentiation of the exposure under the complicated light and shade condition like this, can also the image that different exposure bias values under the Same Scene are taken be compared simultaneously, its implementation procedure is also quite simple, only needing user's conversion exposure bias value to carry out once above-mentioned judgement again gets final product, compare through naked eyes evaluation result with experienced photographer, discovery image complicated for those compositions or unusual exposure has improved accuracy and the stability judged greatly, and speed is quick, and is simple to operate.The present invention can be widely used in digital camera, digital imagery field such as Digital Video, medical or industrial probe.
Embodiment
Below in conjunction with accompanying drawing embodiments of the invention are elaborated: present embodiment has provided detailed execution mode and process being to implement under the prerequisite with the technical solution of the present invention, but protection scope of the present invention is not limited to following embodiment.
The facial image that uses among the embodiment comes from the facial image database of taking voluntarily.Its process is as follows:
(1) at the characteristics of digital image based on personal portrait, at first utilize the human body complexion model, in the different colours space, people's face is detected, behind the position that detects people's face, be that image segmentation is carried out on the basis with its position, if fail to detect people's face, then attach most importance to, be divided into 6 zones equally with middle section.
In the invention, step (1) at first is that the logarithmic code image carries out subregion, and it because most of image is still based on portrait, carries out Region Segmentation according to people's face to picture according to being the position of people's face mainly, can obtain best weight proportion.
Because the particularity of human body complexion, though the skin color of different people may differ greatly, therefore they can judge according to complexion model in the difference of the difference on the colourity in the brightness.(Y is a luminance signal to human body complexion, and Cb, Cr are respectively color difference signal B-Y at YCbCr, R-Y) identification is comparatively concentrated and is easy in distribution in the color space, the similar spindle in its overall distribution territory, the different colours of skin have identical 2D Gaussian model G (m, v in this space
2)
m=(Cr,Cb)
Wherein, Cr, Cb are Cr, and the corresponding mean value of Cb, m are its mean value matrix, and V is a covariance matrix.
By complexion model, coloured image is converted to gray-scale map, gray value belongs to the possibility of skin area corresponding to this point, by choosing suitable threshold, gray-scale map further can be converted to binary map, thereby obtain skin area.
And in HSV (tone H, saturation S, brightness V) space, embodied the characteristics that human eye distinguishes between colors, and being suitable for describing and analyzing color region, can replenish the YCbCr space.Therefore the present invention combines these two color spaces and judges people's face position.
Behind definite people's face position, can carry out subregion to picture, the human face region that at first finds be nucleus 1., according to the human body proportion factor, 3. width is decided to be the zone for zone 1.5 times lower zone 1., the zone is 2. for comprising the annular region of head peripheral part background more than the chest, the zone 2. the top be the zenith zone 6., 4. the zone reaches the zone and 5. lays respectively at both sides.
If fail to find human face region, still picture can be divided in proportion similar six zones, the weight that only needs suitably to increase middle section gets final product.
(2) after subregion is finished, the correlation between distributing according to image exposure degree and its grey level histogram is carried out independent statistics to the histogram information of each subregion, specifically is that the pixel count weighting near the histogram marginal portion is synthetic.
Find that when research exposure status of picture and grey level histogram thereof digital image takes place when under-exposure, in the grey level histogram of its correspondence, it is an end of 0 that pixel concentrates on gray value in a large number, and tangible spillover is arranged, and at gray value near an end of 255, then seldom even do not have.During inverse image generation overexposure, then pixel concentrates on the high zone of gray scale in a large number and spillover is arranged, and seldom occurs in the low zone of gray scale.At last, when the image exposure amount was suitable, pixel distribution was comparatively even, and mainly concentrated on the zone near central authorities, and is less at the pixel quantity that occurs near 0 and 255 places.See accompanying drawing 1-A respectively, 1-B, 1-C.The present invention has obtained a kind of determination methods according to this characteristics, by image histogram is added up near the pixel quantity in 0 and 255 places two neighborhoods, and weighted sum,
val(i)=x
1·m(1)+x
2·m(2)+…x
k·m(k)+x
255-k+1m(255-k+1),
+x
255-k+2m(255-k+2)+…x
255m(255)
Its value is more little, and then the exposure of this digital image is just more suitable.X wherein
kGray value is the number of pixels of k in the expression entire image, and m (k) represents that then gray value is the weighted value of the pixel of k, and wherein k is greater than 0, the integer smaller or equal to 255.
After picture carried out subregion, such gray-scale statistical is independently carried out in each zone, obtain 6 zones exposure evaluation of estimate val (1), val (2), val (3) separately ... val (6).
(3) in fuzzy system, use two fuzzy rules to carry out adaptive judgement at last, and obtain final result according to the Luminance Distribution characteristics of each subregion.
This step is a core of the present invention, by fuzzy logic system each regional statistical value is composed power, and weighted sum again obtains final result, camera or imaging device according to this be worth dispose the exposure value of suffering.
Fuzzy logic system wherein is a kind of mathematical concept at first, then more and more is used for the artificial intelligent field of computer now.
The core of fuzzy logic notion and its basis are fuzzy sets, and it is a kind of set that is different from general mathematical concept, for example as in the univeral mathematics notion, only have two conceptions of species between element a and the set A, belong to or do not belong to.But in fuzzy logic, have more subordinate relation between element a and the set A, element a can 50% belongs to set A, and 50% belongs to set B in addition.By fuzzy logic, mathematical logic is clear and definite no longer so, makes computer when carrying out condition judgment, more abundanter selections occur, and this " bluring " property makes computer the trend of manual intelligent occur.
In the present invention, the utilization fuzzy logic system, the average gray that each is regional is divided in several set and goes.And use following logic rules:
A. 1. mean flow rate is 3. close with the zone when the zone, and with the zone when 2. gap is big, and 1. the zone reaches and regionally 3. will be endowed bigger weight.
B. less than normal when the overall average brightness in 6 zones, and the brightness of its brightest area is when bigger than normal, and darker zone will be endowed big weight.
Rule a refers to that in shooting process the most common exposure is backlight unusually, and promptly subject is back to light source, and camera is taken facing to the subject front, and this situation can cause background too bright and exposure that main body is dark partially is unusual usually.Therefore can see, just now the zone of finding by complexion model 1., the i.e. virtual human body that characterized of people's deltoid among the figure, be in backlight following, 1. the zone reaches the zone 3. because light is blocked, and brightness is all relatively low and close, and the zone is 2. because comprised the light ground part, therefore brightness is greater, 1. reaches the zone with the zone and 3. spaces out.This moment bigger as the portrait of picture main body to the overall exposing quality influence, should suitably increase the zone 1. with zone weight 3..
Rule b refers to the sensitization characteristics of human eye, often more notes the loss of dark portion details.Less than normal when the overall average brightness in 6 zones, the overall brightness of picture is also lower, but the brightness of brightest area is bigger than normal, illustrates that then picture contrast is bigger, and this moment, dark portion details seemed more important, was similar to situation backlight, should increase the weight of brightness lower region.
In this fuzzy logic system, at first need to determine the membership function of input, output variable, in membership function, represent the degree of membership of input variable, represent the value of input variable with the x value certain set with the y value.
In fuzzy rule a, input variable X
1=V
2/ V
1, X
2=V
3/ V
1, because of it is symmetrical input variable, so they have identical membership function.V wherein
iRepresent the average gray of regional i.
The codomain of these two input variables is [0,5], marks off 5 fuzzy sets in its codomain, is respectively zd, zx, zh, fx, fd, is used to characterize V
2With V
1, V
3With V
1Between magnitude relationship.
With input variable X
1Be example, wherein, set zd represents V
2Much smaller than V
1The zone, fd marks V
2Much larger than V
1The zone, therefore they are center symmetry mutually with 1, have
In like manner, zx and fx are center symmetry mutually with 1 also, and its membership function expression formula is:
At last, the also relative axle x=1 of the membership function of set zh symmetry itself, its function expression:
After having determined the membership function of input variable, the membership function of output variable Output, its codomain is [2,2], its value is big more, and is high more for the degree that conforms to of regular a, and adjusts each regional weight more in view of the above.
The codomain of Output is divided into 5 fuzzy sets, U1, and U2, U3 (U4), U5, U6, their membership function is respectively:
According to fuzzy rule a, input variable X
1With X
2Fuzzy set and the fuzzy set of output variable output between have a corresponding relation as shown in the table:
In like manner, fuzzy rule b has also comprised two input variables and an output variable, is respectively X
3, X
4And Output2, wherein X
3Be six zones maximums in the average gray separately, X
4Be six zones separately average gray average again, Output2 then is used for characterizing the degree that conforms to of the regular relatively b of digital image actual conditions, its value is big more, and is just high more to the degree that conforms to of regular b, and adjusts each regional weight more in view of the above.
Since the dimension unanimity, input variable X
3With X
4Shared identical membership function, its codomain is [0,255], is divided into 3 fuzzy sets, is respectively x, zh, d, its function expression is as follows:
The codomain of output variable Output2 is [0,2], is divided into 5 fuzzy sets, is respectively V1, V2, and V3, V4, V5, their membership function expression formula is as follows:
According to fuzzy rule b, input variable X
3With X
4Fuzzy set and the fuzzy set of output variable Output2 between have a corresponding relation as shown in the table:
Obtain the value of Output and Output2 by fuzzy logic after, its substitution weight calculation formula is obtained each self-corresponding weighted value of 6 zones, w (1), w (2) ... w (6).
At last, in conjunction with each regional exposure evaluation of estimate val (i) that obtains above and w (i), obtain end product:
The res value is more little, and the exposure effect of image is just good more so.