g = imfilter(f, w, filtering_mode, boundary_options, size_options)
默认是相关操作,填充为0,大小形同‘same’
即如下效果相同
matlab:
kernel = fspecial('gaussian',10,5);
img2=imfilter(img1,kernel);
img3=imfilter(img1,kernel,'corr',0,'same');
c实现:opencv + C++ + opencv + Eigen
具体原理参考链接:
https://blog.csdn.net/zhuwei0710/article/details/68169317
代码地址:
https://download.csdn.net/download/qq_38676868/11647268
eigen配置方法:
https://blog.csdn.net/qq_38676868/article/details/94589856
2019年10月4号补充:
以上程序虽然可以达到matlab中imfilter函数相同效果,但是运行速度过慢
替代方法:opencv自带滤波函数filter2D
filter2D(src, dst,-1, kernel, Point(-1, -1), 0.0, BORDER_CONSTANT);
对一幅图像分别进行两种滤波操作,对比效果图像,效果完全相同。