automatic save images

4 views (last 30 days)
Abdulrahman altaee
Abdulrahman altaee on 20 May 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

Answers (2)

Arnaud Miege
Arnaud Miege on 20 May 2011

Abdulrahman altaee
Abdulrahman altaee on 21 May 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 Comments
Abdulrahman altaee
Abdulrahman altaee on 21 May 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 on 22 May 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

Sign in to comment.

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!