Summary of the invention
The technical problem to be solved in the present invention is, a kind of image color intensifier and method that the colourity subregion is strengthened is provided, and more flexible user arbitrarily strengthens arbitrary part of color, when avoiding the figure image intensifying simultaneously " as hard as crossing " make image quality decrease.
First aspect present invention provides a kind of image color intensifier, comprising: color-space conversion module is transformed into the HSV space with the view data of importing from rgb space; Based on the gain function generation module of colourity, receive between the colourity regulatory region of user's setting, generate the gain function based on colourity of this colourity subregion; Based on the gain function generation module of saturation, between the colourity regulatory region that this user is provided with in, generate gain function based on saturation; Saturation strengthens module, utilizes described gain function and described gain function based on saturation based on colourity that saturation is strengthened.In the described image color intensifier according to first aspect present invention, described gain function generation module based on colourity further comprises: colourity subregion function storaging unit is used to generate and store 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: the functional value monotonic increase is to first gain function based on colourity of default gain threshold based on colourity, functional value second the 3rd gain function based on colourity that begins monotone decreasing from the default gain threshold based on colourity based on the gain function and the functional value of colourity for default gain threshold based on colourity; And the first gain function selected cell, be used for searching corresponding gain function between the colourity regulatory region that the user is provided with based on colourity from described colourity subregion function storaging unit.
In described image color intensifier according to first aspect present invention, described gain coefficient based on saturation generates computing module and further comprises: saturation function memory cell, the gain function based on saturation in being used to generate and store between the colourity regulatory region that the user is provided with; And described gain function based on saturation comprises and is positioned at default minimum saturation threshold value to the maximum saturation threshold range: first the gain function based on saturation of functional value since 0 monotonic increase to default gain threshold based on saturation, functional value for default gain threshold based on saturation second based on the gain function of saturation and functional value the 3rd gain function based on saturation from default gain threshold monotone decreasing to 0 based on saturation; And the second gain function selected cell, be used for searching corresponding gain function between the colourity regulatory region that the user is provided with based on saturation from described saturation function memory cell.
In the described image color intensifier according to first aspect present invention, described color-space conversion module is transformed into yuv space with the view data of input from rgb space earlier, re-uses the cordic algorithm it is transformed into the HSV space from yuv space.
Second aspect present invention provides a kind of image color Enhancement Method, may further comprise the steps: the color space conversion step is transformed into the HSV space with the view data of importing 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; Generate step based on the gain function of saturation, between the colourity regulatory region that this user is provided with in, generate gain function based on saturation; Saturation strengthens step, utilizes described gain function and described gain function based on saturation based on colourity that saturation is strengthened.
In the described image color Enhancement Method according to second aspect present invention, 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: the functional value monotonic increase is to first gain function based on colourity of default gain threshold based on colourity, functional value second the 3rd gain function based on colourity that begins monotone decreasing from the default gain threshold based on colourity based on the gain function and the functional value of colourity for default gain threshold based on colourity; And first gain function select step, be used to search corresponding gain function between the colourity regulatory region that the user is provided with based on colourity.
In described image color Enhancement Method according to 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 the user is provided with; And described gain function based on saturation comprises and is positioned at default minimum saturation threshold value to the maximum saturation threshold range: first the gain function based on saturation of functional value since 0 monotonic increase to default gain threshold based on saturation, functional value for default gain threshold based on saturation second based on the gain function of saturation and functional value the 3rd gain function based on saturation from default gain threshold monotone decreasing to 0 based on saturation; And second gain function select step, be used to search corresponding gain function between the colourity regulatory region that the user is provided with based on saturation.
In the described image color Enhancement Method according to second aspect present invention, described color space conversion step is transformed into yuv space with the view data of input from rgb space earlier, re-uses the cordic algorithm it is transformed into the HSV space from yuv space.
Implement image color intensifier of the present invention and method; have following beneficial effect: the present invention is by adopting the saturation gain function of different colourity subregions; and to the saturation component too big and too little zone is provided with threshold value; only the interstage of saturation component is partly carried out suitable enhancing; realized protection to the saturation component; make video pictures softer, also the vision to people plays a very good protection.
Embodiment
In order to make purpose of the present invention, technical scheme and advantage clearer,, the present invention is further elaborated below in conjunction with drawings and Examples.
See also Fig. 1, be the module diagram of image color intensifier in the preferred embodiment of the present invention.As shown in Figure 1, the image color intensifier that provides of this embodiment comprise color-space conversion module 10 at least, based on the gain function generation module 20 of colourity, strengthen module 40 based on the gain function generation module 30 and the saturation of saturation.
Wherein, color-space conversion module 10 is transformed into the HSV space with the view data of input from rgb space.Based on the gain function generation module 20 of colourity, receive between the colourity regulatory region of user's setting, generate the gain function based on colourity of this colourity subregion.Based on the gain function generation module 30 of saturation, between the colourity regulatory region that this user is provided with in, generate gain function based on saturation.Saturation strengthens module 40, utilizes described gain function and described gain function based on saturation based on colourity that saturation is strengthened.
Below each functional module of the present invention is described, and the superiority of setting forth these apparatus and method is described, illustrate that simultaneously the image color intensifier has great effect in actual applications in conjunction with each little module.
(1) color-space conversion module 10
Color-space conversion module 10 is transformed into the HSV space with the view data of input from rgb space.The HSV model is made up of colourity H, saturation S, these three components of brightness V, and is 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 getting in touch of colouring information, on the other hand, colourity H and saturation S and people's visual experience is closely related.
At first, image is transformed into the HSV space from rgb space, basic transfer process is as described below, and the following Fig. 2 of model.Certainly, image is transformed into the 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.Earlier 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 in this module, passing through algorithm process, signal is transformed to the HSV space from yuv space, the experiment of the data flow of output after can being provided with is used, all is suitable convenience to the various processing of later signal.
Then, in this definite implication that each several part in the HSV spatial model once is described again, the understanding of model and even later processing all are absolutely necessary.See also Fig. 2, at the V=0 of conical tip place, H and S do not have definition, then represent black, circular cone end face center V=1, and S=0, white is then represented in the H definition.Represent the gradually dark grey of brightness from this to initial point, promptly have the grey of different gray scales, for these S=0, the value of H does not have definition.Color on the circumference of circular cone end face, V=1, S=1, this color is a pure color.
(2) based on the gain coefficient computing module 20 of colourity
When video image is handled,, bring dangerous consequence sometimes iff the saturation component is done enhancing.Though picture is clear, color is also more saturated, often differs too much with raw video image, even the situation of distortion can occur.
So the present invention adopts different processing modes to different zones then preferably to colourity H subregion, also promptly generates the gain function based on colourity, makes the gain function based on colourity of different chroma areas distinguish to some extent.
By above analysis to the hsv color space as can be known, colourity H is according to a circle distribution, also be each sector region all corresponding corresponding chromatic component arranged.The enhancement measures that can implement to be correlated with according to the difference of these components so, just.See also Fig. 3, in the preferred embodiment of the present invention based on the concrete structure figure of the gain function generation module of colourity.As shown in Figure 3, the gain function generation module 20 based on colourity further comprises: the colourity subregion function storaging unit 21 and the first gain function selected cell 22.
Wherein, colourity subregion function storaging unit 21 is used to generate and store the gain function gain ' of different colourity subregions.Store a plurality of saturation gain functions in this colourity subregion function storaging unit 21 at different colourity subregions.As Fig. 6, be the saturation gain function schematic diagram of a colourity subregion in the preferred embodiment of the present invention.Only show the saturation gain function that colourity is arranged in H0 to H1 among Fig. 6 based on colourity.Outside H0 to H1, also may there be a plurality of saturation gain functions based on colourity.The Enhancement Method of Fig. 6 is generalized to other zone in the chromatic component, can adopts different Enhancement Method and reinforcing coefficient different chromatic components.
If it is stronger relatively that other saturation component outside colourity H0 to the H1 scope strengthens, and the saturation between the colourity H0 to H1 does not have respective change, so it is inharmonious transition to occur, color sensation will be bad.The tangible tomography of transition portion between the colourity like this, the stereovision of picture is had a greatly reduced quality, therefore similar in the employing method of this module and the saturation gain coefficient, what promptly adopt is the method for slow transition, allow chromatic component also form one and be similar to above-mentioned adaptive approach, be formed gain coefficient colourity H.
For strengthening, the saturation that makes this colourity be arranged in H0 to H1 also realizes seamlessly transitting, at this, in the saturation gain function of different colourity subregions each comprised be positioned at this colourity subregion: the functional value monotonic increase is to first gain function based on colourity of default gain threshold based on colourity, as the oblique line that rises gradually between colourity H0 and a certain colourity median; Functional value is second gain function based on colourity of default gain threshold based on colourity, is the function of max gain ' as the functional value in interstage; And functional value begins the 3rd gain function based on colourity of monotone decreasing from the default gain threshold based on colourity.The oblique line that descends gradually between this colourity median and colourity H1 for example.Gain function by this colourity subregion shown in Figure 4 just can be arranged in H0 to H1 saturation realization enhancing significantly to colourity, and has the process that seamlessly transits.Wherein, can adopt the parameter of acquiescence based on the gain threshold of colourity; also can be provided with by the user; thereby the zone that needs protection is protected; need the bigger chroma areas of enhancing amplitude; then want emphasis to strengthen, this just so-called colourity control, and this module will solve this difficult problem exactly.Such as people's the colour of skin, or other does not need to do the color region that saturation strengthens such as gold, will implement the protection strategy, otherwise can become quite bad along with these color regions of enhancing of brightness.In this module, just can the protection barrier be set, i.e. the gain threshold based on colourity of this colourity subregion in these chroma areas that needs protection.That is to say that if when doing saturation in the protected zone of this section and strengthening, the interstage only need be done tiny enhancing, or does not strengthen, and keeps original saturation.Should can be set to max-thresholds as required based on the gain threshold of colourity, as max_gain ' among Fig. 4.Should also can be set to minimum threshold as required based on the gain threshold of 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 the colourity subregion is gained, promptly only need do tiny enhancing, or when not strengthening in this zone.The gain coefficient that will be higher than zone line near the gain coefficient of this colourity subregion internal edge.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 the chromatic component be between another colourity interval, we do in the time of just can strengthening the saturation in this colourity interval with other colourity strengthen different enhancing mode, allow its (saturation S) only to do trickle enhancing or do not strengthen, keep original condition.
Therefore, strengthen respectively, just can adopt different reinforcing coefficient different chromatic components by above-mentioned saturation to each colourity subregion.
(2) based on the gain function generation module 30 of saturation
After the colourity of image is carried out subregion, just need the saturation in this colourity subregion be strengthened.Yet, by the introduction that in the background existing saturation component is strengthened, to the enhancing of saturation component S, need not strengthen as can be known in full section, therefore of the present invention need partly carry out suitable enhancing to the interstage of saturation component S and get final product.Gain function generative process based on the gain function generation module 30 of saturation is as follows.
According to above analysis with saturation component S as can be known; 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 the original character of image on the contrary; make image worse, spectators' vision can not had protective effect, sometimes even can be damage.So, the present invention solves this problem with regard to wanting a way, gain coefficient computing module 30 based on saturation then can be according to the character attribute of saturation component S, design adaptive gain coefficient, also promptly each saturation component S there is a gain coefficient that matches, what reinforced effects then can will be good than with a reinforcing coefficient like this is a lot, and image quality also has the improvement of matter.
See also Fig. 5, in the preferred embodiment of the present invention based on the concrete structure figure of the gain function generation module of saturation.As shown in Figure 5, the gain function generation module 30 based on saturation that provides of this embodiment further comprises: the saturation function memory cell 31 and the second gain function selected cell 32.
Wherein, saturation function memory cell 31, the gain function gain in being used to generate and store between the colourity regulatory region that the user is provided with based on saturation.See also Fig. 6, the schematic diagram that provides for the preferred embodiment of the present invention based on the gain function of saturation.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
1This minimum saturation threshold value s
0With maximum saturation threshold value s
1Can adopt default parameters, perhaps be provided with by the user.When saturation component S original value less than this minimum saturation threshold value s
0Perhaps greater than maximum saturation threshold value s
1The time, when promptly saturation component S original value was just too little or too big originally, again saturation component S is strengthened with regard to there is no need, therefore, minimum saturation threshold value s
0With maximum saturation threshold value s
1Outside the saturation gain coefficient be 0.Minimum saturation threshold value s
0With maximum saturation threshold value s
1Can be provided with neatly to meet the different needs.
Since everyone, so 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, then more acceptant yellow; And especially for Chinese, our vision mechanism then can those more bright-coloured color and lusters of easier selection or the like.According to the reinforced effects wanted, a maximum gain threshold value based on saturation can be set earlier, i.e. maximum gain factor max_gain, this maximum gain factor has then 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
1The gain function of monotonically increasing first based on saturation designed in inside, promptly from minimum saturation threshold value s
0To functional value between a certain median from the 0 oblique line section that rises to default gain threshold max gain based on saturation gradually; The second invariable gain function based on saturation, its functional value is the default gain threshold max gain based on saturation; And the 3rd gain function of monotone decreasing based on saturation, promptly from this median to maximum saturation threshold value s
1Between functional value drop to 0 oblique line section gradually from max gain.Like this, just (as saturation is minimum saturation threshold value s from the lower gain coefficient based on saturation of value
0The time be 0) to the higher gain coefficient based on saturation of value (as saturation for certain median time), perhaps (as saturation is minimum saturation threshold value s to the lower gain coefficient based on saturation of value from the higher gain coefficient based on saturation of value (as saturation for certain median time)
1The time be 0) the enhancing process in added suitable transition, rather than sharply rise or descend, be unlikely to enhancing process to saturation component S and produce inharmoniously, saturation component S strengthened reached good protection effect.
The second gain function selected cell 22 is used for searching the corresponding gain function based on saturation between the colourity regulatory region that the user is provided with from described saturation function memory cell.
Therefore, strengthen by above-mentioned saturation segmentation complete section, make that 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 be provided with, to the corresponding gain coefficient of component two end portions a transition is arranged from the component median, rather than sharply rise or descend, the available segment function is described.Certainly, another benefit of this algorithm is that these parameters can be provided with flexibly.Therefore the carrying out self adaptation to saturation component S and regulate of above-mentioned gain function generation module 30 based on saturation, too big and too little zone is provided with threshold value to saturation component S, strengthens the protection to its whole saturation component S.And in the enhancing process; to from the high value to low value; or added suitable transition the enhancing process from low value to the high value; be unlikely to produce inharmonious to the enhancing process of saturation component S; enhancing has reached good protection effect to saturation component S; so just can make video pictures softer, also the vision to people plays a very good protection.
(3) saturation strengthens module 40
And, as from the foregoing, after saturation component S and chromatic component H are done corresponding analyzing and processing, can produce two corresponding saturation gain functions: gain and gain '.So, strengthen in the module 40 in saturation at last, produce comprehensive gain coefficient, i.e. a gain*gain '.
So, to the final result of the enhancing of color, also be that last saturation component S is:
S′=S*gain*gain′
Like this, just form a color and strengthened management system, can carry out adaptability to the different saturation in the colourity subregions different in the video image strengthens, can manage in the outside of system with different parameters and get final product, and not needing update routine, this also is a characteristic part of the present invention.
See also Fig. 7, be 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 present embodiment provides may further comprise the steps:
At first, in step S1, the view data of importing is transformed into the HSV space from rgb space.The present invention can be transformed into yuv space with the view data of importing from rgb space earlier, re-uses the cordic algorithm it is transformed into the HSV space from yuv space.The function of this step S1 is consistent with the description of function of color-space conversion module 10 in the 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: the functional value monotonic increase is to first gain function based on colourity of default gain threshold based on colourity, functional value second the 3rd gain function based on colourity that begins monotone decreasing from the default gain threshold based on colourity based on the gain function and the functional value of colourity for default gain threshold based on colourity; And first gain function select step, be used to search corresponding gain function between the colourity regulatory region that the user is provided with based on colourity.Description based on the function of the gain function generation module 20 of colourity in the function of step S2 and the device is consistent.
Subsequently, in step S3, between the colourity regulatory region that this user is provided with in, generate 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 the user is provided with; And described gain function based on saturation comprises and is positioned at default minimum saturation threshold value to the maximum saturation threshold range: first the gain function based on saturation of functional value since 0 monotonic increase to default gain threshold based on saturation, functional value for default gain threshold based on saturation second based on the gain function of saturation and functional value the 3rd gain function based on saturation from default gain threshold monotone decreasing to 0 based on saturation; And second gain function select step, be used to search corresponding gain function between the colourity regulatory region that the user is provided with based on saturation.Description based on the function of the gain function generation module 30 of saturation in the function of step S3 and the device is consistent.
At last in step S4, utilize product that saturation is strengthened based on the gain function gain ' of colourity and described gain function gain based on saturation.Be S '=S*gain*gain '.It is consistent that saturation strengthens the description of function of module 40 in step S4 and the device.
In sum, image color intensifier of the present invention and method are by the saturation gain function of the different colourity subregions of employing, and the mode of use transition, make picture softer, avoid the tomography of the transition portion appearance between the colourity, kept the stereovision of picture.Simultaneously in this colourity subregion; be provided with threshold value to the saturation component is too big with too little zone, only the interstage of saturation component partly carried out suitable enhancing, realized protection the saturation component; make video pictures softer, also the vision to people plays a very good protection.
Image color intensifier 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 breaking away 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 break away from its protection range the present invention.Therefore, the present invention is not limited to specific embodiment disclosed herein, and comprises that all drop into the embodiment of claim protection range.