图像处理中更高阶的拉普拉斯核 [英] Laplacian kernels of higher order in image processing

查看:570
本文介绍了图像处理中更高阶的拉普拉斯核的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在有关数字图像处理的文献中,您可以找到相对较低阶的Laplace内核(通常为3或5)的示例.我想知道,有没有通用的方法来构建Laplace内核或任意阶?链接或/和引用将不胜感激.

In literature on digital image processing you find examples of Laplace kernels of relatively low orders, typically, 3 or 5. I wonder, is there any general way to build Laplace kernels or arbitrary order? Links or/and references would be appreciated.

推荐答案

拉普拉斯运算符定义为沿图像每个轴的二阶导数之和. (也就是说,它是Hessian矩阵的踪迹):

The Laplace operator is defined as the sum of the second derivatives along each of the axes of the image. (That is, it is the trace of the Hessian matrix):

  • I =(∂ 2 /∂ x 2 +∂ 2 /∂ y 2 ) I
  • I = ( ∂2/∂x2 + ∂2/∂y2 ) I

有两种常用的离散化方法:

There are two common ways to discretize this:

  1. 使用有限差分.导数运算符是通过[1,-1][0.5,0,-0.5]进行的卷积,第二个导数运算符应用[1,-1]卷积两次,导致与[1,-2,1]进行卷积.

  1. Use finite differences. The derivative operator is the convolution by [1,-1] or [0.5,0,-0.5], the second derivative operator applying the [1,-1] convolution twice, leading to a convolution with [1,-2,1].

与正则化内核的派生卷积.最佳正则化核是高斯,导致高斯算子的拉普拉斯.结果是通过高斯核平滑的图像的精确拉普拉斯.

Convolve with the derivative of a regularization kernel. The optimal regularization kernel is the Gaussian, leading to a Laplace of Gaussian operator. The result is the exact Laplace of the image smoothed by the Gaussian kernel.


另一种方法是用插值内核替换正则化内核.我的一位前同事发表了关于这种方法的论文:


An alternative is to replace the regularization kernel with an interpolating kernel. A former colleague of mine published a paper on this method:

A. Hast,通过双重过滤方法对一阶和二阶导数进行简单的过滤器设计",样式表扬信42(1):65-71,2014 .

他使用了双重过滤器",但线性过滤器始终可以简化为单个卷积.

He used a "double filter", but with linear filters that can always be simplified to a single convolution.

这个想法很简单,就是采用一个插值内核,并在整数位置计算其导数.插值核在原点处始终为1,在其他整数位置处始终为0,但它会通过这些结点"波动,这意味着其导数在这些整数位置处不为零.

The idea is simply that, take an interpolating kernel, and compute its derivative at integer locations. The interpolating kernel is always 1 at the origin, and 0 at other integer locations, but it waves through these "knot points", meaning that its derivative is not zero at these integer locations.

在极端情况下,采用理想的内插器 sinc函数:

In the extreme case, take the ideal interpolator, the sinc function:

  • sinc( x )= sin(π x )/π x
  • sinc(x) = sin(πx) / πx

二阶导数是:

  • d 2 /d x 2 (sinc(π x ))= [(2- π 2 x 2 )sin(π x )-2π x cos(π x )]/(π x 3 )
  • d2/dx2(sinc(πx)) = [ (2 - π2x2) sin(πx) - 2πx cos(πx) ] / (πx3)

在11个整数位置进行采样会导致:

Which sampled at 11 integer locations leads to:

[ 0.08 -0.125 0.222 -0.5 2 -3 2 -0.5 0.222 -0.125 0.08 ]

但是请注意,这里的归一化是不正确的,因为我们要截取无限长的内核.因此,最好选择一个较短的内核,例如三次样条内核.

But note that the normalization is not correct here, as we're cutting off the infinitely long kernel. Thus, it's better to pick a shorter kernel, such as the cubic spline kernel.

第二种选择是通过傅立叶域来计算Laplace运算符.这只需要与-π u 2 v 2 乘以 u v 频率.

A second alternative is to compute the Laplace operator through the Fourier domain. This simply requires multiplying with -πu2v2, with u and v the frequencies.

这是一些MATLAB代码,将此滤波器应用于单位脉冲图像,从而生成大小为256x256的内核图像:

This is some MATLAB code that applies this filter to a unit impulse image, leading to an image of the kernel of size 256x256:

[u,v] = meshgrid((-128:127)/256,(-128:127)/256);
Dxx = -4*(pi*u).^2;
Dyy = -4*(pi*v).^2;
L = Dxx + Dyy;
l = fftshift(ifft2(ifftshift(L)));
l = real(l);        % discard insignificant imaginary component (probably not necessary in MATLAB, but Octave leaves these values there)
l(abs(l)<1e-6) = 0; % set near-zero values to zero

l与上面理想插值器的结果相同,将垂直和水平插值相加,并归一化为256.

l here is the same as the result above for the ideal interpolator, adding the vertical and horizontal ones together, and normalizing for a length of 256.

最后,我想提一下Laplace运算符对噪声非常非常敏感(高频显着增强).这里讨论的方法仅对没有鼻子的数据有意义(大概是合成数据?).对于任何现实世界的数据,我高度建议您使用高斯拉普拉斯(Laplace of Gaussian).这将为您提供平滑图像的精确拉普拉斯(Laplace).为了防止噪声影响,必须进行平滑处理.在噪声很小的情况下,您可以使用较小的高斯σ(例如σ= 0.8).与其他方法相比,这将为您提供更多有用的结果.

Finally, I'd like to mention that the Laplace operator is very sensitive to noise (high frequencies are enhanced significantly). The methods discussed here are meaningful only for data without nose (presumably synthetic data?). For any real-world data, I highly recommend that you use the Laplace of Gaussian. This will give you the exact Laplace of the smoothed image. The smoothing is necessary to prevent influence from noise. With little noise, you can use a small Gaussian sigma (e.g. σ=0.8). This will give you much more useful results than any other approach.

这篇关于图像处理中更高阶的拉普拉斯核的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