automatic save images

조회 수: 11 (최근 30일)
Abdulrahman altaee
Abdulrahman altaee 2011년 5월 20일
  • 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

답변 (2개)

Arnaud Miege
Arnaud Miege 2011년 5월 20일

Abdulrahman altaee
Abdulrahman altaee 2011년 5월 21일
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
Abdulrahman altaee
Abdulrahman altaee 2011년 5월 21일
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 2011년 5월 22일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by