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

📄 restrict.m

📁 采用matlab编写的数字图像恢复程序
💻 M
字号:
  function [v] = restrict(u,p)%%  [v] = restrict(u)%  [v] = restrict(u,p)%%  Apply 2-D multilevel restriction based on piecewise constant %  heirarchical basis functions.%%  u is the grid function (2-D array) being restricted.%  p is the number of levels of restriction.  if nargin == 1    p = 1;  end  [m,n] = size(u);  if m ~= n    disp(' *** Error in restrict.m.  u must be square array ***');    return   elseif 2^(round(log2(n))) ~= n    disp(' *** Error in restrict.m.  size(u) must be power of 2 ***');    return  elseif p < 1    disp(' *** Error in restrict.m.  p must be positive ***');    return  elseif 2^p > n    disp(' *** Error in restrict.m.  2^p > size(u) ***');    return  end  for level = 1:p    nd2 = n/2;    v = zeros(nd2,nd2);    for i = 1:nd2      vi = sum([u(2*i-1,:); u(2*i,:)]);      v(i,:) = vi(1:2:n-1) + vi(2:2:n);    end    v = v / 4;    u = v;    n = nd2;  end  

⌨️ 快捷键说明

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