impyramid , imresize. , , , expand impyramid, A :
M = size(A,1);
N = size(A,2);
scaleFactor = 2;
outputSize = 2*[M N] - 1;
kernel = makePiecewiseConstantFunction( ...
[1.25 0.75 0.25 -0.25 -0.75 -1.25 -Inf], ...
[0.0 0.125 0.5 0.75 0.5 0.125 0.0]);
kernelWidth = 3;
B = imresize(A, scaleFactor, {kernel, kernelWidth}, ...
'OutputSize', outputSize, 'Antialiasing', false);
, outputSize 1, 1 . makePiecewiseConstantFunction , impyramid. . , .
1 .
, , outputSize :
outputSize = 2*[M N];
, , , , , true, 1 false . impyramid, :
function B = impyramid(A, direction, padding)
, , :
if nargin == 2
padding = false;
end
impyramid , .
, expand if :
else
scaleFactor = 2;
outputSize = 2*[M N];
if ~padding %// Change
outputSize = outputSize - 1;
end
kernel = makePiecewiseConstantFunction( ...
[1.25 0.75 0.25 -0.25 -0.75 -1.25 -Inf], ...
[0.0 0.125 0.5 0.75 0.5 0.125 0.0]);
kernelWidth = 3;
end
if , 2M x 2N 2M - 1 x 2N - 1. , , :
scaled_result1_2 = impyramid(scale1_2, 'expand', true);
scaled_result1_4 = impyramid(impyramid(scale1_4,'expand', true), 'expand', true);