0

I need to know that is there a method to remove the background of a live streaming web cam. There is a method called background Subtractor. If anyone knows to use that please help me out with the issue..

Dilshan Zuhdi
  • 199
  • 1
  • 1
  • 5
  • This is not a [real question](http://meta.stackexchange.com/questions/145677/what-is-a-real-question). Did you try anything so far to solve your problem? Read [FAQ] and [ask] – Soner Gönül Jun 30 '13 at 16:21

1 Answers1

0

If you already have an image of the background you can just calculate

I - B

Where I is the Image and B is the background (of type say, Image)

B - I

Will also work.

Since images don't store negative numbers, you may wish to combine these both using

(I - B) + (B - I)

And convert the result to grayscale.

I method which I have found works better is to do this using fourier transforms.

ie:

F^-1(F(I) - F(B))

for example

    CvInvoke.cvDFT(video.Convert<Gray, Single>().Ptr, DFT.Ptr, Emgu.CV.CvEnum.CV_DXT.CV_DXT_FORWARD, -1);
    CvInvoke.cvDFT(Background.Convert<Gray, Single>().Ptr, DFTBack.Ptr, Emgu.CV.CvEnum.CV_DXT.CV_DXT_FORWARD, -1);

    CvInvoke.cvDFT((DFTBack - DFT).Convert<Gray, Single>().Ptr, originalLeft.Ptr, Emgu.CV.CvEnum.CV_DXT.CV_DXT_INVERSE, -1);
    CvInvoke.cvDFT((DFT - DFTBack).Ptr, originalRight.Ptr, Emgu.CV.CvEnum.CV_DXT.CV_DXT_INVERSE, -1);

This works well when the foreground is partially translucent.

There's also the built in Foreground detector

sav
  • 2,064
  • 5
  • 25
  • 45