필터 지우기
필터 지우기

How to captured 60 Frames in 1 Sec?

조회 수: 9 (최근 30일)
SAMEER ahamed
SAMEER ahamed 2014년 1월 11일
댓글: Walter Roberson 2014년 1월 14일
Hi, below sample code which it's 60 frames per 60 seconds , but i need to generate 60 frames in 1 sec ? if any idea?
if true
% code
vid = videoinput('winvideo',1, 'MJPG_1280x720');
vid1 = vid;
num_frames=60;
triggerconfig(vid1, 'Manual');
set(vid1,'FramesPerTrigger',num_frames);
start(vid1);
while 1
[data1 time1] = getdata(vid1,num_frames);
kk=length(time1);
for i=1:kk
F=data1(:,:,:,i);
aviobj = addframe(aviobj,F);
end
aviobj = close(aviobj);
end
end

채택된 답변

Walter Roberson
Walter Roberson 2014년 1월 11일
Your code will capture as many frames per second as it can. As you request that all 60 frames be captured in one command, you are already making the request as quickly as practical for that library interface.
With the code you show, there are three possible reasons that your code might take 60 seconds to capture 60 frames:
  1. your video camera frame-rate itself is set to 1 frame per second and you need to try to set() a different rate; or
  2. you are running out of physical memory and your system is paging to disk; or
  3. your bandwidth to your camera is not fast enough to transfer more than one frame per second at that image size
Question: why are you closing the aviobj within the "while 1" loop? You do not show opening the object.
  댓글 수: 2
SAMEER ahamed
SAMEER ahamed 2014년 1월 14일
편집: Walter Roberson 2014년 1월 14일
Now i have change above code like ,how to get 60 frames in 0.01 milliseconds any calculation need ?
vid = videoinput('winvideo',1, 'MJPG_1280x720');
vid1 = vid;
num_frames=60;
triggerconfig(vid1, 'Manual');
set(vid1,'FramesPerTrigger',num_frames);
start(vid1);
trigger(vid1);
frame = getsnapshot(vid1);
[data1 time1] = getdata(vid1,num_frames);
kk=length(time1);
disp(kk);%kk value 60
aviobj = avifile('myrecord17.avi');
for i=1:kk
F=data1(:,:,:,i);
aviobj = addframe(aviobj,F);
end
aviobj = close(aviobj);
Walter Roberson
Walter Roberson 2014년 1월 14일
You may have to set() a framerate for vid1 . 60 frames per second might not be supported at that frame size.
Don't forget to configure the avifile object to display back at 60 frames per second; that is not the default.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Support Package for IP Cameras에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by