Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

Extracting the silhouette of a person in a video and change background

$
0
0
I want to track a man silhouette in a video, and get automatically this silhouette in next frames. He is moving (the size and shape of the silhouette is changing and it is possible that the man to leave the area and return back later). Why I need the silhouette? I want to change the entire background and keep the man. Or in other cases I will “erase” the man and I will repair the background using inpaint OpenCV method. Here you can see an example of what I want to achieve: https://www.youtube.com/watch?v=G_AVZ8GZbTw Also the background can change (the camera isn't fixed). Moreover, the light isn’t constant, and as you can imagine it can influence a lot. First, let's talk about a simple scenario in which I will have a fixed camera and the light is constant. I will split the problem in pieces and I will treat each case separately. Firstly, I will get the man silhouette. For this I will use algorithms like Watershed or GrabCut. This is already done, I stop the camera or the video, and using the current frame I get the man silhouette. The result is something like this: ![image description](/upfiles/14603004421300721.png) I will smooth the contour of shape with Gaussian blur (but this isn’t important now). So, I have this silhouette, how can I get it in the next frame without manual processing. I tried some other methods using MOG2 from OpenCV, but it isn’t what I need. The man can move or not, or he can moves only his arm or head. Track by color or shape aren’t solutions because them can change when man moving and his clothes don’t have the same color. What I need are some ways (ideas and examples) to do automatic subtraction of man in the next frames. I’m planning to use OpenCV3 and C++ as main programming language. Can you suggest something that fits my needs? P.S: I am aware that there is no perfect method and the result will not be fantastic (there will be noise on the new video, but if I can do the same as in the above video, for me is perfect).

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>