time stamp in video files (image to video file conversion)

14 views (last 30 days)
Hi,
I a making video file from set of 500 .bmp image files, the time gap between each image is 0.0002 sec. Here, I would like to add time stamp in my video, please help me with this.. I am using the below standard code for image to video conversion
myFolder = 'Y:\Processing\';
if ~isdir(myFolder)
errorMessage = sprintf('Error: The following folder does not exist:\n%s', myFolder);
uiwait(warndlg(errorMessage));
return;
end
filePattern = fullfile(myFolder, '*.bmp');
Files = dir(filePattern);
writerObj = VideoWriter('video1');
writerObj.FrameRate = 5;
open(writerObj);
for frameNumber = 1 : length(Files)
baseFileName = pngFiles(frameNumber).name;
fullFileName = fullfile(myFolder, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
thisimage = imread(fullFileName);
imshow(thisimage);
drawnow;
writeVideo(writerObj, thisimage);
end
close(writerObj);

Accepted Answer

Image Analyst
Image Analyst on 23 Jan 2021
If you have the Computer Vision Toolbox, use insertText().
If not, you have to use text() and then getframe() but the image size will be changed (since it's a screenshot) so then you need to follow that by imresize() to resize it back to the original size.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!