Summary of the invention
Present invention seek to address that the problems such as definition is inadequate easily occurs in existing coloured image, and at definition
The problem that cross-color easily occurs during enhancing, it is provided that the coloured image definition of a kind of color constancy increases
Strong method.
Embodiments of the invention provide the coloured image definition enhancing method of a kind of color constancy, including: bag
Include,
Three wave bands of RGB according to image calculate luminance picture;
Calculate luminance picture average on neighborhood and standard deviation, obtain neighboring mean value image and neighborhood standard deviation
Image;
According to neighboring mean value image and neighborhood standard deviation image, calculate the weight of each pixel;
Calculate new luminance picture;
Calculate the result images that definition strengthens.
Three wave bands of RGB according to image calculate luminance picture method particularly includes:
I=(R+G+B)/3
Wherein, R, G, B are respectively three wave bands of RGB of image.
Further, concretely comprising the following steps of neighboring mean value image and neighborhood standard deviation image is calculated:
For each pixel on luminance picture, if the radius of neighbourhood is N, then Size of Neighborhood is (2N+1) *
(2N+1), take out the value of its neighborhood territory pixel, calculate average and the standard deviation of this neighborhood, be assigned to this pixel,
Respectively obtain the neighboring mean value image with original brightness image formed objects and neighborhood standard deviation image;
Calculate speed for improving, first luminance picture is carried out down-sampling M times, be then based on down-sampling luminance graph
As calculating neighboring mean value image and neighborhood standard deviation image, then by neighboring mean value image and neighborhood standard deviation image
Carrying out up-sampling 1/M times, wherein M≤1, up-sampling and Downsapling method can use nearest neighbor algorithm, bilinearity
The methods such as interpolation, bicubic convolution method.
Further, according to neighboring mean value image and neighborhood standard deviation image, the weight of each pixel is calculated
Method particularly includes:
Wherein i and j represents pixel coordinate, and (i j) represents that (mean (I) represents calculating brightness to pixel for i, weights j) to w
The average of image, (i j) represents that (i, j) value at place, S_max and S_min represents neighborhood standard deviation image in pixel to S
The maximum of neighborhood standard deviation image and minima.
Further, the method for the luminance picture that described calculating is new is:
I_new (i, j)=Ave (i, j)+w (i, j) * [I (and i, j)-Ave (i, j)]
Wherein (i j) represents that (i, j) value at place, (i j) represents that luminance picture is in pixel to I to neighboring mean value image in pixel to Ave
(i, j) value at place, (i j) represents pixel (i, j) weight at place to w.
Further, the result images that described calculating definition strengthens method particularly includes:
Wherein R_new, G_new, B_new are three wave bands of the enhanced RGB of definition.
In above technical scheme, by calculating luminance picture neighboring mean value and neighborhood standard deviation, it is possible to catch figure
As the texture strength feature of upper each pixel region, it is adaptively calculated the enhancing weight of each pixel accordingly,
The self adaptation definition being capable of each pixel strengthens;During calculating neighboring mean value and neighborhood standard deviation,
Image carries out first down-sampling up-sample again, it is possible to while ensureing to calculate effect, be effectively reduced computing
Amount;According to color constancy principle, each pixel is strengthened on year-on-year basis such that it is able to be effectively prevented from color
Color distortion, obtains good clarity enhancement effect.
Detailed description of the invention
In order to make technical problem solved by the invention, technical scheme and beneficial effect clearer, with
Lower combination drawings and Examples, are further elaborated to the present invention.Should be appreciated that described herein
Specific embodiment only in order to explain the present invention, be not intended to limit the present invention.
The invention mainly comprises following step:
(1) luminance picture is calculated
The overall bright-dark degree of image has been reacted in the brightness of image, in multicolour space, has calculating bright
The method of degree image, calculates by simplest mode here, takes the average of three wave bands of coloured 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 deviation 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), take out the value of its neighborhood territory pixel, calculate average and the standard deviation of this neighborhood, be assigned to this pixel,
Respectively obtain the neighboring mean value image with original brightness image formed objects and neighborhood standard deviation image;
Mean value computation formula is:
Standard deviation computing formula is:
Wherein i and .j represents pixel coordinate, and N is the radius of neighbourhood, and Ave is neighboring mean value image, and S is neighborhood
Standard deviation image.
Calculate speed for improving, first luminance picture is carried out down-sampling M times, be then based on down-sampling luminance graph
As calculating neighboring mean value image and neighborhood standard deviation image, then by neighboring mean value image and neighborhood standard deviation image
Carrying out up-sampling 1/M times, wherein M≤1, up-sampling and Downsapling method can use nearest neighbor algorithm, two-wire
The property method such as interpolation, bicubic convolution method.
(3) weight of each pixel is calculated
The average of neighborhood and standard deviation have reacted the Local textural feature of image, it is possible to reflection image is clear indirectly
Clear degree.On the basis of neighboring mean value image and neighborhood standard deviation image, calculate the weights of each pixel,
For calculating the definition enhancing degree of each pixel:
Wherein i and j represents pixel coordinate, and (i j) represents that (mean (I) represents calculating brightness to pixel for i, weights j) to w
The average of image, (i j) represents that (i, j) value at place, S_max and S_min represents neighborhood standard deviation image in pixel to S
The maximum of neighborhood standard deviation image and minima.
(4) new luminance picture is calculated
On the basis of definition weights, new luminance picture can be calculated by equation below:
I_new (i, j)=Ave (i, j)+w (i, j) * [I (and i, j)-Ave (i, j)]
Wherein (i j) represents that (i, j) value at place, (i j) represents that luminance picture is in pixel to I to neighboring mean value image in pixel to Ave
(i, j) value at place, (i j) represents pixel (i, j) weight at place to w.
By above-mentioned calculating, definition higher brightness image can be obtained.
(5) result images that definition strengthens is calculated
In HSV space, the computational methods of H and S component are:
WhereinX0=min (R, G, B), I=(R+G+B)/3, if before Chu Liing
The color vector of certain pixel is X=(R, G, B), and ratio warp parameter is α, and translation parameters is β, then pass through
Color vector after translation and ratio stretching is:
X '=(α R+ β, α G+ β, α B+ β)=α X+ β (2)
(1) formula that substituted into by X ' calculates and understands,Therefore H '=H.
Understand it addition, calculate S component,
If the translational movement β ≈ 0 on this pixel, then S ' ≈ S, the saturated of this pixel can be approximately considered
Spend the most constant.In this case, tone and saturation are all not changed in, then the color letter of image after processing
Breath will maximize the retention.It is to say, strengthened on year-on-year basis by pixel each to coloured image,
I.e. can keep the constancy of color well.
Therefore, in the present invention, by new luminance picture and the ratio of original brightness image, calculate final
Definition enhancing image:
Wherein R_new, G_new, B_new are three wave bands of the enhanced RGB of definition.
In order to verify the effectiveness of Enhancement Method of the present invention, it is right that embodiments of the invention give many groups
Than experiment, simultaneously by the method for the present invention and histogram equalization, multiple dimensioned Retinex color enhancement method
(MSRCR) compare.Fig. 1 is the enhancing result of mountain image, and Fig. 2 is the enhancing knot of Flos Nelumbinis image
Really.It can be seen that in FIG, the result of histogram equalization presents obvious color distortion, and MSRCR
Result seem fuzzyyer.In fig. 2, the contrast of histogram equalization result is the most unbalance, and MSRCR
There is the problem that color is the brightest.
For the effectiveness of objective evaluation each method, the present embodiment uses general image quality index to comment
Valency.
Use articulation index evaluate strengthen image definition:
For the contrast of result images and the brightness of each algorithm of objective evaluation, use conventional depending in existing research
Average and the evaluation methodology of local mean variance according to image:
Wherein M and N is the length and width of image, C and L represents average and variance.In order to evaluate color
Distortion level, according to These parameters, uses following tone and saturation deviation to evaluate:
Wherein H and S is respectively tone and the saturation of image.
According to evaluation index, D is the highest, and image definition is the highest;C, L, H, S are the least, and image color is also
Former degree is the highest.
Evaluation result is as shown in the table:
The evaluation result of table 1. Fig. 1
The evaluation result of table 2. Fig. 2
|
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 inventive method |
3.9072 |
0.0161 |
8.2939e-005 |
0.0017 |
0.0077 |
Although as it can be seen from table 1 the definition of histogram equalizing method is the highest, but C, L, H, S
Desired value all much larger than the method for the present invention, it can be seen that histogram equalizing method from result images
Fine definition is with color distortion as cost, and the inventive method is in addition to definition is less than histogram equalization method,
Remaining index is the most excellent with histogram equalization method and MSRCR.Similarly, in table 2, the inventive method exists
The most excellent and histogram equalization method and MSRCR in the index such as definition, C, L, H, S.Consolidated statement 1 He
The result of table 2 is it can be seen that the inventive method has the highest definition, and color distortion degree is the most remote simultaneously
Less than histogram equalization and MSRCR method, show that the inventive method is improving while image definition,
Color distortion can be effectively prevented from.
The foregoing is only presently preferred embodiments of the present invention, not in order to limit the present invention, all at this
Any amendment, equivalent and the improvement etc. made within bright spirit and principle, should be included in the present invention
Protection domain within.