MATLAB: Imfilter and filter2 filter2imfilter Hi guys, Are imfilter and fiter2 the same for two dimensional array? I did a lot of experiment. It seems they are the same. But filter2 are much faster than imfilter Thanks, Zhong Best Answer 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' Related SolutionsMATLAB: How to resize image of 511*511 to 512*512 in matlab imresize(your_image,512/511) MATLAB: Imfilter Zhang, the difference is that there is a rotation of the kernel by 180 degrees (pi radians) between the two.So for: h = [1 2 3 4 5 6 7 8 9];and h1 = [9 8 7 6 5 4 3 2 1]; x = randn(20,20); isequal(imfilter(x,h,'corr'),imfilter(x,h1,'conv'))returns a 1. Related QuestionCUDA crashes when training LSTM on GeForce RTX 2080 SUPERWhat is the difference between conv2, filter2 and imfilter..Error using imfilter: imfilter_mex.mexw64Imfilter at single point
Best Answer