How can I acquire frames from a live video stream, acquire the frames, then use the frames to recreate the live video stream?

1 回表示 (過去 30 日間)
Shinobu
Shinobu 2016 年 12 月 7 日
回答済み: Jiro Doke 2016 年 12 月 9 日

Hello. I want to detect red objects from the live video stream (I know how to detect red objects)

What I want to know is how to acquire the frames from the original live video stream and recreate another live video stream using the processed frames and play these two video streams side by side.

Please help. I'd be really grateful to you.

回答 (2 件)

Image Analyst
Image Analyst 2016 年 12 月 8 日
Use getsnapshot()
  3 件のコメント
Image Analyst
Image Analyst 2016 年 12 月 8 日
I have not personally done that so I can't direct you. Call tech support and they will help you.
Shinobu
Shinobu 2016 年 12 月 9 日
Okay. Thank you for your time and help. I'll try to do that.

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


Jiro Doke
Jiro Doke 2016 年 12 月 9 日
One such example.
v = VideoReader('xylophone.mp4');
% Display first frame
firstFrame = readFrame(v);
subplot(1,2,1)
h1 = imshow(firstFrame);
subplot(1,2,2)
h2 = imshow(rgb2gray(firstFrame));
% Loop through all frames
while hasFrame(v)
frame = readFrame(v);
frameG = rgb2gray(frame);
% Update image
h1.CData = frame;
h2.CData = frameG;
drawnow
end

Community Treasure Hunt

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

Start Hunting!

Translated by