Downsampling a selection of images before converting them to video
2 views (last 30 days)
Show older comments
Guglielmo Sonnino Sorisio
on 2 May 2022
I'm trying to create an .avi file from several .tif images, due to the very large number of images and the high frame rate I need to only use every other frame so that instead of 80 fps I get 40 fps. for example if there are images named 1, 2, 3, 4, 5, 6 etc, I only need images 1, 3, 5 in the video. This is the code I'm using so far:
function tif2avi
clc; close all;
[imagelist,p]=uigetfile('*.tif','MultiSelect','on',...
'Select LIST to plot'); pause(0.5); cd(p);
if ~iscell(imagelist); disp('imagelist not cell'); return; end;
outputVideo = VideoWriter('0424_rat01.avi');
outputVideo.FrameRate = 80;
outputVideo.Quality = 50;
open(outputVideo);
for i=1:numel(imagelist)
img=imread(imagelist{i});
writeVideo(outputVideo,img);
end
0 Comments
Accepted Answer
Chandra
on 5 May 2022
Hi,
for i=1:numel(imagelist)
img=imread(imagelist{i});
img = imresize(img,[1920 911]); % change the values accordingly, find the size in outputVideo using workspace or command window
writeVideo(outputVideo,img);
end
close(outputVideo);
try to explore outputVideo from workspace and change the required values accordingly.
0 Comments
More Answers (0)
See Also
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!