CN113610734B - Image edge processing method based on guided filtering and application - Google Patents

Image edge processing method based on guided filtering and application Download PDF

Info

Publication number
CN113610734B
CN113610734B CN202110969770.7A CN202110969770A CN113610734B CN 113610734 B CN113610734 B CN 113610734B CN 202110969770 A CN202110969770 A CN 202110969770A CN 113610734 B CN113610734 B CN 113610734B
Authority
CN
China
Prior art keywords
image
edge
denoising
window
filtering
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110969770.7A
Other languages
Chinese (zh)
Other versions
CN113610734A (en
Inventor
李香花
何珊
孙德印
朱钧
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mouxin Technology Shanghai Co ltd
Original Assignee
Mouxin Technology Shanghai Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mouxin Technology Shanghai Co ltd filed Critical Mouxin Technology Shanghai Co ltd
Priority to CN202110969770.7A priority Critical patent/CN113610734B/en
Publication of CN113610734A publication Critical patent/CN113610734A/en
Application granted granted Critical
Publication of CN113610734B publication Critical patent/CN113610734B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/20Image enhancement or restoration using local operators
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20024Filtering details

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)

Abstract

The invention discloses an image edge processing method based on guided filtering and application thereof, and relates to the technical field of digital image processing. The method comprises the steps of: acquiring an input image and a guide image; acquisition of a first rectangular window w for weak denoising k1 And a second rectangular window w for strong denoising k2 The method comprises the steps of carrying out a first treatment on the surface of the By means of windows w k1 Weak denoising by using window w k2 Performing guide filtering to remove noise strongly; obtaining the absolute difference of denoising intensity according to the filter coefficients corresponding to the two windows, and obtaining the corresponding filter weight according to the absolute difference; and judging pixel information needing edge smoothing after obtaining the value of the edge gradient of the strong denoising result image; and carrying out edge smoothing treatment on the pixels based on the weak denoising result image and the filtering weight to obtain a final result image. The invention can restrain image noise, keep edge detail, and simultaneously realize edge smoothing, the denoising intensity and the edge smoothing intensity can be independently and respectively controlled, the applicability is wide, and the flexibility is strong.

Description

