Add time stamp in seconds
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a series of images taken at 82fps, I would like to add a time stamp in seconds at the top of each photo.
For example its 400 images of a bubble growing, so I would like to add the seconds at the top of each image.
Heres what I have so far but its not working. Thank you for the help.
clear;clc
%%%identify the window%%%
folderDir='E:\1.ACRYLIC_CHAMBER\20um_coated\vacum_test\Trial_6\1psi\test_1\dry\CUT\CUT\';
ImgSer=dir([folderDir,'*.tif']);
TimeStep=1/82; % time step between two images in min, "MODIFY THIS VALUE ACCORDING TO YOUR EXPER.."
mkdir([folderDir,'TEST'])
for i = 1:300
I=imread([folderDir,ImgSer(i).name]);
%%%% add time
ht2=text(30,30,sprintf('t= %2.2f s',TimeStep*i),'Fontname','times','fontsize',30,'Color','k');
% % % % %%%% add arrow
% % % % a=annotation('arrow',[0.2,0.2],[0.20,0.40]);%,'HeadWidth',5,'HeadLength',5);
% % % % a.Color='red';
imwrite(I,[folderDir,'TEST/',sprintf('%05d.tif',i)],'tif','compression','none');
end
0 comentarios
Respuestas (1)
Jan
el 5 de Dic. de 2022
The text() command inserts text in an axes. Then the text is displayed on the screen. This does not modify the image in any way. Use insertText(), which needs the Image Processing Toolbox:
% [UNTESTED CODE]
inFolder = 'E:\1.ACRYLIC_CHAMBER\20um_coated\vacum_test\Trial_6\1psi\test_1\dry\CUT\CUT\';
outFolder = fullfile(inFolder, 'TEST');
ImgSer = dir(fullfile(inFolder, '*.tif'));
TimeStep = 1/82;
mkdir(outFolder);
for i = 1:300
Img = imread(fullfile(folderDir, ImgSer(i).name));
Img = insertText(sprintf('t= %2.2f s',TimeStep*i), [10, 10], ...
'Fontname', 'Times', 'FontSize', 30, 'TextColor', 'k');
imwrite(Img, fullfile(outFolder, sprintf('%05d.tif', i)], ...
'tif', 'compression', 'none');
end
0 comentarios
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!