Summary of the invention
Technical problem to be solved by this invention is exactly the above-mentioned shortcoming at prior art, and a kind of controlled image enchancing method of degree that strengthens is provided.
The present invention solve the technical problem, and the technical scheme of employing is method for image greyscale histogram equalizing treatment; May further comprise the steps:
A. the gray scale with original image is divided into the approximate histogram accumulative total of 16 progressive line shapes;
B. limit the max pixel value L_grade of every grade of gray scale, enhancing degree between controlled stage;
C. set the maximum control coefrficient L_bright that highlights, when strengthening image brightness, control gray scale maximum;
D. set overall enhancing degree coefficient scale, control equalization degree.
Concrete is that described max pixel value L_grade is: 1/4 sum of all pixels.
Further be the maximum control coefrficient L_bright=1/4 of described enhancing gray scale, gray scale maximum L=1+ (256-1) * L_right after the figure image intensifying; Wherein 1 is original image gray scale maximum, and L is for strengthening the maximum of back gradation of image.
More particularly, described equalization overall degree control coefrficient scale span is: 0≤scale≤1.
The invention has the beneficial effects as follows, increased the brightness of original image, expanded the picture level of original image, improved the contrast of image, the details and the monochrome information that have well kept original image, and simplified the circuit realization, and improved calculation process speed, be more suitable in the timeliness system, using.
Embodiment
Below in conjunction with drawings and Examples, describe technical scheme of the present invention in detail.
The present invention carries out dynamic, controlled figure image intensifying by the gray-level histogram equalization processing to image.The present invention is divided into 16 grades to the gray scale of original image, adopts counter to carry out the linear approximate enhancing of segmentation respectively.The present invention limits the image equalization degree, has set overall enhancing degree coefficient scale; Enhancing spreading range to image gray levels limits, and the upper limit threshold that image is highlighted is set at: 1+ (256-1) * L_bright; Enhancing degree to the gradation of image inter-stage limits, and the pixel maximum that comprises for every section gray scale is set at 1/4 of 1 frame sum of all pixels; The gray scale of original image has been carried out redistributing of dynamic, controlled gray scale equalization.Experimental results show that, through after the enhancement process of the present invention, increased the brightness of original image, expanded the picture level of original image, improve the contrast of image, well kept the details and the monochrome information of original image, and simplified the circuit realization, improved calculation process speed, be more suitable in the timeliness system, using.
According to traditional algorithm of histogram equalization,, establish P for piece image
r(r) be the original image histogram, P
s(s) be the histogram of equalization, both all are probability-distribution functions, have between them to concern P
s(s) dS=P
r(r) dr.Because of P
s(s) be equalization, can establish P
s(s)=1, thus
dS=p
r(r)dr (1)
The both sides integration gets
For discrete picture, then have
Wherein n is a sum of all pixels in the frame, P
r(R
j) be the probability of j level gray scale, n
jBe the sum of all pixels of j level gray scale in the image, p is the total number of gray scale in the image.
Method for image greyscale histogram equalizing treatment process of the present invention is as follows:
(1) the linear approximate processing of segmentation
16 sections linear approximations realize original image grey level histogram accumulative total, as shown in Figure 1.Wherein, adopt left figure curve, adopt the curve on the right side for bright image for darker image.Represented among Fig. 1 that image has three interpolation points, integral body is divided into the situation of four sections processing, and as can be seen, have three control data F (p1), F (p2) and F (p3) this moment one.Three parameter p 1, p2 and p3 are divided into four sections with image to be handled, and controls the picture contrast in dark space, centre and clear zone respectively.
For the image that minute n section is handled, the image after the conversion is:
(4)
In the present invention, original image is divided into 16 sections processing, can make the original grey level histogram accumulative total function of the more approaching reality of piece wire approximation accumulative total function like this, reduces process errors.
(2) equalization is handled and is strengthened extent control
In order to control the degree of histogram equalization, (4) formula is revised, set control coefrficient scale
Wherein, coefficient scale has represented the equalization degree, and when scale=0, expression does not strengthen image; When scale=1, expression has been carried out maximum equalization processing, picture contrast maximum at this moment to image.In actual applications, can suitably adjust according to the characteristics of original image signal.
(3) strengthen the control of gray scale brightness and intersegmental degree of expansion
For monochrome information and the details that keeps original image, the brightness and the inter-stage degree of expansion that strengthen gray scale are controlled.
L=1+(256-1)×L_bright (6)
Wherein, L is for strengthening the gray scale maximum, and 1 is original image gray scale maximum, and L_bright is the maximum control coefrficient that highlights, can be according to the brightness timely adjustment of original image, and preferred value of the present invention is got L_bright=1/4.
Extent control is specially between booster stage: carry out counting statistics respectively for the image pixel number in 16 sections, when the counting sum surpassed maximum and limits constant (sum of all pixels 1/4), counting added 1; When counting sum obtain sum of all pixels 1/4 the time, counter stops to add up, the output count results is as the distribution total value of this section pixel.Promptly the pixel that surpasses maximum qualification constant is limited, do not count, so just can prevent the serious phenomenon of pixel grayscale extruding effectively.
The max pixel value of L_grade for limiting can be adjusted according to input image information in good time, when expanding gray value greater than particular value L_grade, carries out threshold value and limits, and to avoid the excessive compression losses of gray scale, keeps the details of image.The present invention recommends to get the total pixel of L_grade=1/4.
Fig. 2 shows program circuit of the present invention (functional module), below main process is described:
The picture signal conversion: this functional module is finished the transformation of color picture signal to brightness, colourity and saturation signal, for enhancement algorithms luminance signal is handled.If directly input luminance signal is handled, can save this functional module.
16 periods linear cutting apart of image gray levels: the gray scale that this functional module is finished image is cut apart, and entire image is divided into 16 aspects handles.In realization, replaced the histogram of traditional complexity to add up circuit, improved arithmetic speed, saved resource with 16 gray value comparators.
The maximum setting that highlights: this functional module is finished the highlight setting of the upper limit of image.According to the value of 16 counters, determine the maximum gray scale of original image, determine the maximum value of highlighting then.
Maximum enhancing degree limits between gray scale: this module is finished inter-stage enhancing degree and is limited.Distribute more extreme for grey level histogram, such as dark or special bright especially image, its gray value is distributed in very little zone mostly, equalization will occupy between very big gray area after handling like this, cause other gray scale excessive compression even lose, in order to prevent to strengthen the generation of phenomenon, here enhancing degree between gray scale is limited, distribute interval maximum to carry out the threshold value qualification to strengthening gray scale.
Strengthen that gray scale is redistributed and brightness promotes and revises: this module is finished the lifting with brightness redistributed that strengthens image gray levels.Maximum enhancing degree limits between gray scale, has caused the compression of image gray levels, and the overall brightness of this sampled images will be dark partially, and this module is the correction to gray scale, makes the gray scale of the image after the enhancing expand to 0 and between maximum highlights.
Equalization degree scale coefficient correction: this functional module is finished the equalization extent control.Work as scale=0, expression does not strengthen original image; When scale=1, expression has been carried out maximized histogram equalization to original image, obtains maximum picture contrast.In actual applications, can follow according to the image reinforced effects and select flexibly.
Picture signal output: this module is finished picture signal after the processing to the conversion of color picture signal, finishes the processing of picture signal.
Distribute the difference before and after the comparison process below by grey level histogram:
Fig. 3 is that the grey level histogram of original image distributes, and Fig. 4 distributes for the grey level histogram that strengthens the back image.As can be seen from the figure, the image information concentrated part, distribution mainly concentrates between [0,50] as original image, sees Fig. 3; Strengthen expanding between [0,100] now, see Fig. 4.Histogram distribution is more reasonable, and the expansion of distributed area increased the stereovision of the emphasis part of image greatly, has strengthened the contrast of image, has promoted the brightness of image.