Image edge processing method based on guided filtering and application
Technical Field
The invention relates to the technical field of digital image processing, in particular to an image edge processing method based on guided filtering and application thereof.
Background
The image sensor is used as a carrier of image information, and becomes an important information channel in the present informatization age, such as a mobile phone camera, a monitoring camera and the like. When image data is acquired by an image sensor, various noises such as thermal noise, photon noise, dark current noise, light response non-uniformity noise, etc. caused by resistance are inevitably introduced due to influence of factors such as sensor material properties, working environment, electronic components, circuit structure, etc. Taking the main stream image sensor CMOS (Complementary Metal Oxide Semiconductor ) in the market as an example, the collected image data is obviously affected by noise, and the noise is high. Meanwhile, the sensor noise changing with the signal is usually amplified by a subsequent image processing module, and the phenomenon is more obvious in a low-illumination environment.
An image data can be seen as having a region with a sharp transition, i.e. a large gradient, and edges (including the texture and details of the image, etc.) together. Since noise is a detrimental factor affecting image quality, in order to acquire a high-quality image, it is desirable to filter out noise to improve image quality. However, when the image is denoised by common isotropic filtering (such as gaussian filtering), since a consistent denoising method is adopted for both the noise to be treated and the edge information, while the noise is reduced, the edges (including the texture, the detail and the like of the image) with importance in the image are lost, so that the edge of the image is blurred. Accordingly, researchers have proposed some image denoising algorithms that can preserve edges (Edge-persistence), such as bilateral filtering, adaptive smoothing filtering denoising algorithms, and the like. Currently, edge-preserving image denoising algorithms generally employ the following two approaches: the first is a pixel-to-point similarity comparison: the center pixel value is calculated by considering the Euclidean distance and the similarity between the pixel points and the center pixel point, and a weighted average weight is obtained, wherein the weight represents the denoising intensity of the center pixel. The method has high operation efficiency, denoising and better reservation of high-frequency information, but the edge is excessively unsmooth. The second is a pixel block-to-block similarity comparison: the filter estimation value of the central pixel is obtained by the weighted average of pixels with similar neighborhood structures in the image, and according to the weighted average weight result, the filter intensity of the pixel points with high weight is larger, and the pixel points with low weight are not filtered or have lower filter intensity. The method has higher computational complexity and longer algorithm running time. Taking guide filter (Guided filter) as an example, it performs filtering processing on an input image P (target image) by a guide image I so that the final output image is substantially similar to the input image P but the texture portion is similar to the guide image I, thereby maintaining the image edges; the guide image I may be another image or the input image p itself. The guide filtering is widely applied to image processing such as noise reduction, edge emergence, image enhancement, image matting and the like of images.
However, on the one hand, as a guard filtering technique, although the denoising effect similar to the mean filtering can be achieved in the flat area, so that the block noise caused by video compression in the flat area can be removed well, but the burr noise on the edge part cannot be removed, so that the edge burr is caused, the burr phenomenon can be amplified by the subsequent module for edge enhancement, and the edge smoothing result is affected, as shown in fig. 1, wherein fig. 1a shows the edge of the image after the guard filtering denoising treatment, and the edge burr phenomenon exists; fig. 1b shows that the edge of the image after edge enhancement after the guided filter denoising process has been enhanced by the burr phenomenon. On the other hand, in the existing edge-preserving image denoising algorithm, the denoising algorithm and the edge smoothing algorithm are difficult to control independently, the usable scene of the edge-preserving denoising algorithm is limited, and the applicability of the edge-preserving denoising algorithm is reduced.
In summary, how to provide an image edge processing method capable of improving edge transition smoothness and having wider applicability while denoising and edge protection, so as to keep more image details as much as possible while denoising is a technical problem to be solved at present.
Disclosure of Invention
The invention aims at: the defects of the prior art are overcome, and an image edge processing method based on guide filtering and application are provided. The invention can effectively reduce the phenomenon of losing high-frequency detail information in the denoising process, can smooth the edge while inhibiting image noise and keeping edge detail, and ensures that the edge is excessively natural; meanwhile, the denoising strength and the edge smoothing strength can be independently and respectively controlled, so that the method is wide in applicability and strong in flexibility.
In order to achieve the above object, the present invention provides the following technical solutions:
an image edge processing method based on guide filtering comprises the following steps:
acquiring an input image p and a guide image I;
collecting a first rectangular window w set by a user and used for weak denoising k1 And a second moment for strong denoisingWindow w of shape k2 The first rectangular window w k1 Is smaller than the second rectangular window w k2 The method comprises the steps of carrying out a first treatment on the surface of the Window w for guiding image I and input image p k1 Conducting guided filtering to weakly remove noise, and calculating a corresponding filter coefficient (a k1 ,b k1), wherein ,ak1 and bk1 Representation window w k1 Coefficients of the linear model in (a); window w for guiding image I and input image p k2 Performing guided filtering to remove noise strongly, and calculating corresponding filter coefficient (a k2 ,b k2), wherein ,ak2 and bk2 Representation window w k2 Coefficients of the linear model in (a);
according to the aforementioned filter coefficient a k1 and ak2 Obtaining the absolute difference Diff of the denoising intensity ka The Diff is ka =|a k2 - a k1 I, based on preset denoising intensity absolute difference Diff ka And filtering weight W g Obtain the corresponding relation of the Diff ka Filter weight W corresponding to the value of (2) g The filtering weight is used for adjusting the denoising strength; and obtaining an edge gradient G of the strong denoising result image x and Gy Wherein G is x Represents the transverse gradient, G y Representing a longitudinal gradient, and judging pixel information needing edge smoothing according to the value of the edge gradient;
pixel information based on weak denoising result image GIF0According to the filtering weight W g After performing edge smoothing on the pixels to be subjected to edge smoothing, calculating pixel information of the final result image +.>The formula is as follows:
,
wherein ,for pixels +.>A corresponding center pixel mean; n is a preset threshold value of the filtering weight;iijjrepresenting the pixel subscript.
Further, the guide image I is the input image p.
Further, the preset threshold value n=6 of the filtering weight, at this time, the absolute difference Diff of denoising intensity ka And filtering weight W g The correspondence of (a) is as follows:
when (when)When in use, let->
When (when)When in use, let->
When (when)When in use, let->
When (when)When in use, let->
When (when)When in use, let->
When (when)When in use, let->
When (when)When in use, let->
Further, the first rectangular window w k1 For M1 window, the second rectangular window w k2 Is a window of M2 x M2, wherein M1<M2。
Further, m1=3, m2=9; obtaining edge gradient G of strong denoising result image x and Gy The step of the value of (c) comprises,
based on a Sobel operator of 3*3, a 3*3 window is obtained on a strong denoising result image, a pixel matrix A of the window is obtained, and convolution operation is carried out on the pixel matrix A and the Sobel operator to obtain a result G x and Gy The calculation formula is as follows:
further, the step of judging pixel information to be subjected to edge smoothing processing according to the value of the edge gradient includes,
edge gradient G of image according to strong denoising result x and Gy Calculating the corresponding gradient magnitude, wherein
Comparing the gradient threshold value parameters TH based on the user settingAnd the magnitude of the gradient threshold parameter TH, whenWhen the corresponding center point is judged to be noise, edge smoothing is not performed; when->When the corresponding center point is judged to be an edge, edge smoothing processing is needed to continuously judge whether the center point belongs to a transverse edge or a longitudinal edge, wherein,
when (when)When the center point is judged to be a transverse edge;
when (when)When the center point is judged to be a longitudinal edge;
triggering to carry out edge smoothing processing on the horizontal direction and the vertical direction on the transverse edge and the longitudinal edge respectively.
Further, for the followingCalculating pixel information +.>The formula of (2) is as follows:
for the followingCalculating pixel information +.>The formula of (2) is as follows:
further, use window w kn When guided filtering denoising is performed, the filter coefficient (a kn ,b kn ) The calculation formula of (2) is as follows:
wherein i represents a pixel; n is a window subscript, n=1, 2;to guide the imageIWindow->The pixel mean value of (a); />For inputting images +.>Window->The pixel mean value of (a); but->For window->Pixel variance in (a);εis a preset smoothing parameter;I i to guide the pixel value of the i-th pixel in the image,p i for the pixel value of the i-th pixel in the input image,
the invention also provides an image edge processing device based on the guide filtering, which comprises the following structures:
the information acquisition module is used for acquiring an input image p and a guide image I; and collecting a first rectangular window w set by a user and used for weak denoising k1 And a second rectangular window w for strong denoising k2 The first rectangular window w k1 Is smaller than the second rectangular window w k2
A weak denoising module for window w based on the guiding image I and the input image p k1 Conducting guided filtering to weakly remove noise, and calculating a corresponding filter coefficient (a k1 ,b k1), wherein ,ak1 and bk1 Representation window w k1 Coefficients of the linear model in (a);
a strong denoising module for window w based on the guiding image I and the input image p k2 Performing guided filtering to remove noise strongly, and calculating corresponding filter coefficient (a k2 ,b k2), wherein ,ak2 and bk2 Representation window w k2 Coefficients of the linear model in (a);
a filtering weight adjusting module for adjusting the filtering coefficient according to the filtering coefficient a k1 and ak2 Obtaining the absolute difference Diff of the denoising intensity ka The Diff is ka =|a k2 - a k1 I, based on preset denoising intensity absolute difference Diff ka And filtering weight W g Obtain the corresponding relation of the Diff ka Filter weight W corresponding to the value of (2) g The filtering weight is used for adjusting the denoising strength;
an edge gradient detection module for calculating an edge gradient G of the strong denoising result image based on the strong denoising result image x and Gy Wherein G is x Represents the transverse gradient, G y Representing a longitudinal gradient, and judging pixel information needing edge smoothing according to the value of the edge gradient;
a smoothing module for smoothing pixel information of the image GIF0 based on the weak denoising resultAccording to the filtering weight W g Performing edge smoothing on pixels needing edge smoothing to obtain pixel information of a final result image,/>The formula of (2) is as follows:
,
wherein ,for pixels +.>A corresponding center pixel mean; n is the filtering weightA heavy preset threshold;iijjrepresenting the pixel subscript.
The invention also provides an edge enhancement processing system of the image, which comprises the following steps:
a processor;
a memory for storing processor-executable instructions and parameters;
the processor is configured to: acquiring an input image p and a guide image I, and a first rectangular window w for weak denoising set by a user k1 And a second rectangular window w for strong denoising k2 The first rectangular window w k1 Is smaller than the second rectangular window w k2 The method comprises the steps of carrying out a first treatment on the surface of the Window w for guiding image I and input image p k1 Conducting guided filtering to weakly remove noise, and calculating a corresponding filter coefficient (a k1 ,b k1), wherein ,ak1 and bk1 Representation window w k1 Based on coefficients of the linear model in the guide image I and the window w for the input image p k2 Performing guided filtering to remove noise strongly, and calculating corresponding filter coefficient (a k2 ,b k2), wherein ,ak2 and bk2 Representation window w k2 Coefficients of the linear model in (a); the method comprises the steps of,
according to the aforementioned filter coefficient a k1 and ak2 Obtaining the absolute difference Diff of the denoising intensity ka The Diff is ka =|a k2 - a k1 I, based on preset denoising intensity absolute difference Diff ka And filtering weight W g Obtain the corresponding relation of the Diff ka Filter weight W corresponding to the value of (2) g The filtering weight is used for adjusting the denoising strength; computing edge gradient G of strong denoising result image based on strong denoising result image x and Gy Wherein G is x Represents the transverse gradient, G y Representing a longitudinal gradient, and judging pixel information needing edge smoothing according to the value of the edge gradient; then, pixel information of the image GIF0 based on the weak denoising resultAccording to the filtering weight W g For needsThe pixels to be subjected to the edge smoothing are subjected to the edge smoothing to obtain pixel information of the final result image +.>,/>The formula of (2) is as follows:
,
wherein ,for pixels +.>A corresponding center pixel mean; n is a preset threshold value of the filtering weight;iijjrepresenting the pixel subscript.
Compared with the prior art, the invention has the following advantages and positive effects by taking the technical scheme as an example: the phenomenon of losing high-frequency detail information in the denoising process can be effectively reduced or avoided, image noise is suppressed, edge detail is kept, and meanwhile, edge smoothness can be achieved, so that the edge is excessively natural; meanwhile, the denoising intensity and the edge smoothing intensity can be independently and respectively controlled, so that a user can conveniently and flexibly adjust the denoising intensity and the edge smoothing intensity according to the input image requirement, and the method is wide in applicability and high in flexibility.
Drawings
Fig. 1 is a diagram showing the edge burr phenomenon of the guide filtering denoising result in the prior art.
Fig. 2 is a flowchart of an image edge processing method based on guided filtering.
Fig. 3 is a flowchart of an information processing for performing edge smoothing processing according to an embodiment of the present invention.
Fig. 4 is a diagram illustrating an example of comparison of a weak denoising edge gradient and a strong denoising edge gradient according to the present invention.
FIG. 5 shows the absolute difference Diff of denoising intensity according to the present invention ka Is a graph of the variation of (a).
FIG. 6 shows the absolute difference Diff of denoising intensity according to the present invention ka And filtering weight W g Is a correspondence map of (a).
Detailed Description
The image edge processing method and application based on the guide filtering disclosed by the invention are further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the technical features or combinations of technical features described in the following embodiments should not be regarded as being isolated, and they may be combined with each other to achieve a better technical effect. In the drawings of the embodiments described below, like reference numerals appearing in the various drawings represent like features or components and are applicable to the various embodiments. Thus, once an item is defined in one drawing, no further discussion thereof is required in subsequent drawings.
It should be noted that the structures, proportions, sizes, etc. shown in the drawings are merely used in conjunction with the disclosure of the present specification, and are not intended to limit the applicable scope of the present invention, but rather to limit the scope of the present invention. The scope of the preferred embodiments of the present invention includes additional implementations in which functions may be performed out of the order described or discussed, including in a substantially simultaneous manner or in an order that is reverse, depending on the function involved, as would be understood by those of skill in the art to which embodiments of the present invention pertain.
Techniques, methods, and apparatus known to one of ordinary skill in the relevant art may not be discussed in detail, but should be considered part of the specification where appropriate. In all examples shown and discussed herein, any specific values should be construed as merely illustrative, and not a limitation. Thus, other examples of the exemplary embodiments may have different values.
Examples
Referring to fig. 2, an image edge processing method based on guided filtering is provided for this embodiment. The method comprises the following steps:
s100, an input image p and a guide image I are acquired.
The guide filtering filters the input image p by a guide image I such that the final output image is substantially similar to the input image p but the texture portion is similar to the guide image I. The guide image I may be a single image or the input image p itself. In this embodiment, preferably, the guiding image I is the input image p.
The guided filtering is based on one such model assumption:
(1)
i.e. in window w k On the above, there is a linear relationship between the guide image I and the output image q. Wherein a is k and bk Is a rectangular window w k The coefficients of the linear model in (a), called filter coefficients, are assumed to be constant within a certain rectangular window; i i Is the pixel value of the I-th pixel in the guide image I.
The above linear relationship ensures that at each window w k In the case of guiding an imageThere is an edge in the output image +.>The edge will remain unchanged. Due to the requirement of outputting an image +.>As far as possible +.>The same is used for reducing the information loss caused by filtering, and a parameter is introduced +.>Prevent->Too large, the following loss function is obtained:
(2)
wherein epsilon is a preset smoothing coefficient, and the larger the value of epsilon is, the more obvious the smoothing effect of the output image is. Applying the least squares solution minima, we can obtain:
(3)
(4)
wherein i represents a pixel;to guide the imageIWindow->The mean value of the pixels (i.e., the average value of the pixels); />For inputting images +.>Window->The pixel mean value of (a); />For window->Pixel variance in (a);εis a preset smoothing parameter;I i to guide the pixel value of the i-th pixel in the image,p i for the pixel value of the I-th pixel in the input image, when the guiding image I is the aforementioned input image p,/is>
Taking the average value of window pixels in the whole image, the method can be as follows:
(5)
wherein ,for window->Calculated for all pixels in the range +.>Is the average value of (2); />For window->Calculated for all pixels in the range +.>Is a mean value of (c).
S200, collecting a first rectangular window w set by a user and used for weak denoising k1 And a second rectangular window w for strong denoising k2 The first rectangular window w k1 Less than the secondRectangular window w k2 The method comprises the steps of carrying out a first treatment on the surface of the Window w for guiding image I and input image p k1 Conducting guided filtering to weakly remove noise, and calculating a corresponding filter coefficient (a k1 ,b k1), wherein ,ak1 and bk1 Representation window w k1 Coefficients of the linear model in (a); window w for guiding image I and input image p k2 Performing guided filtering to remove noise strongly, and calculating corresponding filter coefficient (a k2 ,b k2), wherein ,ak2 and bk2 Representation window w k2 Coefficients of the linear model in (a).
The guided filtering algorithm utilizes a box filter to complete the calculation of the correlation coefficient, namely the mean value filtering. Therefore, under the same degree of denoising parameters, the larger the window is, the stronger the denoising effect is, the smaller the window is, and the weaker the denoising effect is. In the present embodiment, a first rectangular window w for weak denoising is provided k1 And a second rectangular window w for strong denoising k2 The first rectangular window w k1 Is smaller than the second rectangular window w k2 So that the first rectangular window w k1 Relative to the second rectangular window w k2 For weak denoising, a second rectangular window w k2 Relative to the first rectangular window w k1 Is a strong denoising.
Preferably, the first rectangular window w k1 For the M1 x M1 window, i.e. the first rectangular window w k1 M1 x M1 pixels, the second rectangular window w k2 For M2 x M2 window, i.e. second rectangular window w k2 M2 x M2 pixels, where M1<M2。
In particular, the specific reference to M1 and M2 may be set by a user or a system. Preferably, a window size parameter setting unit is provided in the initialization module for a user to set the first rectangular window w k1 And a second rectangular window w k2 The user can adjust the parameter values of M1 and M2 based on the actually required denoising effect.
In a typical implementation of this embodiment, m1=3 and m2=9. Referring to fig. 3, a 3*3 window is used for pilot filtering weak denoising to obtain a weak denoising result image GIF0, denoising while maintaining detail. The weak de-noised resultant image GIF0 may be used as a basis for subsequent edge filtering. Meanwhile, a 9*9 window is used for conducting guided filtering and strong denoising, and a strong denoising result image is used for edge gradient detection.
As can be seen from equation (3) and equation (4), window w is used k1 When guided filtering denoising is performed, the filter coefficient (a k1 ,b k1 ) The calculation formula of (2) is as follows:
(6)
(7)
by means of windows w k2 When guided filtering denoising is performed, the filter coefficient (a k2 ,b k2 ) The calculation formula of (2) is as follows:
(8)
(9)
s300, according to the filtering coefficient a k1 and ak2 Obtaining the absolute difference Diff of the denoising intensity ka The Diff is ka =|a k2 - a k1 I, based on preset denoising intensity absolute difference Diff ka And filtering weight W g Obtain the corresponding relation of the Diff ka Filter weight W corresponding to the value of (2) g The filtering weight is used for adjusting the denoising strength; and obtaining an edge gradient G of the strong denoising result image x and Gy Wherein G is x Represents the transverse gradient, G y And representing the longitudinal gradient, and judging pixel information needing edge smoothing according to the value of the edge gradient.
The advantage of guided filtering with gradient non-inversion characteristics is thus available for this gradient information, see fig. 4Shown, where the left 4a is a weak denoising edge gradient and the right 4b is a strong denoising edge gradient. Obtaining a denoising intensity absolute difference according to the edge response results of weak denoising and strong denoising, as shown in FIG. 5, the denoising intensity absolute difference Diff ka Is equal to the first filter coefficient a k Related parameters, in particular, diff ka The calculation formula of (2) is as follows:
(10)
obtaining the absolute difference Diff of the denoising intensity ka After the value of (2), the absolute difference Diff of the denoising intensity can be based on the preset value ka And filtering weight W g Obtain the corresponding relation of the Diff ka Filter weight W corresponding to the value of (2) g
The filtering weight W g For adjusting the denoising strength. Filtering weight W g The larger the corresponding denoising strength is, the stronger the filtering weight W is, otherwise g The smaller the corresponding denoising strength is, the weaker.
In step S300, it is also necessary to obtain the edge gradient G of the strong denoising result image x and Gy Wherein G is x Represents the transverse gradient, G y And representing the longitudinal gradient, and judging pixel information needing edge smoothing according to the value of the edge gradient.
According to the weak denoising result image and the strong denoising result image, referring to the trend of the change of the edge detection result coefficients of both the weak denoising result image and the strong denoising result image in fig. 5, it can be seen that the edge detection result coefficient of the strong denoising result image is excessively smoother than that of the weak denoising result image, so that the edge gradient is detected based on the strong denoising result image.
S400, pixel information of the image GIF0 based on the weak denoising resultAccording to the filtering weight W g After performing edge smoothing on the pixels needing edge smoothing, calculating a final result graphPixel information of the image->The formula is as follows:
(11)
wherein ,for pixels +.>A corresponding center pixel mean; n is a preset threshold value of the filtering weight;iijjrepresenting the pixel subscript.
In a preferred embodiment, the preset threshold value n=6 of the filter weight, at which time the denoising intensity absolute difference Diff ka And filtering weight W g The correspondence of (a) is as follows:
when (when)When in use, let->
When (when)When in use, let->
When (when)When in use, let->
When (when)When in use, let->
When (when)When in use, let->
When (when)When in use, let->
When (when)When in use, let->
At this time, the absolute difference Diff of the denoising intensity ka And filtering weight W g The correspondence of (2) can be seen in fig. 6. Thus, after the first rectangular window w is obtained k1 And a second rectangular window w k2 Corresponding first filter coefficient a k1 and ak2 After that, the corresponding absolute difference Diff of the denoising intensity can be calculated ka Then based on the absolute difference Diff of the denoising intensity ka And filtering weight W g The corresponding filter weight W can be obtained g
In this embodiment, in step S300, an edge gradient G of the image with strong denoising result is obtained x and Gy The steps of the values of (a) may be as follows:
the Sobel operator has a certain noise suppression effect while detecting the edge, so that the noise suppression effect can be effectively maintainedIn detail, in this embodiment, a Sobel operator is preferably used to detect an edge gradient of the image with a strong denoising result. Specifically, a 3*3 window can be obtained on the strong denoising result image based on a Sobel operator of 3*3, and the result G is obtained after the pixel matrix a of the window is obtained and the convolution operation is performed with the Sobel operator x and Gy The calculation formula is as follows:
(12)
(13)
wherein ,representing a horizontal direction operator, ++>Representing the vertical direction operator.
According to the values of the transverse gradient and the longitudinal gradient of each pixel of the image, the corresponding gradient size can be calculatedThen, it is possible to +_ according to the gradient magnitude>The value calculation of (a) determines whether the pixel belongs to noise or an edge.
Gradient sizeThe calculation formula of (2) is as follows:
(14)
in this embodiment, the above equation is simplified to:
(15)
specifically, the step of judging pixel information to be subjected to edge smoothing processing according to the value of the edge gradient is as follows:
first, according to the edge gradient G of the strong denoising result image x and Gy Calculating the corresponding gradient magnitude, wherein
Then, based on the gradient threshold parameter TH set by the user, the foregoing is comparedAnd the magnitude of the gradient threshold parameter TH.
If it isAnd when the corresponding center point is judged to be noise, and edge smoothing processing is not performed.
If it isIn this case, it is determined that the corresponding center point is an edge, and an edge smoothing process is required.
And when the corresponding center point is judged to be an edge, continuing to judge whether the center point belongs to a transverse edge or a longitudinal edge.
If it isWhen the center point is determined to be a lateral edge.
If it isWhen this center point is determined to be a longitudinal edge.
Triggering to carry out edge smoothing processing on the horizontal direction and the vertical direction on the transverse edge and the longitudinal edge respectively.
In particular, forCalculating pixel information +.>The formula of (2) is as follows:
(16)
(17)
for the followingCalculating pixel information +.>The formula of (2) is as follows:
(18)
(19)
by utilizing the technical scheme provided by the invention, the guide filtering algorithm is utilized to remove noise and smooth edges, so that the edge detail can be kept and the edges are smooth while the image noise is restrained, the edge burr phenomenon is obviously reduced, and the edges are excessively natural; meanwhile, the denoising strength and the edge smoothing strength can be controlled independently, so that a user can adjust the denoising and edge smoothing strength according to requirements, and the method is wide in applicability and high in flexibility.
The invention further provides an image edge processing device based on the guided filtering.
The device comprises an information acquisition module, a weak denoising module, a strong denoising module, a filtering weight adjustment module, an edge gradient detection module and a smoothing processing module.
The information acquisition module is used for acquiring an input image p and a guide image I; and collecting a first rectangular window w set by a user and used for weak denoising k1 And a second rectangular window w for strong denoising k2 The first rectangular window w k1 Is smaller than the second rectangular window w k2
The guide filtering filters the input image p by a guide image I such that the final output image is substantially similar to the input image p but the texture portion is similar to the guide image I. The guide image I may be a single image or the input image p itself. In this embodiment, preferably, the guiding image I is the input image p.
Preferably, the first rectangular window wk1 is an M1 x M1 window, and the second rectangular window wk2 is an M2 x M2 window, where M1< M2.
The weak denoising module is used for window w based on the guiding image I and the input image p k1 Conducting guided filtering to weakly remove noise, and calculating a corresponding filter coefficient (a k1 ,b k1), wherein ,ak1 and bk1 Representation window w k1 Coefficients of the linear model in (a).
The strong denoising module is used for window w based on the guiding image I and the input image p k2 Performing guided filtering to remove noise strongly, and calculating corresponding filter coefficient (a k2 ,b k2), wherein ,ak2 and bk2 Representation window w k2 Coefficients of the linear model in (a).
The filtering weight adjusting module is used for adjusting the filtering weight according to the filtering coefficient a k1 and ak2 Obtaining the absolute difference of the denoising intensityDiff ka The Diff is ka =|a k2 - a k1 I, based on preset denoising intensity absolute difference Diff ka And filtering weight W g Obtain the corresponding relation of the Diff ka Filter weight W corresponding to the value of (2) g The filtering weight is used for adjusting the denoising strength.
The edge gradient detection module is used for calculating an edge gradient G of the strong denoising result image based on the strong denoising result image x and Gy Wherein G is x Represents the transverse gradient, G y And representing the longitudinal gradient, and judging pixel information needing edge smoothing according to the value of the edge gradient.
The smoothing module is used for smoothing pixel information of the image GIF0 based on the weak denoising resultAccording to the filtering weight W g Performing edge smoothing on the pixel to be subjected to edge smoothing to obtain pixel information of the final result image>,/>The formula of (2) is as follows:
,
wherein ,for pixels +.>A corresponding center pixel mean; n is a preset threshold value of the filtering weight;iijjrepresenting the pixel subscript.
In this embodiment, the preset threshold value n=6 of the filtering weight, where theAbsolute difference Diff of denoising intensity ka And filtering weight W g The correspondence of (a) is as follows:
when (when)When in use, let->
When (when)When in use, let->
When (when)When in use, let->
When (when)When in use, let->
When (when)When in use, let->
When (when)When in use, let->
When (when)When in use, let->
In this embodiment, m1=3 and m2=9 are preferable. The edge gradient detection module comprises an edge gradient calculation unit and an edge detection judgment unit.
The edge gradient calculation unit is configured to: based on a Sobel operator of 3*3, a 3*3 window is obtained on a strong denoising result image, a pixel matrix A of the window is obtained, and convolution operation is carried out on the pixel matrix A and the Sobel operator to obtain a result G x and Gy
The edge detection judgment unit is configured to: edge gradient G of image according to strong denoising result x and Gy Calculating the corresponding gradient magnitude, wherein />The method comprises the steps of carrying out a first treatment on the surface of the Based on the gradient threshold parameter TH set by the user, the aforementioned +.>The magnitude of the gradient threshold parameter TH, when +.>When the corresponding center point is judged to be noise, edge smoothing is not performed; when->When the corresponding center point is judged to be an edge, edge smoothing processing is required, continuing to determine whether the center point belongs to the lateral edge or the longitudinal edge, wherein, when +.>When the center point is judged to be a transverse edge; when->When the center point is judged to be a longitudinal edge; triggering to carry out edge smoothing processing on the horizontal direction and the vertical direction on the transverse edge and the longitudinal edge respectively.
For other technical features, see the description of the previous embodiments, each module may be configured to perform the corresponding information processing procedure described in the previous embodiments, which is not described herein.
In another embodiment of the invention, an edge enhancement processing system for an image is also provided. The system includes a processor and a memory for storing processor-executable instructions and parameters.
Wherein the processor is configured to:
acquiring an input image p and a guide image I, and a first rectangular window w for weak denoising set by a user k1 And a second rectangular window w for strong denoising k2 The first rectangular window w k1 Is smaller than the second rectangular window w k2 The method comprises the steps of carrying out a first treatment on the surface of the Window w for guiding image I and input image p k1 Conducting guided filtering to weakly remove noise, and calculating a corresponding filter coefficient (a k1 ,b k1), wherein ,ak1 and bk1 Representation window w k1 Based on coefficients of the linear model in the guide image I and the window w for the input image p k2 Performing guided filtering to remove noise strongly, and calculating corresponding filter coefficient (a k2 ,b k2), wherein ,ak2 and bk2 Representation window w k2 Coefficients of the linear model in (a);
and according to the aforementioned filter coefficient a k1 and ak2 Obtaining the absolute difference Diff of the denoising intensity ka The Diff is ka =|a k2 - a k1 I, based on preset denoising intensity absolute difference Diff ka And filtering weight W g Obtain the corresponding relation of the Diff ka Filter weight W corresponding to the value of (2) g The filtering weight is used for adjusting the denoising intensityThe method comprises the steps of carrying out a first treatment on the surface of the Computing edge gradient G of strong denoising result image based on strong denoising result image x and Gy Wherein G is x Represents the transverse gradient, G y Representing a longitudinal gradient, and judging pixel information needing edge smoothing according to the value of the edge gradient; then, pixel information of the image GIF0 based on the weak denoising resultAccording to the filtering weight W g Performing edge smoothing on the pixel to be subjected to edge smoothing to obtain pixel information of the final result image>,/>The formula of (2) is as follows:
,
wherein ,for pixels +.>A corresponding center pixel mean; n is a preset threshold value of the filtering weight;iijjrepresenting the pixel subscript.
For other technical features, see the description of the previous embodiments, the processor may be configured to include a plurality of modules, such as the foregoing weak denoising module, strong denoising module, filtering weight adjustment module, edge gradient detection module, and smoothing processing module, to perform the information processing procedure described in the previous embodiments, which are not described herein.
In the above description, the disclosure of the present invention is not intended to limit itself to these aspects. Rather, the components may be selectively and operatively combined in any number within the scope of the present disclosure. In addition, terms like "comprising," "including," and "having" should be construed by default as inclusive or open-ended, rather than exclusive or closed-ended, unless expressly defined to the contrary. All technical, scientific, or other terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. Common terms found in dictionaries should not be too idealized or too unrealistically interpreted in the context of the relevant technical document unless the present disclosure explicitly defines them as such. Any alterations and modifications of the present invention, which are made by those of ordinary skill in the art based on the above disclosure, are intended to be within the scope of the appended claims.

