resamp.m

来自「NONSUBSAMPLED CONTOURLET TRANSFORM FILTE」· M 代码 · 共 51 行

M
51
字号
function y = resamp(x, type, shift, extmod)
% RESAMP   Resampling in 2D filterbank重采样二维filterbank
%
%	y = resamp(x, type, [shift, extmod])
%
% Input:
%	x:	input image
%	type:	one of {1, 2, 3, 4} (see note)
%	shift:	[optional] amount of shift (default is 1)
%       extmod: [optional] extension mode (default is 'per').
%		Other options are:
%
% Output:
%	y:	resampled image.
%
% Note:
%	The resampling matrices are:
%		R1 = [1, 1;  0, 1];
%		R2 = [1, -1; 0, 1];
%		R3 = [1, 0;  1, 1];
%		R4 = [1, 0; -1, 1];
%
%	For type 1 and type 2, the input image is extended (for example
%	periodically) along the vertical direction;
%	while for type 3 and type 4 the image is extended along the 
%	horizontal direction.
%
%	Calling resamp(x, type, n) which n is positive integer is equivalent
%	to repeatly calling resamp(x, type) n times.
%
%	Input shift can be negative so that resamp(x, 1, -1) is the same
%	with resamp(x, 2, 1)

if ~exist('shift', 'var')
    shift = 1;
end

if ~exist('extmod', 'var')
    extmod = 'per';
end

switch type
    case {1, 2}
	y = resampc(x, type, shift, extmod);
	
    case {3, 4}
	y = resampc(x.', type - 2, shift, extmod).';
	
    otherwise
	error('The second input (type) must be one of {1, 2, 3, 4}');	
end

⌨️ 快捷键说明

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