title: How to extract foreground image in Matlab
body: <p>I have an .avi file (taken from <a href="http://www.wisdom.weizmann.ac.il/~vision/SpaceTimeActions.html" rel="nofollow noreferrer">Actions as Space-Time Shapes - Classification Dataset</a>) from which I've extracted the frames in .png format. Now, I want to do foreground detection from these images using Matlab.</p>
  
  <p>I've seen one code which uses <code>vision.ForegroundDetector()</code>, but it works for video files.</p>
  
  <p>So please if anyone can give me the code foreground detection for images, then I'll be really thankful.</p>
  
  <p>This is an example of a frame:</p>
  
  <p><a href="https://i.stack.imgur.com/IDdqB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IDdqB.png" alt="enter image description here"></a></p>