%
Here we go, this is a quick try of mine. I do something not
sophisticate on the input. If it takes memory, we can try to
squeeze it a little more.
Hope it helps,
Bruno
% uint8 Input data
% This is an example:
% M=reshape(1:10,1,1,[]);
% M=repmat(M,[5,5,1]);
% M=uint8(M);
k=4; % multication factor of number of frames
d=size(M);
z=1:d(3); % original frame number
nint=(d(3)-1)*k+1; % number of interpolated frames
zi=linspace(1,d(3),nint); % interpolated indices
% Allocate a big output 3d array, same class as the original
sizeout=[d(1:2) nint];
Mint=zeros(sizeout,class(M));
% Cast original frame input to float
Msingleperm=single(permute(M,[3 1 2]));
blksize=10; % blocksize, will interpolate 10 by 10 by 10...
braket=union(0:blksize:nint,nint); % where to split
zilist=mat2cell(zi,1,diff(braket)); % splitting indices
% Go...
for i=1:length(zilist)
Mint(:,:,braket(i)+1:braket(i+1)) = ...
permute(interp1(z,Msingleperm,zilist{i}),[2 3 1]);
end