Question: Describe what the following MATLAB code does. The original function name has been replaced by fname. Insert the right line of code where it says

Describe what the following MATLAB code does. The original function name has been replaced by fname. Insert the right line of code where it says "%comment taken out,"

function [gx,gy]=fname(IM,sigma)

%(comment taken out)

% [gx,gy]=fname(IM,sigma) (comment taken out)

%

epsilon=1e-2;

halfsize=ceil(sigma*sqrt(-2*log(sqrt(2*pi)*sigma*epsilon)));

size=2*halfsize+1;

%(comment taken out)

for i=1:size

for j=1:size

u=[i-halfsize-1 j-halfsize-1];

hx(i,j)=gauss(u(1),sigma)*dgauss(u(2),sigma);

end

end

hx=hx/sqrt(sum(sum(abs(hx).*abs(hx))));

%(comment taken out)

hy=hx';

%(comment taken out)

gx=imfilter(IM,hx,'replicate','conv');

gy=imfilter(IM,hy,'replicate','conv');

function y = gauss(x,sigma)

%(comment taken out)

y = exp(-x^2/(2*sigma^2)) / (sigma*sqrt(2*pi));

function y = dgauss(x,sigma)

%(comment taken out)

y = -x * gauss(x,sigma) / sigma^2;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!