Getting ready

To illustrate this recipe, we will apply a processing function that sharpens an image. It is based on the Laplace operator (which will be discussed in Chapter 6, Filtering the Images). It is indeed a well-known result in image processing that if you subtract its Laplacian from an image, the image edges are amplified, thereby giving a sharper image. This sharpened value is computed as follows:

sharpened_pixel= 5*current-left-right-up-down; 

Here, left is the pixel that is immediately on the left-hand side of the current one, up is the corresponding one on the previous line, and so on.