How it works...

The Gabor filter is a linear filter whose kernel is a 2D Gaussian modulated with a cosine wave. The kernel can be obtained using the cv2.getGaborKernel function, which takes such parameters as kernel size, Gaussian standard deviation, wave orientation, wave length, spatial ratio, and phase. One of the areas where Gabor filters are useful is detecting edges of known orientation.

The following output is expected:

Get OpenCV 3 Computer Vision with Python Cookbook 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.