📄 upsampling_2d.m
字号:
function [y, ny] = upsampling_2d(x, nx, M)
% upsampling of a two-dimensional sequence
% input: x -- original sequence
% nx -- index of the elements in x at the upperleft corner
% M -- an integer sampling matrix
% output: y -- upsampled sequence
% ny -- index of the elements in y at the upperleft corner
% Copyright (c) 2006 Yi Chen
nx0 = nx(1):size(x,1) + nx(1) - 1; nx1 = nx(2):size(x,2) + nx(2) - 1;
[nx1, nx0] = meshgrid(nx1, nx0);
ny0 = M(1,1)*nx0 + M(1,2)*nx1;
ny1 = M(2,1)*nx0 + M(2,2)*nx1;
ny(1) = min(min(ny0));
ny(2) = min(min(ny1));
ly0 = max(max(ny0)) - min(min(ny0)) + 1;
ly1 = max(max(ny1)) - min(min(ny1)) + 1;
y = zeros(1, ly0*ly1);
iy = reshape(ny0-ny(1)+1+ly0*(ny1-ny(2)), [1, prod(size(x))]);
y(iy) = x(1:prod(size(x)));
y = reshape(y, [ly0, ly1]);
[y, ny] = reduce_size(y, ny, 0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -