Fixed number of frames video buffer

조회 수: 3 (최근 30일)
Eirik Furuholt
Eirik Furuholt 2021년 4월 21일
답변: Shiva Kalyan Diwakaruni 2021년 5월 5일
Hi,
I get a new picture from my camera every 100ms. I want to store some frames to understand what happens before and after an event.
How can I implement a buffer that continuously saves the last 30 pictures?
The last lines of code shows what I want to do.
Any help with the saving of frames after the trigger event is also appreciated, but I think I can do it.
while true
%get video
I = videoinput('winvideo', 2, 'YUY2_1280x720');
I.ReturnedColorspace = 'rgb';
I = getsnapshot(I);
vid.ROIPosition = [585 400 648 313]; % crop the image to smaller ROI
% preprosess the image
I = imresize(I,frameSize);
I= imsubtract(I,background);
I = imadjust(I,[low high]);
%----------------------------------- save last 30 frames of I
% if something happens
% save 30 more more frames
% merge the two videos
end
  댓글 수: 2
Walter Roberson
Walter Roberson 2021년 4월 21일
Eirik Furuholt
Eirik Furuholt 2021년 4월 21일
Hello Walter,
Thank you for your reply.
In the link you provided I cannot see a solution to logging just the last few seconds. This camera will run for weeks and I will quickly run out of disk space if I log continuously. Could you please explain further how I can log the last few seconds without losing frames?
Best regards
Eirik F.

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

답변 (1개)

Shiva Kalyan Diwakaruni
Shiva Kalyan Diwakaruni 2021년 5월 5일
Hi,
You can try Creating a video reader object and read one or more video frames using the frame indices.
below is the link to documentation
Hope it helps.

카테고리

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