2

I am currently using vision.ForegroundDetector for motion detection. It returns the foreground image. Is there any way to also get the background image that it has learnt?

Dima
  • 38,860
  • 14
  • 75
  • 115
Suhas Lohit
  • 171
  • 8
  • Not really - it hasn't learnt a "background image", it's learnt a model for determining whether a pixel is foreground or background, which is a different thing altogether. – Roger Rowland May 07 '13 at 14:03

2 Answers2

1

vision.ForegroundDetector does not really learn a background image. It learns a probability distribution over the intensities or colors for each pixel. You could, in theory, get the mean or the mode of each of these distributions and put them into an image, but vision.ForegroundDetector does not provide this ability.

Dima
  • 38,860
  • 14
  • 75
  • 115
0

You can use the bitwise operator, try to separate the foreground mask then remaining pixel would be your background.

You can also try cv2.absdiff() method for finding diff.

Thank You!