In dimensional space, we have:
When applied to a 2-D function , this operator produces a scalar function:
In discrete case, the second order differentiation becomes second order difference. In 1-D case, if the first order difference is defined as
then the second order difference is
Note that is so defined that it is symmetric to the center element . The Laplace operation can be carried out by 1-D convolution with a kernel .
In 2-D case, Laplace operator is the sum of two second order differences in both dimensions:
This operation can be carried out by 2-D convolution kernel:
Other Laplace kernels can be used:
We see that these Laplace kernels are actually the same as the high-pass filtering kernels discussed before. Gradient operation is an effective detector for sharp edges where the pixel gray levels change over space very rapidly. But when the gray levels change slowly from dark to bright (red in the figure below), the gradient operation will produce a very wide edge (green in the figure). It is helpful in this case to consider using the Laplace operation. The second order derivative of the wide edge (blue in the figure) will have a zero crossing in the middle of edge. Therefore the location of the edge can be obtained by detecting the zero-crossings of the second order difference of the image.
One dimensional example:
In the two dimensional example, the image is on the left, the two Laplace kernels generate two similar results with zero-crossings on the right:
Edge detection by Laplace operator followed by zero-crossing detection:
If in the neighborhood (3x3, 5x5, 7x7, etc.) of a given pixel there exist both polarities, i.e., pixel values greater than and smaller than 0, then the pixel is a zero-crossing. (Note that the pixel in question does not have to be zero.) Specifically, we find the maximum and minimum among all pixels in the neighborhood of a pixel under consideration. If the maximum is greater than zero and the minimum is smaller than zero, the pixel is a zero-crossing.
Due to the existence of random noise some false zero-crossing may be detected. In this case we check whether the difference between the maximum and the minimum is greater than a threshold value. If so the pixel is on an edge, otherwise the zero-crossing is assumed to be caused by noise and suppressed.