automatic save images

4 visualizaciones (últimos 30 días)
Abdulrahman altaee
Abdulrahman altaee el 20 de Mayo de 2011
  • I build i loop where I can take image per 1 min, while I get several images from the camera, I have to save these images under any letter like h as a sequence (h1, h2 , etc). how can I do it automatically.Please help me

Respuestas (2)

Arnaud Miege
Arnaud Miege el 20 de Mayo de 2011

Abdulrahman altaee
Abdulrahman altaee el 21 de Mayo de 2011
vid = videoinput('winvideo', 1, 'YUY2_640x480');
src = getselectedsource(vid);
vid.ReturnedColorspace = 'rgb';
count=0
for i=1:5
preview(vid);
framesPerTrigger = 1;
set(vid, 'FramesPerTrigger', framesPerTrigger)
get(src)
fps = 30;
set(src, 'FrameRate', num2str(fps))
acqPeriod = 5;
frameDelay = fps * acqPeriod
set(vid, 'TriggerFrameDelay', frameDelay)
acqDuration = (acqPeriod) + 3
vid.Timeout = acqDuration;
start(vid)
wait(vid,acqDuration)
g=getsnapshot(vid);
figure, imshow(g)
saveas(gcf,'A.tif')% I want to save the g as *.tif sequencly exp. A1,A2,A3....
count=count+1
if count< 5
continue
else
end
end
  2 comentarios
Abdulrahman altaee
Abdulrahman altaee el 21 de Mayo de 2011
Thanks
Mr.Arnaud Miege
this is part of my program
I want to save the snapshot as *.tif like A1, A2 , A3 ...etc
automatically
thank you
Arnaud Miege
Arnaud Miege el 22 de Mayo de 2011
Have you looked at the links that I gave you, that's explaine din quite some detail there.
Something as simple as this should work;
g = getsnapshot(vid);
figure, imshow(g)
fname = ['A' str2num(i) '.tif'];
saveas(gcf,fname);
HTH,
Arnaud

Iniciar sesión para comentar.

Categorías

Más información sobre Images en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by