matlab - Save extracted video frames as images -
i wish take screen grab of video frame , save each frame image in folder on desktop. there frames want capture however, written in text document.
my question is, how read in frame numbers stored in text document , extract these frames png files?
thanks can provide. if need clarify anything, please ask.
frames = dlmread('frames.txt'); %getting no of frames numframes = mov.numberofframes; %setting current status of number of frames written 0 numframeswritten = 0; t = frames: numframes currframe = read(mov, t); %reading individual frames opbasefilename = sprintf('%3.3d.png', t); opfullfilename = fullfile(opfolder, opbasefilename); imwrite(currframe, opfullfilename, 'png'); %saving 'png' file progindication = sprintf('wrote frame %4d of %d.', t, numframes); disp(progindication); numframeswritten = numframeswritten + 1; end
if understand question correctly:
... how read in frame numbers stored in text document , extract these frames png files?
and assuming 'frames' vector contains subset of indicies of frames want, need change loop
for t = frames
Comments
Post a Comment