Background modeling and get foreground mask.
fg = detectforeground(im) fg = detectforeground(im, method)
'LI'
(default), 'GMM'
. Other methods will appear in the future.detectforeground
is used to create background model, then fg is an empty matrix.
If detectforeground
is used to detect foreground, then fg is the foreground mask.The function detectforeground
creates background model and gets the foreground mask from an input video. The user should first use fg=detectforeground(im,method)
or fg=detectforeground(im)
to create the background model by the assigned method or the default method. Then use fg=detectforeground(im)
to detect foreground and get the foreground mask.
n = aviopen(SCI+'/contrib/sivp-svn-trunk/images/video.avi'); im = avireadframe(n); fg = detectforeground(im, 'GMM');//or:fg = detectforeground(im). create background model while ~isempty(im), fg = detectforeground(im);//get the foreground mask imshow(fg); im = avireadframe(n); end; aviclose(n); | ![]() | ![]() |
'LI': "Foreground Object Detection from Videos Containing Complex Background", Liyuan Li, Weimin Huang, Irene Y.H. Gu, and Qi Tian, ACM MM2003.
'GMM': "An improved adaptive background mixture model for real-time tracking with shadow detection", P. KadewTraKuPong and R. Bowden, in Proc. 2nd European Workshp on Advanced Video-Based Surveillance Systems, 2001.
http://sivp.sf.net