Summary of the invention
For solving the problems of the technologies described above, the object of the present invention is to provide a kind of image processing method of eliminating false contouring, by changing the spatial distribution of color value, the color value that utilizes the vision average characteristics of human eye to produce to make new advances is with the false contouring in removal of images.
Corresponding described method, another object of the present invention is to provide a kind of image processing apparatus of eliminating false contouring.
One of for achieving the above object, a kind of image processing method of eliminating false contouring provided by the invention, comprise the steps:
Detect the false contouring pixel of each the corresponding certain pixel value that belongs to false contouring;
Spatial distribution by changing pixel value is to eliminate false contouring.
As a further improvement on the present invention, the detection of described false contouring pixel specifically comprises the following steps:
Set a configurable judgment threshold;
Calculate each Grad of pixel to be detected;
Ask absolute value corresponding to each Grad, relatively draw maximum value;
Whether judge described maximum value less than described judgment threshold, if described pixel to be detected is the false contouring pixel; If not, described pixel to be detected is non-false contouring pixel;
As a further improvement on the present invention, described Grad comprises vertical gradient, horizontal gradient, left diagonal angle gradient and right diagonal angle gradient.
As a further improvement on the present invention, the method need to determine that one comprises described false contouring pixel neighborhood of a point, described field is divided into the first area with first color value by false contouring and has the second area of the second color value, the step that difference Step between described the first color value and the second color value is a configurable value, described " spatial distribution by changing pixel value is to eliminate false contouring " specifically comprises the steps:
Get respectively k=0 ,+Step ,-Step, put pixel value around calculating and equal the pixel number p (k) of current some pixel value;
Get respectively k=0 ,+Step ,-Step, according to formula
Calculate probable value corresponding to different values;
Obtain random number r at random between interval [0,1];
, according to obtained random number r and the comparison of described probable value, determine the output pixel value that will export.
As a further improvement on the present invention, the step of described ", according to obtained random number r and the comparison of described probable value, determining the output pixel that will export " is specially:
If r<p ' (0), output pixel value is input pixel value;
If p ' (0)≤r<p ' (+Step), output pixel value be input pixel value and Step and;
If other situations, output pixel value is the poor of input pixel value and Step.
One of for achieving the above object, a kind of image processing apparatus of eliminating false contouring provided by the invention, described device comprises:
The false contouring detecting unit, for detection of false contouring pixel of each the corresponding certain pixel value that goes out to belong to false contouring;
False contouring is eliminated unit, is used for passing through to change the spatial distribution of pixel value to eliminate false contouring.
As a further improvement on the present invention, described false contouring detecting unit specifically is used for:
Set a configurable judgment threshold;
Calculate each Grad of pixel to be detected;
Ask absolute value corresponding to each Grad, relatively draw maximum value;
Whether judge described maximum value less than described judgment threshold, if described pixel to be detected is the false contouring pixel; If not, described pixel to be detected is non-false contouring pixel;
As a further improvement on the present invention, described Grad comprises vertical gradient, horizontal gradient, left diagonal angle gradient and right diagonal angle gradient.
As a further improvement on the present invention, this device needs to determine that one comprises described false contouring pixel neighborhood of a point, described field is divided into the first area with first color value by false contouring and has the second area of the second color value, difference Step between described the first color value and the second color value is a configurable value, and described false contouring is eliminated unit and specifically comprised with lower unit:
The probability calculation unit, be used for getting respectively k=0 ,+Step ,-Step, put pixel value around calculating and equal the pixel number p (k) of current some pixel value;
The ratio computing unit, be used for getting respectively k=0,
Calculate probable value corresponding to different values according to formula;
Output unit, be used for obtaining random number r at random between interval [0,1], according to obtained random number r and the comparison of described probable value, the definite output pixel value that will export.
As a further improvement on the present invention, described output unit specifically is used for:
If r<p ' (0), output pixel value is input pixel value;
If p ' (0)≤r<p ' (+Step), output pixel value be input pixel value and Step and;
If other situations, output pixel value is the poor of input pixel value and Step.
Compared with prior art, the invention has the beneficial effects as follows: the present invention is by changing the spatial distribution of color value, utilize the vision average characteristics of human eye to produce " new color value " with the false contouring in removal of images, can not lose the details of image when eliminating false contouring, can not increase extra noise yet, and it is dark not need to increase position, and then has greatly saved hardware resource.
Embodiment
Describe the present invention below with reference to embodiment shown in the drawings.But these execution modes do not limit the present invention, and the conversion on the structure that those of ordinary skill in the art makes according to these execution modes, method or function all is included in protection scope of the present invention.
Referring to Fig. 4, in an embodiment of the present invention, the image processing method of shown elimination false contouring comprises inspection false contouring and two steps of elimination false contouring, particularly:
The method comprises the following steps:
S1, detect false contouring pixel of each the corresponding certain pixel value that belongs to false contouring;
So each pixel to false contouring, the distribution of color that we apply based on neighborhood around it produces shake, eliminate this false contouring, so must draw by detection the position at false contouring place before eliminating false contouring, so, in the present invention, just in the zone that false contouring is arranged, just can do the processing of eliminating false contouring, inoperative in other zones.
as shown in Figure 5, at first the present invention needs to determine that one comprises described false contouring pixel neighborhood of a point, described field is divided into the first area with first color value by false contouring and has the second area of the second color value, suppose R (x, y) be pixel (x, y) neighborhood, false contouring is divided into 2 parts to this neighborhood: a part is for having the first area of the first color value c, another part is the second area with second color value c+step, (step is a configurable value, such as 1, 2 etc.), at this neighborhood R (x, y) in, the appearance color value is that the probability of c is p, and occur that color value is that the probability of c+step is 1-p.In order to eliminate or to reduce false contouring, color value should little by little change to c+step from c from top to bottom, rather than suddenly from c, changes to c+step.Yet we are any median between c and c+step not.But, human eye has the average visual characteristic of neighborhood around certain, utilize the average characteristics of human eye vision, can produce the effect of median between c and c+step,, by changing the spatial distribution of c and these two color values of c+step, utilize the vision average characteristics of human eye to produce the effect of the median between c and c+step.
So, continue referring to Fig. 4, in the present embodiment, step S1 specifically comprises the steps to realize the detection of false contouring:
S11, setting one configurable judgment threshold;
Each Grad of S12, calculating pixel to be detected;
Wherein, Grad refers to: vertical gradient, horizontal gradient, left diagonal angle gradient and right diagonal angle gradient.
For example, as shown in Figure 6 and Figure 7, vertical gradient Grad and horizontal gradient Grad X=a-d+b-e+c-f, wherein a, b, c, d, e, f are respectively the value with the directions X of 6 adjacent pixels of this pixel (x, y).
S13, ask absolute value corresponding to each Grad, relatively draw maximum value;
S14, whether judge described maximum value less than described judgment threshold, if described pixel to be detected is false contouring pixel (step S15); If not, described pixel to be detected is non-false contouring pixel (step S16).
Be formulated and be:
Wherein:
X, y are abscissa and the ordinates of pixel (x, y), the field of R (x, y) expression pixel (x, y),
The expression gradient, abs represents to ask absolute value, and Th is the threshold value of the absolute value of gradient, is a configurable parameter.
S2, the spatial distribution by changing pixel value are to eliminate false contouring.In the present embodiment, the method for the elimination of false contouring is to produce some new pixel values (for example in precedent, increase some pixel values of 2,5,7,10 etc. on false contouring, it is seamlessly transitted) on false contouring.
Described step S2 specifically comprises the steps:
S21, respectively get k=0 ,+Step ,-Step, put pixel value around calculating and equal current point
The pixel number p (k) of pixel value;
Be shown with the calculating formula table:
Wherein, get k=0 ,+step ,-step,
Wherein I represents input picture,
S22, respectively get k=0 ,+Step ,-Step, according to formula
Calculate probable value corresponding to different values;
In this step, suppose to calculate p (0)=a, p (step)=b, p (+step)=c
When k=0, p ' (0)=a/ (a+b+c);
When k=-step, p ' (step)=b/ (a+b+c);
When k=+step, p ' (+step)=c/ (a+b+c).
S23, obtain random number r at random between interval [0,1], preferably, random number r is equally distributed between interval [0,1].
S24, according to obtained random number r and the comparison of described probable value, determine the output pixel value that will export.
This step is specially: if r<p ' (0), output pixel value is input pixel value;
If p ' (0)≤r<p ' (+Step), output pixel value be input pixel value and Step and;
If other situations, output pixel value is the poor of input pixel value and Step.
Be formulated and be:
Wherein, O (x, y) is the pixel value of output.
See also Fig. 8 and shown in Figure 9, Fig. 8 is the state of image before eliminating, and Fig. 9 is the state of image after eliminating.Spatial distribution by changing false contouring (namely produce between two pixel values (color value) new pixel value go forward side by side line output), to have reached the elimination purpose of false contouring.
Next, introduce the device of eliminating false contouring in an embodiment of the present invention in connection with Figure 10, it comprises with lower unit:
False contouring detecting unit 10, for detection of false contouring pixel of each the corresponding certain pixel value that goes out to belong to false contouring;
So each pixel to false contouring, the distribution of color that we apply based on neighborhood around it produces shake, eliminate this false contouring, so must draw by detection the position at false contouring place before eliminating false contouring, so, in the present invention, just in the zone that false contouring is arranged, just can do the processing of eliminating false contouring, inoperative in other zones.
as shown in Figure 5, at first the present invention needs to determine that one comprises described false contouring pixel neighborhood of a point, described field is divided into the first area with first color value by false contouring and has the second area of the second color value, suppose R (x, y) be pixel (x, y) neighborhood, false contouring is divided into 2 parts to this neighborhood: a part is for having the first area of the first color value c, another part is the second area with second color value c+step, (step is a configurable value, such as 1, 2 etc.), at this neighborhood R (x, y) in, the appearance color value is that the probability of c is p, and occur that color value is that the probability of c+step is 1-p.In order to eliminate or to reduce false contouring, color value should little by little change to c+step from c from top to bottom, rather than suddenly from c, changes to c+step.Yet we are any median between c and c+step not.But, human eye has the average visual characteristic of neighborhood around certain, utilize the average characteristics of human eye vision, can produce the effect of median between c and c+step,, by changing the spatial distribution of c and these two color values of c+step, utilize the vision average characteristics of human eye to produce the effect of the median between c and c+step.
So in the present embodiment, false contouring detecting unit 10 specifically is used for:
Set a configurable judgment threshold;
Calculate each Grad of pixel to be detected;
Wherein, Grad refers to: vertical gradient, horizontal gradient, left diagonal angle gradient and right diagonal angle gradient.
For example, as shown in Figure 6 and Figure 7, vertical gradient Grad and horizontal gradient Grad X=a-d+b-e+c-f, wherein a, b, c, d, e, f are respectively the value with the directions X of 6 adjacent pixels of this pixel (x, y).
Ask absolute value corresponding to each Grad, relatively draw maximum value;
Whether judge described maximum value less than described judgment threshold, if described pixel to be detected is the false contouring pixel; If not, described pixel to be detected is non-false contouring pixel.
Be formulated and be:
Wherein:
X, y are abscissa and the ordinates of pixel (x, y), the field of R (x, y) expression pixel (x, y),
The expression gradient, abs represents to ask absolute value, and Th is the threshold value of the absolute value of gradient, is a configurable parameter.
False contouring is eliminated unit 20, is used for passing through to change the spatial distribution of pixel value to eliminate false contouring.In the present embodiment, the method for the elimination of false contouring is to produce some new pixel values (for example in precedent, increase some pixel values of 2,5,7,10 etc. on false contouring, it is seamlessly transitted) on false contouring.
False contouring is eliminated unit 20 and is comprised that specifically following each unit realizes the elimination of false contouring:
At first, probability calculation unit 201, be used for getting respectively k=0 ,+Step ,-Step, put pixel value around calculating and equal the pixel number p (k) of current some pixel value;
Be shown with the calculating formula table:
Wherein, get k=0 ,+step ,-step,
Wherein I represents input picture (pixel value),
Moreover, ratio computing unit 202, this element be used for getting respectively k=0 ,+Step ,-Step,
According to formula
Calculate probable value corresponding to different values;
Suppose to calculate p (0)=a, p (step)=b, p (+step)=c
When k=0, p ' (0)=a/ (a+b+c);
When k=-step, p ' (step)=b/ (a+b+c);
When k=+step, p ' (+step)=c/ (a+b+c).
Output unit 203, be used for obtaining random number r at random between interval [0,1], preferably, random number r is equally distributed between interval [0,1].
, according to obtained random number r and the comparison of described probable value, determine the output pixel value that will export.
Wherein, if r<p ' (0), output pixel value is input pixel value;
If p ' (0)≤r<p ' (+Step), output pixel value be input pixel value and Step and;
If other situations, output pixel value is the poor of input pixel value and Step.
Be formulated and be:
Wherein, O (x, y) is the pixel value of output.
Compared with prior art, the invention has the beneficial effects as follows: adaptivity: just in the zone that false contouring is arranged, just can do the processing of eliminating false contouring, inoperative in other zones; Therefore, not only can eliminate false contouring, and can not lose the details of image, also can not increase extra noise (particularly at flat site); Moreover the present invention does not need to increase that position is dark just can eliminate false contouring; This can save hardware resource greatly.
Device embodiments described above is only schematic, wherein said unit as the separating component explanation can or can not be also physically to separate, the parts that show as unit can be or can not be also physical locations, namely can be positioned at a place, perhaps also can be distributed on a plurality of network element.Can select according to the actual needs wherein some or all of module to realize the purpose of present embodiment scheme.Those of ordinary skills in the situation that do not pay creative work, namely can understand and implement.
, for the convenience of describing, be divided into various unit with function while describing above device and describe respectively.Certainly, can realize the function of each unit in same or a plurality of softwares and/or hardware when implementing the application.
As seen through the above description of the embodiments, those skilled in the art can be well understood to the application and can realize by the mode that software adds essential general hardware platform.Based on such understanding, the part that the application's technical scheme contributes to prior art in essence in other words can embody with the form of software product, this computer software product can be stored in storage medium, as ROM/RAM, magnetic disc, CD etc., comprise that some instructions are with so that a computer equipment (can be personal computer, server, the perhaps network equipment etc.) carry out the described method of some part of each execution mode of the application or execution mode.
Device embodiments described above is only schematic, wherein said unit as the separating component explanation can or can not be also physically to separate, the parts that show as unit can be or can not be also physical locations, namely can be positioned at a place, perhaps also can be distributed on a plurality of network element.Can select according to the actual needs wherein some or all of module to realize the purpose of present embodiment scheme.Those of ordinary skills in the situation that do not pay creative work, namely can understand and implement.
The application can be used in numerous general or special purpose computingasystem environment or configuration.For example: personal computer, server computer, handheld device or portable set, plate equipment, multicomputer system, the system based on microprocessor, set top box, programmable consumer-elcetronics devices, network PC, minicom, mainframe computer, comprise distributed computing environment (DCE) of above any system or equipment etc.
The application can describe in the general context of the computer executable instructions of being carried out by computer, for example program module.Usually, program module comprises the routine carrying out particular task or realize particular abstract data type, program, object, assembly, data structure etc.Also can put into practice the application in distributed computing environment (DCE), in these distributed computing environment (DCE), by the teleprocessing equipment that is connected by communication network, be executed the task.In distributed computing environment (DCE), program module can be arranged in the local and remote computer-readable storage medium that comprises memory device.
Be to be understood that, although this specification is described according to execution mode, but not each execution mode only comprises an independently technical scheme, this narrating mode of specification is only for clarity sake, those skilled in the art should make specification as a whole, technical scheme in each execution mode also can, through appropriate combination, form other execution modes that it will be appreciated by those skilled in the art that.
Above listed a series of detailed description is only illustrating for feasibility execution mode of the present invention; they are not in order to limit the scope of the invention, all disengaging within equivalent execution mode that skill spirit of the present invention does or change all should be included in protection scope of the present invention.