Background technique
Since color-image forming apparatus is in digital equipment, multimedia, biomedicine and being widely used in internet, cromogram
As processing technique is increasingly valued by people.Due to the factor restriction or condition limitation of various aspects, the colour frequently resulted in
Picture quality may be undesirable, situations such as image is fuzzy, clarity is not high occurs, therefore before subsequent image processing, usually
It needs to carry out enhancing processing to color image, to provide effective characteristic information, or to improve its quality satisfactory to obtain
Visual effect.
Color image is made of gray level image, by the enhancing of gray level image, can achieve color image enhancement
Purpose.Gray level image enhancing main method such as: contrast stretching, clipping, histogram equalization are in many documents and materials
There is detail discussion, but these methods cannot be directly used to color image enhancement, when essentially consisting in enhancing color image
The chromatic value of pixel cannot be changed, and not so, the visual effect of image can change.Color image enhancement technology is far from ash
It is mature to spend image processing techniques.There is very high correlations for the red, green, blue three primary colours of color image, must in enhancing processing
It must keep or restore, otherwise will cause chromatic distortion.
The problem of for keeping color enhancement image, has had a series of algorithm to propose, wherein involve wavelet transformation,
Retinex theory etc., these algorithms preferably enhance image, and color keeps good, but simultaneously as involves small echo
Transformation is paid biggish with operations such as the convolution of multiple Gaussian functions while realizing good treatment effect as cost
Calculation amount and longer operation time, the real-time processing being poorly suitable in real work.
Color constancy refers to the psychological tendency not tended towards stability by external environment variation to object color perception.For
For color image, the color constancy of image is kept, is to guarantee distortionless effective means after image enhancement.Early-stage study hair
It is existing, by being enhanced on year-on-year basis three wave bands of color image, it can satisfy the demand of color constancy, therefore, the present invention mentions
A kind of image definition enhancing method of color constancy is gone out.
Summary of the invention
Present invention seek to address that existing color image is easy to appear the problems such as clarity is inadequate, and enhanced in clarity
The problem of cross-color is easy to appear in journey provides a kind of color image definition enhancing method of color constancy.
The embodiment of the present invention provides a kind of color image definition enhancing method of color constancy, comprising:
Luminance picture is calculated according to three wave bands of RGB of image;
Mean value and standard deviation of the luminance picture on neighborhood are calculated, neighboring mean value image and neighborhood standard difference image are obtained;
According to neighboring mean value image and neighborhood standard difference image, the weight of each pixel is calculated;
Calculate new luminance picture;
Calculate the result images of clarity enhancing.
Luminance picture is calculated according to three wave bands of RGB of image method particularly includes:
I=(R+G+B)/3
Wherein, R, G, B are respectively three wave bands of RGB of image.
Further, the specific steps of neighboring mean value image and neighborhood standard difference image are calculated are as follows:
For each pixel on luminance picture, if the radius of neighbourhood is N, then Size of Neighborhood is (2N+1) * (2N+1), is taken
The value of its neighborhood territory pixel out calculates the mean value and standard deviation of the neighborhood, is assigned to the pixel, respectively obtains and original brightness image
The neighboring mean value image and neighborhood standard difference image of same size;
To improve calculating speed, luminance picture is first carried out M times of down-sampling, down-sampling luminance picture is then based on and calculates neighbour
Domain mean value image and neighborhood standard difference image, then neighboring mean value image and neighborhood standard difference image are subjected to 1/M times of up-sampling,
The methods of nearest neighbor algorithm, bilinear interpolation method, bicubic convolution method can be used in middle M≤1, up-sampling and Downsapling method.
Further, according to neighboring mean value image and neighborhood standard difference image, the specific of the weight of each pixel is calculated
Method are as follows:
Wherein i and j indicates that pixel coordinate, w (i, j) indicate that the weight of pixel (i, j), mean (I) indicate to calculate luminance graph
The mean value of picture, S (i, j) indicate value of the neighborhood standard difference image at pixel (i, j), and S_max and S_min indicate neighborhood standard deviation
The maximum value and minimum value of image.
Further, the method for calculating new luminance picture are as follows:
Wherein Ave (i, j) indicates adjacent to I_new (i, j)=Ave (i, j)+w (i, j) * [I (i, j)-Ave (i, j)] [0024]
Value of the domain mean value image at pixel (i, j), I (i, j) indicate value of the luminance picture at pixel (i, j), and w (i, j) indicates picture
Weight at plain (i, j).
Further, the result images that the calculating clarity enhances method particularly includes:
Wherein R_new, G_new, B_new are three wave bands of the enhanced RGB of clarity.
In above technical scheme, by calculating luminance picture neighboring mean value and neighborhood standard deviation, it can capture every on image
The texture strength feature of a pixel region is adaptively calculated the enhancing weight of each pixel accordingly, can be realized each pixel
Adaptive clarity enhancing;During calculating neighboring mean value and neighborhood standard deviation, to image carry out first down-sampling again on adopt
Sample can be effectively reduced operand while guaranteeing to calculate effect;According to color constancy principle, to each pixel into
Row enhancing on year-on-year basis, so as to be effectively prevented from color distortion, obtains good clarity enhancement effect.
Specific embodiment
In order to which the technical problems, technical solutions and beneficial effects solved by the present invention is more clearly understood, below in conjunction with
Accompanying drawings and embodiments, the present invention will be described in further detail.It should be appreciated that specific embodiment described herein is only used
To explain the present invention, it is not intended to limit the present invention.
The invention mainly comprises following steps:
(1) luminance picture is calculated
The whole bright-dark degree of image has been reacted in the brightness of image, in multicolour space, there is calculating luminance picture
Method, calculated here with simplest mode, take the mean value of three wave bands of color image:
I=(R+G+B)/3
Wherein, R, G, B are respectively three wave bands of RGB of image.
(2) neighboring mean value image and neighborhood standard difference image are calculated
For each pixel on luminance picture, if the radius of neighbourhood is N, then Size of Neighborhood is (2N+1) * (2N+1), is taken
The value of its neighborhood territory pixel out calculates the mean value and standard deviation of the neighborhood, is assigned to the pixel, respectively obtains and original brightness image
The neighboring mean value image and neighborhood standard difference image of same size;
Mean value computation formula are as follows:
Standard deviation calculation formula are as follows:
Wherein i and .j indicates that pixel coordinate, N are the radius of neighbourhood, and Ave is neighboring mean value image, and S is neighborhood standard deviation figure
Picture.
To improve calculating speed, luminance picture is first carried out M times of down-sampling, down-sampling luminance picture is then based on and calculates neighbour
Domain mean value image and neighborhood standard difference image, then neighboring mean value image and neighborhood standard difference image are subjected to 1/M times of up-sampling,
The methods of nearest neighbor algorithm, bilinear interpolation method, bicubic convolution method can be used in middle M≤1, up-sampling and Downsapling method.
(3) weight of each pixel is calculated
The mean value and standard deviation of neighborhood have reacted the Local textural feature of image, can reflect the clarity of image indirectly.
On the basis of neighboring mean value image and neighborhood standard difference image, the weight of each pixel is calculated, for calculating each pixel
The clarity of point enhances degree:
Wherein i and j indicates that pixel coordinate, w (i, j) indicate that the weight of pixel (i, j), mean (I) indicate to calculate luminance graph
The mean value of picture, S (i, j) indicate value of the neighborhood standard difference image at pixel (i, j), and S_max and S_min indicate neighborhood standard deviation
The maximum value and minimum value of image.
(4) new luminance picture is calculated
On the basis of clarity weight, new luminance picture can be calculated by following formula:
I_new (i, j)=Ave (i, j)+w (i, j) * [I (i, j)-Ave (i, j)]
Wherein Ave (i, j) indicates value of the neighboring mean value image at pixel (i, j), and I (i, j) indicates luminance picture in picture
Value at plain (i, j), w (i, j) indicate the weight at pixel (i, j).
By above-mentioned calculating, the available higher brightness image of clarity.
(5) result images of clarity enhancing are calculated
In HSV space, the calculation method of H and S component are as follows:
WhereinX0=min (R, G, B), I=(R+G+B)/
3, if the color vector of certain pixel is X=(R, G, B) before handling, ratio warp parameter is α, translation parameters β, then by flat
It moves and the color vector after ratio stretching are as follows:
X '=(α R+ β, α G+ β, α B+ β)=α X+ β (2)
By X ' substitution (1) formula calculate it is found thatTherefore H '=H.
In addition, calculate S component it is found that
If the translational movement β ≈ 0 on this pixel, S ' ≈ S, the saturation degree of the pixel can be approximately considered also not
Become.In this case, tone and saturation degree all do not change, then the colouring information of image will obtain to greatest extent after handling
Retain.That is, the constant of color can be kept well by being enhanced on year-on-year basis each pixel of color image
Property.
Therefore, it in the present invention, by the ratio of new luminance picture and original brightness image, calculates final clarity and increases
Strong image:
Wherein R_new, G_new, B_new are three wave bands of the enhanced RGB of clarity.
In order to verify the validity of Enhancement Method of the present invention, it is real that the embodiment of the present invention gives multiple groups comparison
It tests, while method of the invention and histogram equalization, multiple dimensioned Retinex color enhancement method (MSRCR) being compared.Fig. 1
For mountain image enhancing as a result, Fig. 2 is the enhancing result of lotus flower image.As can be seen that in Fig. 1, the knot of histogram equalization
Fruit shows apparent color distortion, and the result of MSRCR seems fuzzyyer.In Fig. 2, the contrast of histogram equalization result
It is obvious unbalance, and MSRCR has that color is excessively bright.
In order to objectively evaluate the validity of each method, the present embodiment is evaluated using general image quality index.
The clarity of enhancing image is evaluated using articulation index:
For objectively evaluate each algorithm result images contrast and brightness, using common according to image in existing research
Mean value and local mean variance evaluation method:
Wherein M and N is the length and width of image, and C and L indicate mean value and variance.In order to evaluate color distortion degree, according to
According to These parameters, evaluated using tone below and saturation degree deviation:
Wherein H and S is respectively the tone and saturation degree of image.
According to evaluation index, D is higher, and image definition is higher;C, L, H, S are smaller, and image color reduction degree is higher.
Evaluation result is as shown in the table:
The evaluation result of 1. Fig. 1 of table
The evaluation result of 2. Fig. 2 of table
|
D |
C |
L |
H |
S |
Original image |
1.9715 |
|
|
|
|
Histogram equalization |
3.0622 |
0.4133 |
0.1513 |
0.1374 |
0.9239 |
MSRCR |
1.8842 |
0.3938 |
0.2594 |
0.1351 |
0.4712 |
The method of the present invention |
3.9072 |
0.0161 |
8.2939e-005 |
0.0017 |
0.0077 |
As it can be seen from table 1 although the clarity highest of histogram equalizing method, the index value of C, L, H, S are remote
Greater than method of the invention, as can be seen that the fine definition of histogram equalizing method is to be with color distortion from result images
Cost, and the method for the present invention is except clarity is lower than in addition to histogram equalization method, remaining index it is remote it is excellent with histogram equalization method and
MSRCR.Similarly, in table 2, the method for the present invention in the indexs such as clarity, C, L, H, S it is remote it is excellent with histogram equalization method and
MSRCR.The result of comprehensive Tables 1 and 2, which can be seen that the method for the present invention, has very high clarity, while color distortion degree
It is much smaller than histogram equalization and MSRCR method, shows that the method for the present invention, can be effectively while improving image definition
Avoid color distortion.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all in essence of the invention
Made any modifications, equivalent replacements, and improvements etc., should all be included in the protection scope of the present invention within mind and principle.