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: