⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_learn_filt.m

📁 Standard model object recognition matlab code
💻 M
字号:
function [test_result,test_loc] = test_learn_filt (f,r,s)% FUNCTION [test_result,test_loc] = test_learn_filt (f,r,s)% % Test if the leraned filter f is valid, by trying to find the% patch from the input r.  The output test_result will give the% indices of the features from which the matching patch was found.% The input arguement s specifies the scale from which f was% learned.s_tag = ['s' num2str(s)];i1 = getfield(f, ['i1_' s_tag]);i2 = getfield(f, ['i2_' s_tag]);i3 = getfield(f, ['i3_' s_tag]);siz = getfield(f, ['size_' s_tag]);f_val = getfield(f, ['f1_' s_tag]);x  = getfield(r,s_tag);for i = 1:15%size(f_val,2) % Loop thru features  for j = 1:size(f_val,1)    for m = 1:size(x,1)-siz(1)      for n = 1:size(x,2)-siz(2)	x_val(j,m,n) = x(i1(j,i)+m,i2(j,i)+n,i3(j,i));      end    end  end  % Threshold for finding, in case of roundoff error.  thresh = eps*1000;   is_match = squeeze(sum(abs(x_val-repmat(f_val(:,i),[1 m n]))));  is_found = find(is_match<thresh);  if length(is_found) > 0    if length(is_found)>1      disp(['Threshold too big for feature ' num2str(i)]);    end    test_result(i) = 1;    [m_tmp,n_tmp]  = ind2sub(size(is_match),is_found(1));    test_loc(1,i)  = m_tmp;    test_loc(2,i)  = n_tmp;   else    test_result(i)  = 0;    test_loc(1:2,i) = 0;  endend

⌨️ 快捷键说明

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