MATLAB interp3 帧间插值

如题,MATLAB里面有interp1,interp2和interp3等等插值方法

也有‘linear’:线性插值(缺省算法); ‘cubic’:三次插值; ‘spline’:三次样条插值;‘ nearest’:最邻近插值。等插值选择

但如何用两张图像去插中间一张呢,或者用四张去插中间的一张呢

我们选择用interp3

input_path = './cremi/';
out_path = './cremi/0005_interp.png';
temp = zeros(1761,1680,4, 'uint8');

temp(:,:,1) = imread([input_path, num2str(3, '%04d'), '.png']);
temp(:,:,2) = imread([input_path, num2str(4, '%04d'), '.png']);
temp(:,:,3) = imread([input_path, num2str(6, '%04d'), '.png']);
temp(:,:,4) = imread([input_path, num2str(7, '%04d'), '.png']);

temp = double(temp);
[x,y,z] = size(temp);
[hx,hy,hz] = meshgrid(1:y, 1:x, 2:1/2:3);
hr = interp3(temp, hx, hy, hz, 'cubic');
imwrite(uint8(hr(:,:,2)), out_path)

注意:

cubic插值至少需要三张图像

你可能感兴趣的:(matlab,matlab,interp3,帧间插值)