I am trying to write a function that imports an .AVI file and returns a 3D matrix in MATLAB.
Ultimately, this is so I can perform an fftn on the 3d matrix.
Blockquote
% this is basically for gray scale video
function video3d
carobj=mmreader('carwide.avi');
% the carwide.avi is video considered for making it % matrix
nFrames=carobj.NumberOfFrames;
M=carobj.Height; % no of rows
N=carobj.Width; % no of columns
video=zeros(M,N,nFrames,'uint8'); % creating a video 3d matrix
for k= 1 : nFrames
im= read(carobj,k);
im=im(:,:,1); % all three layers will have same image
video(:,:,k)=im;
end
end
Blockquote