using peekdata or getdata for live video stream
조회 수: 17 (최근 30일)
이전 댓글 표시
Hi,
I'm having a lot of trouble processing frames from a continuous feed in real time. I want to first get the pixel data from each 100th frame using either the peekdata function or the getdata function. However, my code only seems to return the information for one frame rather than every hundred frames. This is what I came up with so far:
while isrunning(vid) == 1
if mod(vid.FramesAcquired,100) == 0
for i = vid.FramesAcquired/100
Frame100(i) = peekdata(vid,1);
regionsprops(Frame100(i));
end
end
end
Does anyone have any insight?
댓글 수: 0
답변 (1개)
Walter Roberson
2018년 1월 16일
peekdata() returns a height by width by bands by frames numeric matrix. You are trying to store that matrix into a single location Frame(i) . That is going to cause an error unless you have set your ROI to be a single pixel on a greyscale image.
댓글 수: 6
Walter Roberson
2018년 1월 17일
편집: Walter Roberson
2018년 1월 17일
"The number of frames available to peekdata is determined by recalling the last frame returned by a previous peekdata call, and the number of frames that were acquired since then."
This implies that if you want to peek a frame you cannot peek with a lower frame count and then go back to peek with a larger count to get more of the recent frames.
But I think I am getting confused here. What is the state of the Running property at the time you are trying to do the peekdata ?
참고 항목
카테고리
Help Center 및 File Exchange에서 Acquisition Using Any Hardware에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!