Process the method and apparatus of image
Technical field
The present invention relates to image processing techniques, particularly relate to a kind of method and apparatus processing image.
Background technology
The method at existing process image edge has following several: the first is that neighbor (pixel) is poor
Value method, the second is spaced pixels differential technique, and the third is by poor to Difference of Adjacent Pixels method and spaced pixels
The simple superposition of value method.First method is used to can be good at processing the high frequency detail of black white image, but
It is that the details to coloured image but can produce sawtooth class problem;Second method is used to can be good at processing
The details of coloured image, but the high frequency detail of black white image can be produced trellis class problem;Use the 3rd
The method of kind solves sawtooth class problem and the trellis class problem of image well.
In prior art, when processing image, one way in which can be taked at random to process, so
Perhaps suitable method can not be chosen to process image, so that the image validity after Chu Liing reduces.
Summary of the invention
The present invention provides a kind of method and apparatus processing image, to avoid process figure in prior art as far as possible
As time owing to randomly selecting the problem that processing mode causes image validity to reduce.
First aspect of the present invention provides a kind of method processing image, including:
The first gradient calculation method is used to obtain the first horizontal gradient and first vertical gradient of image;
The second gradient calculation method is used to obtain the second horizontal gradient and second vertical gradient of described image;
According to preset rules, described first horizontal gradient, described first vertical gradient, described second level
Gradient and described second vertical gradient, obtain terminal level's gradient of described image and final vertical gradient.
In the implementation that the first is possible, according to first aspect, described according to preset rules, described
First horizontal gradient, described first vertical gradient, described second horizontal gradient and described second vertical gradient,
Obtain terminal level's gradient of described image and final vertical gradient, including:
Maximum as first using in described first horizontal gradient and the first vertical gradient one of maximum absolute value
Gradient, another is as the first minimal gradient;
Maximum as second using in described second horizontal gradient and the second vertical gradient one of maximum absolute value
Gradient, another is as the second minimal gradient;
When the absolute value of described first greatest gradient is more than with the product of the absolute value of described second minimal gradient
When the absolute value of described second greatest gradient and the product of the absolute value of described second minimal gradient, by described
First horizontal gradient as described terminal level's gradient, and using described first vertical gradient as described
Whole vertical gradient;
When the absolute value of described first greatest gradient is less than with the product of the absolute value of described second minimal gradient
When the absolute value of described second greatest gradient and the product of the absolute value of described second minimal gradient, by described
Second horizontal gradient as described terminal level's gradient, and using described second vertical gradient as described
Whole vertical gradient;
When the absolute value of described first greatest gradient is equal to the product of the absolute value of described second minimal gradient
When the absolute value of described second greatest gradient and the product of the absolute value of described second minimal gradient, by described
The meansigma methods of the first horizontal gradient and the second horizontal gradient is as described terminal level's gradient, and by described
The meansigma methods of the first vertical gradient and the second vertical gradient is as described final vertical gradient.
In the implementation that the second is possible, according to first aspect, described according to preset rules, described
First horizontal gradient, described first vertical gradient, described second horizontal gradient and described second vertical gradient,
Obtain terminal level's gradient of described image and final vertical gradient, including:
Maximum as first using in described first horizontal gradient and the first vertical gradient one of maximum absolute value
Gradient, another is as the first minimal gradient;
Maximum as second using in described second horizontal gradient and the second vertical gradient one of maximum absolute value
Gradient, another is as the second minimal gradient;
According to equation below acquisition weighted value:
Weighted value=(absolute value of absolute value × the second minimal gradient of the first greatest gradient)/(first
Absolute value × the first of absolute value+the second greatest gradient of absolute value × the second minimal gradient of big gradient is
The absolute value of little gradient);
According to weighted value and terminal level's gradient of the equation below described image of acquisition and final vertical gradient:
Described terminal level gradient=the first horizontal gradient × weighted value the+the second horizontal gradient × (1-weight
Value);
Described final vertical gradient=the first vertical gradient × weighted value the+the second vertical gradient × (1-weight
Value).
In the implementation that the third is possible, according to first aspect or implementation that the first is possible or
The implementation that the second is possible, it is characterised in that obtaining terminal level's gradient and of described image
After whole vertical gradient, also include:
Use described terminal level's gradient and described final vertical gradient that described image is processed.
Second aspect of the present invention provides a kind of device processing image, including:
First acquiring unit, for use first gradient calculation method obtain image the first horizontal gradient and
First vertical gradient;
Second acquisition unit, for using the second gradient calculation method to obtain the second horizontal ladder of described image
Degree and the second vertical gradient;
3rd acquiring unit, for according to preset rules, described first horizontal gradient, described first vertical
Gradient, described second horizontal gradient and described second vertical gradient, obtain terminal level's ladder of described image
Degree and final vertical gradient.
In the implementation that the first is possible, according to second aspect, described 3rd acquiring unit is specifically used
In:
Maximum as first using in described first horizontal gradient and the first vertical gradient one of maximum absolute value
Gradient, another is as the first minimal gradient;
Maximum as second using in described second horizontal gradient and the second vertical gradient one of maximum absolute value
Gradient, another is as the second minimal gradient;
When the absolute value of described first greatest gradient is more than with the product of the absolute value of described second minimal gradient
When the absolute value of described second greatest gradient and the product of the absolute value of described second minimal gradient, by described
First horizontal gradient as described terminal level's gradient, and using described first vertical gradient as described
Whole vertical gradient;
When the absolute value of described first greatest gradient is less than with the product of the absolute value of described second minimal gradient
When the absolute value of described second greatest gradient and the product of the absolute value of described second minimal gradient, by described
Second horizontal gradient as described terminal level's gradient, and using described second vertical gradient as described
Whole vertical gradient;
When the absolute value of described first greatest gradient is equal to the product of the absolute value of described second minimal gradient
When the absolute value of described second greatest gradient and the product of the absolute value of described second minimal gradient, by described
The meansigma methods of the first horizontal gradient and the second horizontal gradient is as described terminal level's gradient, and by described
The meansigma methods of the first vertical gradient and the second vertical gradient is as described final vertical gradient.
In the implementation that the second is possible, according to second aspect, described 3rd acquiring unit is specifically used
In:
Maximum as first using in described first horizontal gradient and the first vertical gradient one of maximum absolute value
Gradient, another is as the first minimal gradient;
Maximum as second using in described second horizontal gradient and the second vertical gradient one of maximum absolute value
Gradient, another is as the second minimal gradient;
According to equation below acquisition weighted value:
Weighted value=(absolute value of absolute value × the second minimal gradient of the first greatest gradient)/(first
Absolute value × the first of absolute value+the second greatest gradient of absolute value × the second minimal gradient of big gradient is
The absolute value of little gradient);
According to weighted value and terminal level's gradient of the equation below described image of acquisition and final vertical gradient:
Described terminal level gradient=the first horizontal gradient × weighted value the+the second horizontal gradient × (1-weight
Value);
Described final vertical gradient=the first vertical gradient × weighted value the+the second vertical gradient × (1-weight
Value).
In the implementation that the third is possible, according to second aspect or implementation that the first is possible or
The implementation that the second is possible, also includes:
Processing unit, is used for using described terminal level's gradient and described final vertical gradient to described image
Process.
As shown from the above technical solution, the method and apparatus processing image that the present invention provides, by combining
Multiple gradient algorithm obtains terminal level's gradient and final vertical gradient, uses this terminal level's gradient and
Image is normalized by whole vertical gradient, it is possible to increase the verity of the image after process, more
Reduce original image truly.
Accompanying drawing explanation
In order to be illustrated more clearly that the embodiment of the present invention or technical scheme of the prior art, below will be to reality
Execute the required accompanying drawing used in example or description of the prior art to be briefly described, it should be apparent that under,
Accompanying drawing during face describes is some embodiments of the present invention, for those of ordinary skill in the art,
On the premise of not paying creative work, it is also possible to obtain other accompanying drawing according to these accompanying drawings.
Figure 1A is the schematic flow sheet of the method processing image according to one embodiment of the invention;
Figure 1B is the schematic diagram of differential technique;
Fig. 2 is the schematic flow sheet of the method processing image according to another embodiment of the present invention;
Fig. 3 is the schematic flow sheet of the method processing image according to further embodiment of this invention;
Fig. 4 is the structural representation of the device processing image according to yet another embodiment of the invention;
Fig. 5 is the structural representation of the device processing image according to another embodiment of the present invention;
Fig. 6 is the structural representation of the device processing image according to further embodiment of this invention.
Detailed description of the invention
For making the purpose of the embodiment of the present invention, technical scheme and advantage clearer, below in conjunction with this
Accompanying drawing in bright embodiment, is clearly and completely described the technical scheme in the embodiment of the present invention,
Obviously, described embodiment is a part of embodiment of the present invention rather than whole embodiments.Based on
Embodiment in the present invention, those of ordinary skill in the art are obtained under not making creative work premise
The every other embodiment obtained, broadly falls into the scope of protection of the invention.
Embodiment one
The present embodiment provides a kind of method processing image, for processing, the edge of image to carry
The validity of hi-vision.The executive agent of the method processing image of the present embodiment is the device processing image.
As shown in Figure 1A, for the schematic flow sheet of the method processing image according to the present embodiment.
Step 101, uses the first gradient calculation method to obtain the first horizontal gradient of image and first vertical
Gradient.
First gradient calculation method can be arbitrary in Difference of Adjacent Pixels method and spaced pixels differential technique
Kind, it is also possible to it is by Difference of Adjacent Pixels method and spaced pixels differential technique simple superposition.Specifically how to use
First horizontal gradient and first vertical gradient of the first gradient algorithm acquisition image belong to prior art, at this
Repeat no more.
Specifically, as shown in Figure 1B, Difference of Adjacent Pixels method is:
Absolute value Grad_H=| Z20-Z21 |+| Z21-Z22 |+| Z22-Z23 |+| Z23-Z24 | of horizontal gradient
Absolute value Grad_V=| Z02-Z12 |+| Z12-Z22 |+| Z22-Z32 |+| Z32-Z42 | of vertical gradient
Spaced pixels differential technique is:
Absolute value Grad_H=| Z20-Z22 |+| Z21-Z23 |+| Z22-Z24 | of horizontal gradient
Absolute value Grad_V=| Z02-Z22 |+| Z12-Z32 |+| Z22-Z42 | of vertical gradient
By the concrete mode of Difference of Adjacent Pixels method and spaced pixels differential technique simple superposition it is:
Grad_H=|Z20-Z21|+|Z21-Z22|+|Z22-Z23|+|Z23-Z24|+|Z20-Z22|+|Z21-
Z23|+|Z22-Z24|
Grad_V=|Z02-Z12|+|Z12-Z22|+|Z22-Z32|+|Z32-Z42|+|Z02-Z22|+|Z12-
Z32|+|Z22-Z42|
Step 102, uses the second gradient calculation method to obtain the second horizontal gradient of image and second vertical
Gradient.
Second gradient algorithm be equally the first gradient calculation method can be Difference of Adjacent Pixels method and
Any one in pixel value difference method, it is also possible to be by Difference of Adjacent Pixels method and the letter of spaced pixels differential technique
Single superposition.But this second gradient calculation method need to be different from the first gradient calculation method.Such as, when
When one gradient calculation method is Difference of Adjacent Pixels method, the second gradient calculation method can be that spaced pixels is poor
Value method;When the first gradient calculation method is spaced pixels differential technique, the second gradient calculation method can be
Difference of Adjacent Pixels method.
Step 103, according to preset rules, the first horizontal gradient, the first vertical gradient, the second horizontal ladder
Degree and the second vertical gradient, obtain terminal level's gradient of image and final vertical gradient.
Process image device can by combine multiple gradient algorithm obtain image terminal level's gradient and
Final vertical gradient, then uses this terminal level's gradient and final vertical gradient to process image.
According to the method processing image of the present embodiment, obtain terminal level by combining multiple gradient algorithm
Gradient and final vertical gradient, use this terminal level's gradient and final vertical gradient to process image,
The verity of the image after process can be improved, reduce original image the most truly.
Embodiment two
The present embodiment provides a kind of method processing image based on embodiment one.
As in figure 2 it is shown, be the schematic flow sheet of the method processing image according to the present embodiment.
Step 201, uses the first gradient algorithm to obtain the first horizontal gradient and first vertical gradient of image.
In the present embodiment, the device processing image uses Difference of Adjacent Pixels method to obtain the first level of image
Gradient and the first vertical gradient.
Step 202, uses the second gradient calculation method to obtain the second horizontal gradient of image and second vertical
Gradient.
In the present embodiment, the device processing image uses spaced pixels differential technique to obtain the second level of image
Gradient and the second vertical gradient.
Step 203, using in the first horizontal gradient and the first vertical gradient one of maximum absolute value as
One greatest gradient T1_MAX, another is as the first minimal gradient T1_MIN.
Step 204, using in the second horizontal gradient and the second vertical gradient one of maximum absolute value as
Two greatest gradient T2_MAX, another is as the second minimal gradient T2_MIN.
Step 205, as | T1_MAX | × | T2_MIN | > | T1_MIN | × | T2_MAX |, by the first water
Flat gradient is as terminal level's gradient, and using the first vertical gradient as final vertical gradient;When
During | T1_MAX | × | T2_MIN | < | T1_MIN | × | T2_MAX |, using the second horizontal gradient as final water
Flat gradient, and using the second vertical gradient as final vertical gradient;When | T1_MAX | ×
During | T2_MIN |==| T1_MIN | × | T2_MAX |, average by the first horizontal gradient and the second horizontal gradient
Value is as terminal level's gradient, and using the meansigma methods of the first vertical gradient and the second vertical gradient as
Whole vertical gradient.
Step 206, uses terminal level's gradient and final vertical gradient to process image.
This process can be specifically that filtering and noise reduction processes, for example with terminal level's gradient and final vertical ladder
Image can be added by degree in the sample value average of horizontal direction and the sample average of vertical direction of current point
Weight average, tries to achieve the final weighted mean of current point, so that image is truer.It is assumed that horizontal direction
Weights be Hweight, the weights of vertical direction are Vweight, the level side of current point (Green)
To sample average be H_SamplesAverage, the sample standard deviation of the vertical direction of current point (Green)
Value is V_SamplesAverage, then:
Hweight=Grad_V*Grad_V
Vweight=Grad_H*Grad_H
Filtering and noise reduction result is (H_SamplesAverage*Hweight+V_SamplesAverage
*Vweight)/(Hweight+Vweight)
This process can also is that image enhancement processing.Specifically, terminal level's gradient is compared vertical with final
The absolute value of gradient, and obtain the second order Grad on that direction of wherein maximum absolute value, then should
Second order Grad zooms in and out according to preset ratio and is added to afterwards on the original value of picture point, to improve figure
Picture element amount.Assume the original value of picture point be Original_C, Hgrad be terminal level's gradient, Vgrad
For final vertical gradient, Adjustable_Weight is the configuration parameter of manually adjustable size,
Sharpen_Metric is for strengthening metric, and Sharpened_C is enhanced value, then:
If | Hgrad | > | Vgrad |, make Sharpen_Metric=Grad_H*Adjustable_Weight
Otherwise, Sharpen_Metric=Vgrad*Adjustable_Weight is made
Sharpened_C=Original_C+Sharpen_Metric。
It is, of course, also possible to terminal level's gradient and the final vertical gradient of the present embodiment are applied to inverse Marseille
Gram conversion (Demosaicing) in.It is assumed that the weights of horizontal direction are Hweight, vertical direction
Weights are Vweight, and current point is that in horizontal direction, Green channel sample is equal for Green, H_GsubB
Value deducts the difference obtained by Blue channel sample average, and V_GsubB is Green passage in vertical direction
Sample average deducts the difference obtained by Blue channel sample average, and Esti_GsubB is Green passage
Value deducts the difference obtained by Blue channel value, and H_GsubR is that in horizontal direction, Green channel sample is equal
Value deducts the difference obtained by Red channel sample average, and V_GsubR is Green passage in vertical direction
Sample average deducts the difference obtained by Red channel sample average, and Esti_GsubR is Green channel value
Deducting the difference obtained by Red channel value, Interpolated_B is the Blue value that interpolation goes out,
Interpolated_R is the Red value that interpolation goes out, then:
Hweight=Grad_V*Grad_V
Vweight=Grad_H*Grad_H
Esti_GsubB=(H_GsubB*Hweight+V_GsubB*Vweight)/(Hweight
+Vweight)
Esti_GsubR=(H_GsubR*Hweight+V_GsubR*Vweight)/(Hweight
+Vweight)
Interpolated_B=Original_G-Esti_GsubB
Interpolated_R=Original_G-Esti_GsubR
According to the method processing image of the present embodiment, by the first gradient calculation method is obtained the first water
Flat gradient, the first vertical gradient and by the second gradient calculation method obtain the second horizontal gradient, second
Vertical gradient, then judges to select which kind of gradient calculation method as processing this image according to preset rules
Method so that selected gradient calculation method is more suitable for processing this image, is i.e. capable of at self adaptation
Reason image.
Embodiment three
The present embodiment provides a kind of method processing image based on embodiment one.
As it is shown on figure 3, be the schematic flow sheet of the method processing image according to the present embodiment.
Step 301, uses the first gradient algorithm to obtain the first horizontal gradient and first vertical gradient of image.
In the present embodiment, the device processing image uses Difference of Adjacent Pixels method to obtain the first level of image
Gradient and the first vertical gradient.
Step 302, uses the second gradient calculation method to obtain the second horizontal gradient of image and second vertical
Gradient.
In the present embodiment, the device processing image uses spaced pixels differential technique to obtain the second level of image
Gradient and the second vertical gradient.
Step 303, using in the first horizontal gradient and the first vertical gradient one of maximum absolute value as
One greatest gradient T1_MAX, another is as the first minimal gradient T1_MIN.
Step 304, using in the second horizontal gradient and the second vertical gradient one of maximum absolute value as
Two greatest gradient T2_MAX, another is as the second minimal gradient T2_MIN.
Step 305, according to equation below acquisition weighted value:
Weighted value=(absolute value of absolute value × the second minimal gradient of the first greatest gradient)/(first
Absolute value × the first of absolute value+the second greatest gradient of absolute value × the second minimal gradient of big gradient is
The absolute value of little gradient).
Step 306, obtains terminal level's gradient of image according to weighted value and equation below vertical with final
Gradient:
Terminal level gradient=the first horizontal gradient × weighted value the+the second horizontal gradient × (1-weighted value);
Final vertical gradient=the first vertical gradient × weighted value the+the second vertical gradient × (1-weighted value).
Step 307, uses terminal level's gradient and final vertical gradient to process image.
This process is similar to the process in embodiment two, does not repeats them here.
According to the method processing image of the present embodiment, by the first gradient calculation method is obtained the first water
Flat gradient, the first vertical gradient and by the second gradient calculation method obtain the second horizontal gradient, second
Vertical gradient, then obtains weighted value, and it is vertical with final to obtain terminal level's gradient according to this weighted value
Gradient also processes image according to this terminal level's gradient and final vertical gradient, so that the image after Chu Liing
Verity improve.
One of ordinary skill in the art will appreciate that: realize all or part of step of said method embodiment
Can be completed by the hardware that programmed instruction is relevant, aforesaid program can be stored in a computer-readable
Taking in storage medium, this program upon execution, performs to include the step of said method embodiment;And it is aforementioned
Storage medium include: the various media that can store program code such as ROM, RAM, magnetic disc or CD.
Embodiment four
The present embodiment provides a kind of device processing image, for the method performing above-mentioned process image.
As shown in Figure 4, for the structural representation of the device processing image according to the present embodiment.This enforcement
The structure of the device processing image of example specifically includes the first acquiring unit 401, second acquisition unit 402
With the 3rd acquiring unit 403.
Wherein, the first acquiring unit 401 is for using the first gradient calculation method to obtain the first water of image
Flat gradient and the first vertical gradient;Second acquisition unit 402 obtains for using the second gradient calculation method
Second horizontal gradient of image and the second vertical gradient;3rd acquiring unit 403 for according to preset rules,
First horizontal gradient, the first vertical gradient, the second horizontal gradient and the second vertical gradient, obtain image
Terminal level's gradient and final vertical gradient.
The concrete operation method of the device of this process image is consistent with embodiment one, does not repeats them here.
According to the device processing image of the present embodiment, obtain terminal level by combining multiple gradient algorithm
Gradient and final vertical gradient, use this terminal level's gradient and final vertical gradient to process image,
The verity of the image after process can be improved, reduce original image the most truly.
Alternatively, as it is shown in figure 5, the device processing image of the present embodiment can also include processing unit
501, image is carried out by this processing unit 501 specifically for using terminal level's gradient and final vertical gradient
Process.
Embodiment five
The device processing image of embodiment four is done supplementary notes further by the present embodiment.
Alternatively, the present embodiment process image device in the 3rd acquiring unit 403 specifically for:
Using in the first horizontal gradient and the first vertical gradient one of maximum absolute value as the first maximum ladder
Degree, another is as the first minimal gradient;
Using in the second horizontal gradient and the second vertical gradient one of maximum absolute value as the second maximum ladder
Degree, another is as the second minimal gradient;
When the product of the absolute value of the first greatest gradient and the absolute value of the second minimal gradient is maximum more than second
During the product of the absolute value of gradient and the absolute value of the second minimal gradient, using the first horizontal gradient as finally
Horizontal gradient, and using the first vertical gradient as final vertical gradient;
When the product of the absolute value of the first greatest gradient and the absolute value of the second minimal gradient is maximum less than second
During the product of the absolute value of gradient and the absolute value of the second minimal gradient, using the second horizontal gradient as finally
Horizontal gradient, and using the second vertical gradient as final vertical gradient;
When the product of the absolute value of the first greatest gradient and the absolute value of the second minimal gradient is maximum equal to second
During the product of the absolute value of gradient and the absolute value of the second minimal gradient, by the first horizontal gradient and the second water
The meansigma methods of flat gradient is as terminal level's gradient, and by the first vertical gradient and the second vertical gradient
Meansigma methods is as final vertical gradient.
Or, alternatively, the 3rd acquiring unit 403 in the device processing image of the present embodiment is concrete
For:
Using in the first horizontal gradient and the first vertical gradient one of maximum absolute value as the first maximum ladder
Degree, another is as the first minimal gradient;
Using in the second horizontal gradient and the second vertical gradient one of maximum absolute value as the second maximum ladder
Degree, another is as the second minimal gradient;
According to equation below acquisition weighted value:
Weighted value=(absolute value of absolute value × the second minimal gradient of the first greatest gradient)/(first
Absolute value × the first of absolute value+the second greatest gradient of absolute value × the second minimal gradient of big gradient is
The absolute value of little gradient);
According to weighted value and terminal level's gradient of equation below acquisition image and final vertical gradient:
Terminal level gradient=the first horizontal gradient × weighted value the+the second horizontal gradient × (1-weighted value);
Final vertical gradient=the first vertical gradient × weighted value the+the second vertical gradient × (1-weighted value).
According to the device processing image of the present embodiment, by the first gradient calculation method is obtained the first water
Flat gradient, the first vertical gradient and by the second gradient calculation method obtain the second horizontal gradient, second
Vertical gradient, then judges to select which kind of gradient calculation method as processing this image according to preset rules
Method or obtain terminal level's gradient and final vertical gradient by the weighted value obtained, and according to this
Whole horizontal gradient and final vertical gradient process image so that selected gradient calculation method is more suitable for place
Manage this image, be i.e. capable of self-adaptive processing image.
Embodiment six
The present embodiment provides another kind to process the device of image, for the method performing above-mentioned process image.
As shown in Figure 6, for the structural representation of the device processing image according to the present embodiment.This process
The device 600 of image includes at least one processor 601, communication bus 602, memorizer 603 and extremely
A few communication interface 604.
Wherein, communication bus 602 is used for realizing the connection between said modules and communicating, communication interface 604
For being connected with the network equipment and communicating.This bus can be ISA(Industry Standard
Architecture, industry standard architecture) bus, PCI(Peripheral Component, outward
Portion's apparatus interconnection) bus or EISA(Extended Industry Standard Architecture,
Extended industry-standard architecture) bus etc..Bus can be one or more physical circuit, when being many
Address bus, data/address bus, control bus etc. can be divided into during bar physical circuit.
Wherein, memorizer 603 is used for storing executable program code, and wherein, processor 501 is by reading
In access to memory 603, the executable program code of storage runs the journey corresponding with executable program code
Sequence, for:
The first gradient calculation method is used to obtain the first horizontal gradient and first vertical gradient of image;
The second gradient calculation method is used to obtain the second horizontal gradient and second vertical gradient of image;
Hang down according to preset rules, the first horizontal gradient, the first vertical gradient, the second horizontal gradient and second
Vertical ladder degree, obtains terminal level's gradient of image and final vertical gradient.
Alternatively, processor 601 is transported by reading the executable program code of storage in memorizer 603
The row program corresponding with executable program code, for according to preset rules, the first horizontal gradient, the
One vertical gradient, the second horizontal gradient and the second vertical gradient, obtain terminal level's gradient and of image
Whole vertical gradient, specifically may is that
Using in the first horizontal gradient and the first vertical gradient one of maximum absolute value as the first maximum ladder
Degree, another is as the first minimal gradient;
Using in the second horizontal gradient and the second vertical gradient one of maximum absolute value as the second maximum ladder
Degree, another is as the second minimal gradient;
When the product of the absolute value of the first greatest gradient and the absolute value of the second minimal gradient is maximum more than second
During the product of the absolute value of gradient and the absolute value of the second minimal gradient, using the first horizontal gradient as finally
Horizontal gradient, and using the first vertical gradient as final vertical gradient;
When the product of the absolute value of the first greatest gradient and the absolute value of the second minimal gradient is maximum less than second
During the product of the absolute value of gradient and the absolute value of the second minimal gradient, using the second horizontal gradient as finally
Horizontal gradient, and using the second vertical gradient as final vertical gradient;
When the product of the absolute value of the first greatest gradient and the absolute value of the second minimal gradient is maximum equal to second
During the product of the absolute value of gradient and the absolute value of the second minimal gradient, by the first horizontal gradient and the second water
The meansigma methods of flat gradient is as terminal level's gradient, and by the first vertical gradient and the second vertical gradient
Meansigma methods is as final vertical gradient.
Alternatively, processor 601 is transported by reading the executable program code of storage in memorizer 603
The row program corresponding with executable program code, for according to preset rules, the first horizontal gradient, the
One vertical gradient, the second horizontal gradient and the second vertical gradient, obtain terminal level's gradient and of image
Whole vertical gradient, specifically may is that
Using in the first horizontal gradient and the first vertical gradient one of maximum absolute value as the first maximum ladder
Degree, another is as the first minimal gradient;
Using in the second horizontal gradient and the second vertical gradient one of maximum absolute value as the second maximum ladder
Degree, another is as the second minimal gradient;
According to equation below acquisition weighted value:
Weighted value=(absolute value of absolute value × the second minimal gradient of the first greatest gradient)/(first
Absolute value × the first of absolute value+the second greatest gradient of absolute value × the second minimal gradient of big gradient is
The absolute value of little gradient);
According to weighted value and terminal level's gradient of equation below acquisition image and final vertical gradient:
Terminal level gradient=the first horizontal gradient × weighted value the+the second horizontal gradient × (1-weighted value);
Final vertical gradient=the first vertical gradient × weighted value the+the second vertical gradient × (1-weighted value).
Alternatively, processor 601 is next by reading the executable program code of storage in memorizer 603
Run the program corresponding with executable program code, for obtaining terminal level's gradient of image with final
After vertical gradient, it is also possible to run by reading the executable program code of storage in memorizer 603
The program corresponding with executable program code, for:
Use terminal level's gradient and final vertical gradient that image is processed.
According to the device 600 processing image of the present embodiment, obtain final by combining multiple gradient algorithm
Horizontal gradient and final vertical gradient, use this terminal level's gradient and final vertical gradient to carry out image
Process, it is possible to increase the verity of the image after process, reduce original image the most truly.
Last it is noted that above example is only in order to illustrate technical scheme, rather than to it
Limit;Although the present invention being described in detail with reference to previous embodiment, the ordinary skill of this area
Personnel it is understood that the technical scheme described in foregoing embodiments still can be modified by it, or
Person carries out equivalent to wherein portion of techniques feature;And these amendments or replacement, do not make corresponding skill
The essence of art scheme departs from the scope of various embodiments of the present invention technical scheme.