Gabor change belongs to window-fourier transform, and Gabor function can extract relevant features in different scales and directions in the frequency domain. Gabor function is similar to the biological function of human eyes, so it is often used in texture recognition and has achieved good results.

Two-dimensional Gobor filter function:

Among them:

xp = x*cos(theta)+y*sin(theta)

yp=y*cos(theta)-x*sin(theta)

clc clear all img = imread('1.bmp'); % im: This is the image you want to input, gray scale transformation will be carried out during the running process, and the name of the figure will be arbitrarily named; subplot(121); imshow(img); % show original title(' as shown in original image '); Grayimg = rGB2gray (img); gim = im2double(grayimg); wavelength=3; % wavelength: Wavelength, Gabor filter constructed in pixels Angle =90; % Angle: indicates the filter Angle, in degrees. Angle 0 means that the filter kx that responds to vertical features =0.5; % kx: control bandwidth ky=0.5; % ky: Control direction selection; Generally the default (kx, ky) is set to (0.5, 0.5) [Eim, Oim, Aim] = spatialgabor (gim, where, Angle, kx, ky); %spatialgabor(im, wavelength, angle, kx, ky, showfilter) subplot(122); imshow(Aim); Aimsize = size(Aim); % View the filtered image size title('Gabor filtered image ');Copy the code

Complete code added QQ1575304183