How to record live video with a buffer?

4 ビュー (過去 30 日間)
Mark Golberg
Mark Golberg 2016 年 2 月 15 日
コメント済み: Walter Roberson 2016 年 2 月 24 日
Hello, I have the following problem. I want to record the 1st second of real time video <-- that's my buffer. Now, I'd like to display in my GUI (1/10, which is actually 100 msec) of my buffer data. Repeat it 10 times. At the same time, I'd to record a new 2nd second to fill in the buffer. My question is, how can I simultaneously display data on in the GUI (pulling from the buffer), and recording new data (pushing to the buffer)?
I want to do this, so my Real Time Display would look smooth as new data coming in.
THANKS

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 2 月 15 日
Have you considered using the computer vision toolbox? You can step() your video acquisition device to get a frame and in the same cycle step your video output to display a frame, potentially a frame you recorded earlier.
  6 件のコメント
Mark Golberg
Mark Golberg 2016 年 2 月 22 日
Thanks again Walter. I am using Windows 7. Have 8 cores CPU. Camera is connected via USB 3. I do have Parallel Computing Toolbox, but how exactly it can help solve my problem?
I think I need something like the spmd function. But instead of running single statement on multiple cores, I need to run 2 different statements, each one should run on it's own core.
I don't mind it to be 100% simultaneous, by the split of a second, I am simply trying to reduce my run time.
At the moment my process is the following (running in loop):
1. I grab 1 second of data from usb camera.
2. I process this data.
3. I display the outcome on my GUI.
It takes the above steps 1-3 too long to execute (~1.5 seconds), making my GUI display NOT smooth. Thus I'd like to work through a buffer, making the "reading frames part" as if I am reading from file. Which I know can run quite smoothly.
Walter Roberson
Walter Roberson 2016 年 2 月 24 日
parpool(2,'local')
spmd
if labindex == 1
for Number_of_times = 1 : 15
for framenum = 1 : 10
frames(:,:,:,framenum) = get a frame
end
labSend(2, frames); %send it to the other proccess
end
else %labindex must be 2
for Number_of_times = 1 : 15
frames = labReceive(1);
... do some calculation on the frames
...
end
end
end

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by