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
1
vote
2 answers

OpenCv Issue of Image Subtraction?

i am trying to subtract 2 image using the function cvAbsDiff(img1, img2, dest); it working but sometimes when i bring my hand before my head or body the hand is not clear and background comes into picture... the background image(head) overlays my…
1
vote
2 answers

Per Pixel Thresholding

I was wondering if it is possible in opencv to have a threshold value per pixel. For example p(x,y) should be above 100 and then p(x+1,y) should be above 101. You can see this as background subtraction. So that everything in front of the background…
Olivier_s_j
  • 5,490
  • 24
  • 80
  • 126
1
vote
0 answers

OpenCV BackgroundSubtractor.getBackgroundImage crashes with invalid frame type

I'm using OpenCV in an iOS app via Objective-C wrapper and it works generally fine but an attempt to read a background image from a background subtractor crashes the app: cv::Ptr backSub = createBackgroundSubtractorMOG2(); for…
DreamTeam Mobile
  • 531
  • 3
  • 15
1
vote
1 answer

How to set background subtraction to stable object

hi I'm working on a thesis, I'm looking for a way how to convert human objects into white pixels in the room. Here I use background subtraction to detect objects. The problem is that background subtraction works by continuously updating the…
1
vote
1 answer

opencv BackgroundSubtractorMOG in openframeworks

does anybody knows how to implement nowadays an opencv background subtractor like MOG or MOG2? I tried to use ofxCvMOG2 library (https://github.com/naus3a/ofxCvMOG2) but when I run the example the error "cannot create an instance of an abstract…
rojele
  • 80
  • 7
1
vote
1 answer

Occlusion handling in object tracking

I am implementing motion based object tracking program which is using background substraction, Kalman Filter and Hungarian algorithm. Everything is working fine except the occlusions. When two object are close enough to each other the background…
1
vote
0 answers

Remove shadows with background subtraction for stationary objects detection

I've to detect a stationary object in a predefined area using Opencv V4.4.0. I'm working with two background subtractor that store two different background mask, one that store the stationary initial background mask, and one that detect the moving…
ll_gzr
  • 99
  • 10
1
vote
1 answer

How to improve the foreground extraction using cv2.grabcut

Foreground-extraction I am extracting a person from its background and I am using cv2.grabcut for that. But sometimes the background pixels are misclassified as foreground hence the extraction is not perfect. I have attached the resultant image. How…
1
vote
1 answer

How to remove the background of a noisy image and extract transparent objects?

I have an image processing problem that I can't solve. I have a set of 375 images like the one below (1). I'm trying to remove the background, so to make "background substraction" (or "foreground extraction") and get only the waste on a plain…
1
vote
0 answers

Remove background with OpenCV

i need a little bit of help :) I am trying to remove the background of an image i took. The picture shows a piece of wood that runs through a machine: https://i.stack.imgur.com/KDA9k.jpg Now i want to remove the background so that only the piece of…
Schong
  • 11
  • 3
1
vote
1 answer

Run BackgroundSubtracter in jython script for Fiji

I am trying to create an Imagej/Fiji script to analyze microscopy images. As part of the pipeline, I want to use the rolling ball BackgroundSubtracter supplied in Fiji. According to the Imagej API, that should look something like…
1
vote
0 answers

Opencv.js - Background subtraction and replacement in Javascript

I'm applying the items in this tutorial, in an attempt to replace a background image while maintaining the foreground objects. Ideally, I'd like to replace the black and white mask that is generated with the color version of the arm holding the…
1
vote
1 answer

error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor' in background subtrator code

I am trying to run this code. At the start it runs properly, but gets stuck in the middle with the following error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor' I have tried changing video and path name but of no use. Can…
1
vote
0 answers

Setting initial Background for function cv2.createBackgroundSubtractorMOG2()

Short question about the cv2.createBackgroundSubtragtorMOG2(). I have two video files, one contains the background without moving objects. The second one is with moving objects. Question here is if there is a possibility to set the background frame…
Limbomike
  • 11
  • 2
1
vote
0 answers

How to optimally set parameters for GMG algorithm in opencv for camera inputs from different kinds of environments

I am trying to set parameters for GMG background subtractor algorithm in opencv for camera inputs from different kinds of environments. example, urban road, rural roads, small well lit room, big dimly lit hall, etc. I currently have access to only a…