Laplacian Operator is also a derivative operator which is used to find edges in an image. The major difference between Laplacian and other operators like Prewitt, Sobel, Robinson, and Kirsch is that these all are first order derivative masks but Laplacian is a second order derivative mask.
We use OpenCV function filter2D to apply Laplacian operator to images. It can be found under Imgproc package. Its syntax is given below:
filter2D(src, dst, ddepth , kernel, anchor, delta, BORDER_DEFAULT );
The function arguments are described below:
It is source image.
It is destination image.
It is the depth of dst. A negative value (such as -1) indicates that the depth is the same as the source.
It is the kernel to be scanned through the image.
It is the position of the anchor relative to its kernel. The location Point (-1, -1) indicates the center by default.
It is a value to be added to each pixel during the convolution. By default it is 0.
We let this value by default.
Apart from the filter2D() method, there are other methods provided by the Imgproc class. They are described briefly:
cvtColor(Mat src, Mat dst, int code, int dstCn)
It converts an image from one color space to another.
dilate(Mat src, Mat dst, Mat kernel)
It dilates an image by using a specific structuring element.
equalizeHist(Mat src, Mat dst)
It equalizes the histogram of a grayscale image.
|filter2D(Mat src, Mat dst, int ddepth, Mat kernel, Point anchor, double delta)
It convolves an image with the kernel.|
GaussianBlur(Mat src, Mat dst, Size ksize, double sigmaX)
It blurs an image using a Gaussian filter.
integral(Mat src, Mat sum)
It calculates the integral of an image.