steerable_gauss.m

来自「加州大学伯克利分校的一个车俩识别程序, 用matlab实现」· M 代码 · 共 64 行

M
64
字号
function [basis] = steerable_gauss(I,scale); % defines a set of seperable quadrature pair % basis filters as per freeman & adelson, pami, sept 1991%% returns the response to convolution with the% basis functions.  use function steer.m to % generate actual orientation%% charless fowlkes, 2000% fowlkes@cs.berkeley.edu%% generate a gaussian to upsample the filters%% if we need larger filters.if (scale > 1) k = gen_gaussian(scale-2);else k = [1];end;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% even %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% x-y basis set for second derivative of gaussian f1 = [ 0.0094, 0.1148, 0.3964,-0.0601,-0.9213,-0.0601, 0.3964, 0.1148, 0.0094]; f2 = [ 0.0008, 0.0176, 0.1660, 0.6383, 1.0000, 0.6383, 0.1660, 0.0176, 0.0008];f3 = [-0.0028,-0.0480,-0.3020,-0.5806, 0.0000, 0.5806, 0.3020, 0.0480, 0.0028];f1 = conv(f1,k);f2 = conv(f2,k);f3 = conv(f3,k);% compute response for gaussian 2nd derivative basis filtersbasis.Ga = conv2(conv2(I,f1,'same'),f2','same');basis.Gb = conv2(conv2(I,f3,'same'),f3','same');basis.Gc = conv2(conv2(I,f2,'same'),f1','same');%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% odd %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% x-y basis set for hilbert transform of second derivative of gaussianf1 = [-0.0098,-0.0618, 0.0998, 0.7551, 0.0000,-0.7551,-0.0998, 0.0618, 0.0098];f2 = [ 0.0008, 0.0176, 0.1660, 0.6383, 1.0000, 0.6383, 0.1660, 0.0176, 0.0008];f3 = [-0.0020,-0.0354,-0.2225,-0.4277, 0.0000, 0.4277, 0.2225, 0.0354, 0.0020];f4 = [ 0.0048, 0.0566, 0.1695,-0.1889,-0.7349,-0.1889, 0.1695, 0.0566, 0.0048];f1 = conv(f1,k);f2 = conv(f2,k);f3 = conv(f3,k);f4 = conv(f4,k);% compute response for hilbert trans. of gaussian 2nd derivative basis filtersbasis.Ha = conv2(conv2(I,f1,'same'),f2','same');basis.Hb = conv2(conv2(I,f4,'same'),f3','same');basis.Hc = conv2(conv2(I,f3,'same'),f4','same');basis.Hd = conv2(conv2(I,f2,'same'),f1','same');

⌨️ 快捷键说明

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