Filter löschen
Filter löschen

.tiff to .avi conversion

6 Ansichten (letzte 30 Tage)
Shubhi Sharma
Shubhi Sharma am 8 Jan. 2020
Beantwortet: Mann Baidi am 2 Mai 2024
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.

Antworten (1)

Mann Baidi
Mann Baidi am 2 Mai 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:

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by