Summary of the invention
The object of the embodiment of the present invention is the disposal route proposing a kind of adapting to image brightness, is intended to solve prior art brightness and strengthens the problem that process can lose image detail.
The embodiment of the present invention is achieved in that a kind of disposal route of adapting to image brightness, and described method comprises:
Obtain image a, image a is normalized, obtain image A;
Image A is converted into HSI space from rgb space and obtains image F;
By ad hoc fashion process, component I ' is obtained to the component I of image F;
By the component S of described component I ' with image F, component H merges into new image b;
Be that rgb space obtains image B by image b from HSI spatial transformation;
Output image B.
Further, described " obtaining component I ' by ad hoc fashion process to the component I of image F " is specially:
Statistics with histogram is carried out to component I, and is normalized and obtains histogram P;
Nogata distribution function p after normalized is divided between n gray area by gray level, and calculates the gray level weight r between each gray area
iand the interval weight w calculated between each gray area
i; Wherein, after i represents and carries out gray level subregion to histogram P, the sequence number between the gray area be divided into, 1≤i≤n.
Pass through r
i, w
ibuild between new gray area, and draw each interval weight w ' between gray area new accordingly
i;
By w
i, w '
icomputing function sampling point, and construct Nogata and return determining function f, and to meet function f be monotonically increasing function;
Determining function f is returned to calculate I ' to the component I of image F by Nogata.
Another object of the embodiment of the present invention is the treating apparatus proposing a kind of adapting to image brightness, and described device comprises:
Image collection module, for obtaining image a;
First normalized module, for being normalized image a, obtains image A;
First space conversion module, obtains image F for image A is converted into HSI space from rgb space;
Component treating apparatus, for pressing ad hoc fashion process to the component I of image F, obtains I ';
Component merges module, and for by the component S of described component I ' with image F, component H merges into new image b;
Second space modular converter, for being that rgb space obtains image B by image b from HSI spatial transformation;
Output module, for output image B.
Further, described component treating apparatus also comprises:
Statistics with histogram module, for carrying out statistics with histogram to component I;
Second normalized module, obtains histogram P for being normalized the component I after statistics with histogram;
Division module, for carrying out subregion by the Nogata distribution function p after normalized by gray level;
Interval gray level weight computation module, for and the gray level weight r calculated between each gray area
i;
Interval weight computing module, for calculating the interval weight w between each gray area
i
Module is built, for passing through r between gray area
i, w
ibuild between new gray area;
Interval weight computing module, for calculating the interval weight w ' between each new gray area
i;
Nogata returns determining function construction module, for by w
i, w '
icomputing function sampling point, and construct Nogata and return determining function f, and to meet function f be monotonically increasing function;
Component computing module, for returning determining function f to calculate I ' to the component I of image F by Nogata.
Beneficial effect of the present invention
A lot of too dark, too bright image can't see details, and it is narrow that this part gray scale of usual image shows to show gray scale span in histogram, and gray-scale value is too concentrated.Therefore in order to make the image section of too much details have larger gray scale span, the simultaneously gray scale range of unimportant part in downscaled images.The inventive method is crossed from single channel histogram analysis, and the value of adjustment component I, suitably the gray-level structure of adjustment source images, achieves the effect of image partial enhance.
Embodiment
In order to make object of the present invention, technical scheme and advantage clearly understand, below in conjunction with drawings and Examples, the present invention being further elaborated, for convenience of explanation, illustrate only the part relevant to the embodiment of the present invention.Should be appreciated that the specific embodiment that this place is described, only for explaining the present invention, not in order to limit the present invention.
A lot of too dark, too bright image can't see details, and it is narrow that this part gray scale of usual image shows to show gray scale span in histogram, and gray-scale value is too concentrated.Therefore in order to make the image section of too much details have larger gray scale span, the simultaneously gray scale range of unimportant part in downscaled images.The embodiment of the present invention, by from single channel histogram analysis, adjusts the value of component I, and suitably the gray-level structure of adjustment source images, achieves the effect of image partial enhance.
Embodiment one
Fig. 1 is the process flow figure of a kind of adapting to image brightness of the preferred embodiment of the present invention; Said method comprising the steps of:
S101, obtains image a, is normalized image a, obtains image A;
S102, is converted into HSI space by image A from rgb space and obtains image F;
S103, presses ad hoc fashion process to the component I of image F, obtains I ';
Be specially: (Fig. 2 is the method detailed process flow diagram of step S103 in Fig. 1 process flow diagram)
S1031, carries out statistics with histogram to component I, and is normalized and obtains histogram P;
S1032, carries out subregion by the Nogata distribution function p after normalized by gray level, is divided between n gray area, and calculates the gray level weight r between each gray area
iand the interval weight w calculated between each gray area
i(i.e. length of an interval degree), wherein, after i represents and carries out gray level subregion to histogram P, the sequence number between the gray area be divided into; 1≤i≤n;
The method of the Nogata distribution function p after normalized being carried out to subregion can use threshold value, the methods such as cluster; Use threshold value, the method for cluster subregion is technology well-known in the art, and the present invention is only described threshold value partition method and illustrates.
Threshold value partition method is, sets a threshold value ρ, and in threshold value ρ straight line and histogram P, the horizontal ordinate at the intersection point place of grey value profile curve is the critical point between gray area; And threshold value ρ need meet: as p> ρ, Interval Gray angle value is continuous, and as p< ρ, interval gray-scale value is continuous.Wherein threshold value ρ is the threshold value of (0,1), and p represents Nogata distribution function.
Be illustrated in figure 3 and carry out the histogram after gray level subregion with threshold value partition method to histogram P, histogram P divide between 8 gray areas; Wherein horizontal ordinate is normalized gray-scale value, and ordinate is gray-scale value weight, and the curve in figure is Nogata distribution function p, k
1, k
2, k
3, k
4, k
5, k
6, k
7for the critical point between gray area.
Calculate the gray level weight r between each gray area
imethod be:
Wherein, r
irepresent the integration of p all in i-th gray area, 1≤i≤n; Be [k between the 1st gray area
0, k
1), be [k between the 2nd gray area
1, k
2) ... be [k between the n-th gray area
n-1, k
n];
S1033, passes through r
i, w
ibuild between new gray area, and draw each interval weight w ' between corresponding new gray area
i;
W '
i=(1-λ) r
i+ λ w
i, wherein λ is weight coefficient λ ∈ (0,1);
S1034, by w
i, w '
icomputing function sampling point, and construct Nogata and return determining function f, and to meet function f be monotonically increasing function.
The method of computing function sampling point is as follows:
Wherein, N (x
i, y
i) represent the sampling point of f, x
irepresent the horizontal ordinate of sampling point, y
irepresent the ordinate of sampling point; w
jrepresent the weight between the jth gray area between former gray area, w '
jrepresent the weight between new JianjGe gray area, gray area, after i represents and carries out gray level subregion to histogram P, the sequence number between the gray area be divided into; ∑ represents summation.
Structure Nogata returns determining functional based method can be linear, also can be spline smooth, Hermite interpolation etc.If Fig. 4 is simple linear function, Fig. 5 is spline smooth function; S1035, returns determining function f to calculate I ' to the component I of image F by Nogata;
Be illustrated in figure 6 the new histogram P ' after returning determining function f to calculate the component I of image F by Nogata.In Fig. 6, horizontal ordinate represents gray level, and ordinate is distribution density.Initial point on horizontal ordinate, k '
1, k '
2, k '
3, k '
4, k '
5, k '
6, k '
7represent the critical point between new gray area.
S104, by the component S of described component I ' with image F, component H merges into new image b;
Image b is that rgb space obtains image B from HSI spatial transformation by S105;
S106, output image B.
Embodiment two
Fig. 7 is the treating apparatus structural drawing of a kind of adapting to image brightness of the preferred embodiment of the present invention, and described device comprises:
Image collection module, for obtaining image a;
First normalized module, for being normalized image a, obtains image A;
First space conversion module, obtains image F for image A is converted into HSI space from rgb space;
Component treating apparatus, for pressing ad hoc fashion process to the component I of image F, obtains I ';
Component merges module, and for by the component S of described component I ' with image F, component H merges into new image b;
Second space modular converter, for being that rgb space obtains image B by image b from HSI spatial transformation;
Output module, for output image B.
Further, described component treating apparatus also comprises (detailed structure view that Fig. 8 is component processing module in Fig. 7 structural drawing):
Statistics with histogram module, for carrying out statistics with histogram to component I;
Second normalized module, obtains histogram P for being normalized the component I after statistics with histogram;
Division module, for carrying out subregion by the Nogata distribution function p after normalized by gray level;
Interval gray level weight computation module, for and the gray level weight r calculated between each gray area
i;
Interval weight computing module, for calculating the interval weight w between each gray area
i
Module is built, for passing through r between gray area
i, w
ibuild between new gray area;
Interval weight computing module, for calculating the interval weight w ' between each new gray area
i;
Nogata returns determining function construction module, for by w
i, w '
icomputing function sampling point, and construct Nogata and return determining function f, and to meet function f be monotonically increasing function;
Component computing module, for returning determining function f to calculate I ' to the component I of image F by Nogata;
Those having ordinary skill in the art will appreciate that, the all or part of step realized in above-described embodiment method can have been come by programmed instruction related hardware, described program can be stored in a computer read/write memory medium, and described storage medium can be ROM, RAM, disk, CD etc.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, all any amendments done within the spirit and principles in the present invention, equivalent replacement and improvement etc., all should be included within protection scope of the present invention.