enopv2.m

来自「matlab程序」· M 代码 · 共 41 行

M
41
字号
function X = enopv2(X,Level,Degree)
%ENOPV2  2D Essentially Non-Oscillatory point-value decomposition.
%   Y = ENO2(X,L,N) computes the L-stage ENO decomposition of image
%   X using Nth-degree interpolation.  The size of X must be such that
%   size(X,1) and size(X,2) = 2^K + 1 for some integer K.  If not, the
%   right and bottom sides are padded using constant extrapolation.
%
%   For reconstruction, use L < 0 to reverse -L stages.
%
%   Example:
%   % Transform with 3 stages and 4th-degree interpolation
%   Y = enopv2(X,3,4);   % Decompose X
%   R = enopv2(Y,-3,4);  % Recover X from Y
%
%   See also ENOPV, ENOCA2.

% Pascal Getreuer 2005

if nargin < 3, error('Not enough input arguments.'); end

K = log2(size(X)-1);
M = pow2(ceil(K)) + 1 - size(X);

if any(M ~= 0)
   warning('Image padded to 2^K+1 size.');
   X = X([1:size(X,1),size(X,2)*ones(1,M(1))], ...
      [1:size(X,2),size(X,2)*ones(1,M(2))]);
end

if Level > 0
   for L = 0:Level-1
      M = (size(X)-1)*pow2(-L) + 1;
      X(1:M(1),1:M(2)) = enopv(enopv(X(1:M(1),1:M(2)),1,Degree,0,1),1,Degree,0,2);
   end
else
   for L = 1+Level:0
      M = (size(X)-1)*pow2(L) + 1;
      X(1:M(1),1:M(2)) = enopv(enopv(X(1:M(1),1:M(2)),-1,Degree,0,2),-1,Degree,0,1);
   end
end

⌨️ 快捷键说明

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