%function [F, D, Fx, Fy] = filtered_gradient(I, sigma) %Computes the filtered gradient of the grayscale double image I % %Inputs: % I: grayscale double image % sigma: scalar sigma value for gaussian smoothing %Outputs: % F: Magnitude of gradient at each pixel % D: Orientation of gradient at each pixel % Fx: Component of gradient in x direction % Fy: Component of gradient in x direction function [F, D, Fx, Fy] = filtered_gradient(I, sigma) [g, dg] = gaussian(sigma); Fx = conv2(I, g'*dg, 'same'); Fy = conv2(I, dg'*g, 'same'); F = sqrt(Fx.^2 + Fy.^2); D = atan(Fy ./ Fx);