Yes, they are the same in some instances:
h = 1/100*ones(10,10);
x = randn(20,20);
y = filter2(h,x);
y1 = imfilter(x,h);
max(abs(y(:)-y1(:)))
but imfilter() gives more options to specify boundary conditions for example and whether to rotate the kernel or not -- 'corr' vs 'conv'
Best Answer