This depends on many parameters. For example is your background is monochrome or single color ? In that case you can use simple color segmentation (some thing similar is done in these papers ;
. If you want to detect something moving from back ground, you can use mean value subtractions or optical flow. (this paper have some info on optical flow "https://www.researchgate.net/publication/233855641_An_autonomous_robot_navigation_system_based_on_optical_flow")
It highly depend on the context.
Article Using Image Processing Techniques to Automate Chess Game Recording
Data Image processing based low cost leaf area meter
Conference Paper An autonomous robot navigation system based on optical flow
Thank you for the reply. I was actually looking for matlab codes for separation of foreground and background using graph-cut and grab-cut techniques to extract human silhouettes in video sequences.
I haven't tried either of those methods. But from what I read in the internet I guess it is possible to use it. Why not try simulink ? It is good for real time processing.