LIVE video object detection

5 views (last 30 days)
vardhit
vardhit on 4 Apr 2014
Answered: Dima Lisin on 1 Jul 2014
I found this example in matlab which is used on avi files. % EXAMPLE: Tracking cars hsrc = vision.VideoFileReader('viptraffic.avi', ... 'ImageColorSpace', 'Intensity', ... 'VideoOutputDataType', 'uint8'); hfg = vision.ForegroundDetector(... 'NumTrainingFrames', 5, ... % 5 because of short video 'InitialVariance', 30*30); % initial standard deviation of 30 hblob = vision.BlobAnalysis(... 'CentroidOutputPort', false, 'AreaOutputPort', false, ... 'BoundingBoxOutputPort', true, 'MinimumBlobArea', 250);
hsnk = vision.VideoPlayer();
while ~isDone(hsrc)
frame = step(hsrc);
fgMask = step(hfg, frame);
bbox = step(hblob, fgMask);
% draw bounding boxes around cars
out = insertShape(frame, 'Rectangle', bbox, 'Color', 'White');
step(hsnk, out); % view results in the video player
end
release(hsnk);
release(hsrc);
I want it to process this code on LIVE webcam video feed. please suggest a way to achieve this.

Answers (1)

Dima Lisin
Dima Lisin on 1 Jul 2014
You would either need to have the Image Acquisition Toolbox, or MATLAB version R2014a, which includes support for getting video from a webcam in base MATLAB.

Categories

Find more on Computer Vision Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!