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
3
votes
1 answer

Why is createBackgroundSubtractorGMG considered obsolete, and how can I use it

I am rather new to OpenCV and image processing in general. I am looking into background subtraction to facilitate motion tracking (people counting). Looking at the openCV documentation on background subtracting, GMG gives rather nice results. Also…
Claude
  • 8,806
  • 4
  • 41
  • 56
3
votes
1 answer

how to adjust the parameters of backgroundSubtractorMOG

So I know there are a few parameters that I can set and I am not really sure about the nmixtures, backgroundRatio and noseSigma Python: cv2.createBackgroundSubtractorMOG([history[, nmixtures[, backgroundRatio[, noiseSigma]]]]) → retval Parameters:…
Georgi Angelov
  • 4,338
  • 12
  • 67
  • 96
3
votes
1 answer

Background Subtractor

I'm using OpenCV 2.4.9 on Python 2.7. I am trying to use OpenCV's background subtraction. It's supposed to somehow determine from the video input, what objects are in the foreground and what others are in the background (?). However, the resulting…
Mayowa
  • 39
  • 2
3
votes
1 answer

Background substraction using opencv mogdetector and c++ from live camera feed

I am trying to use this code for background subtraction for a live camera feed. but this code is giving a white image in both the windows. the problem is that when tested with a video file from the same camera it is working fine, without any error…
root
  • 572
  • 5
  • 18
3
votes
1 answer

How to subtract the background from an image - python , opencv

How to subtract the background in a still image? IF the issue is with videos then we can use cv2.createBackgroundSubtractorMOG(). I tried to manipulate the function, but I got AttributeError This is what i have tried: img =…
user3483746
  • 155
  • 3
  • 4
  • 13
3
votes
4 answers

OpenCV Background subtraction with varying illumination

I'm working on a project where I have to automatically segment different parts of a car (i.e. door, headlight, etc.) in an image provided by a cam. In a first step I'd like to remove the background, so the algorithm won't find anything where it's…
3
votes
3 answers

How can shadow tracking be disabled in BackgroundSubtractorMOG2?

Im trying to disable shadow detection in openCV when using the BackgroundSubtractor algorithm BackgroundSubtractorMOG2. However even after setting bShadowDetection to false, the algorithm still seems to track shadows as foreground objects.…
3
votes
1 answer

Background Subtraction with OpenCV 2

Is there any OpenCV 2.4.2 function or class that implements an Image Background Subtraction algorithm? The images I will be processing will be portraits, such as images from a webcam. I want to keep only the upper part of the body (from the chest…
3
votes
2 answers

Opencv: Background Subtraction: Access violation

#include "opencv/cvaux.h" #include "opencv2/opencv.hpp" #include "opencv2/opencv_modules.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/video/background_segm.hpp" #include…
2
votes
2 answers

Background subtraction in opencv2

I am trying to detect foreground motion using opencv2 by removing static (mostly) BG elements. The method I am using is based on taking the mean of a series of images - representing the background. Then calculating one Standard deviation above and…
Neon22
  • 590
  • 5
  • 17
2
votes
1 answer

OpenCV background subtraction/codebook?

Im trying out the codebook method, but don't really understand the point of int t in a code_book struct. Its the variable used to "Count every access", but this completely lost me. Count what access to what? By whom? Could someone please explain …
fdh
  • 5,256
  • 13
  • 58
  • 101
2
votes
2 answers

Background Subtraction for short videos

I was going through this paper: Adaptive Background Mixture Models for Real-Time Tracking(1999) by Chris Stauffer, W. Eric L. Grimson Their method is ok for a long video where one can start making blobs after some time when the gaussian mixture…
2
votes
0 answers

Gaussian Mixture Model for Background Subtraction

This is more like something that I would like to discuss with the community rather than something that I am seeking for an absolute answer. I am trying to implement the GMM based background subtraction algorithm from scratch. Apparently, OpenCV…
2
votes
1 answer

openCV background subtraction with GSOC

im trying to implement the GSOC background subtractor from openCV. fgbg = cv.bgsegm_BackgroundSubtractorGSOC() fgmask = fgbg.apply(frame) but this gives me following error: fgmask = fgbg.apply(frame) TypeError: Incorrect type of self (must be…
fogx
  • 1,749
  • 2
  • 16
  • 38
2
votes
0 answers

Is there any documentation describes the way GSOC algorithm (background subtraction) works?

I need to track some moving objects so want to use one of background subtraction algorithms implemented in opencv. Saw some examples of how they work and it seems like GSOC is the one I need (the best result for my purposes), but can't find any good…
ekon
  • 443
  • 3
  • 12