Questions tagged [background-subtraction]

Background-subtraction is a Computer-Vision technique that given a frame sequence from a fixed camera, processes pixels and separates them into foreground and background pixels.

Background Subtraction is a type of image segmentation which goal is to separate the parts of the image that are invariant over time (background) from the objects that are moving or changing (foreground).

The simplest techniques use frame differencing and more advanced techniques require using statistical methods. For example, a moving leaf of a tree would be considered foreground using simple frame differencing but with a proper statistical method it can be considered background as the leaf is always there, moving periodically.

Methods:

  • Frame differencing
  • Background as the average or the median of the previous nframes.
  • Background as the running average.
  • Pfinder (one Gaussian)
  • Mixture of K Gaussians
290 questions
224
votes
25 answers

How can I quantify difference between two images?

Here's what I would like to do: I'm taking pictures with a webcam at regular intervals. Sort of like a time lapse thing. However, if nothing has really changed, that is, the picture pretty much looks the same, I don't want to store the latest…
20
votes
1 answer

Differences between MOG, MOG2, and GMG

What's the difference between these 3 methods of background subtraction?
CubbyBluePen
  • 251
  • 1
  • 3
  • 7
19
votes
4 answers

OpenCV: how to use createBackgroundSubtractorMOG

I was trying to go through this tutorial på OpenCV.org: http://docs.opencv.org/trunk/doc/tutorials/video/background_subtraction/background_subtraction.html#background-subtraction The MOG pointer is initialized as Ptr pMOG;…
Rickz0r
  • 193
  • 1
  • 1
  • 5
17
votes
7 answers

OpenCV2 Python createBackgroundSubtractor module not found

I am trying to use cv2.createBackgroundSubtractorMOG2 () method in Python. I have tried both on my Mac and on my Raspberry Pi, and get the same error when running the following line of code: fgbg = cv2.createBackgroundSubtractorMOG2() The code I am…
user2765323
  • 273
  • 1
  • 2
  • 9
15
votes
1 answer

Laplacian of Gaussian: how does it work? (OpenCV)

Does anybody know how does it work and how to do it using OpenCV? Laplacian can be calculated using OpenCV, but the result is not what I expected. I mean I expect the image to be approximately constant contrast at background regions, but it is…
maximus
  • 4,201
  • 15
  • 64
  • 117
14
votes
1 answer

Otsu thresholding for depth image

I am trying to substract background from depth images acquired with kinect. When I learned what otsu thresholding is I thought that it could with it. Converting the depth image to grayscale i can hopefully apply otsu threshold to binarize the…
bahti
  • 636
  • 1
  • 7
  • 21
13
votes
4 answers

How to use cv::BackgroundSubtractorMOG in OpenCV?

I'm using OpenCV2.2 to implement moving objects detection with the method of Background Subtraction. And I use the Gaussian Mixture Model(GMM) method to model the background reference image. I directly get the foreground pixels(or foreground mask)…
12
votes
1 answer

OpenCV C++/Obj-C: Proper object detection

As some kind of "holiday project" I'm playing around with OpenCV and want to detect and measure stuff. Current workflow (early stage - detection): Convert to grayscale (cv::cvtColor) Apply Adaptive threshold (cv::adaptiveThreshold) Apply…
dom
  • 11,894
  • 10
  • 51
  • 74
9
votes
1 answer

OpenCV findContours issue

I have the following code which performs background subtraction and then uses findContours to draw a boundary around the foreground object. // frame - Input frame from a camera. // output - Output frame to be displayed. void process(cv:: Mat…
Madman
  • 309
  • 1
  • 5
  • 10
9
votes
3 answers

Mask for BackgroundSubtractorMOG2

How can I tell BackgroundSubtractorMOG2 which pixels to update to the background model and which pixels shouldn't. I am facing problem when there's an object entered the scene and stopped for a few ten seconds, the object will be absorbed into the…
Yaobin Then
  • 2,662
  • 1
  • 34
  • 54
8
votes
3 answers

OpenCV Android Background Subtraction

I am working on a robotics project using an Android phone as the main processor and the camera to detect movement. I got the Android binary package from OpenCV and got it correctly installed. I can capture images using the OpenCV native camera and…
8
votes
2 answers

opencv background substraction

I have an image of the background scene and an image of the same scene with objects in front. Now I want to create a mask of the object in the foreground with background substraction. Both images are RGB. I have already created the following…
pietro
  • 155
  • 1
  • 1
  • 10
8
votes
2 answers

Background subtraction in OpenCV(C++)

I want to implement a background averaging method. I have 50 frames of images taken in one second and some of the frames contain lightning which I want to extract as the foreground. The frames are taken with a stationary camera and the frames are…
user854576
  • 113
  • 1
  • 5
8
votes
2 answers

Efficient Background subtraction with OpenCV

I want to do background subtraction in a video file using OpenCV method. Right now I'm able to do background subtraction, but the problem is that I couldn't get the output in color mode. All the output after subtracting the background is coming in…
Jabez
  • 1,883
  • 6
  • 19
  • 18
7
votes
3 answers

Opencv Motion detection with tracking

I need a robust motion detection and tracking in web cam's video frames. The background is always the same. The aim is to identify the position of the object, if possible without the shadows, but not so urgent to remove shadows. I've tried the…
maximus
  • 4,201
  • 15
  • 64
  • 117
1
2 3
19 20