I tried to create a Gabor Filter. We all know that this kind of filter is more complex than any other filters because it is characterized by more complex features such as ha
You can now create a Gabor filter bank using the gabor function in the image processing toolbox, and you can apply it to an image using imgaborfilt.
Replace below line in your code:
gb= exp(-.5*(x_theta.^2/sigma_x^2+y_theta.^2/sigma_y^2)).*cos(2*pi/lambda*x_theta+psi);
I replace the cos with sin in above matlab code.
The formula is exp(-(...) / (2*sigma^2) ). Isn't it? So 1/2 = 0.5 = .5