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

8 views (last 30 days)
Shinobu on 7 Dec 2016
Answered: jiro on 9 Dec 2016

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.

Answers (2)

Image Analyst
Image Analyst on 8 Dec 2016
Use getsnapshot()

Sign in to comment.

jiro on 9 Dec 2016
One such example.
v = VideoReader('xylophone.mp4');
% Display first frame
firstFrame = readFrame(v);
h1 = imshow(firstFrame);
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;

Community Treasure Hunt

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

Start Hunting!