automatic save images

10 Ansichten (letzte 30 Tage)
Abdulrahman altaee
Abdulrahman altaee am 20 Mai 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

Antworten (2)

Arnaud Miege
Arnaud Miege am 20 Mai 2011

Abdulrahman altaee
Abdulrahman altaee am 21 Mai 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 Kommentare
Abdulrahman altaee
Abdulrahman altaee am 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 am 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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by