Claims (10)

1. An image edge processing method based on guide filtering is characterized by comprising the following steps:
acquiring an input image p and a guide image I;
collecting a first rectangular window w set by a user and used for weak denoising k1 And a second rectangular window w for strong denoising k2 The first rectangular window w k1 Is smaller than the second rectangular window w k2 The method comprises the steps of carrying out a first treatment on the surface of the Window w for guiding image I and input image p k1 Conducting guided filtering to weakly remove noise, and calculating a corresponding filter coefficient (a k1 ,b k1), wherein ,ak1 and bk1 Representation window w k1 Coefficients of the linear model in (a); window w for guiding image I and input image p k2 Performing guided filtering to remove noise strongly, and calculating corresponding filter coefficient (a k2 ,b k2), wherein ,ak2 and bk2 Representation window w k2 Coefficients of the linear model in (a);
according to the aforementioned filter coefficient a k1 and ak2 Obtaining the absolute difference Diff of the denoising intensity ka The Diff is ka =|a k2 - a k1 I, based on preset denoising intensity absolute difference Diff ka And filtering weight W g Obtain the corresponding relation of the Diff ka Filter weights corresponding to the values of (2)W g The filtering weight is used for adjusting the denoising strength; and obtaining an edge gradient G of the strong denoising result image x and Gy Wherein G is x Represents the transverse gradient, G y Representing a longitudinal gradient, and judging pixel information needing edge smoothing according to the value of the edge gradient;
pixel information based on weak denoising result image GIF0According to the filtering weight W g After performing edge smoothing on the pixels to be subjected to edge smoothing, calculating pixel information of the final result image +.>The formula is as follows:
,
wherein ,for pixels +.>A corresponding center pixel mean; n is a preset threshold value of the filtering weight;iijjrepresenting the pixel subscript.
2. The method according to claim 1, characterized in that: the guide image I is the input image p.
3. The method according to claim 2, characterized in that: the preset threshold value n=6 of the filtering weight, at this time, the absolute difference Diff of the denoising intensity ka And filtering weight W g The correspondence of (a) is as follows:
when (when)When in use, let->
When (when)When in use, let->
When (when)When in use, let->
When (when)When in use, let->
When (when)When in use, let->
When (when)When in use, let->
When (when)When in use, let->
4. A method according to claim 3, characterized in that: the first rectangular window w k1 For M1 window, the second rectangular window w k2 Is a window of M2 x M2, wherein M1<M2。
5. The method according to claim 4, wherein: m1=3, m2=9; obtaining edge gradient G of strong denoising result image x and Gy The step of the value of (c) comprises,
based on a Sobel operator of 3*3, a 3*3 window is obtained on a strong denoising result image, a pixel matrix A of the window is obtained, and convolution operation is carried out on the pixel matrix A and the Sobel operator to obtain a result G x and Gy The calculation formula is as follows:
6. the method according to claim 5, wherein: the step of judging pixel information to be subjected to edge smoothing processing based on the value of the edge gradient includes,
edge gradient G of image according to strong denoising result x and Gy Calculating the corresponding gradient magnitude, wherein
Comparing the gradient threshold value parameters TH based on the user settingAnd the magnitude of the gradient threshold parameter TH, whenWhen the corresponding center point is judged to be noise, edge smoothing is not performed; when->When the corresponding center point is judged to be an edge, edge smoothing processing is needed to continuously judge whether the center point belongs to a transverse edge or a longitudinal edge, wherein,
when (when)When the center point is judged to be a transverse edge;
when (when)When the center point is judged to be a longitudinal edge;
triggering to carry out edge smoothing processing on the horizontal direction and the vertical direction on the transverse edge and the longitudinal edge respectively.
7. The method according to claim 6, wherein:
for the followingCalculating pixel information +.>The formula of (2) is as follows:
for the followingCalculating pixel information +.>The formula of (2) is as follows:
8. the method according to claim 1, characterized in that: by means of windows w kn When guided filtering denoising is performed, the filter coefficient (a kn ,b kn ) The calculation formula of (2) is as follows:
wherein i represents a pixel; n is a window subscript, n=1, 2;to guide the imageIWindow->The pixel mean value of (a);for inputting images +.>Window->The pixel mean value of (a); but->For window->Pixel variance in (a);εis a preset smoothing parameter;I i to guide the pixel value of the i-th pixel in the image,p i for the pixel value of the i-th pixel in the input image,
9. an image edge processing apparatus based on guided filtering, characterized by comprising:
the information acquisition module is used for acquiring an input image p and a guide image I; and collecting a first rectangular window w set by a user and used for weak denoising k1 And a second rectangular window w for strong denoising k2 The first rectangular window w k1 Is smaller than the second rectangular window w k2
A weak denoising module for window w based on the guiding image I and the input image p k1 Conducting guided filtering to weakly remove noise, and calculating a corresponding filter coefficient (a k1 ,b k1), wherein ,ak1 and bk1 Representation window w k1 Coefficients of the linear model in (a);
a strong denoising module for window w based on the guiding image I and the input image p k2 Performing guided filtering to remove noise strongly, and calculating corresponding filter coefficient (a k2 ,b k2), wherein ,ak2 and bk2 Representation window w k2 Coefficients of the linear model in (a);
a filtering weight adjusting module for adjusting the filtering coefficient according to the filtering coefficient a k1 and ak2 Obtaining the absolute difference Diff of the denoising intensity ka The Diff is ka =|a k2 - a k1 I, based on preset denoising intensity absolute difference Diff ka And filtering weight W g Obtain the corresponding relation of the Diff ka Filter weight W corresponding to the value of (2) g The filtering weight is used for adjusting the denoising strength;
an edge gradient detection module for calculating an edge gradient G of the strong denoising result image based on the strong denoising result image x and Gy Wherein G is x Represents the transverse gradient, G y Representing a longitudinal gradient, and judging pixel information needing edge smoothing according to the value of the edge gradient;
a smoothing module for smoothing pixel information of the image GIF0 based on the weak denoising resultAccording to the filtering weight W g Performing edge smoothing on pixels needing edge smoothing to obtain pixel information of a final result image,/>The formula of (2) is as follows:
,
wherein ,for pixels +.>A corresponding center pixel mean; n is a preset threshold value of the filtering weight;iijjrepresenting the pixel subscript.
10. An edge enhancement processing system for an image, comprising:
a processor;
a memory for storing processor-executable instructions and parameters;
the processor is configured to: acquiring an input image p and a guide image I, and a first rectangular window w for weak denoising set by a user k1 And a second rectangular window w for strong denoising k2 The first rectangular window w k1 Is smaller than the second rectangular window w k2 The method comprises the steps of carrying out a first treatment on the surface of the Window w for guiding image I and input image p k1 Conducting guided filtering to weakly remove noise, and calculating a corresponding filter coefficient (a k1 ,b k1), wherein ,ak1 and bk1 Representation window w k1 Based on coefficients of the linear model in the guide image I and the window w for the input image p k2 Performing guided filtering to remove noise strongly, and calculating corresponding filter coefficient (a k2 ,b k2), wherein ,ak2 and bk2 Representation window w k2 Coefficients of the linear model in (a); the method comprises the steps of,
according to the aforementioned filter coefficient a k1 and ak2 Obtaining the absolute difference Diff of the denoising intensity ka The Diff is ka =|a k2 - a k1 I, based on preset denoising intensity absolute difference Diff ka And filtering weight W g Obtain the corresponding relation of the Diff ka Filter weight W corresponding to the value of (2) g The filtering weight is used for adjusting the denoising strength; computing edge gradient G of strong denoising result image based on strong denoising result image x and Gy Wherein G is x Represents the transverse gradient, G y Representing a longitudinal gradient, and judging pixel information needing edge smoothing according to the value of the edge gradient; then, pixel information of the image GIF0 based on the weak denoising resultAccording to the filtering weight W g Performing edge smoothing on the pixel to be subjected to edge smoothing to obtain pixel information of the final result image>,/>The formula of (2) is as follows:
,
wherein ,for pixels +.>A corresponding center pixel mean; n is a preset threshold value of the filtering weight;iijjrepresenting the pixel subscript.
CN202110969770.7A 2021-08-23 2021-08-23 Image edge processing method based on guided filtering and application Active CN113610734B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110969770.7A CN113610734B (en) 2021-08-23 2021-08-23 Image edge processing method based on guided filtering and application

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110969770.7A CN113610734B (en) 2021-08-23 2021-08-23 Image edge processing method based on guided filtering and application

