CN106920222A - A kind of image smoothing method and device - Google Patents
A kind of image smoothing method and device Download PDFInfo
- Publication number
- CN106920222A CN106920222A CN201710146581.3A CN201710146581A CN106920222A CN 106920222 A CN106920222 A CN 106920222A CN 201710146581 A CN201710146581 A CN 201710146581A CN 106920222 A CN106920222 A CN 106920222A
- Authority
- CN
- China
- Prior art keywords
- image
- smoothed
- smoothing
- original image
- function
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 142
- 238000003706 image smoothing Methods 0.000 title claims abstract description 47
- 238000001914 filtration Methods 0.000 claims abstract description 85
- 238000009499 grossing Methods 0.000 claims abstract description 82
- 230000002146 bilateral effect Effects 0.000 claims abstract description 36
- 230000004087 circulation Effects 0.000 claims 4
- 238000011084 recovery Methods 0.000 claims 2
- 238000010276 construction Methods 0.000 claims 1
- 230000000694 effects Effects 0.000 abstract description 24
- 238000012545 processing Methods 0.000 abstract description 20
- 230000008901 benefit Effects 0.000 abstract description 10
- 239000000470 constituent Substances 0.000 abstract 1
- 230000006870 function Effects 0.000 description 72
- 239000013598 vector Substances 0.000 description 11
- 230000008569 process Effects 0.000 description 10
- 238000005516 engineering process Methods 0.000 description 6
- 230000009286 beneficial effect Effects 0.000 description 5
- 239000011159 matrix material Substances 0.000 description 5
- 238000002474 experimental method Methods 0.000 description 4
- 238000000605 extraction Methods 0.000 description 4
- 230000003044 adaptive effect Effects 0.000 description 3
- 238000005457 optimization Methods 0.000 description 3
- 238000004321 preservation Methods 0.000 description 3
- 230000009466 transformation Effects 0.000 description 3
- 238000004458 analytical method Methods 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 230000007423 decrease Effects 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000018109 developmental process Effects 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 230000002708 enhancing effect Effects 0.000 description 1
- 238000003709 image segmentation Methods 0.000 description 1
- 238000012804 iterative process Methods 0.000 description 1
- 230000014759 maintenance of location Effects 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 230000000630 rising effect Effects 0.000 description 1
- 238000005096 rolling process Methods 0.000 description 1
- 230000003595 spectral effect Effects 0.000 description 1
- 238000003860 storage Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/70—Denoising; Smoothing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20024—Filtering details
- G06T2207/20028—Bilateral filtering
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20048—Transform domain processing
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
Description
技术领域technical field
本发明实施例涉及图像处理技术领域,特别是涉及一种图像平滑方法及装置。The embodiments of the present invention relate to the technical field of image processing, and in particular, to an image smoothing method and device.
背景技术Background technique
随着计算机图像处理技术的迅猛发展,图像平滑技术为了满足当前图像处理技术领域的高要求,也得到了较快的发展。图像平滑技术是指用于突出图像的宽大区域、低频成分、主干部分或抑制图像噪声和干扰高频成分,使图像亮度平缓渐变,减小突变梯度,改善图像质量的图像处理技术,广泛的应用于图像分割、去噪、细节增强,目标分类,边缘提取等领域中。With the rapid development of computer image processing technology, image smoothing technology has also developed rapidly in order to meet the high requirements of the current image processing technology field. Image smoothing technology refers to the image processing technology used to highlight the wide area, low-frequency components, and main parts of the image or suppress image noise and interference high-frequency components, make the image brightness gradually change, reduce the abrupt gradient, and improve image quality. It is widely used In image segmentation, denoising, detail enhancement, object classification, edge extraction and other fields.
图像在获取和传递过程中往往不可避免的会受到噪声、不重要的细节(尤其是高对比度)的干扰,使得待识别的目标出现轮廓特征不明显的问题,给识别带来了困难。利用图像平滑技术对图像进行处理可以在一定程度上规避干扰,从而提高图像识别的成功率。In the process of image acquisition and transmission, it is unavoidable to be disturbed by noise and unimportant details (especially high contrast), which makes the target to be recognized appear inconspicuous, which brings difficulties to the recognition. Using image smoothing technology to process images can avoid interference to a certain extent, thereby improving the success rate of image recognition.
现有技术中,图像平滑方法一般为局部平滑方法以及全局平滑方法。局部平滑方法,例如高斯滤波、双边滤波、中值滤波、变换域滤波等,是指对图像的局部区域或补丁进行处理。局部平滑法仅仅顾及到图像的局部区域特征,对图像局部的平滑效果较好,但容易造成结构模糊问题。全局平滑法,如全变分平滑算法、加权最小均方平滑算法、L0梯度最小化平滑算法等,是同时对整个图像的所有区域进行处理。全局平滑法的结构保持约束项的优化框架较为灵活,对于图像的全局特征要优于局部平滑法,特别是对图像的背景部分等不重要的细节,但是全局平滑算法往往对局部高对比度噪声的平滑效果较差。In the prior art, image smoothing methods generally include local smoothing methods and global smoothing methods. Local smoothing methods, such as Gaussian filtering, bilateral filtering, median filtering, transform domain filtering, etc., refer to processing local regions or patches of images. The local smoothing method only takes into account the local area characteristics of the image, and has a better smoothing effect on the local area of the image, but it is easy to cause the problem of structural blur. Global smoothing methods, such as total variational smoothing algorithm, weighted least mean square smoothing algorithm, L 0 gradient minimization smoothing algorithm, etc., process all areas of the entire image at the same time. The structure of the global smoothing method keeps the optimization framework of the constraint items more flexible, and it is better than the local smoothing method for the global features of the image, especially for the unimportant details such as the background part of the image, but the global smoothing algorithm often affects the local high contrast noise. Smoothing is less effective.
综上所述,局部平滑方法以及全局平滑方法各有优劣,在对图像进行平滑处理时,如何综合应用全局特征以及局部特征,规避局部平滑方法以及全局平滑方法的劣势,以提高图像平滑算法的鲁棒性,获得好的图像平滑效果,是本领域技术人员亟待解决的问题。In summary, local smoothing methods and global smoothing methods have their own advantages and disadvantages. When smoothing images, how to comprehensively apply global features and local features, avoid the disadvantages of local smoothing methods and global smoothing methods, and improve image smoothing algorithms. Robustness and obtaining a good image smoothing effect are urgent problems to be solved by those skilled in the art.
发明内容Contents of the invention
本发明实施例的目的是提供一种图像平滑方法及装置,以提高图像平滑算法的鲁棒性,获得好的图像平滑效果。The purpose of the embodiments of the present invention is to provide an image smoothing method and device, so as to improve the robustness of an image smoothing algorithm and obtain a good image smoothing effect.
为解决上述技术问题,本发明实施例提供以下技术方案:In order to solve the above technical problems, embodiments of the present invention provide the following technical solutions:
本发明实施例一方面提供了一种图像平滑方法,包括:An embodiment of the present invention provides an image smoothing method, including:
对原始图像循环进行预设次数的双边滤波以及变换域滤波,以获得引导图像;Perform preset times of bilateral filtering and transform domain filtering on the original image to obtain a guide image;
根据最小二乘法对所述原始图像、所述引导图像以及预设平滑图像构造最小二乘模型;Constructing a least squares model for the original image, the guide image and the preset smoothed image according to the least squares method;
利用范数定义所述预设平滑图像的像素强度以及梯度,以获得所述预设平滑图像的约束函数;defining the pixel intensity and gradient of the preset smooth image by norm, so as to obtain the constraint function of the preset smooth image;
根据所述最小二乘模型以及所述约束函数得到平滑能量目标函数;obtaining a smooth energy objective function according to the least squares model and the constraint function;
利用半二次分裂法以及交替固定变量法求解所述平滑能量目标函数,以获得平滑图像。The smooth energy objective function is solved by semi-quadratic splitting method and alternating fixed variable method to obtain a smooth image.
可选的,所述根据最小二乘法对所述原始图像、所述引导图像以及预设平滑图像构造最小二乘模型为:Optionally, the least squares model constructed for the original image, the guide image and the preset smooth image according to the least squares method is:
根据所述最小二乘法以及2-范数的平方对所述原始图像、所述引导图像以及预设平滑图像构造最小二乘模型为:According to the least squares method and the square of 2-norm, the least squares model is constructed for the original image, the guide image and the preset smooth image as:
式中,S为所述预设平滑图像,I为所述原始图像,G为所述引导图像,α为细节恢复因子。In the formula, S is the preset smooth image, I is the original image, G is the guide image, and α is the detail restoration factor.
可选的,所述利用范数定义所述预设平滑图像的像素强度以及梯度为:Optionally, the definition of pixel intensity and gradient of the preset smoothing image using a norm is:
利用0-范数定义所述预设平滑图像的像素强度以及梯度。The 0-norm is used to define the pixel intensity and gradient of the preset smoothing image.
可选的,所述根据所述最小二乘模型以及所述约束函数得到平滑能量目标函数为:Optionally, the smooth energy objective function obtained according to the least squares model and the constraint function is:
根据所述最小二乘模型以及所述约束函数得到平滑能量目标函数为:According to the least squares model and the constraint function, the smooth energy objective function is:
式中,E(S)为所述平滑能量目标函数,S为所述预设平滑图像,I为所述原始图像,G为所述引导图像,α为所述细节恢复因子,λ为平滑因子,||▽S||0为所述约束函数。In the formula, E(S) is the smoothing energy objective function, S is the preset smoothing image, I is the original image, G is the guiding image, α is the detail restoration factor, and λ is the smoothing factor , ||▽S|| 0 is the constraint function.
可选的,所述根据最小二乘法对所述原始图像、所述引导图像以及预设平滑图像构造最小二乘模型为:Optionally, the least squares model constructed for the original image, the guide image and the preset smooth image according to the least squares method is:
根据所述最小二乘法对经过中值滤波的原始图像、所述引导图像以及预设平滑图像构造最小二乘模型。A least squares model is constructed on the median filtered original image, the guide image and the preset smoothed image according to the least squares method.
可选的,所述对原始图像循环进行预设循环次数的双边滤波以及变换域滤波,以获得引导图像包括:Optionally, performing bilateral filtering and transform domain filtering with a preset number of cycles on the original image to obtain a guide image includes:
S1:获取所述原始图像、常值图像、空间权重值以及范围权重值;S1: Obtain the original image, constant value image, spatial weight value and range weight value;
S2:以所述常值图像为初始引导函数,根据变换域滤波法对所述原始图像以及所述初始引导函数进行变换域滤波,得到新引导函数;S2: Using the constant value image as an initial guiding function, perform transform domain filtering on the original image and the initial guiding function according to a transform domain filtering method to obtain a new guiding function;
S3:根据双边滤波法对所述原始图像以及所述新引导函数进行双边滤波,得到一次引导函数;S3: Perform bilateral filtering on the original image and the new guiding function according to the bilateral filtering method to obtain a primary guiding function;
S4:对S2以及S3循环执行所述预设次数,以获得所述引导图像。S4: cyclically execute S2 and S3 for the preset number of times to obtain the guide image.
可选的,所述预设次数为3次。Optionally, the preset number of times is 3 times.
可选的,所述空间权重值以及范围权重值为:Optionally, the space weight value and range weight value are:
所述空间权重值为3;The spatial weight value is 3;
所述范围权重值为0.01。The range weight value is 0.01.
可选的,所述利用半二次分裂法以及交替固定变量法求解所述平滑能量目标函数,以获得平滑图像包括:Optionally, solving the smooth energy objective function by using the semi-quadratic splitting method and the alternating fixed variable method to obtain a smooth image includes:
引入辅助变量替换所述平滑能量目标函数中的约束函数项;introducing auxiliary variables to replace the constraint function term in the smooth energy objective function;
利用所述半二次分裂法对替换过的平滑能量目标函数进行最小化处理,加入误差惩罚项,得到平滑最小化模型;Using the semi-quadratic splitting method to minimize the replaced smooth energy objective function, adding an error penalty term to obtain a smooth minimization model;
根据所述交替固定变量法求解所述平滑最小化模型,以获得所述平滑图像。Solving the smoothing minimization model according to the alternating fixed variable method to obtain the smoothed image.
本发明实施例另一方面提供了一种图像平滑装置,包括:Another aspect of the embodiment of the present invention provides an image smoothing device, including:
滤波平滑模块,用于对原始图像循环进行预设次数的双边滤波以及变换域滤波,以获得引导图像;A filtering and smoothing module, for performing a preset number of bilateral filtering and transform domain filtering on the original image to obtain a guide image;
建立模型模块,用于根据最小二乘法对所述原始图像、所述引导图像以及预设平滑图像构造最小二乘模型;Establishing a model module for constructing a least squares model for the original image, the guide image and the preset smooth image according to the least squares method;
获取平滑图像模块,用于利用范数定义所述预设平滑图像的像素强度以及梯度,以获得所述预设平滑图像的约束函数;根据所述最小二乘模型以及所述约束函数得到平滑能量目标函数;利用半二次分裂法以及交替固定变量法求解所述平滑能量目标函数,以获得平滑图像。Obtaining a smooth image module, used to define the pixel intensity and gradient of the preset smooth image by norm, so as to obtain the constraint function of the preset smooth image; obtain the smooth energy according to the least squares model and the constraint function Objective function: using the semi-quadratic splitting method and the alternating fixed variable method to solve the smooth energy objective function to obtain a smooth image.
本发明实施例提供了一种图像平滑方法,先利用局部平滑法中的双边滤波以及变换域滤波对原始图像进行平滑处理,获得引导图像;然后利用最小二乘法对原始图像、引导图像以及预设平滑图像构造最小二乘模型,加入对预设平滑图像的约束函数以控制平滑图像的稀疏度,得到平滑能量目标函数;最后利用半二次分裂法以及交替固定变量法求解该函数,从而获得原始图像经过平滑处理后的平滑图像。The embodiment of the present invention provides an image smoothing method. First, the original image is smoothed by bilateral filtering and transform domain filtering in the local smoothing method to obtain a guide image; then the original image, the guide image and the preset The least squares model is constructed from the smooth image, and the constraint function on the preset smooth image is added to control the sparsity of the smooth image to obtain the smooth energy objective function; finally, the function is solved by using the semi-quadratic splitting method and the alternating fixed variable method to obtain the original A smoothed image after the image has been smoothed.
本申请提供的技术方案,综合考虑全局特征以及局部特征,先对原始图像进行局部平滑处理,然后进行全局平滑处理,规避了局部平滑方法以及全局平滑方法的劣势,有效的利用了二者的优势。通过控制平滑图像与原始图像之间差异以及控制平滑图像与引导图像差异,增强了对原始图像中结构成分的保护,保留了图像的结构,在去除细节纹理特征的同时恢复了一些高对比度的细节,获得了好的图像平滑效果;此外,对图像进行了有效的噪声滤除,加强了边界像素的强度,有利于图像轮廓的提取,从而有利于提高图像识别的准确率与效率。The technical solution provided by this application comprehensively considers the global features and local features, first performs local smoothing processing on the original image, and then performs global smoothing processing, avoids the disadvantages of the local smoothing method and the global smoothing method, and effectively utilizes the advantages of both . By controlling the difference between the smoothed image and the original image and controlling the difference between the smoothed image and the guided image, the protection of the structural components in the original image is enhanced, the structure of the image is preserved, and some high-contrast details are restored while removing detailed texture features. , to obtain a good image smoothing effect; in addition, effective noise filtering is carried out on the image, which strengthens the intensity of boundary pixels, which is beneficial to the extraction of image contours, and thus helps to improve the accuracy and efficiency of image recognition.
此外,本发明实施例还针对图像平滑方法提供了相应的实现装置,进一步使得所述方法更具有实用性,所述装置具有相应的优点。In addition, the embodiment of the present invention also provides a corresponding implementation device for the image smoothing method, which further makes the method more practical, and the device has corresponding advantages.
附图说明Description of drawings
为了更清楚的说明本发明实施例或现有技术的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单的介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions of the prior art, the following will briefly introduce the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only For some embodiments of the present invention, those skilled in the art can also obtain other drawings based on these drawings without creative work.
图1-1为本发明实施例提供的一个示例性例子的原始图像;Fig. 1-1 is the original image of an exemplary example provided by the embodiment of the present invention;
图1-2为本发明实施例提供的图1-1中的原始图像经平滑处理后的图像;Fig. 1-2 is the smoothed image of the original image in Fig. 1-1 provided by the embodiment of the present invention;
图2为本发明实施例提供的一种图像平滑方法的流程示意图;FIG. 2 is a schematic flowchart of an image smoothing method provided by an embodiment of the present invention;
图3为本发明实施例提供的另一个示例性例子的原始图像;Fig. 3 is the original image of another exemplary example provided by the embodiment of the present invention;
图4为本发明实施例提供的图3中原始图像经过输入不同的空间权重值进行平滑处理得到的图像;Fig. 4 is the image obtained by smoothing the original image in Fig. 3 provided by an embodiment of the present invention by inputting different spatial weight values;
图5为本发明实施例提供的图3中原始图像经过输入不同的范围权重值进行平滑处理得到的图像;FIG. 5 is an image obtained by smoothing the original image in FIG. 3 provided by an embodiment of the present invention by inputting different range weight values;
图6为本发明实施例提供的图3中原始图像经过输入不同的细节恢复因子进行平滑处理得到的图像;Fig. 6 is an image obtained by smoothing the original image in Fig. 3 provided by an embodiment of the present invention by inputting different detail restoration factors;
图7为本发明实施例提供的图3中原始图像经过输入不同的平滑因子进行平滑处理得到的图像;FIG. 7 is an image obtained by smoothing the original image in FIG. 3 provided by an embodiment of the present invention by inputting different smoothing factors;
图8为本发明实施例提供的图像平滑装置的一种实施方式结构图;FIG. 8 is a structural diagram of an implementation manner of an image smoothing device provided by an embodiment of the present invention;
图9为本发明实施例提供的另一个示例性例子的原始图像;FIG. 9 is an original image of another exemplary example provided by an embodiment of the present invention;
图10为本发明实施例提供的图9中原始图像经过RGF和BLF算法进行平滑处理得到的图像;FIG. 10 is an image obtained by smoothing the original image in FIG. 9 provided by an embodiment of the present invention through RGF and BLF algorithms;
图11为本发明实施例提供的图9中原始图像经过RTV算法进行平滑处理得到的图像;Fig. 11 is the image obtained by smoothing the original image in Fig. 9 provided by the embodiment of the present invention through the RTV algorithm;
图12为本发明实施例提供的图9中原始图像经过NLGRTV算法进行平滑处理得到的图像;Fig. 12 is the image obtained by smoothing the original image in Fig. 9 provided by the embodiment of the present invention through the NLGRTV algorithm;
图13为本发明实施例提供的图9中原始图像经过SSPTF算法进行平滑处理得到的图像;Fig. 13 is the image obtained by smoothing the original image in Fig. 9 provided by the embodiment of the present invention through the SSPTF algorithm;
图14为本发明实施例提供的图9中原始图像经过本申请提供的算法进行平滑处理得到的图像;Fig. 14 is the image obtained by smoothing the original image in Fig. 9 provided by the embodiment of the present invention through the algorithm provided by the present application;
图15为本发明实施例提供的另一个示例性例子的原始图像;Fig. 15 is an original image of another exemplary example provided by the embodiment of the present invention;
图16为本发明实施例提供的图15中原始图像经过RGF和BLF算法进行去噪处理得到的图像;FIG. 16 is an image obtained by denoising the original image in FIG. 15 provided by an embodiment of the present invention through RGF and BLF algorithms;
图17为本发明实施例提供的图15中原始图像经过本申请提供的算法进行去噪处理得到的图像;Fig. 17 is an image obtained by denoising the original image in Fig. 15 provided by the embodiment of the present invention through the algorithm provided by the present application;
图18为本发明实施例提供的再一个示例性例子的原始图像;Fig. 18 is an original image of another exemplary example provided by the embodiment of the present invention;
图19为本发明实施例提供的图19中原始图像经过本申请提供的算法进行图像增强处理得到的图像。FIG. 19 is an image obtained by performing image enhancement processing on the original image in FIG. 19 provided by an embodiment of the present invention through the algorithm provided in this application.
具体实施方式detailed description
为了使本技术领域的人员更好地理解本发明方案,下面结合附图和具体实施方式对本发明作进一步的详细说明。显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to enable those skilled in the art to better understand the solution of the present invention, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. Apparently, the described embodiments are only some of the embodiments of the present invention, but not all of them. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”“第四”等是用于区别不同的对象,而不是用于描述特定的顺序。此外术语“包括”和“具有”以及他们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可包括没有列出的步骤或单元。The terms "first", "second", "third" and "fourth" in the specification and claims of this application and the above drawings are used to distinguish different objects, rather than to describe a specific order . Furthermore, the terms "comprising" and "having", and any variations thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, system, product, or device comprising a series of steps or units is not limited to the listed steps or units, but may include unlisted steps or units.
本申请的发明人经过研究发现,现有技术中往往只考虑局部特征或只考虑全局特征,导致平滑处理过的图像要么结构较为模糊,要么就是细节处理不好,局部噪声较大,总之,图像平滑效果难以符合图像处理技术领域的要求。鉴于此,本申请通过综合考虑全局特征以及局部特征,先对原始图像进行局部平滑处理,然后进行全局平滑处理,规避了局部平滑方法以及全局平滑方法的劣势,有效的利用了二者的优势,获得了好的图像平滑效果。The inventors of the present application have found through research that in the prior art, only local features or global features are often considered, resulting in either a blurred structure of the smoothed image, or poorly processed details and large local noise. In short, the image The smoothing effect is difficult to meet the requirements of the technical field of image processing. In view of this, this application first performs local smoothing processing on the original image and then global smoothing processing by comprehensively considering global features and local features, avoiding the disadvantages of local smoothing methods and global smoothing methods, and effectively utilizing the advantages of both. A good image smoothing effect is obtained.
基于上述本发明实施例的技术方案,下面首先结合图1以及图2对本发明实施例的技术方案涉及的一些可能的应用场景进行举例介绍,图1-1为本发明实施例提供的原始图像,图1-2为经过本申请提供的方法进行处理后的图像。Based on the above-mentioned technical solution of the embodiment of the present invention, some possible application scenarios related to the technical solution of the embodiment of the present invention will be described below with reference to Fig. 1 and Fig. 2. Fig. 1-1 is the original image provided by the embodiment of the present invention. Figures 1-2 are images processed by the method provided in this application.
先利用局部平滑法中的双边滤波以及变换域滤波对原始图像(图1-1)进行平滑处理,获得引导图像;然后利用最小二乘法对原始图像、引导图像以及预设平滑图像构造最小二乘模型,加入对预设平滑图像的约束函数以控制平滑图像的稀疏度,得到平滑能量目标函数;最后利用半二次分裂法以及交替固定变量法求解该函数,从而获得原始图像经过平滑处理后的平滑图像(图1-2)。对比图1-1和图1-2可以看出,本申请提供的技术方案对图形的进行平滑处理后,不仅保留了图像的结构,在去除细节纹理特征的同时恢复了一些高对比度的细节,得到了很好的平滑效果。First use the bilateral filtering and transform domain filtering in the local smoothing method to smooth the original image (Figure 1-1) to obtain the guide image; then use the least squares method to construct the least squares of the original image, the guide image and the preset smoothing image model, adding a constraint function to the preset smooth image to control the sparsity of the smooth image, and obtain the smooth energy objective function; finally, use the semi-quadratic splitting method and the alternating fixed variable method to solve the function, so as to obtain the original image after smoothing Smooth the image (Figure 1-2). Comparing Figure 1-1 and Figure 1-2, it can be seen that the technical solution provided by this application not only preserves the structure of the image after smoothing the graphics, but also restores some high-contrast details while removing detailed texture features. A nice smoothing effect is obtained.
需要注意的是,上述应用场景仅是为了便于理解本申请的思想和原理而示出,本申请的实施方式在此方面不受任何限制。相反,本申请的实施方式可以应用于适用的任何场景。It should be noted that the above application scenarios are only shown for the convenience of understanding the ideas and principles of the present application, and the implementation manners of the present application are not limited in this regard. On the contrary, the embodiments of the present application can be applied to any applicable scene.
在介绍了本发明实施例的技术方案后,下面详细的说明本申请的各种非限制性实施方式。After introducing the technical solutions of the embodiments of the present invention, various non-limiting implementations of the present application will be described in detail below.
首先参见图2,图2为本发明实施例提供的一种图像平滑方法的流程示意图,本发明实施例可包括以下内容:First, referring to FIG. 2, FIG. 2 is a schematic flowchart of an image smoothing method provided by an embodiment of the present invention. The embodiment of the present invention may include the following:
S201:对原始图像循环进行预设次数的双边滤波以及变换域滤波,以获得引导图像。S201: Circularly perform bilateral filtering and transform domain filtering for a preset number of times on the original image to obtain a guide image.
双边滤波与变换域滤波均属于局部平滑法。Both bilateral filtering and transform domain filtering are local smoothing methods.
双边滤波是一种非线性的滤波方法,是结合图像的空间邻近度和像素值相似度的一种折衷处理,同时考虑空域信息和灰度相似性,达到保边去噪的目的。具有简单、非迭代、局部的特点。双边滤波的优势是可以做边缘保存,一般过去用的维纳滤波或者高斯滤波去降噪,都会较明显地模糊边缘,对于高频细节的保护效果并不明显。双边滤波器顾名思义比高斯滤波多了一个高斯方差,它是基于空间分布的高斯滤波函数,所以在边缘附近,离的较远的像素不会太多影响到边缘上的像素值,这样就保证了边缘附近像素值的保存。但是由于保存了过多的高频信息,对于彩色图像里的高频噪声,双边滤波器不能够干净的滤掉,只能够对于低频信息进行较好的滤波。Bilateral filtering is a nonlinear filtering method, which is a compromise processing combining the spatial proximity of the image and the similarity of pixel values, while considering the spatial information and gray similarity to achieve the purpose of edge preservation and denoising. It is simple, non-iterative, and local. The advantage of bilateral filtering is that it can be used for edge preservation. Generally, Wiener filtering or Gaussian filtering used in the past for noise reduction will blur the edges more obviously, and the protection effect on high-frequency details is not obvious. As the name implies, the bilateral filter has a Gaussian variance more than the Gaussian filter. It is a Gaussian filter function based on the spatial distribution, so near the edge, the pixels farther away will not affect the pixel value on the edge too much, so that it is guaranteed Saving of pixel values near edges. However, due to the preservation of too much high-frequency information, the bilateral filter cannot cleanly filter out the high-frequency noise in the color image, and can only filter the low-frequency information better.
经过多次实验发现,在仅使用双边滤波时,获得的引导图像会损坏主要结构的边角,但所得图像平滑效果较好;而在仅使用变换域滤波时,获得的引导图像能更好地保护主要结构的边角,但所得图像平滑效果较差。故本申请同时使用双边滤波与变换域滤波对图像进行处理,具体流程可如下所示:After many experiments, it is found that when only bilateral filtering is used, the obtained guide image will damage the corners of the main structure, but the smoothing effect of the obtained image is better; and when only transform domain filtering is used, the obtained guide image can be better The corners of the main structure are preserved, but the resulting image is less smoothed. Therefore, this application uses both bilateral filtering and transform domain filtering to process images, and the specific process can be shown as follows:
S2011:获取原始图像、常值图像、空间权重值以及范围权重值;S2011: Obtain the original image, the constant value image, the spatial weight value and the range weight value;
S2012:以常值图像为初始引导函数,根据变换域滤波法对原始图像以及初始引导函数进行变换域滤波,得到新引导函数;S2012: Using the constant value image as the initial guiding function, perform transform domain filtering on the original image and the initial guiding function according to the transform domain filtering method to obtain a new guiding function;
S2013:根据双边滤波法对原始图像以及新引导函数进行双边滤波,得到一次引导函数;S2013: Perform bilateral filtering on the original image and the new guiding function according to the bilateral filtering method to obtain a primary guiding function;
S2014:对S2012以及S2013循环执行所述预设次数,以获得引导图像。S2014: Repeat S2012 and S2013 for the preset number of times to obtain a guide image.
原始图像即为待平滑处理图像,可以为任意格式的图像,例如tiff、tif、bmp、gif等,这均不影响本申请技术方案的实现。The original image is the image to be smoothed, and can be an image in any format, such as tiff, tif, bmp, gif, etc., which will not affect the realization of the technical solution of this application.
常值图像为全为常数0的图像。A constant image is an image that is all constant 0s.
空间权重σs以及范围权重σr为在对图像进行滤波时,用到的参数,一般在使用变换域滤波时,可设置空间权重为双边滤波空间权重的1.5倍,范围权重可设为双边滤波空间权重的3倍。当然,也可不按照上述的参数进行设置,本领域技术人员可根据实际情况进行配置参数,这均不影响本申请的实现。The spatial weight σ s and the range weight σ r are the parameters used when filtering the image. Generally, when using transform domain filtering, the spatial weight can be set to 1.5 times the spatial weight of the bilateral filter, and the range weight can be set to the bilateral filter. 3 times the space weight. Of course, it is also possible not to set the parameters according to the above, and those skilled in the art can configure the parameters according to the actual situation, which will not affect the implementation of the present application.
关于空间权重以及范围权重的取值(空间权重σs>1,范围权重σr>0),对图像的平滑效果以及分辨率的影响,可参见图3-5,图3为待处理的原始图像。由图4-5可知,在其他参数不变时,随着σs的减大,图像越来越模糊;在其他参数不变时,随着σr的增大,图像越来越模糊。由图可见,可选的,在空间权重值σs=3,范围权重值σr=0.01时,图像较为清晰,且具有较好的平滑效果。当然,本领域技术人员可根据具体需求及图像分辨率而定,本申请对此不做任何限定。Regarding the value of the spatial weight and range weight (spatial weight σ s > 1, range weight σ r > 0), the impact on image smoothing and resolution, please refer to Figure 3-5, Figure 3 is the original image to be processed image. It can be seen from Figure 4-5 that when other parameters remain unchanged, the image becomes more and more blurred as σ s decreases; when other parameters remain unchanged, as σ r increases, the image becomes more and more blurred. It can be seen from the figure that optionally, when the spatial weight value σ s =3 and the range weight value σ r =0.01, the image is clearer and has a better smoothing effect. Certainly, those skilled in the art may decide according to specific requirements and image resolution, which is not limited in this application.
需要说明的是,可以先经过双边滤波,再经过变换域滤波,然后循环执行n次;也可先经过变换域滤波,再经过双边滤波,然后循环执行n次;当然可也利用双边滤波进行n次滤波,再利用变换域滤波进行n次滤波;或者先利用变换域滤波进行n次滤波,再利用双边滤波进行n次滤波,这均不影响本申请的实现。但是,经过多次实验发现,先经过变换域滤波进行处理,再经过双边滤波进行滤波处理,然后循环执行n次,得到的图像平滑效果最好。故,可选的,可采用先对原始图像进行变换域滤波,再进行双边滤波,然后循环执行预设次数。It should be noted that bilateral filtering can be performed first, then transform domain filtering, and then looped n times; it can also be transformed first, then bilateral filtering, and then loop n times; of course, bilateral filtering can also be used for n The transformation domain filtering is used to perform n times of filtering; or the transformation domain filtering is used to perform n times of filtering, and then bilateral filtering is used to perform n times of filtering, which will not affect the implementation of this application. However, after many experiments, it is found that the smoothing effect of the obtained image is the best when it is first processed by transform domain filtering, then by bilateral filtering, and then looped n times. Therefore, optionally, transform domain filtering may be performed on the original image first, and then bilateral filtering may be performed, and then a preset number of cycles may be performed.
一次完整的滤波是先对原始图像进行变换域滤波,再进行双边滤波,循环执行是指对一次完整的滤波进行多次操作,举例来说,一次完整的滤波得到的引导图像为一次引导函数,再执行一次完整的滤波得到的是二次引导函数;循环n次,得到的即是n次引导函数。A complete filtering is to perform transformation domain filtering on the original image first, and then perform bilateral filtering. Loop execution refers to performing multiple operations on a complete filtering. For example, the guiding image obtained by a complete filtering is a guiding function. Perform another complete filtering to obtain the secondary guidance function; loop n times, and obtain the n-time guidance function.
据多次实验分析,循环预设次数超过3次就仅有细微的变化,而且增加次数对实验结果没有任何效果,反而会增大图像处理的时间,造成图像处理效率较低。故,可选的,预设次数可取值为3次。According to the analysis of multiple experiments, there is only a slight change in the preset number of cycles exceeding 3 times, and increasing the number of times has no effect on the experimental results, but will increase the time of image processing, resulting in low image processing efficiency. Therefore, optionally, the preset number of times may be 3 times.
经过循环执行上述操作,可以模糊原始图像的细节及小尺度噪声,同时还保留原始图像的结构成分。After performing the above operations in a loop, the details and small-scale noise of the original image can be blurred while retaining the structural components of the original image.
S202:根据最小二乘法对所述原始图像、所述引导图像以及预设平滑图像构造最小二乘模型。S202: Construct a least squares model for the original image, the guide image, and a preset smoothed image according to a least squares method.
最小二乘法(又称最小平方法)是一种数学优化方法。它通过最小化误差的平方和寻找数据的最佳函数匹配,利用最小二乘法可以简便地求得未知的数据,并使得这些求得的数据与实际数据之间误差的平方和为最小。The least square method (also known as the least square method) is a mathematical optimization method. It finds the best function matching of the data by minimizing the sum of the squares of the errors, and the unknown data can be easily obtained by using the least square method, and the sum of the squares of the errors between the obtained data and the actual data is minimized.
平滑图像为原始图像经过本申请的图像平滑方法进行平滑处理后,得到的图像。因为平滑图像是未知的,而采用最小二乘法构造的模型可实现对未知数据的求解,故可假设平滑图像为预设平滑图像,作为未知的数据带入最小二乘模型中。例如数学中一元一次方程的概念,对于求解未知量,一般会先假设变量x,然后将已知量带入求解,从而得到x的值。The smoothed image is an image obtained after the original image is smoothed by the image smoothing method of the present application. Because the smooth image is unknown, and the model constructed by the least square method can solve the unknown data, it can be assumed that the smooth image is a preset smooth image, which is brought into the least square model as unknown data. For example, the concept of a linear equation in one variable in mathematics, to solve the unknown quantity, the variable x is generally assumed first, and then the known quantity is brought into the solution to obtain the value of x.
范数,是具有“长度”概念的函数其为矢量空间内的所有矢量赋予非零的正长度或大小。半范数反而可以为非零的矢量赋予零长度。举例来说,在二维的欧氏几何空间R就可定义欧氏范数。在这个矢量空间中的元素常常在笛卡儿坐标系统中被画成一个从原点出发的带有箭头的有向线段。每一个矢量的欧氏范数就是有向线段的长度。A norm, is a function with the notion of "length" that assigns a non-zero positive length or magnitude to all vectors in a vector space. The semi-norm can instead assign zero length to non-zero vectors. For example, the Euclidean norm can be defined in the two-dimensional Euclidean geometric space R. Elements in this vector space are often drawn in a Cartesian coordinate system as directed line segments with arrows starting from the origin. The Euclidean norm of each vector is the length of the directed segment.
范数一般可分为向量范数与矩阵范数,在向量范数中,0-范数是指向量中非零元素的个数;1-范数为向量元素绝对值之和;2-范数向量元素绝对值的平方和再开方。在矩阵范数中,0-范数是指矩阵中非零元素的个数;1-范数为所有矩阵列向量绝对值之和的最大值;2-范数,也叫谱范数,是指矩阵的最大特征值的开平方,也就是通常意义上的模。Norms can generally be divided into vector norms and matrix norms. In vector norms, 0-norm refers to the number of non-zero elements in the vector; 1-norm is the sum of the absolute values of vector elements; 2-norm The square root of the sum of the absolute values of the elements of a numeric vector. In the matrix norm, the 0-norm refers to the number of non-zero elements in the matrix; the 1-norm is the maximum value of the sum of the absolute values of all matrix column vectors; the 2-norm, also called the spectral norm, is Refers to the square root of the largest eigenvalue of the matrix, which is the modulus in the usual sense.
可根据最小二乘法以及2-范数的平方对原始图像、引导图像以及预设平滑图像构造最小二乘模型为:According to the least square method and the square of the 2-norm, the least square model can be constructed for the original image, the guide image and the preset smooth image as:
式中,S为预设平滑图像,I为原始图像,G为引导图像,α为细节恢复因子。In the formula, S is the preset smooth image, I is the original image, G is the guide image, and α is the detail restoration factor.
需要说明的是,α通常取值为α∈[0,1]。It should be noted that α usually takes the value of α∈[0,1].
构造的最小二乘模型具有双数据保真项,一项用于控制平滑图像与原始图像之间差异(即),另一项用于控制平滑图像与引导图像差异通过这两项控制,既可增强对原始图像中结构成分的保护,同时还提供细节恢复因子来恢复一些高对比度的细节。The constructed least squares model has a double data fidelity item, and one item is used to control the difference between the smoothed image and the original image (ie ), the other is used to control the difference between the smoothed image and the guided image Through these two controls, it can not only enhance the protection of the structural components in the original image, but also provide a detail restoration factor to restore some high-contrast details.
需要说明的是,相较现有技术中使用一个数据保真项(即用于控制平滑图像与原始图像之间差异),本申请采用的双数据保真项的两项均保留了原图中主要结构,区别是一个任保留细节(第一项),另一个模糊削弱了细节(第二项)。使用双数据保真项能够更加有效地保留主要结构,同时可根据选择不同的恢复参数不同程度上保留高对比度细节成分。若仅使用第一个数据保真项,则无法有效滤除高对比度细节,而且易损坏主要结构,若仅使用第二个数据保真项,则武断地删除所有小的成分(可能包含有用成分)。It should be noted that, compared with the use of one data fidelity item in the prior art (that is, used to control the difference between the smooth image and the original image), the two items of the double data fidelity item used in this application both retain the original image. The main structure, the difference is that one preserves details (first item) and the other blurs and weakens details (second item). The use of double data fidelity items can more effectively preserve the main structure, and at the same time preserve the high-contrast detail components to varying degrees according to the selection of different restoration parameters. If only the first data fidelity term is used, high-contrast details cannot be effectively filtered out, and the main structure is easily damaged. If only the second data fidelity term is used, all small components (which may contain useful components ).
S203:利用范数定义所述预设平滑图像的像素强度以及梯度,以获得所述预设平滑图像的约束函数。S203: Using a norm to define the pixel intensity and gradient of the preset smooth image, so as to obtain a constraint function of the preset smooth image.
可利用0-范数定义预设平滑图像的像素强度以及梯度,当然,也可采用1-范数,2-范数进行定义,这均不影响本申请的实现。但是,经过多次实验和分析,相对于1-范数和2-范数,0-范数可以取得更好的效果。The 0-norm can be used to define the pixel intensity and gradient of the preset smooth image. Of course, the 1-norm and 2-norm can also be used for definition, which will not affect the implementation of this application. However, after many experiments and analysis, compared with 1-norm and 2-norm, 0-norm can achieve better results.
0-范数是指变量中不为零的个数,S为预设平滑图像,▽S为预设平滑图像的梯度图,利用0-范数定义所述预设平滑图像的像素强度以及梯度为||▽S||0,其中,▽S∈RM×N。表示▽S中不为零的个数。The 0-norm refers to the number of variables that are not zero, S is the preset smooth image, ▽S is the gradient map of the preset smooth image, and the 0-norm is used to define the pixel intensity and gradient of the preset smooth image is ||▽S|| 0 , where, ▽S∈RM ×N . Indicates the non-zero number in ▽S.
通过构造约束函数,可用来控制平滑图像的稀疏度。By constructing a constraint function, it can be used to control the sparsity of smooth images.
S204:根据所述最小二乘模型以及所述约束函数得到平滑能量目标函数。S204: Obtain a smooth energy objective function according to the least squares model and the constraint function.
根据最小二乘模型以及所述约束函数得到平滑能量目标函数为:According to the least squares model and the constraint function, the smooth energy objective function is:
式中,E(S)为平滑能量目标函数,S为预设平滑图像,I为原始图像,G为引导图像,α为细节恢复因子,λ为平滑因子,||▽S||为约束函数。In the formula, E(S) is the smooth energy objective function, S is the preset smooth image, I is the original image, G is the guide image, α is the detail restoration factor, λ is the smoothing factor, ||▽S|| is the constraint function .
当约束函数为利用0-范数进行定义时,上述平滑能量目标函数即为:When the constraint function is defined using the 0-norm, the above smooth energy objective function is:
式中,E(S)为平滑能量目标函数,S为预设平滑图像,I为原始图像,G为引导图像,α为细节恢复因子,λ为平滑因子,||▽S||0为约束函数。where E(S) is the smooth energy objective function, S is the preset smooth image, I is the original image, G is the guide image, α is the detail restoration factor, λ is the smoothing factor, ||▽S|| 0 is the constraint function.
关于细节恢复因子以及平滑因子(α∈[0,1],λ≥0),对图像的平滑效果以及分辨率的影响,可参见图6和图7。由图可知,在其他参数不变时,随着α的减小,图像越来越模糊;在其他参数不变时,随着λ的增大,图像越来越模糊。由图可见,可选的,在α=1,λ=0.005时,图像较为清晰,具有较好的平滑效果。当然,本领域技术人员可根据具体需求及图像分辨率而定,本申请对此不做任何限定。Regarding the effect of the detail restoration factor and the smoothing factor (α∈[0,1], λ≥0) on the smoothing effect and resolution of the image, please refer to Fig. 6 and Fig. 7 . It can be seen from the figure that when the other parameters are constant, the image becomes more and more blurred with the decrease of α; when the other parameters are constant, the image becomes more and more blurred with the increase of λ. It can be seen from the figure that optionally, when α=1 and λ=0.005, the image is clearer and has a better smoothing effect. Certainly, those skilled in the art may decide according to specific requirements and image resolution, which is not limited in this application.
S205:利用半二次分裂法以及交替固定变量法求解所述平滑能量目标函数,以获得平滑图像。S205: Using the semi-quadratic splitting method and the alternating fixed variable method to solve the smooth energy objective function to obtain a smooth image.
具体的可包括:Specific may include:
引入辅助变量替换所述平滑能量目标函数中的约束函数项;introducing auxiliary variables to replace the constraint function term in the smooth energy objective function;
利用所述半二次分裂法对替换过的平滑能量目标函数进行最小化处理,加入误差惩罚项,得到平滑最小化模型;Using the semi-quadratic splitting method to minimize the replaced smooth energy objective function, adding an error penalty term to obtain a smooth minimization model;
根据所述交替固定变量法求解所述平滑最小化模型,以获得所述平滑图像。Solving the smoothing minimization model according to the alternating fixed variable method to obtain the smoothed image.
由于无法实现直接最小化平滑能量目标函数,这是非凸优化问题,故需要引入辅助变量来替代约束函数,使其尽可能逼近最小值。Since it is impossible to directly minimize the smooth energy objective function, which is a non-convex optimization problem, it is necessary to introduce auxiliary variables to replace the constraint function to make it as close to the minimum as possible.
举例来说,当平滑能量目标函数为:For example, when the smoothed energy objective function is:
引入辅助变量g=(gx,gy)T代替约束项中的||▽S||0;Introduce auxiliary variable g=(g x , g y ) T to replace ||▽S|| 0 in the constraint item;
利用半二次分裂法对替换过的平滑能量目标函数进行最小化处理,原先的平滑图像函数为:The replaced smooth energy objective function is minimized using the semi-quadratic splitting method, and the original smooth image function is:
在上述平滑图像函数上加误差惩罚项,构成最终的平滑最小化模型为:Add an error penalty term to the above smooth image function to form the final smooth minimization model:
其中,β是自适应参数,以控制g与▽S的相似度。where β is an adaptive parameter to control the similarity between g and ▽S.
交替固定变量法一般为固定一个量,求解另外一个量,为一个迭代过程。即需要交替求解g与S,最终求得平滑图像S。具体流程可如下所示:Alternate fixed variable method generally fixes one quantity and solves another quantity, which is an iterative process. That is, it is necessary to solve g and S alternately, and finally obtain a smooth image S. The specific process can be as follows:
对预设平滑图像、自适应参数β、迭代次数i进行初始化;Initialize the preset smooth image, the adaptive parameter β, and the number of iterations i;
利用下述计算关系式进行迭代计算:Iterative calculations are performed using the following calculation relations:
β=kβ;β = kβ;
直至β>βmax,输出S,即为最终获得的平滑图像。Until β>β max , output S, which is the finally obtained smooth image.
其中,预设平滑图像初始化为原始图像,自适应参数β初始化为β0,k为增率。Wherein, the preset smooth image is initialized as the original image, the adaptive parameter β is initialized as β 0 , and k is the increase rate.
F-1(·)表示离散傅里叶逆变换算子,F(·)表示复共轭算子,F(1)表示δ函数的离散傅立叶变换。上述所有的操作符,加、乘、除均按元素来操作。通过傅里叶变换,加快了S的求解速度,有利于提高整体图像平滑处理的效率。F -1 (·) represents the inverse discrete Fourier transform operator, F(·) represents the complex conjugate operator, and F(1) represents the discrete Fourier transform of the delta function. All of the above operators, addition, multiplication, and division, operate element-wise. Through the Fourier transform, the speed of solving S is accelerated, which is beneficial to improve the efficiency of the overall image smoothing process.
可选的,β0=λ,βmax=105,k=2。当然,本领域技术人员可根据具体需求及图像分辨率而定,本申请对此不做任何限定。Optionally, β 0 =λ, β max =10 5 , k=2. Certainly, those skilled in the art may decide according to specific requirements and image resolution, which is not limited in this application.
综合可知,本申请提供的图像平滑处理方法,S201为局部平滑,S202-S205为全局平滑。采用局部平滑法可有效模糊小的高对比度成分,保留大的结构;采用全局平滑法,可有效去除受局部滤波模糊的小的结构,也保留大的结构,最终导致原图中大的结果保留,小的细节噪声去除。It can be seen comprehensively that in the image smoothing processing method provided by the present application, S201 is local smoothing, and S202-S205 are global smoothing. The local smoothing method can effectively blur small high-contrast components and retain large structures; the global smoothing method can effectively remove small structures blurred by local filtering and retain large structures, eventually resulting in the retention of large results in the original image , small detail noise removal.
由上可知,本发明实施例综合考虑全局特征以及局部特征,先对原始图像进行局部平滑处理,然后进行全局平滑处理,规避了局部平滑方法以及全局平滑方法的劣势,有效的利用了二者的优势。通过控制平滑图像与原始图像之间差异以及控制平滑图像与引导图像差异,增强了对原始图像中结构成分的保护,保留了图像的结构,在去除细节纹理特征的同时恢复了一些高对比度的细节,获得了好的图像平滑效果;此外,对图像进行了有效的噪声滤除,加强了边界像素的强度,有利于图像轮廓的提取,从而有利于提高图像识别的准确率与效率。It can be seen from the above that the embodiment of the present invention comprehensively considers the global features and local features, first performs local smoothing processing on the original image, and then performs global smoothing processing, avoids the disadvantages of the local smoothing method and the global smoothing method, and effectively utilizes the advantages of both Advantage. By controlling the difference between the smoothed image and the original image and controlling the difference between the smoothed image and the guided image, the protection of the structural components in the original image is enhanced, the structure of the image is preserved, and some high-contrast details are restored while removing detailed texture features. , to obtain a good image smoothing effect; in addition, effective noise filtering is carried out on the image, which strengthens the intensity of boundary pixels, which is beneficial to the extraction of image contours, and thus helps to improve the accuracy and efficiency of image recognition.
当图像含有大量高对比度噪声的时候,在构造最小二乘模型时,由于原始函数噪声太大,导致构造的模型受噪声干扰太大,求解出的平滑图像会有很大的偏差,难以保证平滑后图像的准确率。因此,本申请基于上述实施例还提供了一个实施例。When the image contains a lot of high-contrast noise, when constructing the least squares model, because the original function is too noisy, the constructed model is too much disturbed by the noise, and the smooth image obtained by solving will have a large deviation, and it is difficult to ensure smoothness The accuracy of the post image. Therefore, the present application also provides an embodiment based on the above embodiment.
在构造最小二乘模型之前,先对原始图像进行中值滤波。Before constructing the least squares model, median filtering is performed on the original image.
中值滤波法是一种非线性平滑技术,基于排序统计理论的一种能有效抑制噪声的非线性信号处理技术,它将每一像素点的灰度值设置为该点某邻域窗口内的所有像素点灰度值的中值。中值滤波的基本原理是把数字图像或数字序列中一点的值用该点的一个邻域中各点值的中值代替,让周围的像素值接近的真实值,从而消除孤立的噪声点。方法是用某种结构的二维滑动模板,将板内像素按照像素值的大小进行排序,生成单调上升(或下降)的为二维数据序列。The median filtering method is a nonlinear smoothing technique, a nonlinear signal processing technique that can effectively suppress noise based on the sorting statistics theory. The median value of all pixel gray values. The basic principle of median filtering is to replace the value of a point in a digital image or digital sequence with the median value of each point in a neighborhood of the point, so that the surrounding pixel values are close to the true value, thereby eliminating isolated noise points. The method is to use a two-dimensional sliding template of a certain structure to sort the pixels in the board according to the size of the pixel value, and generate a monotonically rising (or falling) two-dimensional data sequence.
即根据最小二乘法对经过中值滤波的原始图像、所述引导图像以及预设平滑图像构造最小二乘模型。具体的,跟上述实施例的实现方法相同,此处,就不在赘述。That is, the least squares model is constructed on the original image after median filtering, the guide image and the preset smoothing image according to the least square method. Specifically, the implementation method is the same as that of the foregoing embodiment, and will not be repeated here.
在采用中值滤波对原始图像进行处理后,可有效的滤除原始图像中的高对比度噪声,提高图像平滑效果,提升平滑图像的准确率。After using the median filter to process the original image, it can effectively filter out the high-contrast noise in the original image, improve the smoothing effect of the image, and improve the accuracy of the smoothed image.
本发明实施例还针对图像平滑方法提供了相应的实现装置,进一步使得所述方法更具有实用性。下面对本发明实施例提供的图像平滑装置进行介绍,下文描述的图像平滑装置与上文描述的图像平滑方法可相互对应参照。The embodiment of the present invention also provides a corresponding implementation device for the image smoothing method, which further makes the method more practical. The image smoothing device provided by the embodiment of the present invention is introduced below, and the image smoothing device described below and the image smoothing method described above can be referred to in correspondence.
参见图8,图8为本发明实施例提供的一种图像平滑装置的结构图,该装置可包括:Referring to FIG. 8, FIG. 8 is a structural diagram of an image smoothing device provided by an embodiment of the present invention, which may include:
滤波平滑模块801,用于对原始图像循环进行预设次数的双边滤波以及变换域滤波,以获得引导图像。The filtering and smoothing module 801 is configured to circularly perform bilateral filtering and transform domain filtering for a preset number of times on the original image to obtain a guide image.
建立模型模块802,用于根据最小二乘法对所述原始图像、所述引导图像以及预设平滑图像构造最小二乘模型。The model building module 802 is configured to construct a least square model for the original image, the guide image and the preset smooth image according to the least square method.
获取平滑图像模块803,用于利用范数定义所述预设平滑图像的像素强度以及梯度,以获得所述预设平滑图像的约束函数;根据所述最小二乘模型以及所述约束函数得到平滑能量目标函数;利用半二次分裂法以及交替固定变量法求解所述平滑能量目标函数,以获得平滑图像。Obtaining a smooth image module 803, configured to define the pixel intensity and gradient of the preset smooth image using a norm, so as to obtain a constraint function of the preset smooth image; smoothing is obtained according to the least squares model and the constraint function Energy objective function: solving the smooth energy objective function by using semi-quadratic splitting method and alternating fixed variable method to obtain a smooth image.
在一种具体实施方式中,所述获取平滑图像模块803为根据所述最小二乘法以及2-范数的平方对所述原始图像、所述引导图像以及预设平滑图像构造最小二乘模型的模块,所述最小二乘模型为:In a specific implementation manner, the module 803 of obtaining a smoothed image is to construct a least squares model for the original image, the guide image and the preset smoothed image according to the least square method and the square of the 2-norm module, the least squares model is:
式中,S为所述预设平滑图像,I为所述原始图像,G为所述引导图像,α为细节恢复因子。In the formula, S is the preset smooth image, I is the original image, G is the guide image, and α is the detail restoration factor.
本发明实施例所述图像平滑装置的各功能模块的功能可根据上述方法实施例中的方法具体实现,其具体实现过程可以参照上述方法实施例的相关描述,此处不再赘述。The functions of each functional module of the image smoothing device in the embodiment of the present invention can be implemented according to the method in the above method embodiment, and the specific implementation process can refer to the relevant description of the above method embodiment, and will not be repeated here.
由上可知,本发明实施例综合考虑全局特征以及局部特征,先对原始图像进行局部平滑处理,然后进行全局平滑处理,规避了局部平滑方法以及全局平滑方法的劣势,有效的利用了二者的优势。通过控制平滑图像与原始图像之间差异以及控制平滑图像与引导图像差异,增强了对原始图像中结构成分的保护,保留了图像的结构,在去除细节纹理特征的同时恢复了一些高对比度的细节,获得了好的图像平滑效果;此外,对图像进行了有效的噪声滤除,加强了边界像素的强度,有利于图像轮廓的提取,从而有利于提高图像识别的准确率与效率。It can be seen from the above that the embodiment of the present invention comprehensively considers the global features and local features, first performs local smoothing processing on the original image, and then performs global smoothing processing, avoids the disadvantages of the local smoothing method and the global smoothing method, and effectively utilizes the advantages of both Advantage. By controlling the difference between the smoothed image and the original image and controlling the difference between the smoothed image and the guided image, the protection of the structural components in the original image is enhanced, the structure of the image is preserved, and some high-contrast details are restored while removing detailed texture features. , to obtain a good image smoothing effect; in addition, effective noise filtering is carried out on the image, which strengthens the intensity of boundary pixels, which is beneficial to the extraction of image contours, and thus helps to improve the accuracy and efficiency of image recognition.
为了验证本申请提供的技术方案具有好的图像平滑效果,本申请提供了具体的实施例,请参阅图9-14,图9为待处理的原始图像,图10-13为其他算法处理过的图像,图14为本申请处理的图像,图中方框中的图为相应方框的局部放大图。由图可见,经过RTV(Relative Total Variation,相关性全变差)算法处理的图像,相近的两条线条比较模糊,无法识别;其他算法(例如RGF(Rolling Guidance Filter,循环引导滤波)和BLF(Bilateral filter,双边滤波)算法、NLGRTV(Nonlocal version of GeneralizedRelative Total Variation,非局部版本的通用相关性全变差)算法以及SSPTF(Scale-aware Structure-Preserving Texture Filtering,尺度关注结构保存纹理滤波)算法)对图像细节的平滑效果较为粗糙。可见,本申请的方法具有好的图像平滑效果。In order to verify that the technical solution provided by this application has a good image smoothing effect, this application provides specific examples, please refer to Figures 9-14, Figure 9 is the original image to be processed, and Figures 10-13 are processed by other algorithms Image, Figure 14 is the image processed in this application, and the picture in the box in the figure is a partial enlarged picture of the corresponding box. It can be seen from the figure that in the image processed by the RTV (Relative Total Variation, correlation total variation) algorithm, the two similar lines are blurred and cannot be recognized; other algorithms (such as RGF (Rolling Guidance Filter, circular guidance filter) and BLF ( Bilateral filter, bilateral filtering) algorithm, NLGRTV (Nonlocal version of Generalized Relative Total Variation, non-local version of the general correlation total variation) algorithm and SSPTF (Scale-aware Structure-Preserving Texture Filtering, scale-aware structure-preserving texture filtering) algorithm) The smoothing effect on image detail is coarser. It can be seen that the method of the present application has a good image smoothing effect.
为了验证本申请提供的技术方案具有有效的去噪效果,本申请提供了具体的实施例,请参阅图15-17,图15为待处理的原始图像,图16为经过RGF和BLF算法处理过的图像,图17为本申请处理的图像,由图可见,图16中仍有模糊的杂乱的线条,本申请提供的方法有效的去除了原始图像中杂乱的线条,获得目标对象(长方体结构的对象)。可见,本申请提供的技术方案可有效的滤除图像噪声,避免图像噪声的干扰。In order to verify that the technical solution provided by this application has an effective denoising effect, this application provides specific examples, please refer to Figures 15-17, Figure 15 is the original image to be processed, and Figure 16 is the image processed by the RGF and BLF algorithms Figure 17 is the image processed by this application. It can be seen from the figure that there are still blurred and messy lines in Figure 16. The method provided by this application effectively removes the messy lines in the original image and obtains the target object (cuboid structure) object). It can be seen that the technical solution provided by the present application can effectively filter image noise and avoid the interference of image noise.
为了验证本申请提供的技术方案具有增强图像的效果,本申请提供了具体的实施例,请参阅图18以及19,图18为原始图像,图19为本申请处理的图像,由图可见,经过本申请提供的方法,原始图像像素明显增强,尤其是边缘像素的强度,有利于提取图像的轮廓,从而有利于提高图像识别的准确率与效率。In order to verify that the technical solution provided by this application has the effect of enhancing images, this application provides specific examples, please refer to Figures 18 and 19, Figure 18 is the original image, Figure 19 is the image processed by this application, as can be seen from the figure, after In the method provided by the present application, the pixels of the original image are significantly enhanced, especially the intensity of edge pixels, which is beneficial to extracting the contour of the image, thereby improving the accuracy and efficiency of image recognition.
本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。Each embodiment in this specification is described in a progressive manner, each embodiment focuses on the difference from other embodiments, and the same or similar parts of each embodiment can be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and for the related part, please refer to the description of the method part.
专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Professionals can further realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software or a combination of the two. In order to clearly illustrate the possible For interchangeability, in the above description, the composition and steps of each example have been generally described according to their functions. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present invention.
结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of the methods or algorithms described in connection with the embodiments disclosed herein may be directly implemented by hardware, software modules executed by a processor, or a combination of both. Software modules can be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other Any other known storage medium.
以上对本发明所提供的一种图像平滑方法以及装置进行了详细介绍。本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想。应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以对本发明进行若干改进和修饰,这些改进和修饰也落入本发明权利要求的保护范围内。The image smoothing method and device provided by the present invention have been introduced in detail above. In this paper, specific examples are used to illustrate the principle and implementation of the present invention, and the descriptions of the above embodiments are only used to help understand the method and core idea of the present invention. It should be pointed out that for those skilled in the art, without departing from the principles of the present invention, some improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the protection scope of the claims of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710146581.3A CN106920222B (en) | 2017-03-13 | 2017-03-13 | Image smoothing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710146581.3A CN106920222B (en) | 2017-03-13 | 2017-03-13 | Image smoothing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106920222A true CN106920222A (en) | 2017-07-04 |
CN106920222B CN106920222B (en) | 2019-11-08 |
Family
ID=59460670
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710146581.3A Active CN106920222B (en) | 2017-03-13 | 2017-03-13 | Image smoothing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106920222B (en) |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108897044A (en) * | 2018-07-25 | 2018-11-27 | 梧州市兴能农业科技有限公司 | A kind of device visually showing geological anomalous body |
CN109345478A (en) * | 2018-09-27 | 2019-02-15 | 深圳市牧月科技有限公司 | A kind of picture smooth treatment method based on gradient minimisation |
CN109389565A (en) * | 2018-10-19 | 2019-02-26 | 山东大学 | A kind of holding edge and the adjustable image smoothing method of smoothness |
CN109598680A (en) * | 2018-10-19 | 2019-04-09 | 浙江工业大学 | Shearing wave conversion medicine CT image denoising method based on quick non-local mean and TV-L1 model |
CN111882810A (en) * | 2020-07-31 | 2020-11-03 | 广州市微智联科技有限公司 | Fire identification and early warning method and system |
WO2021036442A1 (en) * | 2019-08-29 | 2021-03-04 | 北京迈格威科技有限公司 | Cyclic edge-preserving smooth filtering method and apparatus, and electronic device |
CN112967195A (en) * | 2021-03-04 | 2021-06-15 | 浙江大华技术股份有限公司 | Image denoising method and device and computer readable storage medium |
CN113436163A (en) * | 2021-06-23 | 2021-09-24 | 四川大学 | Method for identifying and processing flow field characteristics of schlieren image in impeller mechanical blade lattice test |
CN116977227A (en) * | 2023-09-22 | 2023-10-31 | 福建晟哲自动化科技有限公司 | Image smoothing method and device based on local structure variation |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103606132A (en) * | 2013-10-31 | 2014-02-26 | 西安电子科技大学 | Multiframe digital image denoising method based on space domain and time domain combination filtering |
CN104217405A (en) * | 2014-09-23 | 2014-12-17 | 闽江学院 | Salt-pepper noise filter method for image fusing local information and global information |
CN105023245A (en) * | 2015-05-05 | 2015-11-04 | 苏州大学 | Image smoothing method under strength and gradient sparsity constraint |
-
2017
- 2017-03-13 CN CN201710146581.3A patent/CN106920222B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103606132A (en) * | 2013-10-31 | 2014-02-26 | 西安电子科技大学 | Multiframe digital image denoising method based on space domain and time domain combination filtering |
CN104217405A (en) * | 2014-09-23 | 2014-12-17 | 闽江学院 | Salt-pepper noise filter method for image fusing local information and global information |
CN105023245A (en) * | 2015-05-05 | 2015-11-04 | 苏州大学 | Image smoothing method under strength and gradient sparsity constraint |
Non-Patent Citations (2)
Title |
---|
QI ZHANG ETC.: ""Rolling guidance filter"", 《EUROPEAN CONFERENCE ON COMPUTER VISION.SPRINGER》 * |
崔艳萌: ""基于空间域和变换域的图像降噪方法研究"", 《通讯世界》 * |
Cited By (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108897044A (en) * | 2018-07-25 | 2018-11-27 | 梧州市兴能农业科技有限公司 | A kind of device visually showing geological anomalous body |
CN109345478A (en) * | 2018-09-27 | 2019-02-15 | 深圳市牧月科技有限公司 | A kind of picture smooth treatment method based on gradient minimisation |
CN109598680B (en) * | 2018-10-19 | 2021-11-23 | 浙江工业大学 | Shear wave transformation medical CT image denoising method based on rapid non-local mean value and TV-L1 model |
CN109389565A (en) * | 2018-10-19 | 2019-02-26 | 山东大学 | A kind of holding edge and the adjustable image smoothing method of smoothness |
CN109598680A (en) * | 2018-10-19 | 2019-04-09 | 浙江工业大学 | Shearing wave conversion medicine CT image denoising method based on quick non-local mean and TV-L1 model |
WO2021036442A1 (en) * | 2019-08-29 | 2021-03-04 | 北京迈格威科技有限公司 | Cyclic edge-preserving smooth filtering method and apparatus, and electronic device |
CN111882810B (en) * | 2020-07-31 | 2022-07-01 | 广州市微智联科技有限公司 | Fire identification and early warning method and system |
CN111882810A (en) * | 2020-07-31 | 2020-11-03 | 广州市微智联科技有限公司 | Fire identification and early warning method and system |
CN112967195A (en) * | 2021-03-04 | 2021-06-15 | 浙江大华技术股份有限公司 | Image denoising method and device and computer readable storage medium |
CN112967195B (en) * | 2021-03-04 | 2024-04-23 | 浙江大华技术股份有限公司 | Image denoising method, device and computer readable storage medium |
CN113436163A (en) * | 2021-06-23 | 2021-09-24 | 四川大学 | Method for identifying and processing flow field characteristics of schlieren image in impeller mechanical blade lattice test |
CN113436163B (en) * | 2021-06-23 | 2023-06-09 | 四川大学 | Impeller machinery cascade test schlieren image flow field characteristic identification processing method |
CN116977227A (en) * | 2023-09-22 | 2023-10-31 | 福建晟哲自动化科技有限公司 | Image smoothing method and device based on local structure variation |
CN116977227B (en) * | 2023-09-22 | 2023-12-15 | 福建晟哲自动化科技有限公司 | Image smoothing method and device based on local structure variation |
Also Published As
Publication number | Publication date |
---|---|
CN106920222B (en) | 2019-11-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106920222B (en) | Image smoothing method and device | |
Lefkimmiatis | Universal denoising networks: a novel CNN architecture for image denoising | |
Zhang et al. | Rolling guidance filter | |
Chandel et al. | Image filtering algorithms and techniques: A review | |
Dai et al. | Soft edge smoothness prior for alpha channel super resolution | |
Zhang et al. | Adaptive fractional-order multi-scale method for image denoising | |
Sun et al. | Image Structure Retrieval via $ L_0 $ Minimization | |
Dong et al. | Image restoration: a data-driven perspective | |
Cho et al. | Effective five directional partial derivatives-based image smoothing and a parallel structure design | |
CN105023245A (en) | Image smoothing method under strength and gradient sparsity constraint | |
Liu et al. | SGTD: Structure gradient and texture decorrelating regularization for image decomposition | |
Yuan et al. | Perona–malik model with a new diffusion coefficient for image denoising | |
Song et al. | Scale‐adaptive Structure‐preserving Texture Filtering | |
Vacavant et al. | Fast smoothed shock filtering | |
Liu et al. | Multi-modal ship target image smoothing based on adaptive mean shift | |
Charmouti et al. | Extended median filter for salt and pepper noise in image | |
Zhang et al. | Effective document image deblurring via gradient histogram preservation | |
Yadav et al. | Performance Comparison of Image Restoration techniques using CNN and their applications | |
Suwabe et al. | Globalized BM3D using fast eigenvalue filtering | |
Hazavei et al. | A new method for removing the moire'pattern from images | |
Vaudrey et al. | Fast trilateral filtering | |
Tan et al. | An improved detail enhancement method for colorful image via guided image | |
Gusev et al. | Fast parallel grid warping-based image sharpening method | |
Senzaki et al. | Efficient implementation of filtering-direction-controlled digital TV filter for image denoising | |
Sanaee et al. | A structural refinement method based on image gradient for improving performance of noise-restoration stage in decision based filters |
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 |