The Laplacian filter is used for detection of edges in an image. It highlights areas in which intensity changes rapidly producing a picture of all the edges in an image.

The Laplacian filter is a standard Laplacian of Gaussian convolution. This is a second derivative function designed to measure changes in intensity without being overly sensitive to noise. The function produces a peak at the start of the change in intensity and then at the end of the change.

Because the Laplacian of Gaussian produces a fairly wide convolution for a small radius this filter can become quite computationally expensive as radius is increased.

Syntax

[C#]

static void Laplacian(Bitmap bitmap, double radius);

[Visual Basic]

Shared Sub Laplacian(bitmap As Bitmap, radius As Double)
Params
Name Description
bitmap The bitmap to process
radius This value represents the standard deviation of the Laplacian of Gaussian function. It determines the size of the edges that are detected.
Notes

None.

Example

[C#]using (Bitmap bm = (Bitmap)Bitmap.FromFile(Server.MapPath("rez/ryk-naves-4Q6kXLAKK_Y-unsplash.jpg"))) {
  Effects.Laplacian(bm, 0.8);
  bm.Save(Server.MapPath("IG8_Effects_Laplacian1.jpg"));
}
using (Bitmap bm = (Bitmap)Bitmap.FromFile(Server.MapPath("rez/ryk-naves-4Q6kXLAKK_Y-unsplash.jpg"))) {
  Effects.Laplacian(bm, 1.6);
  bm.Save(Server.MapPath("IG8_Effects_Laplacian2.jpg"));
}
using (Bitmap bm = (Bitmap)Bitmap.FromFile(Server.MapPath("rez/ryk-naves-4Q6kXLAKK_Y-unsplash.jpg"))) {
  Effects.Laplacian(bm, 3.2);
  bm.Save(Server.MapPath("IG8_Effects_Laplacian3.jpg"));
}


Here we apply a Laplacian edge detection filter using different radii. Ouput files are shown below.


ryk-naves-4Q6kXLAKK_Y-unsplash.jpg


IG8_Effects_Laplacian1.jpg


IG8_Effects_Laplacian2.jpg


IG8_Effects_Laplacian3.jpg