Publications (2)

Publication Number Publication Date
CN113610734A CN113610734A (en) 2021-11-05
CN113610734B true CN113610734B (en) 2023-10-03

Family

ID=78341637

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110969770.7A Active CN113610734B (en) 2021-08-23 2021-08-23 Image edge processing method based on guided filtering and application

Country Status (1)

Country Link
CN (1) CN113610734B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114125471A (en) * 2021-11-27 2022-03-01 北京工业大学 Video coding pre-filtering method
CN118229574B (en) * 2024-05-21 2024-08-06 济宁景泽信息科技有限公司 Digital enhancement method for water supply and drainage design drawing

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106228515A (en) * 2016-07-13 2016-12-14 凌云光技术集团有限责任公司 A kind of image de-noising method and device
CN108830798A (en) * 2018-04-23 2018-11-16 西安电子科技大学 Improved image denoising method based on propagation filter
CN111028171A (en) * 2019-12-06 2020-04-17 北京金山云网络技术有限公司 Method, device and server for determining noise level of image
CN112488957A (en) * 2020-12-15 2021-03-12 南京理工大学 Low-illumination color image real-time enhancement method and system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9002131B2 (en) * 2011-09-18 2015-04-07 Forus Health Pvt. Ltd. Method and system for enhancing image quality

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106228515A (en) * 2016-07-13 2016-12-14 凌云光技术集团有限责任公司 A kind of image de-noising method and device
CN108830798A (en) * 2018-04-23 2018-11-16 西安电子科技大学 Improved image denoising method based on propagation filter
CN111028171A (en) * 2019-12-06 2020-04-17 北京金山云网络技术有限公司 Method, device and server for determining noise level of image
CN112488957A (en) * 2020-12-15 2021-03-12 南京理工大学 Low-illumination color image real-time enhancement method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
喻恒 ; 胡海峰 ; 耿则勋 ; .图像梯度引导的窗口形状自适应双边滤波.计算机应用与软件.2019,(第12期),全文. *

Also Published As

Publication number Publication date
CN113610734A (en) 2021-11-05

Similar Documents

Publication Publication Date Title
CN103440630B (en) Show and detail enhancing method based on the Larger Dynamic scope infrared image guiding wave filter
CN113610734B (en) Image edge processing method based on guided filtering and application
US8306348B2 (en) Techniques for adjusting the effect of applying kernels to signals to achieve desired effect on signal
Pang et al. Improved single image dehazing using guided filter
Deng et al. A guided edge-aware smoothing-sharpening filter based on patch interpolation model and generalized gamma distribution
CN109003233B (en) Image denoising method based on self-adaptive weight total variation model
CN107292834B (en) Infrared image detail enhancement method
US20120308153A1 (en) Device and method of removing noise in edge area
CN112419162A (en) Image defogging method and device, electronic equipment and readable storage medium
WO2017100971A1 (en) Deblurring method and device for out-of-focus blurred image
KR101684990B1 (en) Method for deblurring vehicle image using sigma variation of Bilateral Filter
CN108470343A (en) A kind of improved method for detecting image edge
CN105631854A (en) FPGA platform-based self-adaptive image definition evaluation algorithm
CN108961172A (en) A kind of method for enhancing picture contrast based on Gamma correction
CN107025640A (en) The Medical Image Denoising method of non-local mean based on optimization
CN115660976A (en) Image processing method, device, equipment and computer readable storage medium
CN109064413B (en) Image contrast enhancement method and image acquisition medical equipment adopting same
CN107610072B (en) Adaptive noise reduction method for low-light-level video image based on gradient guided filtering
CN109035228B (en) X-ray image processing method of non-uniform-thickness component
CN103886558A (en) Improved adaptive threshold wavelet denoising algorithm based on LoG operator
KR101651889B1 (en) Video quality enhancement device and method for extremely low-light video
JP2024037722A (en) Content based image processing
Septiana et al. X-ray image enhancement using a modified anisotropic diffusion
CN115311243A (en) Image sharpening method and terminal based on filtering difference
RU2405200C2 (en) Method and device for fast noise filtration in digital images

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant