Summary of the invention
The object of the present invention is to provide a kind of self-adaptation of the smooth wave-filtering spatial scale towards Image Edge-Detection to determine method, if utilized pixel to drop in the even smooth region of image, each sub regions in this zone then, as the left side, right-hand part, the sample mean of the first half and Lower Half gray scale or color is that whole area grayscale or color mean value one does not have estimation partially, under the situation of given confidence level 1-α, judge the left side that this is regional, right-hand part, whether the gray scale of the first half and Lower Half or the sample mean of color drop on whole area grayscale or the corresponding fiducial interval of color mean value.Can select to select best smooth wave-filtering spatial scale adaptively for each pixel in the set for smooth wave-filtering spatial scale at one group according to these characteristics.
The step of the technical solution used in the present invention is as follows:
(1) set a discrete values set selecting smooth wave-filtering spatial scale for each pixel in the image, the numerical value in this discrete set is to arrange from big to small;
(2) the image smoothing wave filter is a moving window, and according to grating lattice scan mode point by point scanning view picture input picture, input picture is gray level image or coloured image, and described smooth wave-filtering spatial scale is exactly the radius r of this moving window;
(3) when moving window scans a pixel, when promptly the center of moving window rests on this pixel, from gathering, the selective discrete values of above-mentioned smooth wave-filtering spatial scale gets the radius r of a numerical value as moving window according to order;
(4) calculate the mean value that drops on interior all pixel gray scales of this moving window or color, and the variance of gray scale or color:
(x wherein, y) volume coordinate of central pixel point in the expression moving window, r represents the radius of described moving window, r is a unit with pixel interval in the digital picture, (x ', y ') expression drops on that (x y) is the center, and radius is the volume coordinate of the moving window interior pixel point of r with pixel, c (x ', y ') expression is positioned at the gray scale or the color of pixel (x ', y ')
(x y) is the center, and radius is the mean value of interior all pixel gray scales of the moving window of r or color, σ with pixel in expression
2(x, y) variance of all pixel gray scales or color in the described moving window of expression;
(5) calculating drops on described moving window left side respectively, right-hand part, and the mean value of the first half and Lower Half pixel gray scale or color:
Here
With
Expression drops on described moving window left side respectively, right-hand part, and the mean value of the first half and Lower Half pixel gray scale or color is if input picture is a gray level image, then
With
It all is scalar; If input picture is a coloured image, then
With
Be vector, each vector all has three components, and is promptly red, green and blue component;
(6) press the definition of α quantile in the t distribution on the statistics, check described moving window left side, right-hand part, the mean value of the first half and Lower Half pixel gray scale or color, promptly
With
The mean value that whether drops on whole slide window gray scale or color is in confidence level is fiducial interval under the 1-α:
If input picture is a gray level image, subscript i=1 here is because have only a gray-scale value on each pixel in the image, and when input picture is coloured image, here subscript i represents redness corresponding in color mean value or the color variance, green or blue component, and
Middle subscript j then represents it is described moving window left side, right-hand part, the first half or Lower Half, n represents to drop on described moving window left side, right-hand part, the number of pixel in the first half or the Lower Half, if described moving window is a square, n numerical value then just equals (2r+1) r, according to given α numerical value, obtains z by the inquiry of t distribution table
α/2Numerical value;
(7) if described moving window left side, right-hand part, the mean value of the first half and Lower Half pixel gray scale or color, promptly
With
In each component, all satisfy formula (7), judge that then (x y) drops on a length of side and is the homogeneous area of (2r+1), jumps to step (9) for the pixel at place, described moving window center;
(8) if described moving window left side, right-hand part, the mean value of the first half and Lower Half pixel gray scale or color, promptly
With
In each component have one not satisfy formula (7), the image-region that current moving window place is described is not a homogeneous area, then next than the radius r of fractional value as moving window according to order selection from the alternative discrete values set of above-mentioned smooth wave-filtering spatial scale from big to small, repeat above-mentioned steps (4) then to step (6);
(9) the current moving window radius r of getting is as the smooth wave-filtering spatial scale of the pixel at place, moving window center;
(10) described moving window moves on to next pixel according to the grating lattice scanning sequency, and repeating step (3) is to step (9), and all pixels are all determined smooth wave-filtering spatial scale separately in image.
The beneficial effect that the present invention has is:
This self-adaptation determines that the smooth wave-filtering spatial scale of each pixel can be incorporated in the rim detection or smothing filtering of gray scale or coloured image in the image, independent distribution white Gaussian noise or space correlation texture interference of noise in the removal of images effectively, keep the edge in the image can not blured excessively simultaneously, can be applied in the textile printing and dyeing industry.
Embodiment
As shown in drawings, workflow of the present invention is as follows:
(1) input one width of cloth numerical imaging.
(2) the given discrete values set that can select smooth wave-filtering spatial scale for each pixel in the image, as 6,5,4,3,2,1}.
(3) input confidence level 1-α is 0.05 as the α value.
(4) the image smoothing wave filter is a square moving window, and the radius r of moving window is equal to smooth wave-filtering spatial scale.
(5) maximal value desirable according to the radius r of moving window, as 6 in this example, image is done symmetry expansion up and down accordingly, if the width of input picture and highly be respectively Width and Height, expand the width of back image so and highly be respectively Width+2r and Height+2r, can be earlier the row of image be carried out the symmetry expansion, and then row are carried out symmetry expand, promptly
Here I
cBe a certain component of expression input picture,, just have only one-component if input picture is a gray level image; If input picture is a coloured image, then at redness, green or the blue component of rgb color space.Here (i, j) volume coordinate of pixel in the image of back is expanded in expression.
Be to component I
cThe symmetry expansion of line direction, and
Be
Again column direction is carried out symmetry expansion back image on the basis.
Perhaps also can be earlier the row of image be carried out the symmetry expansion, and then row is carried out symmetry expand, promptly
Wherein
Be to component I
cSymmetry expansion on column direction, and
Be
On the basis line direction is carried out image after the symmetry expansion, the expanded images that two kinds of symmetrical extended modes obtain is the same.
(6) moving window is according to inner the work from top to bottom of grating lattice scan mode image after expansion, zigzag scanning from left to right, promptly remove the image inside of moving window maximum radius size frame, the size of expanded images inside is the same with the original size of input picture.
(7) when moving window scans a pixel, when promptly the center of moving window rests on this pixel, get the current radius r of a numerical value according to order as moving window from the alternative discrete values set of above-mentioned smooth wave-filtering spatial scale;
(8) calculate the mean value that drops on this moving window interior pixel point gray scale or color, and gray scale or color variance
(x wherein, y) volume coordinate of central pixel point in the expression moving window, r represents the current numerical value r that gets radius of described moving window, r is a unit with pixel interval in the digital picture, (x ', y ') expression drops on that (x y) is the center, and radius is the volume coordinate of the moving window interior pixels point of r with pixel, c (x ', y ') expression is positioned at the gray scale or the color of pixel (x ', y ')
(x y) is the center, and radius is the mean value of interior all pixel gray scales of the moving window of r or color, σ with pixel in expression
2(x, y) variance of inner all pixel gray scales of the described moving window of expression or color.If input picture is a gray level image, then
And σ
2(x y) is scalar; If input picture is a coloured image, then
And σ
2(x y) is vector, and each vector all has three components, and is promptly red, green and blue component.
(9) calculating drops on described moving window left side respectively, right-hand part, and the mean value of the first half and Lower Half pixel gray scale or color:
Here
With
Expression drops on described moving window left side respectively, right-hand part, and the mean value of the first half and Lower Half pixel gray scale or color is if input picture is a gray level image, then
With
Be scalar, and if input picture is a coloured image, then
With
Be vector, each all has three components, and is promptly red, green and blue component.
(10) press the definition of α quantile in the statistics t distribution, check described moving window left side, right-hand part, the mean value of the first half and Lower Half pixel gray scale or color, promptly
With
Whether drop in the fiducial interval that confidence level is 1-α:
If input picture is a gray level image, subscript i=1 here is because have only a gray-scale value on each pixel in the image, and when input picture is coloured image, here subscript i represents corresponding redness in color mean value or the color variance, green or blue component, and
Middle subscript j then represents it is described moving window left side, right-hand part, the first half or Lower Half, n represents to drop on described moving window left side, right-hand part, the number of pixel in the first half or the Lower Half, if described moving window is a square, n numerical value then just equals (2r+1) r, according to given α numerical value, can obtain z by the inquiry of statistics t distribution table
α/2Numerical value.
(11) if described moving window left side, right-hand part, the mean value of the first half and Lower Half pixel gray scale or color, promptly
With
In each component, all satisfy formula (11), judge that then (x y) drops on a length of side and is the homogeneous area of (2r+1), jumps to step (13) for the pixel at place, described moving window center.
(12) if described moving window left side, right-hand part, the mean value of the first half and Lower Half pixel gray scale or color, promptly
With
In each component have one not satisfy formula (11), the image-region that current moving window place is described is not a homogeneous area, then next than the radius r of fractional value as moving window according to order selection from the alternative discrete values set of above-mentioned smoothing filter space scale from big to small, repeat above-mentioned steps (8) then to (10).
(13) the current moving window radius r of getting is as the smooth wave-filtering spatial scale of the pixel at place, moving window center.
(14) described moving window moves on to next pixel according to the grating lattice scanning sequency, and repeating step (7) is to step (13), and all pixels are all determined smooth wave-filtering spatial scale separately in image.
(15), can be incorporated in Image Edge-Detection or the smothing filtering according to the smooth wave-filtering spatial scale of each pixel.If in conjunction with method for detecting image edge, can be earlier image be carried out smothing filtering according to the smooth wave-filtering spatial scale of each pixel the best based on gradient; On the basis of removing picture noise, the space derivative of computed image; Be steps such as local non-maximum value inhibition and hysteresis threshold processing then, just can obtain edge of image.