conv2sep.m

来自「图像配准的源程序」· M 代码 · 共 23 行

M
23
字号
function result = conv2sep(im,rowfilt,colfilt,shape)
% CONV2SEP: Separable convolution using conv2.
% 
%      result=conv2sep(im,rowfilt,colfilt,shape)
%
%      im - input image.
%      rowfilt - 1d filter applied to the rows
%      colfilt - 1d filter applied to the cols
%      shape - 'full', 'same', or 'valid' (see doc for conv2).
%
% Example: foo=conv2sep(im,[1 4 6 4 1],[-1 0 1],'valid');


if ~exist('shape')
  shape='full';
end

rowfilt=rowfilt(:)';
colfilt=colfilt(:);

tmp = conv2(im,rowfilt,shape);
result = conv2(tmp,colfilt,shape);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?