"Ideal weight" for Discrete Laplacian?

Discuss digital image processing techniques and algorithms. We encourage its application to ImageMagick but you can discuss any software solutions here.
Post Reply
barnhillec
Posts: 3
Joined: 2012-08-16T02:25:15-07:00
Authentication code: 67789

"Ideal weight" for Discrete Laplacian?

Post by barnhillec »

I am wondering if there is a "proper" weighting for a Discrete Laplacian operator in which the result values are not chosen for edge enhancement but for the closest representation to del2x plus del2y.

For example, two common Laplacians are: [0, -1, 0; -1, 4, -1; 0, -1, 0] and [-1, -1, -1; -1, 8, -1; -1, -1, -1] .

However, when applied to the same image, the eight neighbor above gives me considerably higher overall values for the result than the four neighbor, around double. I will get closer values to the four neighbor if I multiply by .5 or use the kernel [-0.5, -0.5, -0.5; -0.5, 4, -0.5; -0.5, -0.5, -0.5] . These two kernels seem to produce numbers closest to, for example, Matlab's del2 function .

What I see emphasized in textbooks is how these kernels sum to zero, so that theoretically there isn't an overall increase in image brighness. But in my case I get dramatically different results depending on which 8 neighbor kernel I choose. It may be the scientific application that causes the complication: since we are looking for the Laplace operator to solve the Helmholtz equation, all values greater than or equal to zero get filtered out.

I suspect having 4 in the middle is key due to the one-fourth term found in many Laplacian derivations, and that means kernels with four in the middle would be the most "true". Can anyone help me come to a clear conclusion on this?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: "Ideal weight" for Discrete Laplacian?

Post by fmw42 »

I generally leave them unnormalized. But if you want, just divide by the sum of positive values assuming that the sum of all values is 0. But that will make the image very dark. So you may want to then apply some common scale factor to bring them back to visible range.
Post Reply