Get the Foreground in opencv
There is no way that your camera or software will be able to look at a flat image and decide what is foreground and what is background. Is that parrot sitting on a perch and staring at the camera or is it a picture of a parrot on the wall?
In the past I've made a collection of frames from the camera and formed a reference image by taking the median value of every pixel. Hopefully, this is now an imge that can be compared with every subsequent frame and now substracting the two can be used to isolate where change has occurred. The difference isn't what you want but can be turned into a mask that will select what you want from the frame in question.
I'm trying to create a program that removes the background and get the foreground in color. For example if a face appears in front of my webcam i need to get the face only. I tried using BackgroundSubtractorMOG in opencv 3. But that didn't solve my problem. Can anyone tell me where to look or what to use. I'm a newbie in opencv. 
P.S i use opencv3 in python