Foreground Extraction

2019-08-05 11:17发布

I am doing some work regarding tracking a person, I am using this dataset. I am trying right now to extract foreground using background subtraction method i.e. Mean Filter

My background is like

Background

and if I try to subtract my current frame like this

enter image description here

so after subtraction I am getting image like this

enter image description here

and after thresholding of 0.15 or 38

I get this mask

enter image description here

So if you notice this mask, it is splitting this foreground in to two pieces because of occlusion of person and chair. I dont know how to solve this problem. Any suggestions?

4条回答
贪生不怕死
2楼-- · 2019-08-05 11:30

It's not a perfect solution, but maybe it will be enough for you - on mask image find all contours, join them(usually contours are represented as vectors of points so put all contours into one vector) and then find the convex hull of connected contour (if you are using opencv - use convexHull function http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/hull/hull.html).

查看更多
叛逆
3楼-- · 2019-08-05 11:31

To solve you particular problem of joining separate parts, use dilation http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=dilate#dilate

查看更多
何必那么认真
4楼-- · 2019-08-05 11:42

If I understand you correctly, you are trying to do background subtraction using frame differences, like mean filter as you mentioned. But please keep in mind that it will only detect moving foregrounds, and manually providing threshold is difficult. I suggest you to instead try Mixture of Gaussian method, which is more effective, and implemented in OpenCV.

查看更多
Anthone
5楼-- · 2019-08-05 11:48

It's also not a perfect solution. Please reduce the number of frames to create background image in background subtraction method it may help you. Or initialize the background subtraction structure frequently.

查看更多
登录 后发表回答