automatic save images

  • 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

Réponses (2)

Abdulrahman altaee
Abdulrahman altaee le 21 Mai 2011

0 votes

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 commentaires

Abdulrahman altaee
Abdulrahman altaee le 21 Mai 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 le 22 Mai 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

Connectez-vous pour commenter.

Catégories

En savoir plus sur Images dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by