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

📄 mkdisc.m

📁 PDTDFB toolbox The filter bank is described in: The Shiftable Complex Directional Pyramid—Pa
💻 M
字号:
% IM = mkDisc(SIZE, RADIUS, ORIGIN, TWIDTH, VALS)
%
% Make a "disk" image.  SIZE specifies the matrix size, as for
% zeros().  RADIUS (default = min(size)/4) specifies the radius of 
% the disk.  ORIGIN (default = (size+1)/2) specifies the 
% location of the disk center.  TWIDTH (in pixels, default = 2) 
% specifies the width over which a soft threshold transition is made.
% VALS (default = [0,1]) should be a 2-vector containing the
% intensity value inside and outside the disk.  

% Eero Simoncelli, 6/96.

function [res] = mkDisc(sz, rad, origin, twidth, vals)

if (nargin < 1)
  error('Must pass at least a size argument');
end
  
sz = sz(:);
if (size(sz,1) == 1)
  sz = [sz sz];
end
 
%------------------------------------------------------------
% OPTIONAL ARGS:

if (exist('rad') ~= 1)
  rad = min(sz(1),sz(2))/4;
end

if (exist('origin') ~= 1)
  origin = (sz+1)./2;
end

if (exist('twidth') ~= 1)
  twidth = 2;
end

if (exist('vals') ~= 1)
  vals = [1,0];
end

%------------------------------------------------------------

res = mkR(sz,1,origin);

if (abs(twidth) < realmin)
  res = vals(2) + (vals(1) - vals(2)) * (res <= rad);
else
  [Xtbl,Ytbl] = rcosFn(twidth, rad, [vals(1), vals(2)]);
  res = pointOp(res, Ytbl, Xtbl(1), Xtbl(2)-Xtbl(1), 0);
% 
% OLD interp1 VERSION:
%  res = res(:);
%  Xtbl(1) = min(res);
%  Xtbl(size(Xtbl,2)) = max(res);
%  res = reshape(interp1(Xtbl,Ytbl,res), sz(1), sz(2));
% 
end
  

⌨️ 快捷键说明

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