1

I am trying to use the OpenCVs Background Subtractor class MOG2 to seperate a person moving infront of a camera. I got everything set up and working nicely. But the resulting mask I am getting looks something like this:

MOG2 result (default settings)

Now what I would like to get is something like this:

MOG2 wished result (bad gimp skills :D)

I have already tryed to mess around with the parameter described in the docu, but all I managed to accomplish was something the looked like a motion blur effect...

So I was hopeing somebody with a better understanding of the algorithm or somebody who has already done something similar might be able to help me!

Thanks in advance, Foaly

Foaly
  • 565
  • 1
  • 7
  • 22
  • I am not familiar with this opencv class in particular, but I've implemented several different background subtraction algorithms and results you are getting should be correct. So for extracting silhouette probably some additional processing step is needed on top of that. Maybe smth in direction of "convex hull" will provide some ideas. – Jun Murakami Mar 22 '15 at 14:40

2 Answers2

0

I am working also with that and what I've seen is that this algorithm needs a good calibration to accomplish that goal, because you should be aware that this algorithm try to put in the background some pixels that don't show changes, e.g. in your skin major part of the pixels have the same color maybe this is the reason. I recommend to you that use other kind of methods (using zncc) if you want to use an application like the one that is showed in your question.

Alexander Leon VI
  • 499
  • 1
  • 4
  • 18
  • OK that sounds intersting. what is zncc? I can't find anything on google that would help me. – Foaly May 16 '15 at 09:56
  • Hi, zncc means 'zero mean normalized cross-correlation' I'm pretty sure that you will find a lot of information of this topic, I hope this could help you in your application, cheers! – Alexander Leon VI May 18 '15 at 14:57
0

So I guess this were our image processing skills come into play. The first thing I would do is make the lines on the image thicker and join it it. We can use the following:

1) I would want the lines thicker. Use Morphological operators tutorial on Morphological operators with Otsu's method. This paper worked for me when I did my ear biometrics http://www4.comp.polyu.edu.hk/~csajaykr/myhome/papers/PR2011.pdf

2) Fill in connected components using opencv and clean the image

3) Segment human profile

Sade
  • 450
  • 7
  • 27