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

조회 수: 11 (최근 30일)
Turbulence Analysis
Turbulence Analysis 2021년 1월 23일
댓글: Turbulence Analysis 2021년 1월 23일
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);

채택된 답변

Image Analyst
Image Analyst 2021년 1월 23일
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.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by