.tiff to .avi conversion
3 views (last 30 days)
Show older comments
I have a sequence of .tiff images and need to convert it into an .avi file. Can anyone provide the matlab code for the same.
0 Comments
Answers (1)
Mann Baidi
on 2 May 2024
As per my understanding of the question, you would like to create an .avi file using a sequence of .tif images in MATLAB.
I would sugget you to use the 'VideoWriter' object to create a video object and then can add the frames using the 'writeVideo' function.
You can take help of the following code as a reference.
% Specify the folder where your .tif file is located
folder = pwd;
% List all files in the folder
files = dir(fullfile(folder, '*.tif'));
% Check if any .tif files are found
if isempty(files)
error('No .tif files found in the specified folder');
end
% Create a Video Writer Object for .avi video file
v = VideoWriter('new.avi','Uncompressed AVI');
% numFiles contains the number of .tif files in the folder
numFiles=numel(files);
open(v);
for k=1:numFiles
% Reading each tif file one by one and adding it in the video
x=imread(files(k).name);
v.writeVideo(x);
end
close(v);
% Play the .avi file
implay('new.avi')
You can know more about the 'VideoWriter' object using the documentation link mentioned below:
0 Comments
See Also
Categories
Find more on Image Data 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!