简体   繁体   中英

how is Laplacian filter calculated?

I don't really follow how they came up with the derivative equation. Could somebody please explain in some details or even a link to somewhere with sufficient math explanation?

图片

Laplacian filter looks like

在此处输入图片说明

Monsieur Laplace came up with this equation. This is simply the definition of the Laplace operator: the sum of second order derivatives (you can also see it as the trace of the Hessian matrix ).

The second equation you show is the finite difference approximation to a second derivative. It is the simplest approximation you can make for discrete (sampled) data. The derivative is defined as the slope (equation from Wikipedia ):

导数方程

In a discrete grid, the smallest h is 1. Thus the derivative is f(x+1)-f(x) . This derivative, because it uses the pixel at x and the one to the right, introduces a half-pixel shift (ie you compute the slope in between these two pixels). To get to the 2 nd order derivative, simply compute the derivative on the result of the derivative:

f'(x) = f(x+1) - f(x)
f'(x+1) = f(x+2) - f(x+1)

f"(x) = f'(x+1) - f'(x)
      = f(x+2) - f(x+1) - f(x+1) + f(x)
      = f(x+2) - 2*f(x+1) + f(x)

Because each derivative introduces a half-pixel shift, the 2 nd order derivative ends up with a 1-pixel shift. So we can shift the output left by one pixel, leading to no bias. This leads to the sequence f(x+1)-2*f(x)+f(x-1) .

Computing this 2nd order derivative is the same as convolving with a filter [1,-2,1] .

Applying this filter, and also its transposed, and adding the results, is equivalent to convolving with the kernel

[ 0, 1, 0       [ 0, 0, 0       [ 0, 1, 0
  1,-4, 1    =    1,-2, 1    +    0,-2, 0
  0, 1, 0 ]       0, 0, 0 ]       0, 1, 0 ] 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM