A kind of method of adjustment, device and equipment of image saturation
Technical field
The present invention relates to technical field of image processing, relate in particular to a kind of method of adjustment, device and equipment of image saturation.
Background technology
Saturation refers to the bright-coloured degree of color, also claims the purity of color.Saturation depends on the ratio containing colour content and colour killing composition (grey) in this look.Larger containing colour content, saturation is larger, and color relation is more bright-coloured; The composition of colour killing is simultaneously larger, and saturation is less, and color relation more approaches gray scale.HSV (Hue, Saturation, Value, it is a kind of color space creating according to the characteristic directly perceived of color, also claim hexagonal pyramid model Hexcone Model, in this model, the parameter of color respectively: tone (H), saturation (S), brightness (V)) be one color model more intuitively, in many image editing tools, application is more extensive.Conventionally while RGB image being carried out to saturation adjustment, first convert RGB to HSV, then in HSV space, adjust, after having adjusted, again HSV model conversion is become to RGB model.
But RGB model and HSV model are mutually needing a large amount of calculating in conversion process, and prior art that RGB image is carried out to saturation is often inhomogeneous while adjusting, occur that color is overflowed or fault-layer-phenomenon.
Summary of the invention
The object of the embodiment of the present invention is to propose a kind of method of adjustment of image saturation, be intended to solve prior art RGB model and HSV model large in mutual conversion calculations amount, and prior art to RGB image carry out saturation adjust time inhomogeneous, occur that color is overflowed or the problem of fault-layer-phenomenon.
The embodiment of the present invention is achieved in that a kind of method of adjustment of image saturation, said method comprising the steps of:
Obtain pending image A;
If A (i, j)
rfor (i, j) some pixel red color component value of A, A (i, j)
gfor (i, j) some pixel green component values of A, A (i, j)
bfor (i, j) some pixel blue component value of A; I represents that pixel is positioned at the row-coordinate of present image; J represents that pixel is positioned at the row coordinate of present image;
RGB component to image A is processed, and obtains image B;
Concrete processing method is as follows:
If M=max{A (i, j)
r, A (i, j)
g, A (i, j)
b, m=min{A (i, j)
r, A (i, j)
g, A (i, j)
b}
If M=A (i, j)
r, image B assignment by the following method:
If M=A (i, j)
g, image B assignment by the following method:
If M=A (i, j)
b, image B assignment by the following method:
Wherein: B (i, j)
rfor (i, j) some pixel red color component value of B, B (i, j)
gfor (i, j) some pixel green component values of B, B (i, j)
bfor (i, j) some pixel blue component value of B; α is the adjustment parameter of [1,1];
Output image B.
Another object of the embodiment of the present invention is to propose a kind of adjusting device of image saturation, and described device comprises:
Image collection module, for obtaining pending image A;
Component processing module, processes for the RGB component to image A, obtains image B;
Described component processing module further comprises and module is set and judges assignment module,
Module is set, for M=max{A (i, j) is set
r, A (i, j)
g, A (i, j)
b,
m=min{A(i,j)
R,A(i,j)
G,A(i,j)
B};
Wherein, A (i, j)
rfor (i, j) some pixel red color component value of A, A (i, j)
gfor (i, j) some pixel green component values of A, A (i, j)
bfor (i, j) some pixel blue component value of A; I represents that pixel is positioned at the row-coordinate of present image; J represents that pixel is positioned at the row coordinate of present image;
Judge assignment module, for judgement
If M=A (i, j)
r, image B assignment by the following method:
If M=A (i, j)
g, image B assignment by the following method:
If M=A (i, j)
b, image B assignment by the following method:
Wherein: B (i, j)
rfor (i, j) some pixel red color component value of B, B (i, j)
gfor (i, j) some pixel green component values of B, B (i, j)
bfor (i, j) some pixel blue component value of B; α is the adjustment parameter of [1,1];
Image output module, for output image B.
The 3rd object of the embodiment of the present invention is to propose a kind of equipment of the adjusting device that comprises described image saturation.
Beneficial effect of the present invention
The present invention is by rgb space, utilizing a coefficient freely to adjust saturation measures, do not need model conversion, thereby minimizing amount of calculation, and after the inventive method processing image, there is no distortion, color transition is smooth, adjust very evenly, there will not be color too saturated (or gray processing) and occur the phenomenon that color is overflowed, avoided part picture color fault-layer-phenomenon with this.Be more suitable for eye-observation, there is higher picture quality, meet real-time video application, also can, in shooting, in electronic image signal system, apply.
Brief description of the drawings
Fig. 1 is the method for adjustment flow chart of a kind of image saturation of the preferred embodiment of the present invention;
Fig. 2 is the adjusting device structure chart of a kind of image saturation of the preferred embodiment of the present invention.
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, for convenience of explanation, only show 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.
The embodiment of the present invention is by rgb space, utilizing a coefficient freely to adjust saturation measures, do not need model conversion, thereby minimizing amount of calculation, and after the processing of the embodiment of the present invention method image, there is no distortion, color transition is smooth, adjust very evenly, there will not be color too saturated (or gray processing) and occur the phenomenon that color is overflowed, avoided part picture color fault-layer-phenomenon with this.Be more suitable for eye-observation, there is higher picture quality, meet real-time video application, also can, in shooting, in electronic image signal system, apply.
Embodiment mono-
Fig. 1 is the method for adjustment flow chart of a kind of image saturation of the preferred embodiment of the present invention; Said method comprising the steps of:
S101, obtains pending image A;
If A (i, j)
rfor (i, j) some pixel red color component value of A, A (i, j)
gfor (i, j) some pixel green component values of A, A (i, j)
bfor (i, j) some pixel blue component value of A; I represents that pixel is positioned at the row-coordinate of present image; J represents that pixel is positioned at the row coordinate of present image;
S102, processes the RGB component of image A, obtains image B;
Concrete processing method is as follows:
If M=max{A (i, j)
r, A (i, j)
g, A (i, j)
b, m=min{A (i, j)
r, A (i, j)
g, A (i, j)
b}
If M=A (i, j)
r, image B assignment by the following method:
If M=A (i, j) is G, image B assignment by the following method:
If M=A (i, j)
b, image B assignment by the following method:
Wherein: B (i, j)
rfor (i, j) some pixel red color component value of B, B (i, j)
gfor (i, j) some pixel green component values of B, B (i, j)
bfor (i, j) some pixel blue component value of B;
α is the adjustment parameter of [1,1]; When α >0, saturation strengthens operation, and when α <0, saturation weakens operation.
S103, output image B.
Embodiment bis-
Fig. 2 is the adjusting device structure chart of a kind of image saturation of the preferred embodiment of the present invention, and described device comprises:
Image collection module, for obtaining pending image A;
Component processing module, processes for the RGB component to image A, obtains image B;
Described component processing module further comprises and module is set and judges assignment module,
Module is set, for M=max{A (i, j) is set
r, A (i, j)
g, A (i, j)
b,
m=min{A(i,j)
R,A(i,j)
G,A(i,j)
B};
Wherein, A (i, j)
rfor (i, j) some pixel red color component value of A, A (i, j)
gfor (i, j) some pixel green component values of A, A (i, j)
bfor (i, j) some pixel blue component value of A; I represents that pixel is positioned at the row-coordinate of present image; J represents that pixel is positioned at the row coordinate of present image;
Judge assignment module, for judgement
If M=A (i, j)
r, image B assignment by the following method:
If M=A (i, j)
g, image B assignment by the following method:
If M=A (i, j)
b, image B assignment by the following method:
Wherein: B (i, j)
rfor (i, j) some pixel red color component value of B, B (i, j)
gfor (i, j) some pixel green component values of B, B (i, j)
bfor (i, j) some pixel blue component value of B;
α is the adjustment parameter of [1,1]; When α >0, saturation strengthens operation, and when α <0, saturation weakens operation.
Image output module, for output image B.
Those having ordinary skill in the art will appreciate that, the all or part of step realizing in above-described embodiment method can complete by program command 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 of doing within the spirit and principles in the present invention, be equal to and replace and improvement etc., within all should being included in protection scope of the present invention.