Summary of the invention
The technical problem to be solved in the present invention is, a kind of image color enhancement device that colourity subregion is strengthened and method are provided, and more flexible user arbitrarily strengthens arbitrary part of color, while avoiding figure image intensifying simultaneously " as hard as crossing " make image quality decrease.
First aspect present invention, provides a kind of image color enhancement device, comprising: color-space conversion module, is transformed into HSV space by the view data of input from rgb space; Gain function generation module based on colourity, receives between the colourity regulatory region of user's setting, generates the gain function based on colourity of this colourity subregion; Gain function generation module based on saturation, between the colourity regulatory region arranging this user in, generate the gain function based on saturation; Saturation strengthens module, utilizes described gain function based on colourity and described gain function based on saturation to strengthen saturation.According in the image color enhancement device described in first aspect present invention, the described gain function generation module based on colourity further comprises: colourity subregion function storaging unit, for generating and storing the gain function of different colourity subregions; And each in the gain function of described different colourity subregions comprises and is positioned at this colourity subregion: functional value monotonic increase to the first gain function, functional value based on colourity of the default gain threshold based on colourity is the default gain threshold based on colourity the second gain function based on colourity and functional value starts the 3rd gain function based on colourity of monotone decreasing from the default gain threshold based on colourity; And the first gain function selected cell, for search the corresponding gain function based on colourity between the colourity regulatory region that user arranges from described colourity subregion function storaging unit.
According in the image color enhancement device described in first aspect present invention, described gain coefficient based on saturation generates computing module and further comprises: saturation function memory cell, for the gain function based on saturation in generating and storing between the colourity regulatory region that user arranges; And the described gain function based on saturation comprises and is positioned at default minimum saturation threshold value to maximum saturation threshold range: first gain function, the functional value based on saturation of functional value since 0 monotonic increase to the default gain threshold based on saturation is the default gain threshold based on saturation the second gain function based on saturation and functional value is from the 3rd gain function based on saturation of the default gain threshold monotone decreasing to 0 based on saturation; And the second gain function selected cell, for search the corresponding gain function based on saturation between the colourity regulatory region that user arranges from described saturation function memory cell.
According in the image color enhancement device described in first aspect present invention, described color-space conversion module is first transformed into yuv space by the view data of input from rgb space, re-uses cordic algorithm it is transformed into HSV space from yuv space.
Second aspect present invention, provides a kind of image color Enhancement Method, comprises the following steps: color space conversion step, is transformed into HSV space by the view data of input from rgb space; Gain function based on colourity generates step, receives between the colourity regulatory region of user's setting, generates the gain function based on colourity of this colourity subregion; Gain function based on saturation generates step, between the colourity regulatory region arranging this user in, generate the gain function based on saturation; Saturation strengthens step, utilizes described gain function based on colourity and described gain function based on saturation to strengthen saturation.
According in the image color Enhancement Method described in second aspect present invention, the described gain function based on colourity generates step and further comprises: colourity subregion function storing step, generates and stores the gain function of different colourity subregions; And each in the gain function of described different colourity subregions comprises and is positioned at this colourity subregion: functional value monotonic increase to the first gain function, functional value based on colourity of the default gain threshold based on colourity is the default gain threshold based on colourity the second gain function based on colourity and functional value starts the 3rd gain function based on colourity of monotone decreasing from the default gain threshold based on colourity; And first gain function select step, for searching the corresponding gain function based on colourity between the colourity regulatory region that user arranges.
According in the image color Enhancement Method described in second aspect present invention, described gain coefficient based on saturation generates step and further comprises: saturation function storing step, the gain function based on saturation in generating and storing between the colourity regulatory region that user arranges; And the described gain function based on saturation comprises and is positioned at default minimum saturation threshold value to maximum saturation threshold range: first gain function, the functional value based on saturation of functional value since 0 monotonic increase to the default gain threshold based on saturation is the default gain threshold based on saturation the second gain function based on saturation and functional value is from the 3rd gain function based on saturation of the default gain threshold monotone decreasing to 0 based on saturation; And second gain function select step, for searching the corresponding gain function based on saturation between the colourity regulatory region that user arranges.
According in the image color Enhancement Method described in second aspect present invention, described color space conversion step is first transformed into yuv space by the view data of input from rgb space, re-uses cordic algorithm it is transformed into HSV space from yuv space.
Implement image color enhancement device of the present invention and method; there is following beneficial effect: the present invention is by adopting the saturation gain function of different colourity subregions; and to the too large and too little region division of saturation component threshold value; only the interstage of saturation component is partly carried out to suitable enhancing; realized the protection to saturation component; make video pictures softer, also people's vision is played a very good protection.
Embodiment
In order to make object of the present invention, technical scheme and advantage clearer, below in conjunction with drawings and Examples, the present invention is further elaborated.
Referring to Fig. 1, is the module diagram of image color enhancement device in the preferred embodiment of the present invention.As shown in Figure 1, the image color enhancement device that this embodiment provides at least comprises that color-space conversion module 10, the gain function generation module 20 based on colourity, the gain function generation module 30 based on saturation and saturation strengthen module 40.
Wherein, color-space conversion module 10 is transformed into HSV space by the view data of input from rgb space.Gain function generation module 20 based on colourity, receives between the colourity regulatory region of user's setting, generates the gain function based on colourity of this colourity subregion.Gain function generation module 30 based on saturation, between the colourity regulatory region arranging this user in, generate the gain function based on saturation.Saturation strengthens module 40, utilizes described gain function based on colourity and described gain function based on saturation to strengthen saturation.
Below each functional module of the present invention is described, and in conjunction with each little module, the superiority of setting forth these apparatus and method is described, illustrate that image color enhancement device has great effect in actual applications simultaneously.
(1) color-space conversion module 10
Color-space conversion module 10 is transformed into HSV space by the view data of input from rgb space.HSV model is comprised of colourity H, saturation S, these three components of brightness V, more approaching to the perception of color with the mankind.The advantage of this model is: on the one hand eliminated brightness composition V in image with the contacting of colouring information, on the other hand, colourity H and saturation S and people's visual experience is closely related.
First, image is transformed into HSV space from rgb space, basic transfer process is as described below, and the following Fig. 2 of model.Certainly, image is transformed into HSV space from rgb space has many methods to realize, but in this module, in order accelerating system to move, improves operational efficiency, and what this module adopted is with classical cordic algorithm.First coloured image from being transformed into the yuv space of television set receiving system, so both can carry out some other direct processing to signal, also can be as pass through algorithm process in this module, signal is transformed to HSV space from yuv space, the data flow of output can be used for later experiment, to the various processing of later signal, is all suitable convenience.
Then, the precise meaning that each several part in HSV spatial model is once described again at this, is all absolutely necessary to the understanding of model and even later processing.Refer to Fig. 2, at the V=0 of conical tip place, H and S, without definition, represent black, circular cone end face center V=1, and S=0, H definition, represents white.From this to initial point, represent gradually dark grey of brightness, have the grey of different gray scales, for these S=0, the value of H is without definition.Color on the circumference of circular cone end face, V=1, S=1, this color is pure color.
(2) the gain coefficient computing module 20 based on colourity
When video image is processed, iff saturation component is done and strengthened, bring sometimes dangerous consequence.Although picture is clear, color is also more saturated, often differs too much with raw video image, even there will be the situation of distortion.
So the present invention preferably, to colourity H subregion, then adopts different processing modes to different regions, also generate the gain function based on colourity, the gain function based on colourity of different chroma areas is distinguished to some extent.
By above known to the analysis in hsv color space, colourity H, according to a circle distribution, is also the corresponding chromatic component that has of each sector region correspondence.So, just can implement relevant enhancement measures according to the difference of these components.Referring to Fig. 3, is the concrete structure figure of the gain function generation module based on colourity in the preferred embodiment of the present invention.As shown in Figure 3, the gain function generation module 20 based on colourity further comprises: colourity subregion function storaging unit 21 and the first gain function selected cell 22.
Wherein, colourity subregion function storaging unit 21, for generating and storing the gain function gain ' of different colourity subregions.In this colourity subregion function storaging unit 21, store a plurality of saturation gain functions for different colourity subregions.As Fig. 6, it is the saturation gain function schematic diagram of a colourity subregion in the preferred embodiment of the present invention.In Fig. 6, only show the saturation gain function based on colourity that colourity is arranged in H0 to H1.Outside H0 to H1, also may there are a plurality of saturation gain functions based on colourity.The Enhancement Method of Fig. 6 is generalized to other region in chromatic component, can adopts different Enhancement Method and strengthen coefficient different chromatic components.
If it is relatively strong that other saturation component outside colourity H0 to H1 scope strengthens, and saturation between colourity H0 to H1 does not have respective change, so just there will be transition inharmonious, color sensation will be bad.The obvious tomography of transition portion between colourity like this, the stereovision of picture is had a greatly reduced quality, therefore the employing method of this module is similar to saturation gain coefficient, what adopt is the method for slow transition, allow chromatic component also form one and be similar to above-mentioned adaptive approach, be the formed gain coefficient to colourity H.
For the saturation that makes this colourity be arranged in H0 to H1 strengthens also, realize and seamlessly transitting, at this, each in the saturation gain function of different colourity subregions is comprised and is positioned at this colourity subregion: functional value monotonic increase is to the first gain function based on colourity of the default gain threshold based on colourity, as the oblique line rising gradually between colourity H0 and a certain colourity median; Functional value is the default gain threshold based on colourity the second gain function based on colourity, if the functional value in interstage is the function of max gain '; And functional value starts the 3rd gain function based on colourity of monotone decreasing from the default gain threshold based on colourity.The oblique line declining gradually between this colourity median and colourity H1 for example.Gain function by this colourity subregion shown in Fig. 4 just can be arranged in H0 to H1 saturation realization enhancing significantly to colourity, and has the process seamlessly transitting.Wherein, gain threshold based on colourity can adopt the parameter of acquiescence; also can be arranged by user; thereby the region needing protection is protected; need to strengthen the chroma areas that Amplitude Ratio is larger; want emphasis to strengthen, this is so-called colourity control namely, and this module will solve this difficult problem exactly.Such as people's the colour of skin, or such as gold, other does not need to do the color region that saturation strengthens, and will implement protection strategy, otherwise can become along with these color regions of enhancing of brightness quite bad.In this module, the chroma areas that just can need protection at these arranges protective barrier, i.e. the gain threshold based on colourity of this colourity subregion.The interstage that is to say, if while doing saturation enhancing in this section of protected region, only need to be done tiny enhancing, or does not strengthen, and keeps original saturation.Should can be set to as required max-thresholds by the gain threshold based on colourity, as max_gain ' in Fig. 4.Should also can be set to as required minimum threshold by the gain threshold based on colourity.
In addition, the saturation gain function of different colourity subregions can also adopt with Fig. 4 in the reverse function of figure the saturation in colourity subregion is gained, in this region, only need to do tiny enhancing, or while not strengthening.The gain coefficient of close this colourity subregion internal edge is by the gain coefficient higher than zone line.This chroma areas that for example will strengthen is people's the colour of skin, and people's colour of skin scope to be embodied on chromatic component be between another colourity interval, we do with other colourity and strengthen difference enhancement method in the time of just can strengthening the saturation in this colourity interval, allow its (saturation S) only to do trickle enhancing or do not strengthen, keep original condition.
Therefore, by the above-mentioned saturation to each colourity subregion, strengthen respectively, just can adopt different enhancing coefficients to different chromatic components.
(2) the gain function generation module 30 based on saturation
After the colourity of image is carried out to subregion, just need to the saturation in this colourity subregion be strengthened.Yet by the introduction in background, existing saturation component being strengthened, the known enhancing to saturation component S, need not strengthen in full section, therefore of the present invention need partly be carried out suitable enhancing to the interstage of saturation component S.The gain function generative process of the gain function generation module 30 based on saturation is as follows.
According to above known with the analysis of saturation component S; we are when gain coefficient; if allow all gain coefficients of saturation component S be same coefficients; so sometimes not only can not play the effect of enhancing; can destroy on the contrary the original character of image; making image worse, spectators' vision can not had to protective effect, can be even damage sometimes.So, the present invention solves this problem with regard to wanting a way, gain coefficient computing module 30 based on saturation can be according to the attribute of saturation component S, design adaptive gain coefficient, also each saturation component S is had to a gain coefficient matching, strengthen like this effect can than with one, strengthen that coefficient will be good a lot, image quality also has the improvement of matter.
Referring to Fig. 5, is the concrete structure figure of the gain function generation module based on saturation in the preferred embodiment of the present invention.As shown in Figure 5, the gain function generation module 30 based on saturation that this embodiment provides further comprises: saturation function memory cell 31 and the second gain function selected cell 32.
Wherein, saturation function memory cell 31, for the gain function gain based on saturation in generating and storing between the colourity regulatory region that user arranges.Refer to Fig. 6, the schematic diagram of the gain function based on saturation providing for the preferred embodiment of the present invention.As shown in Figure 6, the gain function based on saturation is provided with minimum saturation threshold value s to saturation component S
0with maximum saturation threshold value s
1.This minimum saturation threshold value s
0with maximum saturation threshold value s
1can adopt default parameters, or be arranged by user.When saturation component S original value is less than this minimum saturation threshold value s
0or be greater than maximum saturation threshold value s
1time, saturation component S original value is original just too little or when too large, with regard to there is no need, again saturation component S is strengthened, therefore, minimum saturation threshold value s
0with maximum saturation threshold value s
1outside saturation gain coefficient be 0.Minimum saturation threshold value s
0with maximum saturation threshold value s
1can arrange neatly to meet the different needs.
Due to everyone, and even some specific crowd is not the same to the vision response of color, and as for the ethnic group of Asia, people are for the colour of skin, more acceptant yellow; And especially for Chinese, our vision mechanism can more easily be selected those more bright-coloured color and lusters etc.According to the enhancing effect wanted, a maximum gain threshold value based on saturation can be first set, i.e. maximum gain factor max_gain, this maximum gain factor has determined the top that our saturation component S strengthens.The gain coefficient of the mid portion of saturation component S can be set to maximum gain coefficient, so just can guarantee that most saturation component S is enhanced.
Therefore, at minimum saturation threshold value s
0with maximum saturation threshold value s
1inside, has designed the gain function of monotonically increasing first based on saturation, from minimum saturation threshold value s
0to functional value between a certain median from the 0 oblique line section that rises to gradually the default gain threshold max gain based on saturation; The invariable second gain function based on saturation, its functional value is the default gain threshold max gain based on saturation; And the 3rd gain function based on saturation of monotone decreasing, from this median to maximum saturation threshold value s
1between functional value from max gain, drop to gradually 0 oblique line section.Like this, just from the lower gain coefficient based on saturation of value (if saturation is minimum saturation threshold value s
0time be 0) to the higher gain coefficient based on saturation of value (as saturation for certain median time), or from the higher gain coefficient based on saturation of value (as saturation for certain median time) to the lower gain coefficient based on saturation of value (if saturation is minimum saturation threshold value s
1time be 0) enhancing process in added suitable transition, rather than sharply rise or decline, be unlikely to the enhancing process of saturation component S to produce inharmonious, saturation component S is strengthened and has reached good protection effect.
The second gain function selected cell 22, for searching the corresponding gain function based on saturation between the colourity regulatory region that user arranges from described saturation function memory cell.
Therefore, by the above-mentioned saturation segmentation to complete section, strengthen, make the gain coefficient of the extra high part of component value can be for less, it is also less that the gain coefficient of low especially part can arrange, from component median, to the corresponding gain coefficient of component two end portions, there is a transition, rather than sharply rise or decline, available segment function is described.Certainly, another benefit of this algorithm is that these parameters can arrange flexibly.Therefore the above-mentioned gain function generation module 30 based on saturation can carry out self adaptation adjusting to saturation component S, to the too large and too little region division of saturation component S threshold value, strengthen the protection to its whole saturation component S.And in enhancing process; to from high value to low value; or added suitable transition the enhancing process from low value to high value; be unlikely to the enhancing process of saturation component S to produce inharmonious; saturation component S is strengthened and reached good protection effect; so just can make video pictures softer, also people's vision be played a very good protection.
(3) saturation strengthens module 40
And, as from the foregoing, after saturation component S and chromatic component H are done to corresponding analyzing and processing, can produce two corresponding saturation gain functions: gain and gain '.So, finally in saturation, strengthen in module 40, produce comprehensive gain coefficient, i.e. a gain*gain '.
So the final result to the enhancing of color is also that last saturation component S is:
S′=S*gain*gain′
Like this, just formed a color Strengthening Management system, can carry out adaptability enhancing to the different saturation in colourity subregions different in video image, can manage the outside in system by different parameters, and not needing update routine, this is also a characteristic part of the present invention.
Referring to Fig. 7, is the flow chart of image color Enhancement Method in the preferred embodiment of the present invention.As shown in Figure 7, the image color Enhancement Method that the present embodiment provides, comprises the following steps:
First, in step S1, the view data of input is transformed into HSV space from rgb space.The present invention can first be transformed into yuv space by the view data of input from rgb space, re-uses cordic algorithm it is transformed into HSV space from yuv space.The function of this step S1 is consistent with the description of the function of color-space conversion module 10 in device.
In step S2, receive between the colourity regulatory region of user's setting subsequently, generate the gain function gain ' based on colourity of this colourity subregion.This step further comprises: colourity subregion function storing step, generates and stores the gain function of different colourity subregions; And each in the gain function of described different colourity subregions comprises and is positioned at this colourity subregion: functional value monotonic increase to the first gain function, functional value based on colourity of the default gain threshold based on colourity is the default gain threshold based on colourity the second gain function based on colourity and functional value starts the 3rd gain function based on colourity of monotone decreasing from the default gain threshold based on colourity; And first gain function select step, for searching the corresponding gain function based on colourity between the colourity regulatory region that user arranges.The function of step S2 is consistent with the description of the function of the gain function generation module 20 based on colourity in device.
Subsequently, in step S3, between the colourity regulatory region arranging this user in, generate the gain function gain based on saturation.Step S3 can further comprise: saturation function storing step, the gain function based on saturation in generating and storing between the colourity regulatory region that user arranges; And the described gain function based on saturation comprises and is positioned at default minimum saturation threshold value to maximum saturation threshold range: first gain function, the functional value based on saturation of functional value since 0 monotonic increase to the default gain threshold based on saturation is the default gain threshold based on saturation the second gain function based on saturation and functional value is from the 3rd gain function based on saturation of the default gain threshold monotone decreasing to 0 based on saturation; And second gain function select step, for searching the corresponding gain function based on saturation between the colourity regulatory region that user arranges.The function of step S3 is consistent with the description of the function of the gain function generation module 30 based on saturation in device.
Finally in step S4, utilize gain function gain ' based on colourity and the product of the described gain function gain based on saturation to strengthen saturation.Be S '=S*gain*gain '.Step S4 is consistent with the description of the function of saturation enhancing module 40 in device.
In sum, image color enhancement device of the present invention passes through to adopt the saturation gain function of different colourity subregions with method, and uses the mode of transition, makes picture softer, avoid the tomography of the transition portion appearance between colourity, retained the stereovision of picture.Simultaneously in this colourity subregion; to the too large and too little region division of saturation component threshold value, only the interstage of saturation component is partly carried out to suitable enhancing, realized the protection to saturation component; make video pictures softer, also people's vision is played a very good protection.
Image color enhancement device of the present invention and method are described according to specific embodiment, but it will be understood by those skilled in the art that when not departing from the scope of the invention, can carry out various variations and be equal to replacement.In addition,, for adapting to the specific occasion of the technology of the present invention, can carry out many modifications and not depart from its protection range the present invention.Therefore, the present invention is not limited to specific embodiment disclosed herein, and comprises all embodiment that drop into claim protection range.