If I upsample an image like this:
A = imread('cameraman.tif');
M = 2;
N = 3;
B = zeros([size(A,1)*M size(A,2)*N]);
B(1:M:end,1:N:end) = A;
Then how do I interpolate B
in Matlab to fill in the zeros?
If I upsample an image like this:
A = imread('cameraman.tif');
M = 2;
N = 3;
B = zeros([size(A,1)*M size(A,2)*N]);
B(1:M:end,1:N:end) = A;
Then how do I interpolate B
in Matlab to fill in the zeros?
I believe you can do this by calling interp2
with a newly defined grid. E.g.
im = imread('cameraman.tif');
im = im2double(im);
M = 2;
N = 3;
x = linspace(1, size(im, 2), size(im, 1)*N);
y = linspace(1, size(im, 1), size(im, 2)*M);
[xs, ys] = meshgrid(x, y);
new_im = interp2(im, xs, ys, 'cubic');