You are on page 1of 7

NAME: SATYANSH TEWARI

REG NO: 19BCE0520


COURSE CODE: CSE3018
SLOT: L55+L56
FACULTY: VIJAYARAJAN V

Content Based Image and Video Retrieval LAB DA-7

Lab-7 Question: CBIVR - Foreground extraction using background


sub

MATLAB CODE:
%19BCE0520 SATYANSH TEWARI
clc
close all
clear all
videoSource =VideoReader('metmovie.mp4');
detector=vision.ForegroundDetector('NumTrainingFrames',5,'Initia
lVariance',...
30*30);
blob =
vision.BlobAnalysis('CentroidOutputPort',false,'AreaOutputPort',
...

false,'BoundingBoxOutputPort',true,'MinimumBlobAreaSource',...
'Property','MinimumBlobArea',250);
shapeInserter=vision.ShapeInserter('BorderColor','White');
videoPlayer=vision.VideoPlayer();
while hasFrame(videoSource)
frame=readFrame(videoSource);
fgMask=detector(frame);
bbox=blob(fgMask);
out=shapeInserter(fgMask,bbox);
videoPlayer(out);
pause(0.1);
end

CODE SCREEN:

WORKSPACE:
INPUT VIDEO LINK:
https://youtu.be/K-YOt-boj8g
SOME INSTANCES OF INPUT VIDEO:
OUTPUT VIDEO LINK:
https://youtu.be/YdhJWGz4UZA
SOME INSTANCES OF OUTPUT VIDEO :

You might also like