Computing the Laplacian of an image

The Laplacian is another high-pass linear filter that is based on the computation of the image derivatives. As it will be explained, it computes second-order derivatives to measure the curvature of the image function.

How to do it...

The OpenCV function, cv::Laplacian, computes the Laplacian of an image. It is very similar to the cv::Sobel function. In fact, it uses the same basic function, cv::getDerivKernels, in order to obtain its kernel matrix. The only difference is that there are no derivative order parameters since these ones are, by definition, second order derivatives.

For this operator, we will create a simple class that will encapsulate some useful operations related to the Laplacian. The basic attributes ...

Get OpenCV 3 Computer Vision Application Programming Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.