How filter2() is working in this code?

function G=costfunction(im)
G=zeros(size(im,1),size(im,2));
for ii=1:size(im,3)
G=G+(filter2([.5 1 .5; 1 -6 1; .5 1 .5],im(:,:,ii))).^2;
end
end

Answers (0)

Asked:

on 28 Feb 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!