<< detectfaces SIVP - Scilab Image and Video Processing Toolbox edge >>

SIVP - Scilab Image and Video Processing Toolbox >> SIVP - Scilab Image and Video Processing Toolbox > detectforeground

detectforeground

Background modeling and get foreground mask.

Calling Sequence

fg = detectforeground(im)
fg = detectforeground(im, method)

Parameters

im
The input image.
method
Background modeling methods. Can be 'LI'(default), 'GMM'. Other methods will appear in the future.
fg
If 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.

Description

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.

Examples

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);

Authors

Bibliography

'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.

Availability

The latest version of SIVP can be found at

http://sivp.sf.net

See Also

<< detectfaces SIVP - Scilab Image and Video Processing Toolbox edge >>